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.

TMS570LS0432 BootLoad FLASH API函数调用有问题

参考TI 官方BootLoad 程序,使用HerCoGen 生产的底层程序,接受DOWNLOAD 消息时,调用函数

BLInternalFlashStartAddrCheck( g_ulTransferAddress, g_ulTransferSize ) 时, g_ulTransferAddress = 0x00020000;  g_ulTransferSize = 0x000003e8;

当debug 单步调试进入函数BLInternalFlashStartAddrCheck(uint32_t ulAddr, uint32_t ulImgSize) ,ulAddr = 0x09B56E12  ulImgSize = 0x00142000;

形参的数值发生了变化 ,很奇怪的值,不知道是什么原因造成的?

Flash API 运行在RAM中,cmd 配置如下:

--retain="*(.intvecs)"


MEMORY
{
VECTORS (X) : origin=0x00000000 length=0x00000020
FLASH_API (RX) : origin=0x00000020 length=0x000014E0
FLASH0 (RX) : origin=0x00001500 length=0x0005EB00 //LS04x and RM42 Flash size is 0x60000
SRAM (RW) : origin=0x08002000 length=0x00006000 //LS04x and RM42 SRAM size is 0x8000
STACK (RW) : origin=0x08000000 length=0x00002000
}
SECTIONS
{
.intvecs : {} > VECTORS
flashAPI :
{
.\source\Fapi_UserDefinedFunctions.obj (.text)
.\source\bl_flash.obj (.text)

--library= F021_API_CortexR4_BE.lib < FlashStateMachine.IssueFsmCommand.obj
FlashStateMachine.SetActiveBank.obj
FlashStateMachine.InitializeFlashBanks.obj
FlashStateMachine.EnableMainSectors.obj
FlashStateMachine.IssueFsmCommand.obj
FlashStateMachine.ScaleFclk.obj
Init.obj
Utilities.CalculateEcc.obj
Utilities.WaitDelay.obj
Utilities.CalculateFletcher.obj
Read.MarginByByte.obj
Read.Common.obj
Read.FlushPipeline.obj
Read.WdService.obj
Async.WithAddress.obj
Program.obj > (.text)
} load = FLASH_API, run = SRAM, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)

.text > FLASH0
.const > FLASH0
.cinit > FLASH0
.pinit > FLASH0
.data > SRAM
.bss > SRAM
}

做了一个简单测试,将CMD 中FLASH API 相关删掉后,让函数运行在FLASH 中,入参带入就没什么问题,但是BootLoad 需要将Flash 函数运行在RAM中,问题一直无法解决。

flashAPI :
{
.\source\Fapi_UserDefinedFunctions.obj (.text)
.\source\bl_flash.obj (.text)

--library= F021_API_CortexR4_BE.lib < FlashStateMachine.IssueFsmCommand.obj
FlashStateMachine.SetActiveBank.obj
FlashStateMachine.InitializeFlashBanks.obj
FlashStateMachine.EnableMainSectors.obj
FlashStateMachine.IssueFsmCommand.obj
FlashStateMachine.ScaleFclk.obj
Init.obj
Utilities.CalculateEcc.obj
Utilities.WaitDelay.obj
Utilities.CalculateFletcher.obj
Read.MarginByByte.obj
Read.Common.obj
Read.FlushPipeline.obj
Read.WdService.obj
Async.WithAddress.obj
Program.obj > (.text)
} load = FLASH_API, run = SRAM, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)

  • 能否给出详细的例程路径?我明天看看有没有这个板子做一下测试
  • _copyAPI2RAM_ 没移植到 void _c_int00(void)
    ;-------------------------------------------------------------------------------
    ;
    ; Copy the Flash API from flash to SRAM.
    ;

    .def _copyAPI2RAM_
    .asmfunc

    _copyAPI2RAM_

    .ref api_load
    flash_load .word api_load
    .ref api_run
    flash_run .word api_run
    .ref api_size
    flash_size .word api_size

    ldr r0, flash_load
    ldr r1, flash_run
    ldr r2, flash_size
    add r2, r1, r2
    copy_loop1:
    ldr r3, [r0], #4
    str r3, [r1], #4
    cmp r1, r2
    blt copy_loop1
    bx lr

    .endasmfunc
  • 谢谢 已经解决了。 _copyAPI2RAM_ 没移植到 void _c_int00(void)中
  • 很高兴您能解决问题