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.

CCSv4.1 How to replace exit() function in rst430.lib

Other Parts Discussed in Thread: MSP430F2131

I am using CCSv4.1 and my target processor is MSP430F2131. I'd like to know how I could replace the exit() function within rts430.lib with something less bloated & more suitable for my application, for example:

#pragma FUNC_NEVER_RETURNS(exit)

void exit(int status)       
{
    for (;;);
}

When using CCE I was previously able to declare such a trivial function within main.c file (after main{}) and have it linked in rather the the rts430.lib version. This saved about 50bytes if memory serves correct. I'm now trying to compile the same code with CCSv4.1 and the following error is reported:


error: symbol "exit" redefined: first defined in "./main.obj"; redefined in
   "C:/Program Files (x86)/Texas
   Instruments/ccsv4/tools/compiler/msp430/lib/rts430.lib<exit.obj>"
error: errors encountered during linking; "TS911-CCS.out" not built

 

I understand the cause of the error, but is there anyway I could get around this by setting up the linker to avoid the rts430.lib exit() function being linked in due to _c_int00() calling it after main returns?

So far I've investigated:

a) using --priority to search for library in priority order

b) changing the command line from: ${command} ${flags} ${output_flag} ${output} ${inputs}

    to: ${command} ${inputs} ${flags} ${output_flag} ${output}