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.

MSP430F5418A: Custom bootloader + application for msp430f5418a

Part Number: MSP430F5418A

Hi to everybody,

there are a plenty of informations on how to implement a custom bootloader for msp430 microcontroller, maybe too much for me...

I understand that:

1) bootloader interrupt vector must stay on 0xFF80-0xFFFF. Bootloader code start at 0x5C00.

2) application interrupt vector have to be relocate to a different address, lets say 0xFF00-0xFF7F. Application interrupt vector table can move to ram at startup by the bootloader or by the application. Application code start ad 0xA100.

Now, besides interrupt part, I simplified bootloader and application without using any ISRs.

So my bootloader start at the reset address 0xFFFE, turn on a led, wait 1 second and then jump to the application that turn off that led and turn on another led. The problem is that I'm not able to jump to the application code.

Have I to jump to application reset vector address 0xFF7E? Or have I to jump to main 0xA100? I think the first one.

The instruction that I use to jump is ((void(*)())0xFF7E)();

Bootloader is implemented using CCS 6.0

On application side where I use gcc I implement a custom linker file memory.x where

MEMORY {
  sfr              : ORIGIN = 0x0000, LENGTH = 0x0010 /* END=0x0010, size 16 */
  peripheral_8bit  : ORIGIN = 0x0010, LENGTH = 0x00f0 /* END=0x0100, size 240 */
  peripheral_16bit : ORIGIN = 0x0100, LENGTH = 0x0100 /* END=0x0200, size 256 */
  bsl              : ORIGIN = 0x1000, LENGTH = 0x0800 /* END=0x1800, size 2K as 4 512-byte segments */
  infomem          : ORIGIN = 0x1800, LENGTH = 0x0200 /* END=0x1a00, size 512 as 4 128-byte segments */
  infod            : ORIGIN = 0x1800, LENGTH = 0x0080 /* END=0x1880, size 128 */
  infoc            : ORIGIN = 0x1880, LENGTH = 0x0080 /* END=0x1900, size 128 */
  infob            : ORIGIN = 0x1900, LENGTH = 0x0080 /* END=0x1980, size 128 */
  infoa            : ORIGIN = 0x1980, LENGTH = 0x0080 /* END=0x1a00, size 128 */
  ram (wx)         : ORIGIN = 0x1c00, LENGTH = 0x3f80 /* END=0x5b80, size 16K-128byte */
  rom (rx)         : ORIGIN = 0xa100, LENGTH = 0x4e80 /* END=0xff80, size 24192 */
  //rom (rx)         : ORIGIN = 0x5c00, LENGTH = 0xff80 /* END=0xff80, size 41856 */
  //vectors          : ORIGIN = 0xff80, LENGTH = 0x0080 /* END=0x10000, size 128 as 64 2-byte segments */
  far_rom          : ORIGIN = 0x00010000, LENGTH = 0x00015c00 /* END=0x00025c00, size 87K */
  /* Remaining banks are absent */
  ram2 (wx)        : ORIGIN = 0x0000, LENGTH = 0x0000
  ram_mirror (wx)  : ORIGIN = 0x0000, LENGTH = 0x0000
  usbram (wx)      : ORIGIN = 0x0000, LENGTH = 0x0000
  /* Interrupt Proxy table from  _App_Proxy_Vector_Start */
  vectors          : ORIGIN = 0xFF00, LENGTH = 0x0080
}

I think that there is something missing when I call application reset vector, some code that I have to implement on application side in order to jump correctly to main but I don't know what I have to do.

Thanks in advance if someone can help me

Regards

  • Your boot-loader need to jump to the entry point of your application. This entry point is the actual address of the reset vector for your compiled application. Assuming your boot-loader maintains the address mapping of the original application, the best way (in my opinion) to locate the entry point is to output your application as a TI-TXT file and scroll all the way down to the 0xFFFE address. All you need to do is make sure that your boot-loader jumps to that address.

  • Hello Matt,

    You may also want to check out the Custom BSL SW download (CUSTOM-BSL430) as we have custom BSL examples already made that you can just modify. http://www.ti.com/tool/MSPBSL
  • Hi Jace,

    I already implemented my custom bootloader and it seems to work (flash erase, backup data from external spi flash, read and write to/from internal msp430 flash). I have a problem on my application that is written for msp430-gcc. I posted before my custom memory.x where a redefined vectors from 0xFF80 to 0xFF00 in order not to overwrite bootloader's interrupt vector. Normally application reset vector start at 0xFFFE so with my redefinion of vectors I expect to jump to 0xFF7E in order to start my application but this doesn't work. I'm not able to realize what I'm missing.

    Regards

  • I think this post shows to me the right way to solve my issue
    e2e.ti.com/.../1880389

    I have to add -nostartfiles to LDFLAGS in my makefile in order not to load the default startup file and then write my own startup code.

    But at the moment nothing works :(
  • Matt,

    To clarify, you are not having issues with your custom bootloader per say, but wiht the interrupt vector redirect, correct?

    If so check out MSPBOOT as it also redirects the interrupt vector and would be the best example I can think of.

**Attention** This is a public forum