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.

F29H850TU: Compiler selects wrong register

Part Number: F29H850TU


Tool/software:

We have observed a problem when using extended "asm" commands. For example, if the value of a register is to be stored in a global C variable,
the compiler provides a "Dx" register instead of an "Ax" register for the address of the variable, which leads to a compilation error:

To reproduce this issue on your side, we have modified the example "led_ex1_blinky.c" of the SDK:

#include "board.h"

uint32_t sp;

int main (void)
{
    Device_init();
    Board_init();
    
    /* Compilation fails as the compiler selects a `Dx` register instead of a `Ax` register to load the address of `sp`. */
    __asm volatile("ST.32 *%0, A15" : : "r"(&sp));
    
    for(;;)
    {
        GPIO_writePin(myBoardLED1_GPIO, 0);
        DEVICE_DELAY_US(1000000);
        GPIO_writePin(myBoardLED1_GPIO, 1);
        DEVICE_DELAY_US(1000000);
    }
}

We use the makefile-based build to build the example: "gmake -s led_ex1_blinky.c PROFILE={debug_O0|debug_O1} CONFIG=FLASH"
Used compiler: "TI C29 Clang Compiler 1.0.0.LTS"

Many thanks in advance.