English 中文(简体)
how to program the STM32 flash using openOCD and gdb
原标题:

I m using an Olimex ARM-USB-OCD dongle with openOCD and GDB to program and debug an stm32f103 micro. The IDE I m using came from the Olimex dev-kit CD and makes use of eclipse ganymede.

I can load a small program into the RAM and step through the code without any problems.

I now have a much larger program which doesn t fit into RAM (which is only 20K) and so I d like to run it from flash (which is 128K).

I ve modified the linker script indicating the program code should go in the flash section (address 0x8000000), but gdb fails to load the program.

(gdb) 
20 load main.out
&"load main.out
"
load main.out
~"Loading section .text, size 0xb0e6 lma 0x8000000
"
Loading section .text, size 0xb0e6 lma 0x8000000
&"Load failed
"
Load failed

What should I do to get gdb to load the program into flash?

最佳回答

Have you considered flashing directly with openocd? I am doing this in a similar setup, but with an ARM7 microcontroller.

 openocd -f flash.cfg

Here is my flash.cfg

set CHIPNAME at91sam7x512

source [find interface/olimex-arm-usb-ocd.cfg]
source [find target/at91sam7sx.cfg]

init    
halt

flash probe 0
flash probe 1

flash erase_sector 0 0 15
flash erase_sector 1 0 15

flash write_image my-image.elf

at91sam7 gpnvm 0 set
at91sam7 gpnvm 1 set
at91sam7 gpnvm 2 set
shutdown

The GPNVM stuff is Atmel SAM7 specific, but I think this script should give you a good starting point for making a STM32 version. Openocd can be a bit confusing in the beginning, but the documentation is good and worth reading (http://openocd.berlios.de/). The current stable version (0.4.0) is quite old, so if you have problems, download the latest source code and compile your own.

问题回答

暂无回答




相关问题
tell gdb to disassemble "unknown" code

is it possible to configure gdb in order to debug assembly code when there are no debug symbols or no sources available ? I mean showing assembly instruction by assembly instruction when performing a ...

C++ Netbeans debugging issues

I installed netbeans6.7.1 ide for c/c++ also i have mingw/msys cygwin installed and i have given C:Msysin as environment variable path.It has gdb7 version.However wheni run dbugging thru netbeans ...

setting strings in gdb

c++: int main() { string a = "a"; ... ... } when i debug in gdb: (gdb) set var a = "ok" Invalid cast I run the program and pause at a break point after string a has been ...

How to debug programms written in fasm under linux using gdb?

I wrote simple "hello, world" in fasm, and its works, but how i can generate debug info for gdb and edb (Evan s Debugger)? Fasm compiler could only produce debugging symbols in its specific format - "...

How can I display Unicode strings while debugging on linux?

I have been working for some years now as C++ Developer using MS Visual Studio as working platform. Since I privately prefer to use linux, I recently took the chance to move my working environment to ...

Continue to debug after failed assertion on Linux?

When an assertion fails with Visual C++ on Windows, the debugger stops, displays the message, and then lets you continue (or, if no debugging session is running, offers to launch visual studio for you)...

热门标签