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.

Compiler/TMS320F28023: Followup to prevoius thread "Compiler not adding constants, addition happening in run code"

Part Number: TMS320F28023

Tool/software: TI C/C++ Compiler

I want to add a solution I found to one of my earlier posts called "Compiler not adding constants, addition happening in run code" here

https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/792907

But the "add a related question" does not work (it may be my browser)

Anyway, I found I can create two symbols in the linker, then use them in the code.

In the SECTIONS portion of  my CMD file, I have...

SECTIONS

{

...

    .stack                : LOAD = R_STACK,
                          RUN_START(_stackStart),
                          RUN_END(_stackStop),        PAGE = 1
...

}

Then, after the closing } of SECTIONS I can create

        _my_stack_start = _stackStart + 8;
        _my_stack_size = (_stackStop - _stackStart) - 8;

Then, simply use these symbols in my code.

This prevents the run time code from having to do the math to calculate the offsets.

Yes, it only saves two instructions, but every byte helps.

Mark.