找不到地址 0x00000000 的闪存组

No flash bank found for address 0x00000000

我正在尝试将我的固件刷入 STM32L152,但我有:

Open On-Chip Debugger 0.10.0+dev-00312-g1a3cbbf3 (2018-03-02-20:11)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
adapter speed: 300 kHz
adapter_nsrst_delay: 100
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
none separate
Info : Unable to match requested speed 300 kHz, using 240 kHz
Info : Unable to match requested speed 300 kHz, using 240 kHz
Info : clock speed 240 kHz
Info : STLINK v2 JTAG v28 API v2 SWIM v6 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 1.769170
Info : stm32l1.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Unable to match requested speed 300 kHz, using 240 kHz
Info : Unable to match requested speed 300 kHz, using 240 kHz
adapter speed: 240 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800b324 msp: 0x20007ffc
STM32L: Enabling HSI
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
adapter speed: 1800 kHz
** Programming Started **
auto erase enabled
Info : Device: STM32L1xx (Cat.3 - Medium+ Density)
Info : STM32L flash size is 256kb, base address is 0x8000000
Warn : no flash bank found for address 0x00000000
wrote 0 bytes from file build/firmware.bin in 0.003700s (0.000 KiB/s)
** Programming Finished **
** Verify Started **
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000002e msp: 0x20007ffc
Error: checksum mismatch - attempting binary compare
diff 0 address 0x00000004. Was 0x25 instead of 0xb5
diff 1 address 0x00000005. Was 0xb3 instead of 0xa7
~~~~ Lot's of those ~~~~
More than 128 errors, the rest are not printed.
** Verify Failed **
shutdown command invoked

firmware.cfg

source [find interface/stlink.cfg]

set WORKAREASIZE 0x8000
transport select hla_swd

source [find target/stm32l1.cfg]

init_reset halt

program build/firmware.bin verify reset exit

有趣的是,在尝试编程时 firmware.elf,一切正常。当然,firmware.bin 是从 firmware.elf 生成的,因此它们共享相同的链接器脚本(或者我在这部分有误?):

MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K } ...

我也尝试过 OpenOCD 0.10.00.9.0

wrote 0 bytes from file build/firmware.bin

firmware.bin 丢失了它的偏移量信息,因为它是原始二进制格式。 您最好尝试直接刷新 firmware.elf 文件。

或者您可以尝试将正确的闪存偏移量放入 OpenOCD 命令中:

program build/firmware.bin 0x08000000 verify reset exit