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.

TMS320F28375S: CCS program Stack Size issue

Part Number: TMS320F28375S

Dear Sir,

    Can we change the stack address from RAM M1 to other RAM bank for increasing stack size?

.stack : > RAMM1, <--------------------------------------------Change to GS6 and get the compile error
RUN_START(_HWI_STKBOTTOM),
RUN_END(_HWI_STKTOP),
PAGE = 1

There are bootloader and mainprogram in our software structure.  They are different CCS program projects.

The boolloader is located at 0x80000 and mainprogram is at 0x88000. The bootloader will check the DIP switch to decide whether stays in bootloader or jump to mainprogram.

We think the bootloader may use too many local variables. Do we need to do "stack reset" before jumping to mainprogram?

 ==== Code Snippet ===

PLCAppEntryAddr = 0X00088000; //run main program at SectorE

if(MODE_0==1 && MODE_1==1) //jump to PLC main application
{
msg="\r\n\n\n MCU Boot loader Jump to main program\0";
scib_msg(msg);

if(PLCAppEntryAddr)

               <<DO "stack reset" >> <-------------------------------------------------How to do the stack reset here?
                 ((void (*)(void))PLCAppEntryAddr)();
}

=========END ======

Eddie

  • Hi, 

    The stack has to be placed within 64K boundary and hence the compiler will throw an error. 

    You can try using RAMGS0 instead of RAMGS6 for stack allocation.

    Best Regards

    Siddharth

  • Can we change the stack address from RAM M1 to other RAM bank for increasing stack size?

    It would be unwise, in my view, to locate it in anything other then dedicated memory. i.e. M0, M1 or Dx since only the CPU has access to these.

    Consider combining M0 and M1 to make available memory larger. For example:

       RAMM0_1         : origin = 0x000122, length = 0x0002DD
    
       .stack          : > RAMM0_1

    And don't forget to check the C program stack size in the compiler:

    Do we need to do "stack reset" before jumping to mainprogram?

    Does your mainprogram compile and link F2837xS_CodeStartBranch.asm? If so, this calls the start-up routine i.e. _c_init00(). The start-up routine is responsible for initializing the stack. In fact it is the first instruction:

    	MOV  	SP,#__stack		; set to beginning of stack space

    So I think that perhaps you don't need to change the SP before you jump.

  • Hi, 

    You can also combine RAMM0 and RAMM1 and use it for stack.

    Best Regards

    Siddharth