请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:TMS320F28377S 工具与软件:
大家好、
我想使用闪存 API 将它写入处理器的闪存并擦除我自己的代码、但它在调试屏幕中进入了非法 ISR、我不知道为什么、您可以看到链接器文件和下面代码的相关部分、问题的来源是什么
MEMORY
{
PAGE 0 : /* Program Memory */
/* Memory (RAM/FLASH) blocks can be moved to PAGE1 for data allocation */
// BEGIN : origin = 0x080000, length = 0x000002
RAMM0 : origin = 0x000122, length = 0x0002DE
RAMD0 : origin = 0x00B000, length = 0x000800
RAMLS0 : origin = 0x008000, length = 0x000800
RAMLS1 : origin = 0x008800, length = 0x000800
RAMLS2 : origin = 0x009000, length = 0x000800
RAMLS3 : origin = 0x009800, length = 0x000800
RAMLS4 : origin = 0x00A000, length = 0x000800
RAMGS14 : origin = 0x01A000, length = 0x001000
RAMGS15 : origin = 0x01B000, length = 0x001000
RESET : origin = 0x3FFFC0, length = 0x000002
#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 20012000
GROUP { /* GROUP memory ranges for crc/checksum of entire flash */
#endif
#endif
/* BEGIN is used for the "boot to Flash" bootloar mode */
BEGIN : origin = 0x080000, length = 0x000002
/* Flash sectors */
FLASHA : origin = 0x080002, length = 0x001FFE /* on-chip Flash */
FLASHB : origin = 0x082000, length = 0x002000 /* on-chip Flash */
FLASHC : origin = 0x084000, length = 0x002000 /* on-chip Flash */
FLASHD : origin = 0x086000, length = 0x002000 /* on-chip Flash */
FLASHE : origin = 0x088000, length = 0x008000 /* 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 = 0x002000 /* on-chip Flash */
// FLASHN_RSVD : origin = 0x0BFFF0, length = 0x000010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 20012000
} crc(_ccs_flash_checksum, algorithm=C28_CHECKSUM_16)
#endif
#endif
PAGE 1 : /* Data Memory */
/* Memory (RAM/FLASH) blocks can be moved to PAGE0 for program allocation */
BOOT_RSVD : origin = 0x000002, length = 0x000120 /* Part of M0, BOOT rom will use this for stack */
RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
RAMD1 : origin = 0x00B800, length = 0x000800
RAMLS5 : origin = 0x00A800, length = 0x000800
RAMGS0 : origin = 0x00C000, length = 0x001000
RAMGS1 : origin = 0x00D000, length = 0x001000
RAMGS2 : origin = 0x00E000, length = 0x001000
RAMGS3 : origin = 0x00F000, length = 0x001000
RAMGS4 : origin = 0x010000, length = 0x001000
RAMGS5 : origin = 0x011000, length = 0x001000
RAMGS6 : origin = 0x012000, length = 0x001000
RAMGS7 : origin = 0x013000, length = 0x001000
}
SECTIONS
{
/* Allocate program areas: */
.cinit : > FLASHB | FLASHC PAGE = 0, ALIGN(8)
.pinit : > FLASHB, PAGE = 0, ALIGN(8)
.text:Fapi_issueAsyncCommandWithAddress : {} LOAD = FLASHA, RUN = RAMGS0
.text:Fapi_checkFsmForReady : {} LOAD = FLASHA, RUN = RAMGS0
.text:Fapi_doBlankCheck : {} LOAD = FLASHA, RUN = RAMGS0
.text:Fapi_issueProgrammingCommand : {} LOAD = FLASHA, RUN = RAMGS0
.text:Fapi_getFsmStatus : {} LOAD = FLASHA, RUN = RAMGS0
.text:Fapi_doVerify : {} LOAD = FLASHA, RUN = RAMGS0
.text:Fapi_setActiveFlashBank : {} LOAD = FLASHA, RUN = RAMGS0
.text:Fapi_issueAsyncCommandWithAddress : {} LOAD = FLASHA, RUN = RAMGS0
.text:Fapi_initializeAPI : {} LOAD = FLASHA, RUN = RAMGS0
.text:Fapi_isAddressEcc : {} LOAD = FLASHA, RUN = RAMGS0
.text:Fapi_serviceWatchdogTimer : {} LOAD = FLASHA, RUN = RAMGS0
.text:Example_FlashProgram : {} LOAD = FLASHA, RUN = RAMGS0
.text : > FLASHI PAGE = 0, ALIGN(8)
codestart : > BEGIN PAGE = 0, ALIGN(8)
#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 15009000
#if defined(__TI_EABI__)
.TI.ramfunc : {} LOAD = FLASHA,
RUN = RAMLS0,
LOAD_START(RamfuncsLoadStart),
LOAD_SIZE(RamfuncsLoadSize),
LOAD_END(RamfuncsLoadEnd),
RUN_START(RamfuncsRunStart),
RUN_SIZE(RamfuncsRunSize),
RUN_END(RamfuncsRunEnd),
PAGE = 0, ALIGN(8)
#endif
#endif
#endif
/* Allocate uninitalized data sections: */
.stack : > RAMM1 PAGE = 1
.init_array : > FLASHB, PAGE = 0, ALIGN(8)
.bss : > RAMLS5, PAGE = 1
.ebss : >> RAMLS5 | RAMGS0 | RAMGS1 PAGE = 1
.esysmem : > RAMLS5 PAGE = 1
.data : >> RAMLS5 | RAMGS1 , PAGE = 1, ALIGN(8)
.sysmem : > RAMLS5, PAGE = 1
.const : > FLASHF, PAGE = 0, ALIGN(8)
/* Initalized sections go in Flash */
.econst : >> FLASHF | FLASHG PAGE = 0, ALIGN(8)
.switch : > FLASHD PAGE = 0, ALIGN(8)
.reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */
Filter_RegsFile : > RAMGS0, PAGE = 1
SHARERAMGS0 : > RAMGS0, PAGE = 1
SHARERAMGS1 : > RAMGS1, PAGE = 1
/* Flash Programming Buffer */
BufferDataSection : > RAMD1, PAGE = 1, ALIGN(8)
/* crc/checksum section configured as COPY section to avoid including in executable */
.TI.memcrc : type = COPY
}
/*
//===========================================================================
// End of file.
//===========================================================================
*/
}
}
extern Fapi_StatusType Fapi_initializeAPI(
Fapi_FmcRegistersType *poFlashControlRegister,
uint32 u32HclkFrequency
);
extern Fapi_StatusType Fapi_setActiveFlashBank(Fapi_FlashBankType oFlashBank);
extern Fapi_StatusType Fapi_issueAsyncCommandWithAddress(
Fapi_FlashStateCommandsType oCommand,
uint32 *pu32StartAddress
);
void Example_FlashProgram(Uint16 data)
{
Fapi_StatusType oReturnCheck;
Fapi_FlashStatusWordType oFlashStatusWord;
EALLOW;
PUMPREQUEST = 0x5A5A0002;
oReturnCheck = Fapi_initializeAPI(F021_CPU0_W0_BASE_ADDRESS, 200);
if (oReturnCheck != Fapi_Status_Success) {
//Example_Error(oReturnCheck);
}
oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
if (oReturnCheck != Fapi_Status_Success) {
//Example_Error(oReturnCheck);
}
oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, (Uint32 *)FLASH_SECTOR_START);
while (Fapi_checkFsmForReady() != Fapi_Status_FsmReady) {}
oReturnCheck = Fapi_doBlankCheck((Uint32 *)FLASH_SECTOR_START, FLASH_SECTOR_LENGTH, &oFlashStatusWord);
if (oReturnCheck != Fapi_Status_Success) {
// Example_Error(oReturnCheck);
}
oReturnCheck = Fapi_issueProgrammingCommand((Uint32 *)FLASH_SECTOR_START, &data, 1, 0, 0, Fapi_AutoEccGeneration);
while (Fapi_checkFsmForReady() == Fapi_Status_FsmBusy) {}
if (oReturnCheck != Fapi_Status_Success) {
//Example_Error(oReturnCheck);
}
EDIS;
}
Uint32 Example_FlashRead(void)
{
value_read = *(Uint32 *)FLASH_SECTOR_START;
return value_read;
}
