大家好,我想把官方给的TMS570L04的CAN 的bootloader 移植到 TMS570LS0232上,在执行CAN_COMMAND_DOWNLOAD命令过程中,程序卡在BLInternalFlashStartAddrCheck(g_ulTransferAddress, g_ulTransferSize)里出不来。该函数已经被我改了,如下:
uint32_t BLInternalFlashStartAddrCheck(uint32_t ulAddr, uint32_t ulImgSize)
{
 uint32_t count=0, i;
uint32_t ulWholeFlashSize;
uint8_t ucStatus;
//
 // Determine the size of the flash available on the part in use.
 //
 ulWholeFlashSize = (uint32_t)flash_sector[NUMBEROFSECTORS-1].start + flash_sector[NUMBEROFSECTORS-1].length; /* 128K */
/* The start address must be at the begining of the sector */
 for (i = 0; i < NUMBEROFSECTORS-1; i++){
 if (ulAddr == (uint32_t)(flash_sector[i].start))
 {
 count++;
 }
 }
 if (count == 0){
#ifdef DEBUG_MSG_L3
 //UART_putString(UART, "\r Application Address should be aligned with flash sector start address!\r");
 // ucStatus = data_start_address_error;
 // PacketWrite(CAN_PORT, CAN_COMMAND_ACK, &ucStatus, 1);
#endif
 return(0);
 }
//
 // Is the address we were passed a valid start address? We allow:
 //
 // 1. Address 0 if configured to update the boot loader.
 // 2. The start of the reserved block if parameter space is reserved (to
 // allow a download of the parameter block contents).
 // 3. The application start address specified in bl_config.h.
 //
 // The function fails if the address is not one of these, if the image
 // size is larger than the available space or if the address is not word
 // aligned.
 //
 if((
#ifdef ENABLE_BL_UPDATE
 (ulAddr != 0) &&
#endif
 (ulAddr != APP_START_ADDRESS)) ||
 ((ulAddr + ulImgSize) > ulWholeFlashSize) ||
 ((ulAddr & 3) != 0))
 {
#ifdef DEBUG_MSG_L3
// UART_putString(UART, "\r Flash address and size check failed!\r");
#endif
 return(0);
 }
 else
 {
#ifdef DEBUG_MSG_L3
// UART_putString(UART, "\r Flash address and size check passed!\r");
// ucStatus = data_address_size_error;
// PacketWrite(CAN_PORT, CAN_COMMAND_ACK, &ucStatus, 1);
#endif
 return(1);
 }
}
我移植的过程如下:
第一步:添加头文件路径和添加F021的库,如下图:
库添加后,出现了警告,警告如下图:
请问这是不是我的库添加错了,我换了 F021_API_CortexR4_LE.lib 库,发现错误还是存在。
第二步:改CMD
TMS570LS0232的FLASH如下图:
我写的CMD如下:
MEMORY
{
 VECTORS (X) : origin=0x00000000 length=0x00000200
 BOOT_LOAD (RX) : origin=0x00000200 length=0x00001000
 FLASH_API (RX) : origin=0x00001200 length=0x00001000
 FLASH0 (RX) : origin=0x00002200 length=0x00005200  //32K flash for bootloader
 STACK (RW) : origin=0x08000000 length=0x00001500  //5K RAM for Stack
 SRAM (RW) : origin=0x08001500 length=0x00006B00  //27K RAM for others
}
SECTIONS
{
 .intvecs : {} > VECTORS
boot_code : {..\Debug\src\sys_core.obj (.text)} > BOOT_LOAD
 eabi_start : {..\Debug\src\sys_startup.obj (.text)} > BOOT_LOAD
flashAPI :
 {
 ..\Debug\src\Fapi_UserDefinedFunctions.obj (.text)
 ..\Debug\src\bl_flash.obj (.text)
--library= F021_API_CortexR4_BE.lib <FlashStateMachine.obj
 Program.obj
 Init.obj
 Utilities.obj
 Async.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
}
麻烦大家指教一下,非常感谢!
 
				 
		 
					


 
				