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.

TMS32f28335 custom bootloader

Other Parts Discussed in Thread: TMS320F28335, CONTROLSUITE

Hello,

I am in the process of developing a custom bootloader which will read the application file for TMS320f28335 via CAN message and store in FLASH memory location B to H of TMS processor.

Bootloader code is stored in and run from Flash A and main application software which needs to be loaded via bootloader will be stored in Flash memory location B to H, right now in the code I read the data in the form of CAN message and flash to memory location starting from FLASH B using Flash_Program() API but this scenario is not working accurately.

Is it possible that while running bootloader code in Flash A other flash memories i.e. Flash B to H can be written using this API?

Thanks,

Ajay

  • Ajay,

    You cannot run flash algorithm from flash. You need to copy this section of code in RAM and execute from RAM. Please refer to Flash API documentation for more information regarding the same.

    Please refer Pg: 13 (section 4.4: Flash API do and don'ts)

    www.ti.com/.../spraal3.pdf

    Regards,
    Manoj
  • Hallo Ajay,
    we do it via MCBSP and start like this: (simular as Manoy wrote :-) )

    int main (void){

    //Initialisierung für Flash Api
    Flash_CPUScaleFactor = SCALE_FACTOR;
    Flash_CallbackPtr = NULL;

    // Step 1. Initialize System Control:
    // PLL, WatchDog, enable Peripheral Clocks
    // This example function is found in the DSP2833x_SysCtrl.c file.
    InitSysCtrl();

    // Step 2. Initalize GPIO:

    EALLOW;
    //McBSP
    // ................ initalize CAN her
    EDIS;


    // Step 3. Clear all interrupts and initialize PIE vector table:
    // Disable CPU interrupts
    DINT;

    // Initialize PIE control registers to their default state.
    // The default state is all PIE interrupts disabled and flags
    // are cleared.
    // This function is found in the DSP2833x_PieCtrl.c file.
    InitPieCtrl();

    // Disable CPU interrupts and clear all CPU interrupt flags:
    IER = 0x0000;
    IFR = 0x0000;

    // Initialize the PIE vector table with pointers to the shell Interrupt
    // Service Routines (ISR).
    // Es wird die Tabelle mit einer Funktion (Default_ISR) beschrieben,
    // spart sehr viel Speicher.
    // This function is found in DSP2833x_PieVect.c.
    InitPieVectTable();

    // Step 5. User specific code:

    // Copy time critical code and Flash programming code to RAM
    // The RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart
    // symbols are created by the linker. Refer to the F28335_FLASH_lnk.cmd file.
    MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
    MemCopy(&Flash28_API_LoadStart, &Flash28_API_LoadEnd, &Flash28_API_RunStart);

    br Ralf
  • Hello,

    Have updated the code to have all the Flash and erase API to be loaded in L0 SARAM and from there new application will be read via CAN and flashed into memory B to H but not able to change the program control to starting address of RAM (0x3f8000).

    Regards,
    Ajay
  • Ajay,

    The flash API related code will be loaded in Flash, but should be run from RAM. Do you have similar sections assigned in your linker command file?

    ramfuncs : LOAD = FLASHD,
    RUN = RAML0,
    LOAD_START(_RamfuncsLoadStart),
    LOAD_END(_RamfuncsLoadEnd),
    RUN_START(_RamfuncsRunStart),
    PAGE = 0

    Flash28_API:
    {
    -lFlash28335_API_V210.lib(.econst)
    -lFlash28335_API_V210.lib(.text)
    } LOAD = FLASHD,
    RUN = RAML0,
    LOAD_START(_Flash28_API_LoadStart),
    LOAD_END(_Flash28_API_LoadEnd),
    RUN_START(_Flash28_API_RunStart),
    PAGE = 0

    Regards,
    Manoj
  • Manoj,

    I use the following in linker command file

    ramfuncs : LOAD = FLASHA,
    RUN = RAML0,
    LOAD_START(_RamfuncsLoadStart),
    LOAD_END(_RamfuncsLoadEnd),
    RUN_START(_RamfuncsRunStart),
    PAGE = 0

    but nothing for "Flash28_API", if I use this declaration (Flash28_API:) in command file how to reference it in in the code, for example "ramfuncs" is referenced as following in code
    #pragma CODE_SECTION(initFlash, "ramfuncs");

    Thanks,
    Ajay
  • Ajay,

    Please refer to example project available in controlsuite

    <controlSUITE>\libs\utilities\flash_api\2833x\28335\v210\example

    Regards,
    Manoj
  • Manoj,

    I am able to erase and flash the code fro L0 RAM with the following parameters itself

    ramfuncs : LOAD = FLASHA,
    RUN = RAML0,
    LOAD_START(_RamfuncsLoadStart),
    LOAD_END(_RamfuncsLoadEnd),
    RUN_START(_RamfuncsRunStart),
    PAGE = 0

    Thanks for your Input
    Ajay
  • Manoj,

    When I inspect the map file the memory allocation of Flash library file comes in between main.c and boot28.ASM as shown below

    .text 0 003f8002 00000567
    003f8002 000000aa Flash28335_API_V210.lib : Flash28_Prog.obj (.text)
    003f80ac 000000a0 : Flash28_Erase.obj (.text)
    003f814c 0000009a : Flash28_Erase_Pulse.obj (.text)
    003f81e6 00000084 : Flash28_Internals.obj (.text)
    003f826a 00000080 : Flash28_Prog_Pulse.obj (.text)
    003f82ea 0000007d : Flash28_Compact_Pulse.obj (.text)
    003f8367 0000005a : Flash28_EraseSector.obj (.text)
    003f83c1 00000057 Main.obj (.text)
    003f8418 00000053 Flash28335_API_V210.lib : Flash28_CompactSector.obj (.text)
    003f846b 00000041 : Flash28_ClearLoop.obj (.text)
    003f84ac 00000039 boot28.obj (.text)
    003f84e5 00000033 Flash28335_API_V210.lib : Flash28_ClearSector.obj (.text)
    003f8518 00000029 : Flash28_Init.obj (.text)
    003f8541 00000014 : Flash28_Utils.obj (.text)
    003f8555 0000000d : Flash28_Delay.obj (.text)
    003f8562 00000007 : Flash28_DisInt.obj (.text)

    Is there any way to avoid this, I want the order to be boot28.obj, Main.obj then Flash28335_API_V210.lib

    Regards,
    Ajay