昨天很晚的时候才终于发现其实Unkown USB Device并不是错误,只是个警告而已,所以我们不关心就可以,让Makefile继续往下走就可以,于是我尝试mbs,s110,cload和firmware的下载,执行如下命令:
make flash
make flash_s110
make flash_mbs
make flash_cload
具体执行过程如下:
[email protected]:~/projects/crazyflie2-nrf-firmware$ make flash_mbs openocd -d2 -f interface/stlink-v2.cfg -f target/nrf51_stlink.tcl -c init -c targets -c "reset halt" -c "flash write_image erase bootloaders/nrf_mbs_v1.0.hex" -c "verify_image bootloaders/nrf_mbs_v1.0.hex" -c "reset halt" -c "mww 0x4001e504 0x01" -c "mww 0x10001014 0x3F000" -c "reset run" -c shutdown Open On-Chip Debugger 0.8.0 (2014-05-10-23:21) Licensed under GNU GPL v2 For bug reports, read http://openocd.sourceforge.net/doc/doxygen/bugs.html debug_level: 2 Info : This adapter doesn't support configurable speed Info : STLINK v2 JTAG v16 API v2 SWIM v0 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 2.556986 Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints TargetName Type Endian TapName State -- ------------------ ---------- ------ ------------------ ------------ 0* nrf51.cpu hla_target little nrf51.cpu halted target state: halted target halted due to debug-request, current mode: Thread xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0 auto erase enabled Warn : Unknown device (HWID 0x00000058) ^CMakefile:122: recipe for target 'flash_mbs' failed make: *** [flash_mbs] Interrupt [email protected]:~/projects/crazyflie2-nrf-firmware$ make flash_mbs openocd -d2 -f interface/stlink-v2.cfg -f target/nrf51_stlink.tcl -c init -c targets -c "reset halt" -c "flash write_image erase bootloaders/nrf_mbs_v1.0.hex" -c "verify_image bootloaders/nrf_mbs_v1.0.hex" -c "reset halt" -c "mww 0x4001e504 0x01" -c "mww 0x10001014 0x3F000" -c "reset run" -c shutdown Open On-Chip Debugger 0.8.0 (2014-05-10-23:21) Licensed under GNU GPL v2 For bug reports, read http://openocd.sourceforge.net/doc/doxygen/bugs.html debug_level: 2 Info : This adapter doesn't support configurable speed Info : STLINK v2 JTAG v16 API v2 SWIM v0 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 2.556986 Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints TargetName Type Endian TapName State -- ------------------ ---------- ------ ------------------ ------------ 0* nrf51.cpu hla_target little nrf51.cpu halted target state: halted target halted due to debug-request, current mode: Thread xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0 auto erase enabled Warn : Unknown device (HWID 0x00000058) wrote 3072 bytes from file bootloaders/nrf_mbs_v1.0.hex in 19.481831s (0.154 KiB/s) target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000002e msp: 0x000007c0 verified 2112 bytes in 0.288700s (7.144 KiB/s) target state: halted target halted due to debug-request, current mode: Thread xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0 shutdown command invoked [email protected]:~/projects/crazyflie2-nrf-firmware$ make flash_cload openocd -d2 -f interface/stlink-v2.cfg -f target/nrf51_stlink.tcl -c init -c targets -c "reset halt" -c "flash write_image erase bootloaders/cload_nrf_v1.0.hex" -c "verify_image bootloaders/cload_nrf_v1.0.hex" -c "reset halt" -c "mww 0x4001e504 0x01" -c "mww 0x10001014 0x3F000" -c "mww 0x4001e504 0x01" -c "mww 0x10001080 0x3A000" -c "reset run" -c shutdown Open On-Chip Debugger 0.8.0 (2014-05-10-23:21) Licensed under GNU GPL v2 For bug reports, read http://openocd.sourceforge.net/doc/doxygen/bugs.html debug_level: 2 Info : This adapter doesn't support configurable speed Info : STLINK v2 JTAG v16 API v2 SWIM v0 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 2.556986 Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints TargetName Type Endian TapName State -- ------------------ ---------- ------ ------------------ ------------ 0* nrf51.cpu hla_target little nrf51.cpu running target state: halted target halted due to debug-request, current mode: Thread xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0 auto erase enabled Warn : Unknown device (HWID 0x00000058) wrote 13312 bytes from file bootloaders/cload_nrf_v1.0.hex in 82.957291s (0.157 KiB/s) target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000002e msp: 0x000007c0 verified 12368 bytes in 0.351360s (34.375 KiB/s) target state: halted target halted due to debug-request, current mode: Thread xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0 shutdown command invoked [email protected]:~/projects/crazyflie2-nrf-firmware$ [email protected]:~/projects/crazyflie2-nrf-firmware$ make flash_s110 openocd -d2 -f interface/stlink-v2.cfg -f target/nrf51_stlink.tcl -c init -c targets -c "reset halt" -c "nrf51 mass_erase" -c "flash write_image erase s110/s110_nrf51822_7.0.0_softdevice.hex" -c "reset run" -c shutdown Open On-Chip Debugger 0.8.0 (2014-05-10-23:21) Licensed under GNU GPL v2 For bug reports, read http://openocd.sourceforge.net/doc/doxygen/bugs.html debug_level: 2 Info : This adapter doesn't support configurable speed Info : STLINK v2 JTAG v16 API v2 SWIM v0 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 2.558242 Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints TargetName Type Endian TapName State -- ------------------ ---------- ------ ------------------ ------------ 0* nrf51.cpu hla_target little nrf51.cpu running target state: halted target halted due to debug-request, current mode: Thread xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0 Warn : Unknown device (HWID 0x00000058) auto erase enabled Info : Padding image section 0 with 2112 bytes wrote 87040 bytes from file s110/s110_nrf51822_7.0.0_softdevice.hex in 543.104126s (0.157 KiB/s) shutdown command invoked [email protected]:~/projects/crazyflie2-nrf-firmware$ make flash openocd -d2 -f interface/stlink-v2.cfg -f target/nrf51_stlink.tcl -c init -c targets -c "reset halt" -c "flash write_image erase cf2_nrf.hex" -c "verify_image cf2_nrf.hex" -c "reset run" -c shutdown Open On-Chip Debugger 0.8.0 (2014-05-10-23:21) Licensed under GNU GPL v2 For bug reports, read http://openocd.sourceforge.net/doc/doxygen/bugs.html debug_level: 2 Info : This adapter doesn't support configurable speed Info : STLINK v2 JTAG v16 API v2 SWIM v0 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 2.558242 Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints TargetName Type Endian TapName State -- ------------------ ---------- ------ ------------------ ------------ 0* nrf51.cpu hla_target little nrf51.cpu running target state: halted target halted due to debug-request, current mode: Thread xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0 auto erase enabled Warn : Unknown device (HWID 0x00000058) wrote 45056 bytes from file cf2_nrf.hex in 282.951080s (0.156 KiB/s) target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000002e msp: 0x000007c0 verified 44944 bytes in 0.579762s (75.705 KiB/s) shutdown command invoked
那其实,在Makefile的最后,我们可以看到:
factory_reset: make mass_erase ifeq ($(strip $(S110)),1) make flash_s110 make flash_mbs make flash_cload endif make flash
所以看上去如果S110=1,那么只要执行make factory_reset就可以将s110,mbs,cload和firmware全部下载进去,不用分步进行,一键搞定,真爽! 昨天的研究也没白费,终于搞懂了。
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-12-19 16:02:48