This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Stack initialization with constant

Doe Keil IDE support initializing stack space with a constant? For example with a #define. If not, please does someone have ARM Cortex M3/M4 assembler code to do that and where should it be located? For example in startup*.s prior to the branch to main?

Parents
  • Sorry, I don't have much time now ... but here's a scatter file I've modified from one of the Blinky examples. I gave it a quick try and the stack is not now being cleared.

    In the IDE, select this one (or the one that you'll modify accordingly).

    LR_ROM1 0x00000000 0x04000000  {    ; load region size_region
      ER_ROM1 0x00000000 0x04000000  {  ; load address = execution address
       *.o (RESET, +First)
       *(InRoot$$Sections)
       .ANY (+RO)
      }
    
      RW_RAM1 0x20000000 0x00400000  {  ; RW data
       .ANY (+RW +ZI)
      }
    
      RW_STACK +0 UNINIT ALIGN 16       ; RW data - Stack <<< THIS SECTION IS WHAT I ADDED
      {
        *.o (Stack)
      }
    }
    

Reply
  • Sorry, I don't have much time now ... but here's a scatter file I've modified from one of the Blinky examples. I gave it a quick try and the stack is not now being cleared.

    In the IDE, select this one (or the one that you'll modify accordingly).

    LR_ROM1 0x00000000 0x04000000  {    ; load region size_region
      ER_ROM1 0x00000000 0x04000000  {  ; load address = execution address
       *.o (RESET, +First)
       *(InRoot$$Sections)
       .ANY (+RO)
      }
    
      RW_RAM1 0x20000000 0x00400000  {  ; RW data
       .ANY (+RW +ZI)
      }
    
      RW_STACK +0 UNINIT ALIGN 16       ; RW data - Stack <<< THIS SECTION IS WHAT I ADDED
      {
        *.o (Stack)
      }
    }
    

Children