Thread 中讨论的其他器件:C2000WARE、 SysBIOS
尊敬的先生或女士
我们已将固件从 COFF 格式迁移到 eabi。 或者至少、我们要尝试这么做。 每当我们刷写它时、即使在它到达 main 之前就会崩溃。 更准确地说、在复位时调用的 Userinit 函数中、我们将一些 progam 代码从闪存复制到内存中。 当我们在汇编步骤中调试时、我们看到、该函数以随机步进的方式跳转到地址0x3FE493并停止。 如果不等于零指令、memcpy 基本上是一个具有两条 MOV 指令和一个分支的循环。 RAM 的存储器范围足够大、能够存储来自闪存的所有数据。 有趣的是、它只会在复制 IQmath 库中的对象时发生。
两次调试显示、在复制更新的 IQmath_fpu32_eabi 库的函数期间会发生崩溃。 它的地址并不完全相同、但始终处于存储 IQmath 函数的范围内。
有一个类似的主题没有帮助,因为它只引用手册,我们当然考虑: https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1244672/tms320f28075-migration-from-coff-to-eabi-crash-during-_c_int00
我将新的.eabi 映射文件与 COFF.ABI 文件进行了比较。 有一些变化,似乎是奇怪的我,但我不知道他们是否对这个问题有影响或他们是正确的。
-在 eabi.map 文件中,PieVectTable 以0的长度列出,并且在属性/输入部分只有 DSECT ,而 coff 格式的长度大于0并且也引用了 F2837xS_globalvariables。
- eabi.map 文件中缺少 AdcResultFileD
- CodeStartBranch.asm 在.map 文件中丢失
-在 eabi.map 中:链接器生成的复制表中有一个 addinoal 条目:__TI__cinit_table
这个列表很随机、我认为还有一些其他的差异。 它可能有助于解决该问题。
在帖子的末尾,我插入了这个问题的所有重要文件。
感谢您发送编修。
罗伯特
以下代码显示了 User Init 函数:
/*---------------------------------------------------------------------------- function: UserInit ----------------------------------------------------------------------------*/ extern "C" void UserInit() { // SYS/BIO UserInit function. // // This is the user initialization function to be specified in // the SYS/BIOS configuration file (Startup -> User reset function) // // Use this function to copy flash sections to RAM // // @note Will be called before main(). //--- Copy all Flash sections that need to run in RAM memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize); //--- Section secureRamFuncs contains user defined code that runs from CSM secured RAM memcpy(&secRamRunStart, &secRamLoadStart, (size_t)&secRamLoadSize); }
已剪切.cmd 文件:
codestart : > FLASHE PAGE = 0 ramfuncs : LOAD = FLASHE | FLASHF | FLASHG | FLASHH | FLASHI | FLASHJ | FLASHK | FLASHL | FLASHM | FLASHN PAGE = 0 RUN = D01SARAM PAGE = 0 RUN_START(RamfuncsRunStart), LOAD_START(RamfuncsLoadStart), LOAD_SIZE(RamfuncsLoadSize) { -l IQmath_fpu32_eabi.lib (IQmath) } #ifdef __TI_COMPILER_VERSION #if __TI_COMPILER_VERSION >= 15009000 .TI.ramfunc : LOAD = FLASHE | FLASHF | FLASHG | FLASHH | FLASHI | FLASHJ | FLASHK | FLASHL | FLASHM | FLASHN PAGE = 0, RUN = LS05SARAM PAGE = 1, table(BINIT) #endif #endif IQmathTables : > FLASHE | FLASHF | FLASHG | FLASHH | FLASHI | FLASHJ | FLASHK | FLASHL | FLASHM | FLASHN PAGE = 0
映射文件已打分:
ramfuncs 0 00088010 00000ae3 RUN ADDR = 0000b000 00088010 000001af MotionControl.obj (ramfuncs:_ZN13MotionControl3isrEv) 000881bf 000000a0 MotionControlPwmIRQ.obj (ramfuncs:_ZN19MotionControlPwmIrq6pwmIrqER19PwmControlParamer) 0008825f 0000008b MotionControlPwmIRQ.obj (ramfuncs:_ZN19MotionControlPwmIrq24holdPositionStaHandlerENS_9EPwmEvenR19PwmControlParamer) 000882ea 00000089 PWM.obj (ramfuncs:_ZN6PWMGEN6setPWMERK19PwmControlParamer) 00088373 00000079 PIDController.obj (ramfuncs:_ZN13PIDController9calculaEll) 000883ec 00000069 MotionControlPwmIRQ.obj (ramfuncs:_ZN19MotionControlPwmIrq23safeHoldPosStaHandlerENS_9EPwmEvenR19PwmControlParamer) 00088455 00000064 MotionControlPwmIRQ.obj (ramfuncs:_ZN19MotionControlPwmIrq16moveStaHandlerENS_9EPwmEvenR19PwmControlParamer) 000884b9 0000005e StatisticModuleExnded.obj (ramfuncs:_ZN23StatisticModuleExnded8addValueEv) 00088517 0000004c EncoderBase.obj (ramfuncs:_ZNK11EncoderBase8getThetaEPl) 00088563 00000042 Absoluncoder2.obj (ramfuncs:_ZN15Absoluncoder217calculaPositionEv) 000885a5 0000003b Absoluncoder.obj (ramfuncs:_ZN14Absoluncoder17calculaPositionEv) 000885e0 0000003b QEP.obj (ramfuncs:_ZN3QEP17calculaPositionEv) 0008861b 00000036 MotionControlFsmBase.obj (ramfuncs:_ZN20MotionControlFsmBase24calculaAllEncPositionsEv) 00088651 00000023 TwinQep.obj (ramfuncs:_ZN7TWINQEP17calculaPositionEv) 00088674 0000001e OverCurrent.obj (ramfuncs:_ZN11OverCurrent9calculaEl) 00088692 00000018 DataLogger.obj (ramfuncs:_ZN10DataLogger8logValueEl) 000886aa 00000018 StatisticModuleLight.obj (ramfuncs:_ZN20StatisticModuleLight8addValueEv) 000886c2 00000010 SysmTimers.obj (ramfuncs:SysmTimers_delay_us) 000886d2 0000000e StatisticModuleExnded.obj (ramfuncs:_ZN23StatisticModuleExnded13prepareMeanIQEl) 000886e0 0000000e StatisticModuleExnded.obj (ramfuncs:_ZN23StatisticModuleExnded14prepareMeanInl) 000886ee 00000009 ExndedstPointManager.obj (ramfuncs:_ZN24ExndedstPointManager20calculaMinMaxValueERNS_20ExndedstPointDefE) 000886f7 00000009 ExndedstPointManager.obj (ramfuncs:_ZN24ExndedstPointManager20updaFaststPointsEv) 00088700 00000009 ExndedstPointManager.obj (ramfuncs:_ZN24ExndedstPointManager20updaSlowstPointsEv) 00088709 00000008 MotionControl.obj (ramfuncs:ADCINT_A1_ISR) 00088711 00000006 CanDriver.obj (ramfuncs:ECAN0INTB_ISR) 00088717 00000006 CanDriver.obj (ramfuncs:ECAN1INTB_ISR) 0008871d 00000003 Absoluncoder.obj (ramfuncs:_ZNK11EncoderBase11getPositionEv) 00088720 000000e2 IQmath_fpu32_eabi.lib : IQNtoa.obj (IQmath) 00088802 00000047 : IQ12div.obj (IQmath) 00088849 00000047 : IQ15div.obj (IQmath) 00088890 00000047 : IQ16div.obj (IQmath) 000888d7 00000047 : IQ17div.obj (IQmath) 0008891e 00000047 : IQ20div.obj (IQmath) 00088965 00000047 : IQ26div.obj (IQmath) 000889ac 00000042 : IQ16sqrt.obj (IQmath) 000889ee 00000032 : IQ28sin.obj (IQmath) 00088a20 00000030 : IQ28cos.obj (IQmath) 00088a50 0000002a : IQ26sinPU.obj (IQmath) 00088a7a 00000028 : IQ26cosPU.obj (IQmath) 00088aa2 00000016 : IQ16toF.obj (IQmath) 00088ab8 00000016 : IQ26toF.obj (IQmath) 00088ace 00000016 : IQ28toF.obj (IQmath) 00088ae4 00000009 : IQ16int.obj (IQmath) 00088aed 00000006 : iqntoa_get_frac_c.obj (IQmath)
完整的 cmd 文件在这里:
MEMORY { PAGE 0 : /* Program Memory */ D01SARAM : origin = 0x00B000, length = 0x001000 /* BEGIN is used for the "boot to FLASH" bootloader mode */ BEGIN : origin = 0x080000, length = 0x000002 /* Flash sectors */ #ifdef BOOTLOADER /* IMAGE Header adress range */ IMAGE_HEADER : origin = 0x080010, length = 0x000010 //FLASHA - FLASHC is used for Bootloader FLASHA : origin = 0x080020, length = 0x001FE0 /* on-chip Flash */ FLASHB : origin = 0x082000, length = 0x002000 /* on-chip Flash */ FLASHC : origin = 0x084000, length = 0x001FFE /* on-chip Flash, last two bytes of sector C are reserved for bootloader CRC */ #else /* IMAGE Header adress range */ IMAGE_HEADER : origin = 0x088000, length = 0x000010 // FLASHE - FLASHN is used for Application FLASHE : origin = 0x088010, length = 0x007FF0 /* on-chip Flash */ FLASHF : origin = 0x090000, length = 0x008000 /* on-chip Flash */ FLASHG : origin = 0x098000, length = 0x008000 /* on-chip Flash */ FLASHH : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */ FLASHI : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */ FLASHJ : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */ FLASHK : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */ FLASHL : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */ FLASHM : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */ FLASHN : origin = 0x0BE000, length = 0x001FFE /* on-chip Flash , last two bytes of sector N are reserved for bootloader CRC */ #endif // FLASHD is used for shared data FLASHD : origin = 0x086000, length = 0x001C00 /* on-chip Flash */ USEROTPEMU : origin = 0x087C00, length = 0x000400 /* Mapping of the old user OTP memory */ BOOTROM : origin = 0x3FF27C, length = 0x000D44 RESET : origin = 0x3FFFC0, length = 0x000002 PAGE 1 : /* Data Memory */ BOOT_RSVD : origin = 0x000002, length = 0x000122 /* Part of M0, BOOT rom will use this for stack */ M01SARAM : origin = 0x000124, length = 0x0006D6 /* on-chip RAM */ // M01SARAM_RSVD : origin = 0x0007F8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */ LS05SARAM : origin = 0x008010, length = 0x003000 /* on-chip RAM */ /* on-chip Global shared RAMs */ BOOT_PARAMETER : origin = 0x00C000, length = 0x000010 RAMGS0 : origin = 0x00C010, length = 0x000FF0 RAMGS1 : origin = 0x00D000, length = 0x001000 //RAMGS2 : origin = 0x00E000, length = 0x001000 // Used for overlay RAMGS3 : origin = 0x00F000, length = 0x002000 //RAMGS4 : origin = 0x010000, length = 0x001000 // merged with RAMGS3 to fit the DataLogger.obj RAMGS5 : origin = 0x011000, length = 0x001000 RAMGS6 : origin = 0x012000, length = 0x001000 RAMGS7 : origin = 0x013000, length = 0x000FF8 // RAMGS7_RSVD : origin = 0x013FF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */ PAGE 2: /* Program Memory Overlay1 (RAMGS2) */ LOVERLAY : origin = 0x00E000, length = 0x001000 /* BLDC motor specific programm area */ PAGE 3: /* Program Memory Overlay2 (RAMGS2) */ LOVERLAY : origin = 0x00E000, length = 0x001000 /* FOC motor specific programm area */ PAGE 4: /* Program Memory Overlay3 (RAMGS2) */ LOVERLAY : origin = 0x00E000, length = 0x001000 /* DC motor specific programm area */ }