TMS320F28379D: About Secondary Bootloader + Application on TMS320F28379D

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Tool/software:

Hello everyone,

I have been asked by a client to design and develop a system consisting of a Secondary Bootloader and an Application.

Environment:

  • Device: TMS320F28379D
  • Boot Mode:
    • SCI Boot (firmware update using sci_flash_kernel)
    • Flash Boot (Secondary Bootloader + Application)
  • Flash Memory Map:
    • origin = 0x080000, length = 0x002000 → Secondary Bootloader
    • origin = 0x084000, length = 0x002000 → Application
  • CCS Version: 12.7.1

Overview:

  • Secondary Bootloader
    1. On the first boot, write unique ID, secret, etc. to OTP.
    2. Jump to the Application.
  • Application
    1. Read OTP and verify whether the unique ID, secret, etc. are valid.
    2. If valid, continue running the application.
    3. If invalid (including when OTP is not written), stop the application or report an error.

My questions are as follows:

Q1. Are there any sample codes available for TMS320F28379D that demonstrate a configuration using both a Secondary Bootloader and an Application?

Q2. Is it correct to assume that the Secondary Bootloader and the Application each require their own separate project and linker command file?

Q3. Are the following linker command file definitions for the Secondary Bootloader and Application correct?

→ Is it acceptable that the RESET vector is defined at the same address for both?

  • Secondary Bootloader

MEMORY
{
PAGE 0:    /* Program Memory */
    BEGIN  : origin = 0x080000, length = 0x000002
    ...
    RESET  : origin = 0x3FFFC0, length = 0x000002

    FLASHA : origin = 0x080002, length = 0x001FFE /* Secondary bootloader area */
 // FLASHB : origin = 0x082000, length = 0x002000 /* Undefined */
    FLASHC : origin = 0x084000, length = 0x002000 /* Application area */
    ...
PAGE 1 :   /* Data Memory */
    ...
}

SECTIONS
{
    .cinit      : > FLASHA, ALIGN(8)    PAGE = 0
    .pinit      : > FLASHA, ALIGN(8)    PAGE = 0
    .text       : > FLASHA, ALIGN(8)    PAGE = 0
    codestart   : > BEGIN   PAGE = 0
    ...
    .econst     : > FLASHA, ALIGN(8)    PAGE = 0
    .switch     : > FLASHA, ALIGN(8)    PAGE = 0

    .reset      : > RESET, PAGE = 0, TYPE = DSECT /* not used */
    ...
}

  • Application

MEMORY
{
PAGE 0:    /* Program Memory */
    BEGIN  : origin = 0x084000, length = 0x000002
    ...
    RESET  : origin = 0x3FFFC0, length = 0x000002

    FLASHA : origin = 0x080000, length = 0x002000 /* Secondary bootloader area */
 // FLASHB : origin = 0x082000, length = 0x002000 /* Undefined */
    FLASHC : origin = 0x084002, length = 0x001FFE /* Application area */
    ...
PAGE 1 :   /* Data Memory */
    ...
}

SECTIONS
{
    .cinit      : > FLASHD, ALIGN(8)            PAGE = 0
    .pinit      : > FLASHD, ALIGN(8)            PAGE = 0
    .text       : > FLASHD | FLASHE, ALIGN(8)   PAGE = 0
    codestart   : > BEGIN  PAGE = 0
    ...
    .econst     : >> FLASHF | FLASHG, ALIGN(8)  PAGE = 0
    .switch     : > FLASHD, ALIGN(8)            PAGE = 0

    .reset      : > RESET, PAGE = 0, TYPE = DSECT /* not used */
    ...
}

Q4. How should I implement the jump from the Secondary Bootloader to the Application?
→ Both the Secondary Bootloader and the Application are expected to execute _c_int00 first and then jump to _main.

  When each is programmed in Flash independently, the RESET vector points to _c_int00, and execution proceeds in the order _c_int00_main.

  However, in the linker command files above, RESET is defined at the same address in both.
  Wouldn’t this cause a conflict between the _c_int00_main sequences of the two programs?

  Would you please advise whether my understanding and configuration are correct, and how best to implement the jump sequence between the two?

Thank you very much for your time and support.

  • Hello,

    Q1. Are there any sample codes available for TMS320F28379D that demonstrate a configuration using both a Secondary Bootloader and an Application?

    There are no specific examples for F2837xD devices, but you can refer to the F28004x LFU with reset example in C2000Ware, documentation provided here: https://www.ti.com/lit/ug/spruiu8/spruiu8.pdf

    Q2. Is it correct to assume that the Secondary Bootloader and the Application each require their own separate project and linker command file?

    That's correct. The secondary bootloader and application should have their separate projects and linker command files for ease of development.

    You will need to ensure that the Flash sections for the bootloader and application do not overlap. If you wish to jump back to the bootloader from the application (i.e. LFU), then you will need to also ensure the RAM allocations do not conflict.

    Q3. Are the following linker command file definitions for the Secondary Bootloader and Application correct?

    Your linker command files match your described use-case. 

    → Is it acceptable that the RESET vector is defined at the same address for both?

    Yes, the reset vector is at 0x3FFFC0, in the boot ROM.

    Q4. How should I implement the jump from the Secondary Bootloader to the Application?

    You should branch from the secondary bootloader to the codestart of the application (at 0x84000).

      However, in the linker command files above, RESET is defined at the same address in both.
      Wouldn’t this cause a conflict between the _c_int00_main sequences of the two programs?

    This shouldn't be an issue. Both the application and secondary bootloader should map .reset to reset vector in the boot ROM. Please see this thread clarifying its purpose:  CCS/TMS320F28377D: TMS320F28377D reset vector and bootloading 

    Best,

    Matt