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.
工具与软件:
大家好、团队成员:
我键入以跳转我的应用程序以及重置栈指针、但在汇编级别出现一些错误或我不理解的内容、因此对解决此问题有很大帮助。我将共享代码并尊重错误、如下所示。
以上是代码剪切。
作为错误:-
说明资源路径位置类型
#18 Expected a ")" main.c /SC421_New_DSP Power_Convt_ line 292 C/C++问题。
此致、
您好!
您编写的 JumpToApplication()函数代码是否正确? 或者它是否由 TI 的某个软件包提供?
此致、
Delaney
尊敬的 Ujwal:
您能否 将代码以文本形式发送给我以便我进行测试?
此致、
Delaney
尊敬的 Delaney:
当然会分享代码,所以你可能会自己去,如果可能的话,你会上网如 TeamViewer 或任何东西,以便你可以快速检查它所有我的硬件准备好.
此致、
Ujwal AP.
尊敬的 Ujwal:
您可以先通过 E2E 发送代码以供我尝试吗? 由于这是生成错误、所以我应该能够在没有硬件的情况下轻松进行复制。
此致、
Delaney
void JumpToApplication(void) { //#if 0 // Define a function pointer to the application start address void (*appStart)(void); // Get the reset vector address (address of the application's reset handler) appStart = (void (*)(void))(*((volatile uint32_t *)(APPLICATION_FLASH_START_ADDRESS + 0x4))); // Disable interrupts DINT; // Set the stack pointer to the application's stack pointer uint32_t appStackPointer = *(volatile uint32_t *)APPLICATION_FLASH_START_ADDRESS; // Get the stack pointer from the application's start address __asm(" MOV DP, %0" : : "r" (appStackPointer)); // Set the stack pointer // Jump to the application appStart(); // Call the application //#endif /* // Disable interrupts DINT; // Disable global interrupts // Set the Stack Pointer (SP) asm(" MOV DP, %0" : : "r" (STACK_START_ADDR)); // Set Data Pointer to stack address asm(" MOV SP, %0" : : "r" (STACK_START_ADDR)); // Set Stack Pointer to stack address // Set the Program Counter (PC) to the application start address asm(" MOV DP, %0" : : "r" (APPLICATION_FLASH_START_ADDRESS)); // Set Data Pointer to application address asm(" MOV PC, %0" : : "r" (APPLICATION_FLASH_START_ADDRESS)); // Set Program Counter to application address // Set the Program Counter (PC) to the application start address AppEntry appEntry = (AppEntry)(APPLICATION_FLASH_START_ADDRESS); // Cast the application start address to a function pointer appEntry(); // Jump to the application */ /* // Define the new stack pointer location // This should be a valid RAM address where the stack will start volatile Uint32 *newStackPointer = (volatile Uint32 *)0x2000; // Change this address as needed // Set the stack pointer to the new location // In C, you can't directly assign to SP, so you need to use assembly asm(" MOV A, newStackPointer"); // Load the address into A register asm(" MOV SP, A"); // Move the value in A to the stack pointer */ /* // Get the application's stack pointer value from the start of the image uint32_t app_sp = *((uint32_t *)APP_START_ADDRESS); // Get the application's entry point (Reset Handler) AppEntryPoint app_entry = (AppEntryPoint)(*((uint32_t *)(APP_START_ADDRESS + 4))); __asm(" MOV SP, @_stack_top"); // Reset the stack pointer (SP) (__asm__ volatile ("MOV SP, %0" : : "r" (app_sp) : )); // Jump to the application entry point app_entry(); */ void main(void) { //ReceiveCANData(); JumpToApplication(); } }
嗨、Delaney、这里是共享函数、它从 main 调用级
_asm (" MOV DP,%0":"r"(appStackPointer));//设置堆栈指针
上面的行将在"linenum=15"中发现错误
错误: 描述资源路径位置类型
#18 Expected a ")" main.c /cps_SW_Gen5_New_DSP line 294 C/C++问题
此致
Ujwal AP.
尊敬的 Ujwal:
很抱歉耽误你的时间。 为了进行更新、我已将您的代码复制到项目中、但遇到的问题与您看到的问题相同。 遗憾的是、在调整代码后、我一直无法解决构建警告问题、目前正在与编译器团队合作以了解可能导致此问题的原因。
此致、
Delaney
感谢 Delaney 的快速响应、但我们很奇怪地在寻找解决方案、
请告诉我、如果需要任何东西、我将提供、我们可以缓解此问题。
等待您的解决方案。
谢谢!
Ujwal AP.
尊敬的 Ujwal:
我们的编译器专家帮您:
C 或 C++标准中未指定 asm 语句。 该特定变体来自 GCC。 我们基于 clang 的编译器(tiarmclang 和 c29clang)对其提供支持。
此致、
Delaney
你好、Delaney!!!
谢谢、回应、
但如何解决此问题呢?
如果你能给我你的 ASM 陈述,你刚刚验证,所以我可以实现无效的特定挑战。
等待您的良好响应。
此致、
Ujwal AP.
尊敬的 Ujwal:
Delaney 目前不在办公室,直到节假日结束。 请预计响应会有延迟。 感谢您的耐心。
此致、
Aishwarya.
尊敬的 Ujwal:
很抱歉我的答复被推迟。
asm 语句未在 C 或 C++标准中指定。 该特定变体来自 GCC。 我们基于 clang 的编译器(tiarmclang 和 c29clang)对其提供支持。 [报价]换句话说、C28x 编译器不支持您尝试使用的语句。 虽然 C28x 确实支持_asm 语句、但它们实际上应仅用于 EINT、NOP、ESTOP0等简单指令 MOV 指令要求 CPU 控制寄存器的已知状态才能工作;GCC 编译器知道如何定义这些状态、但 C28x 编译器不能。
我假设此代码用于自定义引导加载程序吗? 您是否在 引导加载程序的链接器 cmd 文件中为引导加载程序定义了单独的栈? 如果是、无需重置应用中的堆栈指针。 您需要做的就是跳转到应用程序代码、这通常是通过长分支指令完成的。
此致、
Delaney
大家好、团队
新年快乐!!!!
希望大家都做得很好、
对此、我还有一个问题、如下所示、
如果我们有代码、它存储在 ABCD 闪存扇区中、还有一个像 LED 闪烁这样的小代码将存储在"H"闪存扇区中、因此我想使用"asm (" LB 0x0A0000");"指令进行跳转、从而使两个代码都实现完美的切换或跳转
注意: 在上述两个代码仅由 TI 调试器推送。
现在、与 LED Blink Hex 文件相同的代码我想使用 CAN 协议以及 FlashAPI 函数存储、它成功地存储在闪存扇区"H"中、没有任何错误、但现在我想使用"asm (" LB 0x0A0000")跳转;"指令它不会跳转或直接跳转到函数以下。
_interrupt void Interrupt_illegalOperationHandler (void)
{
//
//有什么问题。 CPU 试图执行非法的
//指令、生成非法指令陷阱(ITRAP)。
//
ESTOP0;
for (;;)
{
;
}
}
我需要理解的是、如果我们使用 TI 调试器推送代码、那么两个代码会正确跳转且没有任何错误、但如果我们闪存相同的与"H"扇区相关的十六进制文件(LED 闪烁代码十六进制文件)、因此它存储得很好、但无法对其进行编码而不会跳转或切换、因此请关注此事项。
等待您的良好响应!!!!
此致
UJWAL AP
您好!
Delaney 在下周不在办公室、请期待延迟回复。
此致、
Ben Collier
尊敬的 Ujwal:
希望你有一个愉快的假期! 我在 Flash 专家中循环询问您的最新问题。
此致、
Delaney
尊敬的 Ujwal:
所以、你能够使用 asm (" LB 0xA0000")正确分支至0xA0000;当你通过 JTAG/调试器刷写应用时、但不是当你通过闪存 API 编辑它时? 我的理解是否正确? 闪存 API 加载的内容和通过 JTAG/调试器加载的内容应该没有差异。 我建议对闪存扇区 H 进行一个内存转储、并在通过 JTAG/调试器进行编程以及通过闪存 API 进行编程时比较其内容。 如果您发现差异、则编程逻辑可能出错。
此致、
Skyler
嗨、Skyler!!!
感谢您的提示。
我已经检查了这两个。 具有 Beyond Compare 的十六进制文件、并且没有错误、即使每行都与我们使用调试器以及闪存转储的转储相匹配。
此致、
Ujwal AP.
你好、Skyler!!!
如果有任何不同的方法、您能帮助我们如何跳转吗? 而不是执行 asm (" LB 0xA0000");
此致、
Ujwal AP.
尊敬的 Ujwal:
您可以尝试使用长间接分支指令。 因此、您需要将0xA0000存储在 XAR7寄存器中、然后使用 asm (" LB * XAR7")分支到该寄存器;
此指令在 TMS320C28x CPU 和指令集指南中有详细介绍、也可用于其他闪存内核。 您可以参考 F280015x DCAN 闪存内核工程(C2000ware/driverlib/f280015x/examples/flash/ccs/f280015x_flash_kernel_ex5_can_flash_kernel.projectspec)中的 flash_kernel_ex5_dcan_flash_kernel.c、了解其使用方法。
此致、
Skyler