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.

Optimization fails if using (wrong written) .asm files

CCSv4.1.3.00038

 

The compiler is probably not looking into .asm files when optimizing.

 

In the project ‘DC/DC LED Developers Kit’ the compiler is filling XAR2 and expect it to remain unchanged, but hereafter it Calls ‘_ISR_Init’ from ‘Lighting_DCDC-ISR.asm’ (original TI file) which is using XAR2 also, without using Push and Pop, and XAR2 is not correct anymore and the program fails.

 

Or is there any option to avoid such problems?

 

Best regards, Leo Bosch

  • Leo Bosch said:
    In the project ‘DC/DC LED Developers Kit’ the compiler is filling XAR2 and expect it to remain unchanged, but hereafter it Calls ‘_ISR_Init’ from ‘Lighting_DCDC-ISR.asm’ (original TI file) which is using XAR2 also, without using Push and Pop, and XAR2 is not correct anymore and the program fails.
     
    Or is there any option to avoid such problems?

    Hi Leo,

    This is a bug in the assembly function.  The calling convention rules state that any called function will preserve the state of certain registers - XAR2 is one of these.   I've passed this along to the owners of this software module.  (These are detailed in section 7.4 of the compiler guide  www.ti.com/lit/spru514 if you want more info)

    -Lori

     

  • Hallo Lori,

     

    Thanks for your reply.

    I will not blame your software writers, they do a very great job and such a mistakes are always possible. But I expect from the compiler at least a warning for incompatible use of registers. These cases cost a lot of time to debug.

     

    -Leo

  • Leo Bosch said:

    But I expect from the compiler at least a warning for incompatible use of registers. These cases cost a lot of time to debug.

    The compiler cannot know what's going on in hand-written assembly code.  At best, the place to check for adherence to the C calling convention in hand-written assembly functions would be in the assembler, but there is so much flexibility in hand-written assembly that this is pretty much a hopeless task.  It's the responsibility of the author of hand-coded assembly to ensure it adheres to the C calling convention.