This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSPM0L1306: Related to the memory allocation of STACK in MSP TI micro-controller

Part Number: MSPM0L1306


Tool/software:

Hello,

I am trying to allocate the stack memory for MSPM0L1306 Microcontroller by using the scatter file and start up code

below I am updating the modified code for scatter and start up, please check and let me know if any changes required.

Scatter file:

RW_IRAM2 0x20000000 0x00000D00 { ; RW data
.ANY (+RW +ZI)
.ANY (.ramfunc)
}
ARM_LIB_STACK 0x20000D00 0x300 ; Stack region growing down
{*(STACK) }
}


start up file:

tack_Size EQU 0x00000300

AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size
__initial_sp


is the above implementation is proper?

because, the memory is locked in my micro-controller. After flashing


Thanks,
Govardhan Perla.

  • Hello Govardhan,

    Why do you want to allocate the stack memory by yourself because compiler will do the memory allocation automatically so I have not done the same operation. 

    Best Regards,

    Janz Bai

  • Hi Janz Bai,

    Yes, you are correct compiler will allocate the stack memory during compiling time itself.
    But I need to calculate whether stack overflow happened or not, for that I need a constant stack memory to monitor the Stack memory to avoid stack overflow.

    For allocating constant stack memory, I updated the above scatter file.
    My doubt, the way I modified the scatter file is correct or not

    Thanks, 
    Govardhan Perla

  • Hello Govardhan,

    Thanks for your confirming and I have known what you mean. It seems that the IDE you used is Keil and you want to use the scatter file to allocate the position and size of the code, data and stack. I think that maybe you need to look for user guide of Keil to check whether your code writing conforms to writing standards. And about the Flash region (size and address) and specific information about M0 L-series, you can refer to the chapter: "NVM(Flash)" in the TRM which you can download from ti.com.

    MSPM0 L-Series 32-MHz Microcontrollers Technical Reference Manual (Rev. D) (ti.com)

    Best Regards,

    Janz Bai