Hi, > In IAR they gave an example like this: > > mrs r0,cpsr /* Original PSR value */ > bic r0,r0,#MODE_BITS /* Clear the mode bits */ > orr r0,r0,#SVC_MODE /* Set SVC mode bits */ > msr cpsr_c,r0 /* Change the mode */ > ldr sp,=SFE(SVC_STACK) & 0xFFFFFFF8 /* End of SVC_STACK */ > What is this last statement doing, and what would be the correct > equiv to use in GNU? Can't seem to find a reference to it, but I seem to recall that standard IAR syntax is that SFE is something like : Segment (Flash ?) End. So, bascially ldr sp, =SFE(SVC_STACK) & .... loads the SP with the ABSOLUTE address of the END of SEGMENT SVC_STACK, which is in RAM of course. This would make sense, as you'd normally use a descending stack. The & with 0xFFFFFFF8 is to align the stack address to an 8-byte boundary. GNU has its own defines for that like .code x etc. Else just ldr sp with the Start address of your (SVC Stack + The SVC Stack size). (You'd want it to sit on top of RAM) -- Kris [Non-text portions of this message have been removed]
Message
Re: [lpc2000] How to setup Stacks in GNU
2004-12-28 by microbit
Attachments
- No local attachments were found for this message.