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.

C5515 Boot loader

Other Parts Discussed in Thread: TMS320C5515

Hi,

We have an existing project that used the TMS320C5509A, and had that microcontroller executing out of external flash.

We now have a project that utilizes the TMS320C5515 and would like to do the same, execute out of external flash.

Just to be clear, we don't want to copy code from flash into RAM and then execute out of RAM.

We just want to execute code directly out of flash. (I have had a tough time distinguishing in some posts what people are referring to on that subject)

I have been looking around for documentation on the specifics of the boot loader for the TMS320C5515, like a flowchart or source code showing how exactly it works, but cannot find one.

The previous project that used the C5509A, we had our own boot loader trick the TI boot loader into thinking it loaded the whole program into RAM from flash.  From RAM we would then jump to the flash image.  We would like to do the same with the C5515, but it's proving difficult.

We're also having issues with the stack mode bits of this chip.  I was able to find some documentation outlining how the change the stack mode bits, but it didn't seem to work as described.

I was hoping that there might be one grand unifying document outline the entire boot process for the C5515 in detail, and if so does anyone know where I might be able to find it?

Thanks!

  • There is no such an appnote from TI. Hopefully other community members can help.
    Regards.
  • Mr. Michaud,

    I assume that you have read sprabd7, "Using the TMS320C5515/14/05/04 Bootloader", and it hasn't answered your questions.  It seems as though you should be able to do exactly what you are trying to do, provided the device is a supported FLASH device, connected appropriately, and you have the appropriate bootloader data loaded on the first pages of the FLASH.

    If you have your bootloader flash data I can take a look at and see where it goes amiss.

    Regards,

    Bill

  • Hi Bill,

    Thanks for the document!

    This looks like some good reading, and it references other documents on the subject too.

    Our microcontroller is connected to flash with no problems.

    Right now we can put a binary file into flash and the TI boot loader will read it from flash and load the entire image into RAM and the program executes with no issue.

    The project will be getting bigger and bigger and eventually will not fit entirely into RAM.

    Right now I think I have about 10,000 bytes left to play with in RAM, and there's still a lot more to come.

    Our final vision is that time critical code, or code executed very routinely will be in RAM, and all the rest will be located in flash.

    I have tried playing with the linker script to get the microcontroller to execute out of flash, but I'm having trouble understanding if you can do this natively with the linker script, or as I described in my earlier post, "trick" the CPU into getting into flash.

    I'll be reading the documentation you have referenced and post my findings here as things progress.

    Thank you!

    Ben

  • Just as update, I have my flash programmer program seemingly all setup.

    It is programming flash correctly when the program it's loading into flash is meant to fully run from RAM (more on that later).

    At least I know I'm parsing the *.bin file correctly so far.

    The program is just a blinky LED, and when running from RAM all is good.

    The next step was to run the blinky LED routine out from flash.

    Essentially I have main just call another method that resides in flash which blinks the LED forever.

    Below is a snippet of the linker script:

    FLASH_BOOT: origin = 0x800000, len = 0x1000

    FLASH: origin = 0x801000, len = 0x100000

    .romcode: block(0x02) {

    flash_execution.obj(.text)

    } > FLASH

    So essentially main resides in RAM at execution time, but the blinky LED routine now resides after address 0x801000 (which happens to be flash in this case).

    The reason for the FLASH_BOOT section is so the linker doesn't put anything in that area, its actually empty.  (This is where the code resides in flash that gets copied to RAM).

    Otherwise my flash programmer program would strip the headers and the TI boot loader wouldn't know what to do.

    When I try to run the program from flash, I get nothing, I can't even get the main method (which doesn't reside in flash) to do anything.

    It is only when I comment out the .romcode section in the above linker script it runs, but this is being copied from flash to RAM.

    I tried compiling my code in huge memory model thinking that having the PC jump from internal RAM to flash @ 0x800000 had something to do with it, but so far nothing.

    It seems the issue revolves around something to do with declaring a section that has code in flash, it doesn't even need to be actually executed, just declared and the system is hung up at execution time....

    I'm going to keep working at it.

    Any suggestions or pointers would be greatly appreciated.

    Thanks!

  • If you use the debugger and look at the FLASH addresses in the disassembly window, do you see the code you expect?

    Check the .map file output.  Do the addresses of your functions and data make sense?

    Did you program the start of the FLASH to have the right format for the bootloader?  You should verify with the debugger.

    You can enter breakpoints manually into your code using:

    asm(" ESTOP_1")

    Try putting a few of these in, resetting the processor, and running with the JTAG connected.  If all goes well you should hit the breakpoints in your disassembly window.

    Regards,

    Bill

  • Yes,

    I just started doing that. I used the asm(" bclr XF"); and asm(" bset XF"); to toggle the LED.

    So if I see those instructions in flash, I'm probably in the right area.

    What I did was just make a method pointer to 0x801000 (which I confirmed with my map file that the flash instruction is placed here), and called the method pointer.

    In the disassemble window I do see the routine with the asm(" bclr XF"); and asm(" bset XF"); instructions.

    It just gets caught in some type of infinite loop there for some reason.

    I'll have to read up on the asm(" ESTOP_1") instruction to see how it works, (sounds dangerous if it ever got into a production PCB!)

    I still think it might have something to do with the runtime model somehow.

    Thanks for the prompt reply!
  • Got it running!
    Was able to successfully call methods in flash from RAM, just had to check off the option "all gotos/calls are encoded with 24-bit offset".
    Also, I put the memory model back to large, I guess there was no need for huge.

    This also opens up the idea that you could have preloaded libraries in flash to "link" into somehow....

    Thanks for the guidance and tips!