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.

Secondary bootloader for C2xxx

DSP: TMS320C28346

PC: Windows XP

IDE: Code Composer 4.1.2

BIOS: 5.41

Background: My MCU is attached to a SPI Flash device.  In order to boot from flash, it looks like I need to use hex2000.exe and store the resulting file at address 0x0 in the device.  If the boot mode pins are set to SPI-A, then my software should be loaded by the Boot ROM and started.

Problem: I want to store multiple copies of my software in Flash and use another GPIO to select between them.  Therefore, I think I need to create a secondary boot loader to store at address 0x0 which will read the GPIO.  Then, my plan is to somehow load from the correct address in flash.  But, I have no idea how to do that.  Can anyone point me to some documentation for the C2xxx on this subject?

Thanks!

  • Or, can the Boot Loaded be updated?  I was surprised to find the code in SPRUFN5A, so I now wonder if there's some way I could tweak that and update the ROM.

  • It is not possible to update ROM ... you can however write a custom bootloader using OTP. There should be an application note on how to create custom boot loaded using OTP.

  • I don't see anything about OTP in the data manual for the C2834x.  Maybe this is only for another variant of C2xxx?

  • In my mind, there are 2 challenges in creating a 2nd level boot loader:

    1. Jumping to the entry point after the COFF is read into memory

    2. Placing my bootloader into memory where it will not be overwritten by the next application

    I haven't started working on #2 yet, but advice is welcome.  Regarding the #1 (the jump), I tried the following code and the compiler couldn't parse:

             uint32 locEntryAddr = ReadAddr();

             // Read data from flash to RAM

             ...

             // Start execution
             asm("lb %0" :"=r"(locEntryAddr));

    How can I jump to the entry address?

  • regarding 1: In C:

    (*((void(*)(void))locEntryAddr))();

    regarding 2: Use address checking when reprogramming so that your bootloader is never overwritten. The bootloader needs its own sector that is never erased. Best to use the first sector and forward the exception vectors to the application.

  • I was finally able to get a working bootloader.  In order to solve issue #1 (jumping to entry point), I used the example from sprufn5a Init_Boot.asm.  For issue #2 (mapping around the bootloader), I just manually put my loader in an area where I knew my application wouldn't.  That still seems risky to me.  I would like to hear more thoughts on this issue.

    Address checking doesn't make much sense to me.  Does that mean that the COFF reader should prohibit copies to bootloaders own location?  Sacrificing the application to preserve the bootloader is unacceptable for my system.