Part Number: TM4C1294NCPDT
Tool/software:
Hi Team
I partitioned the Bootloader Flash memory to store and boot the Firmware application Hex from bootloader
Each time during new Firmware application Hex to be upgraded I need to Erase the old Application hex
The size of the hex is around 800 KB
When I try to erase the Flash of old Firmware application Hex during boot up of the Bootloader for new firmware upgrade
It is not erasing completely
For eg
Bootloader code is star address 0x00000000
Bootloader end address is 0x0000c000
Firmware application Hex start address 0x0000D000
Firmware application Hex end address 0x00067570
when I erase the flash for firmware upgrade it is erasing only from 0x0000D000 to 0x0000FFFC
after 0x0000FFFC address it is not erasing
please tell how to solve the issue I added the memory window and code snippet for your review
after 0x0000FFFC it is not getting erased

This is my last address

Below is my code for your reference
uint32_t *pui32App = NULL;
pui32App = (uint32_t *)FW_UPGRADE_MEMORY;
//UARTprintf("Erase secondary memory\n");
if((pui32App[0] != 0xffffffff) ||
(pui32App[1] != 0xffffffff))
{
UARTprintf("Erase secondary memory\n");
Flash_Erase(FW_UPGRADE_MEMORY,900);
}
SysCtlDelay(2000);
void Flash_vEnable(void)
{
// If the KEY flag (bit 4) is set, then the key is 0xA442.
// Otherwise, the key is 0x71D5 (pg. 583 of the TM4C123 datasheet).
if (BOOTCFG & 0x10) {
u16_Glob_flashKey = 0xA442;
}
else {
u16_Glob_flashKey = 0x71D5;
}
}
void Flash_Erase(uint32_t FlashBaseAddress,uint32_t blockCount) /*block is 1k*/
{
uint32_t i;
Flash_vEnable();
for ( i = 0; i < blockCount; i++)
{
SysCtlDelay(20);
// Clear then set the OFFSET (17:0) with the write address
FMA &= 0xFFFC0000; //clear from bit zero to 17
// Blocks are erased on 1KiB boundaries, so multiply the index by 1024
// and add this to the base address
FMA |= FlashBaseAddress + (i*FLASH_BLOCK_SIZE);
// Set the ERASE command bit
FMC = (u16_Glob_flashKey << 16) | 0x2;
// Poll the ERASE bit until it is cleared
while (FMC & 0x2);
UARTprintf("\rFlasherase count %d\r\n",i);
}
}
Please help me to sort the issue is there any changes to be made in the code or flash configurations
.cmd file for refernce
