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.

[参考译文] RM48L930:在 Hercules RM48Lx30上启用 FPU

Guru**** 2465890 points
Other Parts Discussed in Thread: HALCOGEN

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/666362/rm48l930-enabling-fpu-on-hercules-rm48lx30

器件型号:RM48L930

您好!

我的项目需要浮点支持、我正在使用的 uC (RM48L930)包含一个 FPU 协处理器。   在 HALCoGen 'Cortex R4 -通用配置'区域中、我启用了"启用矢量浮点单元"。  但是、我在 sys_startup.c 中看不到对_coreEnableVfp_()的调用  这是 HALCOGen 4.07.00中的已知问题吗?  是否需要添加对_coreEnableVfp_()的调用以启用 FPU 协处理器?  我的项目编译器处理器选项设置为-mv7R4 --float_support=VFPv3D16。

谢谢、

Keith

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

    您好、Keith、

    我理解这种情况的混淆。 在 sys_core.asm 文件中的_coreInitRegisters_函数内启用 FPU。 混淆点是使能代码是内联的、 初始化代码不调用汇编函数_coreEnableVfp_。   提供了_coreInitRegisters_函数、以便在出于某种原因需要禁用和重新启用浮点单元的情况下从另一个 C 文件中轻松启用浮点单元。 请参阅下面的_coreInitRegisters_列表、其中 FPU 启用部分突出显示。

    ;------------------------------------------------------------------
    ;初始化 CPU 寄存器
    ;sourceId:core_sourceId_001
    ;DesignId:core_DesignId_001
    ;要求:hL_SR477、hL_SR476、hL_SR492
    
    .def _coreInitRegisters_
    .asmfunc
    
    
    _coreInitRegisters_
    
    
    ;复位后,CPU 处于监控器模式(M = 10011)
    MOV r0、LR
    MOV R1、#0x0000
    MOV R2、#0x0000
    MOV R3、#0x0000
    MOV R4、#0x0000
    MOV R5、#0x0000
    MOV R6、#0x0000
    MOV r7、#0x0000
    MOV R8、#0x0000
    MOV R9、#0x0000
    MOV R10、#0x0000
    MOV r11、#0x0000
    MOV R12、#0x0000
    MOV R13、#0x0000
    R1女士、CPSR
    MSR spsr_cxsf、R1
    ;切换到 FIQ 模式(M = 10001)
    CPS 17
    MOV LR、r0
    MOV R8、#0x0000
    MOV R9、#0x0000
    MOV R10、#0x0000
    MOV r11、#0x0000
    MOV R12、#0x0000
    R1女士、CPSR
    MSR spsr_cxsf、R1
    ;切换到 IRQ 模式(M=10010)
    CPS 18
    MOV LR、r0
    R1女士、CPSR
    MSR spsr_cxsf、R1
    ;切换到中止模式(M = 10111)
    CPS #23
    MOV LR、r0
    R1女士、CPSR
    MSR spsr_cxsf、R1
    ;切换到未定义指令模式(M=11011)
    CPS #27
    MOV LR、r0
    R1女士、CPSR
    MSR spsr_cxsf、R1
    ;切换到系统模式(共享用户模式寄存器)(M = 11111)
    CPS #31
    MOV LR、r0
    R1女士、CPSR
    MSR spsr_cxsf、R1
    
    
    MRC P15、 0x00、 R2、 c1、c0、#0x02
    ORR R2、 R2、 0xF00000
    MCR P15、 0x00、 R2、 c1、c0、#0x02
    MOV R2、 0x40000000
    fmxr fpexc、R2 
    
    fmdr d0、 R1、 R1
    Fmdr D1、 R1、 R1
    Fmdr D2、 R1、 R1
    Fmdr D3、 R1、 R1
    Fmdr D4、 R1、 R1
    Fmdr D5、 R1、 R1
    fmdr d6、 R1、 R1
    Fmdr D7、 R1、 R1
    Fmdr D8、 R1、 R1
    Fmdr D9、 R1、 R1
    fmdr d10、 R1、 R1
    Fmdr D11、 R1、 R1
    fmdr d12、 R1、 R1
    Fmdr D13、 R1、 R1
    Fmdr D14、 R1、 R1
    Fmdr D15、 R1、 R1
    bl next1
    next1
    bl next2
    next2
    bl next3
    next3
    bl next4
    next4
    BX r0
    
    endasmfunc
    

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

    谢谢 Chuck、我第一次在查看_coreInitRegisters_时错过了这个问题。  有道理。  后续问题:我添加了一些测试代码来调用 trig 函数(atan()),然后查看.lst 文件 以查看 生成了什么 asm 代码。  编译器不直接使用 ATAN、而是在 rtsv7R4_T_le_v3D16_eabi.lib 中调用 atan ()。  是否知道为什么不直接使用 ATAN?

    谢谢、

    Keith