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:编译器选择错误的寄存器

Guru**** 2387080 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1535133/f29h850tu-compiler-selects-wrong-register

器件型号:F29H850TU

工具/软件:

我们在使用扩展的“asm"命令“命令时发现了一个问题。  例如、如果寄存器的值要存储在全局 C 变量中、
编译器为变量地址提供一个“Dx"寄存“寄存器、而不是“Ax"寄存“寄存器、这会导致编译错误:

为了在您这边重现此问题、我们修改了 SDK 的示例“led_ex1_blinky.c":“:

#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);
    }
}

我们使用基于 makefile 的构建来构建示例:“gmake -s led_ex1_blinky.c profile={DEBUG_O0|debug_O1}config=flash“
使用的编译器:“TI C29 Clang 编译器 1.0.0.LTS“

提前感谢大家。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢您告知我们这个问题、并提供了一个简明的测试案例。  我能够重现同样的行为。  我提交了条目 EXT_EP-12698 以对此进行调查。  欢迎点击这个链接。

    谢谢。此致、

    -乔治