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.

TMS570LS1224: How to set stack size for TMS570LS1224 in CCS or halcogen

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN, TMS570LC4357

I am using TMS570LS1224 micro-controller, I have set the C System stack size as 0x2000, but still stack overflow in stack usage report as below,

Please guide me to understand if by just configuring the C System stack size in CCS project setting is sufficient or do I have do some changes in sys_core.asm file to modify the stack.

Also how can I know how much stack is allocated to ISR and how to update ISR stack.

  • Please guide me to understand if by just configuring the C System stack size in CCS project setting is sufficient or do I have do some changes in sys_core.asm file to modify the stack.

    In HALCoGen there is the Stack Configuration panel in the RAM tab where the stack sizes can be set:

    If the Stack Length in the above HALCoGen dialog is changed, when HALCoGen regenerates the code the stack sizes in sys_core.asm will be updated.

    The above example was from a HALCoGen project for a TMS570LC4357, but should also be applicable to a TMS570LS1224 .

    Also how can I know how much stack is allocated to ISR and how to update ISR stack.

    The FIQ Stack Length or IRQ Stack Length set how much stack is allocated to an ISR, depending if the ISR is configured as a FIQ or IRQ.

  • Currently in my recent Halcogen project I have set the stack size as 0x2400, and ISR IRQ length as 0x1000

    And as said my sys_core.asm and sys_link.cmd files are updated.

    My (HalTmrIsr) ISR is defined as IRQ,

    When trying to view the stack usage, HalTmrIsr stack usage is 704 bytes which is less than the IRQ stack length defined, but still showing in yellow color which means getting overflow.

    Can you please explain why I am getting this error. 

  • Can you please explain why I am getting this error. 

    I found the thread CCS/TMS320F280049: How Stack Usage of CCS judge for making color bar(Yellow, green and so on) which says their is a bug in how the information is displayed.

    https://sir.ext.ti.com/jira/browse/EXT_EP-9641 was raised as a bug which was found in CCS 9.3.0, and checking with CCS 12.0 the bug is still present.

    The recommendation is to ignore the color indicators for now, and manually check that the worst case stack usage is less than the size of the allocated stack.

  • Got it...I have checked manually the worst case stack usage is less than the size of the allocated stack usage.

    But the root cause why I have debugging on the stack is I was facing some issue in my software, which lead me to think if I am facing some stack overflow issue, but clarified their a bug in color code displayed by CCS for stack usage.

    In my software I have nested functional calls say F1 is calling F2 and F2 is calling F3 and so on, it also passing few arguments but when step debugging it is observed that from F1 to F2 correct values is getting passed and same is passed from F2 to F3 but when passing the value from F3 to F4 I am observing some garbage values getting passed, what could be the possible reason and how to fix it.