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.

[参考译文] TMS570LC4357:_memInit_() 阻塞寄存器 — 需要强制内联

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1604612/tms570lc4357-_meminit_-clobbers-registers---needs-to-be-forced-inlined

器件型号: TMS570LC4357

找到(至少)观察 bizzare 行为的原因之一:_memInit_() 会覆盖已存储在 R5 中的值。

我可以看到发生了什么。 C 编译器期望函数在进入时存储其阻塞的寄存器、并在退出时恢复、当然是这样! 然而,分区函数会擦除所有的 RAM ,因此没有必要存储在堆栈上,因此不会。 这确实意味着必须内联运行、以便编译器可以看到它收缩的寄存器并避免使用它们。  

但是、如何强制将函数内联? 我正在查看 ARM 汇编语言工具文档 (spnu118x.pdf)、但它没有说明如何强制内联。

那么如何解决这个问题呢?

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

    从 spnu151w.pdf:

    我已经使用 R0-R3 重新编写了函数、希望这样可以、但仍在测试中。