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.

TMS320F2800137: Custom Bootloader

Part Number: TMS320F2800137

Hello everyone,

I am working on a custom bootloader for the Texas Instruments TMS320F2800137 microcontroller.

Currently, I have created two separate application projects:

  • APP1 located at address 0x082000

  • APP2 located at address 0x090000

My goal is to implement a bootloader located at 0x080000 that can jump to either of these applications (APP1 or APP2) and execute them.

So far:

  • I am able to successfully flash the applications at their respective addresses.

  • When I run the code directly from Code Composer Studio, the applications execute correctly.

  • After reset, the MCU starts execution from 0x080000, which is where the bootloader should reside.

What I need help with is:

  1. Writing the bootloader code that can jump to either APP1 or APP2.

  2. Ensuring the stack pointer and interrupt vectors are correctly set before jumping to the selected application.

For reference, I am also attaching the custom linker command (.cmd) file for APP1 that defines its memory location.

If anyone has implemented something similar on this device or other C2000 MCUs, guidance or example code would be greatly appreciated.

Thank you.

MEMORY
{
   /* ---------------- FLASH LAYOUT ---------------- */

   BOOT_RSVD        : origin = 0x080000, length = 0x002000  /* Sector 0 - 8KB Bootloader */

   APP_SLOT_A       : origin = 0x082000, length = 0x00E000  /* Sector 1-7 = 56KB */

   /* Bank1 (future Slot B) */
   APP_SLOT_B       : origin = 0x090000, length = 0x00E000  /* 56KB */

   CALIBRATION      : origin = 0x09E000, length = 0x002000  /* Last 8KB sector */

   /* ---------------- RAM ---------------- */

   RAMM0            : origin = 0x00000128, length = 0x000002D8
   RAMM1            : origin = 0x00000400, length = 0x000003F8

   RAMLS0           : origin = 0x00008000, length = 0x00002000
   RAMLS1           : origin = 0x0000A000, length = 0x00001FF8

   RESET            : origin = 0x003FFFC0, length = 0x00000002
}

SECTIONS
{
   codestart        : > APP_SLOT_A

   .text            : > APP_SLOT_A, ALIGN(8)
   .cinit           : > APP_SLOT_A, ALIGN(8)
   .switch          : > APP_SLOT_A, ALIGN(8)
   .const           : > APP_SLOT_A, ALIGN(8)
   .pinit           : > APP_SLOT_A, ALIGN(8)
   .init_array      : > APP_SLOT_A, ALIGN(8)

   .reset           : > RESET, TYPE = DSECT

   .stack           : > RAMM1
   .bss             : > RAMLS0
   .bss:output      : > RAMLS0
   .data            : > RAMLS0
   .sysmem          : > RAMLS0
   .cio             : > RAMLS0

   /* RAM functions must NOT load from boot sector */
   .TI.ramfunc :
      LOAD = APP_SLOT_A,
      RUN = RAMLS0,
      LOAD_START(RamfuncsLoadStart),
      LOAD_SIZE(RamfuncsLoadSize),
      LOAD_END(RamfuncsLoadEnd),
      RUN_START(RamfuncsRunStart),
      RUN_SIZE(RamfuncsRunSize),
      RUN_END(RamfuncsRunEnd),
      ALIGN(8)

   IQmath           : > APP_SLOT_A, ALIGN(8)
   IQmathTables     : > APP_SLOT_A, ALIGN(8)
}