cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with stack pointer initialization.

riaan1
Associate II
Posted on May 09, 2008 at 08:44

Problem with stack pointer initialization.

7 REPLIES 7
riaan1
Associate II
Posted on May 17, 2011 at 09:50

Hi

I am using IAR Embedded Workbench Evaluation for ARM 4.41A with ST lib v2 on STR910-EVAL board.

I've made a project of the uart example distributed with the library, but now I experience a problem with stack pointer initialization in 91x_init.s.

Code is loaded in flash and debugged from the IAR IDE using J-Link. If I single-step through the code, the stack pointers are initialized correctly. If I run the code at full speed up to 'main()', then stack pointers are not intialized correctly. I can see from the disassembly that the instructions are correct and that the data literals to be loaded in the stack pointers are correct based on linker output. The values ending in the stack pointers are just not the correct ones.

If I move the init of RAM to before the FMI configuration, I can run the code at full speed and stack pointer initialization works OK.

The problem seems not to be related to the debugging process because the behaviour is the same if I run without debugging - if I leave RAM init in its default place software doesn't work, if I move it software works.

Riaan

jilisegiar
Associate II
Posted on May 17, 2011 at 09:50

Hi,

What's the revision of silicon you are using.

If it's Rev D, in this case you need to change the following line in the 91x_init.s file:

LDR R7, = 0x19 ; Enable Both banks

by:

LDR R7, = 0x18 ; Enable Both banks

Rgds,

jmazura
Associate II
Posted on May 17, 2011 at 09:50

Hi,

I have similar problem. If I load code to the flash using J-Link and run - application works correctly. When I start my application without J-Link I get Undefined Handler. The problem seems as bad stack pointer initialization. By the J-Link I see, that all stacks are overloaded. I using EWARM5.1x with STlib v2 and STR912FA44X6 rev G. I dont have this trouble at version EWARM4.41 with STlib v1.2.

Best regards

Maca

jilisegiar
Associate II
Posted on May 17, 2011 at 09:50

Could you share your linker and startup files(*.s,*.icf).

Rgds

jmazura
Associate II
Posted on May 17, 2011 at 09:50

Startup and linker files I taked from examples...

jilisegiar
Associate II
Posted on May 17, 2011 at 09:50

I saw that you didn't use the latest version.

Try the attached ones

jmazura
Associate II
Posted on May 17, 2011 at 09:50

With new version of startup files it is possible only single-step through code by J-link. If I run the code, I get Abort Handler.