(Note: I'm experienced with flash-programming microcontrollers from other vendors, but this is my first go with STM)
I have a STM32F4 Discovery board (with a STM32F407VGT6 fitted).
I use GCC-4.8.3 with OpenOCD-0.9.0.
So far, I've gotten the drivers to build with no errors and warnings (I had to modify them and clean the code).
But when it comes to flash-programming, I had some problems where I got a 'write-protected' error from OpenOCD. After messing around with it, I found out that I should remove 'unlock' and 'erase' from this line...
flash write_image erase unlock file_to_flash.elf...so it becomes ...
flash write_image file_to_flash.elf...and it seems that OpenOCD sends the data to the microcontroller.-But where do the data end up ?
The LED-animation stops (expected after a RESET / HALT), but my program does not seem to start.
In OpenOCD, I can do a ...
mdw 0x20000000 32...and a...
mdw 0x10000000 32
mdw 0x08000000fails with the message:
in procedure 'mdw'-Nothing else. This suggests that OpenOCD had some kind of (read) access-error, and could not read the data from the Flash memory.
All that said, This is the output I get from OpenOCD:
Open On-Chip Debugger 0.9.0-dev-00101-gb15a0ee (2014-11-27-08:50)
Licensed under GNU GPL v2
For bug reports, read
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
#0 : stm32f4x.flash (stm32f2x) at 0x00000000, size 0x00000000, buswidth 0, chipwidth 0
Info : clock speed 1000 kHz
Info : STLINK v2 JTAG v14 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 2.893577
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
Info : stm32f4x errata detected - fixing incorrect MCU_IDCODE
Info : device id = 0x10006413
Warn : STM32 flash size failed, probe inaccurate - assuming 1024k flash
Info : flash size = 1024kbytes
wrote 1020 bytes from file output/STM-test8.elf in 0.162985s (6.112 KiB/s)
shutdown command invoked
-I suspect that the file I sent was only transferred to the STM32F4's RAM (although my disassembly clearly indicates that the code should go to 0x08000000, which I understand is where the Flash-memory is located)