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.

TMS320F28027: can i upgrade the bootloader by the bootloader?

Part Number: TMS320F28027

Hi,

I've write a bootloader project based on "f28027_flash_kernel" example project offered by TI. And I've loaded the project to FLASHA, the main function is as below:

Uint32 main(void)
{
//GPIO and SCI are still setup from Sci_Boot()
//Setup sysctl and pll
//DisableDog();
IntOsc1Sel();

memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);//copy SCI_Boot() from flash to RAM
InitPll(DSP28_PLLCR,DSP28_DIVSEL);
InitFlash();

DELAY_US(100);

return SCI_Boot();
}

SCI_Boot() function is the function for upgrading the application reside in FLASHB, FLASHC, FLASHD.

It works well to upgrade the application project.

And then I want to upgrade the bootloader itself which reside in FLASHA, then I need to erase FLASHA in SCI_Boot(), the code is as below:

status = Flash_Erase((SECTORA | SECTORB | SECTORC | SECTORD), &FlashStatus);

but when CPU execute this code,  it will run into illegal trap interrupt.

Does it mean that I cannot erase the FLASH sector which the main function reside in? I've already copied SCI_Boot() to RAM.

Thanks.

  • Hello,
    I am writing to let you know that a C2000 team member has been assigned to this post. We will try our best to address your query. But since one of our sites is affected by bad weather, there may be a delay in response.

    Regards
    Baskaran
  • Howard,

    When you try to erase flash sectors A/B/C/D, you might be calling the flash erase function from Sector A. Even though you execute the Flash erase function from RAM, once the erase function is complete it would return to sector-A address location to continue executing the code. Since the sector-A is already erased, it would fetch illegal op-code and would run into illegal ITRAP code.

    Regards,
    Manoj
  • Thanks.

    Can I conclude that it's impossible to upgrade the bootloader by itself in theory? Or if I write the code correctly, it still can upgrade itself?

  • I won't say it is impossible.

    If your HEX file you download through SCI boot includes functions which call Flash API and hex code (bootloader code) which you want to program in flash. It is certainly possible. But, we don't have any example projects which you can use as reference.

    Regards,
    Manoj