2017-06-29 04:27 PM
Hello,
I am new to STM based MCU and currently have STM32L4Discovery. I am trying to flash an elf to the device using openocd (I am using linux). And failing to do so. I am trying to investigate the issue. According to my understanding the flash address in the openocd is correct and also the FLASH_ACR and RCC_CR are correct. However the flashing is failing saying -flash write algorithm aborted by target
error executing stm32l4 flash write algorithmflash write failed = 000000a0block write failederror writing to flash at address 0x08000000 at offset 0x00000000Any suggestion would be helpful.
Thanks in advance,
Regards,
#stm32l4-flash2017-06-29 05:00 PM
I assume what you have is an 'STM32L476 Discovery kit'. Speak up if that's not what you have.
Have you read through UM1879, especially section 7.1?
What version of openocd are you using?
What programmer are you using?
If using the built-in ST-Link programmer, are the CN3 jumpers installed?
What command-line are you using?
2017-06-29 08:46 PM
Hi Rob,
Thanks for the reply.
It is STM32L475VG Discovery IoT Kit.
I am not sure what user manual you meant, I tried to check datasheet and the reference manual for openocd related stuff (the memory location it is trying to flash, the register location etc etc). But not sure where programming instructions are pointed out.
openocd version:
Open On-Chip Debugger 0.10.0+dev-00161-g1725abc (2017-06-28-21:51)
Programmer used:
Builtin STLink, I am not sure what you meant by CN3 jumper, in my board I have JP1 set to 5V_ST_LINK.
Commands used:
sudo openocd -f /usr/local/share/openocd/scripts/board/stm32l4discovery.cfg
flash write_image /home/fadedreamz/hello-world.elf [failed]program /home/fadedreamz/hello-world.elf [failed]Thanks again and regards,
2017-06-29 09:58 PM
Hi
Alam.Mohammad_Nazmul
OK. That's a different L4 Discovery board; one I wasn't aware of.
I typically use GDB to load images for me via openocd. My knowledge of openocd commands is minimal. However,those commands do not match any I recall seeing.
http://openocd.org/doc/html/General-Commands.html
These days I just have Eclipse do it all for me.
Try this. Open two terminal windows. In the first, run openocd as you have above.
In the other window, start anARM gdb session:
$ arm-none-eabi-gdb
...
(gdb) target remote localhost:3333
You should see some activity in the openocd window.
(gdb) load
/home/fadedreamz/hello-world.elf
Loading section .isr_vector, size 0x194 lma 0x8000000
Loading section .text, size 0x17398 lma 0x80001a0
Loading section .rodata, size 0x4abc lma 0x8017538
...
(gdb)
Does that work for you?
2017-06-29 11:27 PM
Hi Rob,
Thanks for your suggestion.
Unfortunately it didn't work. I am also new to openocd and tried to follow same flashing instruction used for F4 device. I get the following error while running gdb load instructionopenocd window :
Unable to match requested speed 500 kHz, using 480 kHz
Unable to match requested speed 500 kHz, using 480 kHzadapter speed: 480 kHztimed out while waiting for target haltedTARGET: stm32l4x.cpu - Not haltedin procedure 'reset' in procedure 'ocd_bouncer'Target not halted
failed erasing sectors 0 to 4flash_erase returned -304gdb window:
(gdb) load /home/fadedreamz/hello-world.elf
Error erasing flash with vFlashErase packetJust a thought, is there any official tool for STLink in linux?
Thanks again.