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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1535135/f29h850tu-assembler-documentation

器件型号:F29H850TU

工具/软件:

由于我们在汇编语言中实现了中断进入和异常上下文代码来维护细粒度控制、您能否确认是否还有汇编器本身的详细文档(除了我们已经拥有的指令集)? 其中将包括有关指令和语法的信息。 如果是、可否提供这项服务以支持我们的发展?

我们需要说明如何使用参数定义宏。 与其他 LLVM TI 编译器配合使用、我们成功使用了:

.macro MacroName, Params
/* Macro definition */
.endm

但在 C29x 上、我们无法与宏一起定义参数。 由于我们在异常和中断录入代码中严重依赖参数化宏、因此了解 C29x 汇编器的正确语法对我们至关重要。

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

    就像现在一样、使用 tiarmclang 汇编器指令的文档

    谢谢。此致、

    -乔治

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

    您好、George、

    用参数定义宏的问题其实来自我。 我在 Clang 文档 (sourceware.org/.../Macro.html) 中看到 、我们可以使用.macro MacroName、Params 来定义参数。 但是、汇编器无法识别这些参数、从而导致链接期间出现未定义的符号错误。 为了重现该问题、我修改了 SDK 中的源文件 kernel/freertos/Source/portable/ccs/c2000_C29x /portasm.asm。

    我使用 address 参数定义了一个 loadNum 宏。

    .macro loadNum address
        LD.32 A14, @address
    .endm
    然后我在 vPortYield 中调用它:
    loadNum pxCurrentTCB
    然后、在链接期间我收到错误:
     undefined first referenced
      symbol       in file
     --------- ----------------
     address   C:\Users\xchen\AppData\Local\Temp\portasm-f02d2f.o
    
    error: unresolved symbols remain
    error: errors encountered during linking; "SOM/FLASH/control+rtos_demo.out" not
       built
    c29clang: error: c29lnk command failed with exit code 1 (use -v to see invocation)

    我使用基于 makefile 的构建来编译示例。 gmake -s control+RTOS_demo profile=DEBUG_O0 config=flash“

    使用的编译器:“TI C29 Clang 编译器 1.0.0.LTS。“

    我还附上了修改后的 portasm.asm 文件:

        .extern pxCurrentTCB
        .extern bYield
        .extern bPreemptive
        .extern ulCriticalNesting
        .extern xTaskIncrementTick
        .extern vTaskSwitchContext
        .extern ulTaskHasFPUContext
    
        .global portTICK_ISR
        .global portRESTORE_FIRST_CONTEXT
        .global vPortYield
        .global profile1_start, profile1_end, profile2_start, profile2_end
    
        .macro loadNum address
            LD.32 A14, @address
        .endm
    
        .macro portSAVE_CONTEXT
            ST.32 *(A15++#8), A14
            || MV A14, RPC
            ST.32 *(A15-#4), A14
            ST.32 *(A15++#8), DSTS
            ST.32 *(A15-#4), ESTS
            ST.64 *(A15++#8), XA0
            ST.64 *(A15++#8), XA2
            ST.64 *(A15++#8), XA4
            ST.64 *(A15++#8), XA6
            ST.64 *(A15++#8), XA8
            ST.64 *(A15++#8), XA10
            ST.64 *(A15++#8), XA12
            ST.64 *(A15++#8), XD0
            ST.64 *(A15++#8), XD2
            ST.64 *(A15++#8), XD4
            ST.64 *(A15++#8), XD6
            
            ;Check if task has FPU context
            || LD.32	 D0, @ulTaskHasFPUContext
    
            ST.64 *(A15++#8), XD8
            || BCMPZD  .+0x54, D.EQ, D0
            ST.64 *(A15++#8), XD10
            ST.64 *(A15++#8), XD12
            ST.64 *(A15++#8), XD14
    
            ST.64 *(A15++#8), XM0
            ST.64 *(A15++#8), XM2
            ST.64 *(A15++#8), XM4
            ST.64 *(A15++#8), XM6
            ST.64 *(A15++#8), XM8
            ST.64 *(A15++#8), XM10
            ST.64 *(A15++#8), XM12
            ST.64 *(A15++#8), XM14
            ST.64 *(A15++#8), XM16
            ST.64 *(A15++#8), XM18
            ST.64 *(A15++#8), XM20
            ST.64 *(A15++#8), XM22
            ST.64 *(A15++#8), XM24
            ST.64 *(A15++#8), XM26
            ST.64 *(A15++#8), XM28
            ST.64 *(A15++#8), XM30
    
            ; Store FPU context indicator
            ST.32 *(A15++#8), D0 
            ; Store the new top of stack for the task.
            || LD.32	A14, @pxCurrentTCB
            ST.32	*A14, A15
        .endm
    
        .macro portRESTORE_CONTEXT
            LD.32 A0, @pxCurrentTCB
            LD.32 A15, *A0
    
            ;Check if task has FPU context
            LD.32	 D0, *(A15-=#8)
            ST.32 @ulTaskHasFPUContext, D0
            || BCMPZ  .+0x4a, D.EQ, D0
    
            LD.64 XM30, *(A15-=#8)
            LD.64 XM28, *(A15-=#8)
            LD.64 XM26, *(A15-=#8)
            LD.64 XM24, *(A15-=#8)
            LD.64 XM22, *(A15-=#8)
            LD.64 XM20, *(A15-=#8)
            LD.64 XM18, *(A15-=#8)
            LD.64 XM16, *(A15-=#8)
            LD.64 XM14, *(A15-=#8)
            LD.64 XM12, *(A15-=#8)
            LD.64 XM10, *(A15-=#8)
            LD.64 XM8,  *(A15-=#8)
            LD.64 XM6,  *(A15-=#8)
            LD.64 XM4,  *(A15-=#8)
            LD.64 XM2,  *(A15-=#8)
            LD.64 XM0,  *(A15-=#8)
            
            LD.64 XD14, *(A15-=#8)
            LD.64 XD12, *(A15-=#8)
            LD.64 XD10, *(A15-=#8)
            LD.64 XD8,  *(A15-=#8)
            LD.64 XD6,  *(A15-=#8)
            LD.64 XD4,  *(A15-=#8)
            LD.64 XD2,  *(A15-=#8)
            LD.64 XD0,  *(A15-=#8)
            LD.64 XA12, *(A15-=#8)
            LD.64 XA10, *(A15-=#8)
            LD.64 XA8,  *(A15-=#8)
            LD.64 XA6,  *(A15-=#8)
            LD.64 XA4,  *(A15-=#8)
            LD.64 XA2,  *(A15-=#8)
            LD.64 XA0,  *(A15-=#8)
            LD.32 DSTS, *(A15-=#8)
            LD.32 ESTS, *(A15+#4)
            LD.32 A14,  *(A15-=#8)
            LD.32 RPC,  *(A15+#4)
    
        .endm
    
    portTICK_ISR:
    profile1_start:
    	; Save the context of the current task.
        portSAVE_CONTEXT
    profile1_end:
    
        ;ENINT
    
        ; Increment tick counter
        CALL     xTaskIncrementTick
        BCMPZ    skipTaskSwitchContext, D.EQ, D0
        CALL     @vTaskSwitchContext
    
    skipTaskSwitchContext:
    profile2_start:
        ; Restore the context of the task selected to execute.
        portRESTORE_CONTEXT
    profile2_end:
    
        RETI.INT
    
    
    vPortYield:
    	; Save the context of the current task.
        portSAVE_CONTEXT
        loadNum pxCurrentTCB
    
        ;ENINT
    
        ; Select the next task to execute.
        CALL      @vTaskSwitchContext
    
        ; Restore the context of the task selected to execute.
        portRESTORE_CONTEXT
        RETI.INT
    
    
    portRESTORE_FIRST_CONTEXT:
        portRESTORE_CONTEXT
        RET

    提前感谢大家。

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

    我刚意识到我忘记了地址之前的\、因此正确的宏应该是

        .macro loadNum address
            LD.32 A14, @\address
        .endm

    因此问题已解决。 非常感谢。