Menu

#271 STM32L4RET fails to flash for image bigger than 256KB

0.9.0
new
nobody
None
2020-06-21
2020-06-21
Matias N.
No

I have this MCU which has 512KB flash, dual bank. I found that flashing fails for images larger than 256KB. Flashing with:

openocd -f interface/stlink-v2.cfg -f target/stm32l4x.cfg -c 'init; reset halt; program nuttx/nuttx.bin 0x08000000 verify reset; shutdown'

I get this output:

Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 500 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 500 kHz, using 480 kHz
Info : Unable to match requested speed 500 kHz, using 480 kHz
Info : clock speed 480 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.250952
Info : stm32l4x.cpu: hardware has 6 breakpoints, 4 watchpoints
adapter speed: 500 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000188 msp: 0x20003284
adapter speed: 500 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000188 msp: 0x20003284
adapter speed: 4000 kHz
** Programming Started **
auto erase enabled
Info : device id = 0x10076415
Info : flash size = 512kbytes
target halted due to breakpoint, current mode: Thread
xPSR: 0x41000000 pc: 0x20000050 msp: 0x20003284
Error: flash write algorithm aborted by target
Error: error executing stm32l4 flash write algorithm
Error: flash write failed = 000000a0
Warn : block write failed
Error: error writing to flash at address 0x08000000 at offset 0x00000000
embedded:startup.tcl:487: Error: ** Programming Failed **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 543
at file "embedded:startup.tcl", line 487</transport>

Discussion

  • Andreas Bolsch

    Andreas Bolsch - 2020-06-21

    There is to my knowledge no such device like STM32L4RET. The id 0x415 suggests something like L47xRET?

    There had been a major update of the stm32l4x driver recently, hence you
    should test an up to date build of openocd first.

    If that still shows the error, it would be useful if you could supply a log (add '-d3' to your command line) and the current option settings obtainable by 'stm32l4x option_read 0 reg_offset' for reg_offset 0x20, 0x24, 0x28, 0x2C, 0x30, 0x44, 0x48, 0x4C, 0x50.

     
    • Matias N.

      Matias N. - 2020-06-21

      Sorry, I meant STM32L476RET
      I'm using openocd 0.10.0. Should I use a more recent unstable build? Are there newer binaries available or do I need to compile myself?

       
  • Andreas Bolsch

    Andreas Bolsch - 2020-06-21

    The best idea is to compile it yourself as described in http://openocd.org/doc-release/README On Linux that's rather simple and painless.

     
    • Matias N.

      Matias N. - 2020-06-21

      Yes, that fixed it.
      It would good to have a more recent release incorporating these fixes.

       

Log in to post a comment.

MongoDB Logo MongoDB