Rakefile: add method to flash bootloader over DFU
This commit is contained in:
parent
4fcfd29d2b
commit
ced714129c
16
Rakefile
16
Rakefile
@ -204,11 +204,19 @@ OOCD_TARGET = "stm32f4x"
|
||||
# Black Magic Probe port
|
||||
BMP_PORT = ENV["BMP_PORT"] || "/dev/ttyACM0"
|
||||
|
||||
desc "flash application"
|
||||
task :flash => :dfu_application
|
||||
|
||||
desc "flash application using USB DFU"
|
||||
task :flash => APPLICATION+".bin" do |t|
|
||||
task :dfu_application => APPLICATION+".bin" do |t|
|
||||
sh "dfu-util --device 1209:4356 --download #{t.source}"
|
||||
end
|
||||
|
||||
desc "flash application using USB DFU"
|
||||
task :dfu_bootloader => BOOTLOADER+".bin" do |t|
|
||||
sh "dfu-util --device 0483:df11 --cfg 1 --intf 0 --alt 0 --dfuse-address 0x08000000 --download #{t.source} --reset"
|
||||
end
|
||||
|
||||
desc "remove STM32F4 protection using SWD"
|
||||
task :remove_protection do
|
||||
case SWD_ADAPTER
|
||||
@ -220,7 +228,7 @@ task :remove_protection do
|
||||
end
|
||||
|
||||
desc "flash bootloader using SWD"
|
||||
task :flash_bootloader => BOOTLOADER+".hex" do |t|
|
||||
task :swd_bootloader => BOOTLOADER+".hex" do |t|
|
||||
case SWD_ADAPTER
|
||||
when "STLINKV2"
|
||||
sh "#{OOCD} --file interface/#{OOCD_INTERFACE}.cfg --command 'transport select hla_swd' --file target/#{OOCD_TARGET}.cfg --command 'init' --command 'halt' --command 'reset init' --command 'flash erase_sector 0 0 last' --command 'flash write_image erase #{t.source}' --command 'reset' --command 'shutdown'"
|
||||
@ -229,8 +237,10 @@ task :flash_bootloader => BOOTLOADER+".hex" do |t|
|
||||
end
|
||||
end
|
||||
|
||||
task :swd => :swd_application
|
||||
|
||||
desc "flash application using SWD"
|
||||
task :flash_application => APPLICATION+".hex" do |t|
|
||||
task :swd_application => APPLICATION+".hex" do |t|
|
||||
case SWD_ADAPTER
|
||||
when "STLINKV2"
|
||||
sh "#{OOCD} --file interface/#{OOCD_INTERFACE}.cfg --command 'transport select hla_swd' --file target/#{OOCD_TARGET}.cfg --command 'adapter speed 100' --command 'init' --command 'halt' --command 'reset init' --command 'flash write_image erase #{t.source}' --command 'reset' --command 'shutdown'"
|
||||
|
Loading…
Reference in New Issue
Block a user