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: Flash_API Writing to different sectors

Part Number: TMS320F28027

Hello,

i'm writing an application with the following configuration:

The Flash API code in the boot ROM is accessed by the CPU.
2802x_FlashAPI_BootROMSymbols_v2.01.lib linked

SECTIONS
{
 
   /* Allocate program areas: */
   /* The Flash API functions can be grouped together as shown below.
      The defined symbols _Flash28_API_LoadStart, _Flash28_API_LoadEnd
      and _Flash28_API_RunStart are used to copy the API functions out
      of flash memory and into SARAM */

   .cinit              : > BOOT_IMAGE       PAGE = 0
   .pinit              : > BOOT_IMAGE,      PAGE = 0
   .text               : > BOOT_IMAGE       PAGE = 0
   codestart           : > BEGIN            PAGE = 0
   ramfuncs            : LOAD = BOOT_IMAGE, 
                         RUN = RAMM1, 
                         LOAD_START(_RamfuncsLoadStart),
                         LOAD_END(_RamfuncsLoadEnd),
                         RUN_START(_RamfuncsRunStart),
                         PAGE = 0

MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
MemCopy(&RamTimerfuncsLoadStart, &RamTimerfuncsLoadEnd, &RamTimerfuncsRunStart);

Flash Sector A --> user bootloader
Flash Sector B, C, D -> application code

the user bootloader has the following features:
- read and writes to Sectors B,C;D. Not A
- uart protocoll, interrupt driven
- base timer interrupt
- not using Flash API callback

Usually in bootloader I place everything in RAM.

#pragma CODE_SECTION(mainLoop, "ramfuncs");

and I repeat this code for every functions and ISR routines.
The first question is: do I really need to place everything in RAM if Flash_API reside in ROM?
Especially if I write to different sectors?
Maybe I only need ISR placed in RAM?

The second question is: CODE_SECTION will only place in RAM the named function or also the functions called in it's implementation?

  • Hello,

    do I really need to place everything in RAM if Flash_API reside in ROM?

    Flash_API can be run from ROM or RAM, just not Flash. The only benefit from running the API from ROM would be that there is no extra step needed to copy over the functions to execute them.

    CODE_SECTION will only place in RAM the named function or also the functions called in it's implementation?

    Only the named function, CODE_SECTION is not a recursive copy.

  • so I don't need to place my own code that call Flash_API to RAM?

  • Hello,

    No, you can just run it from ROM if you want. This device has the Flash API in ROM, so that's what allows this.

  • Thank you. Just to be sure: If I need to access to an array, such as

    const Uint16 Buffer[WORDS_IN_FLASH_BUFFER];
    FLASH_ST FlashStatus;
    
    void main(void)
    {
        Flash2802x_Erase(SECTORB | SECTORC | SECTORD, &FlashStatus);
    }
    
    // 1ms
    interrupt void _ISR_Timer_1(void)
    {
        // there is not limition on code on reading buffer
    }

    I don't have limitations imposed by the erasing of sectors B,C,D?

    From "TMS320F2802x PiccoloTM A Rev A Flash API"

    On these devices, there is only one flash array. The flash architecture imposes the restriction that the flash
    can perform only one operation at a time. Due to this restriction, when erasing, programming, or verifying
    the flash, code itself cannot execute and data cannot be fetched from the flash.

  • Hello,

    If I need to access to an array, such as

    If you mean whether you can erase multiple Flash sectors, yes this is allowed per the documentation (they don't erase simultaneously, but they will all be erased):