uint32_t Fapi_BlockProgram( uint32_t Bank, uint32_t Flash_Address, uint32_t Data_Address, uint32_t SizeInBytes)
{
register uint32_t src = Data_Address;
register uint32_t dst = Flash_Address;
uint32_t bytes;
if (SizeInBytes < 16)
bytes = SizeInBytes;
else
bytes = 16;
if ((Fapi_initializeFlashBanks((uint32_t)SYS_CLK_FREQ)) == Fapi_Status_Success)
{
(void)Fapi_setActiveFlashBank((Fapi_FlashBankType)Bank);
// if(Bank >= 7)
Fapi_enableEepromBankSectors(0xf, 0);
//else
//(void)Fapi_enableMainBankSectors(0xFFFF); /* used for API 2.01*/
}else
{
return (1);
}
while( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady );
while( FAPI_GET_FSM_STATUS != Fapi_Status_Success );
while( SizeInBytes > 0)
{
Fapi_issueProgrammingCommand((uint32_t *)dst,
(uint8_t *)src,
(uint32_t) bytes,
0,
0,
Fapi_AutoEccGeneration);
while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);
src += bytes;
dst += bytes;
SizeInBytes -= bytes;
if ( SizeInBytes < 16){
bytes = SizeInBytes;
}
}
return (0);
}
写不进去的时候会卡在第二个while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);这里
Susan Yang:
请问您现在使用的是哪款芯片?能否请您详细说明下问题,谢谢
user5822303:
回复 Susan Yang:
startup.c文件中的
/* initialize the C global variables */if (&__TI_Handler_Table_Base < &__TI_Handler_Table_Limit){uint8_t **tablePtr= (uint8_t **)&__TI_CINIT_Base;uint8_t **tableLimit = (uint8_t **)&__TI_CINIT_Limit;
while (tablePtr < tableLimit){uint8_t *loadAdr = *tablePtr++;uint8_t *runAdr= *tablePtr++;uint8_tidx= *loadAdr++;handler_fptrhandler = (handler_fptr)(&__TI_Handler_Table_Base)[idx];
(*handler)((const uint8_t *)loadAdr, runAdr);}}
这段是什么意思?我之前把这段屏蔽了,就不能写成功,加上这段就可以写EE和flash
Susan Yang:
回复 user5822303:
请问您现在使用的是哪款芯片?
其注释如下
/*------------------------------------------------------------------------*//* If elfabi, process the compressed cinit table. The format*//* is as follows:*//* |4-byte load addr|4-byte run addr|*//* |4-byte load addr|4-byte run addr|*//**//* Processing steps:*//*1. Read load and run address.*//*2. Read one byte at load address, say idx.*//*3. Get pointer to handler at handler_start[idx]*//*4. call handler(load_addr + 1, run_addr)*//*------------------------------------------------------------------------*/
user5822303:
回复 Susan Yang:
tms570ls1224
user5822303:
回复 Susan Yang:
我现在需要把这个startup.c中的程序放到sram中运行,怎么设置link.cmd文件,我尝试了几次都不可以