Hello,

if you upload to flash the reset routine gets the sp from the vector table and 
jumps to the correct
location. If you upload to ram the sp is not initialized because it is the 
first entry in the vector
table. You should do it in your reset function. This is the same problem if you 
use a bootloader and
start your firmware.


Regards,

Mathias

On 20.01.2012 17:01, Uwe Bonnes wrote:
> Hello,
> 
> when trying to run a STM32 programm compiled at 0x20000000 (SRAM) after
> loading to ram with
>> arm-none-eabi-gdb owi_test.elf
> (gdb) target extended-remote localhost:4242
> (gdb) load owi_test.elf
> (gdb) c
> 
> I had all kind of strange effects until I realized that I need to setup the
> stack before start:
> (gdb) p $sp=*0x20000000
> 
> When loading to flash the stack gets corrected after loading with the first
> step bringing me to the initialization function. Probably at some point in
> time the value at 0x0 (alias of 0x08000000) is fetched.
> 
> When loading to ram, is correcting the stack a task of the user (or the user
> program) or should gdb do the right thing?
> 
> B.t.w. This was done with stlink/gdbserver/st-util.  I tried to find if
> openocd does such a correction, but didn't find it.
> 
> Bye
> 


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to