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.

Bootloader failed to jump to the application.

Other Parts Discussed in Thread: MSP430FR5739

Hi, everyone:

I'm new to MSP430. So please forgive my ignorance.

I'm trying to build a customized bootloader based on "slaa600a_Main Memory Bootloader for MSP430" using MSP430FR5739. But I got a problem trying to jump from the bootloader to the application.

Two simple projects are built to demo the idea:

1. Code A is the source which is stored from 0xF000 to 0xFFFE in the FRAM (reset vector is in 0xFFFE). Code A only does one thing: jump to Code B using : 

((void (*)()) 0xEFFE) ();

 2. A separate Code B is the target which is stored from 0xC200 to 0xEFFE in the FRAM (reset vector is in 0xEFFE).

I used CCS5.3 IDE to download code B to the chip first. Then in the menu : Project > Properties > Debug > MSP430 Properties > Download Options >  "Erase and download necessary segment only (Differential Download) " is selected.  After that I downloaded Code A to the lower memory location and started the debug. After executing the jump (((void (*)()) APP_RESET_VECTOR) ();),  The CCS IDE reports "No source available for "0xeffe" although I checked the memory that the reset vector for Code B is there.

I must be doing something wrong. Could you please help to point it out? 

BTW, why the MSPBoot uses boot.c to load main_boot(). Why not use main() since it's a seperate project from APP1 and APP2?

  • The souce code for Code A ("bootloader") :

    #include <msp430.h>

    #define APP_RESET_VECTOR 0xEFFE

    /*
    * main.c
    */
    int main(void) {


    WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer

    // configue clock
    CSCTL0_H = 0xA5;
    CSCTL1 = DCOFSEL_1;
    CSCTL1 |= DCORSEL;
    CSCTL2 = SELA_3 + SELS_3 + SELM_3;
    CSCTL3 = DIVA__32 + DIVS_0 + DIVM_0;
    CSCTL0_H = 0x01;

    __delay_cycles(10000);

    // Jump to applciation
    ((void (*)()) APP_RESET_VECTOR) ();

    return 0;
    }

    The memory allocation in .cmd file:

    FRAM : origin = 0xF000, length = 0x0F88

    ...

    RESET : origin = 0xFFFE, length = 0x0002 // bootloader reset vector

  • The souce code for Code B (application) :

    #include <msp430.h>

    /*
    * main.c
    */
    int main(void) {

    int i, j;

    WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer

    // configue clock
    CSCTL0_H = 0xA5;
    CSCTL1 = DCOFSEL_1;
    CSCTL1 |= DCORSEL;
    CSCTL2 = SELA_3 + SELS_3 + SELM_3;
    CSCTL3 = DIVA__32 + DIVS_0 + DIVM_0;
    CSCTL0_H = 0x01;

    // toggle P2.2
    P2DIR |= BIT2;
    P2OUT &= ~BIT2;

    for (i=0;i<300;i++) {
    P2OUT ^= BIT2;
    for (j=0;j<1;j++) {
    __delay_cycles(10000);
    }
    }

    return 0;
    }

    The memory allocation in .cmd file:

    FRAM : origin = 0xC200, length = 0x2D88

    ...

    RESET : origin = 0xEFFE, length = 0x0002 // application reset vector
  • The error seems to indicate that the CPU is jumping to 0xEFFE instead to the address pointed at by 0xEFFE. Of course there is no source code available for 0xEFFE as there is no code and the CPU shouldn't be there at all.

    Your function call is wrong.
    ((void (*)()) APP_RESET_VECTOR) ();
    means the value of APP_RESET_VECTOR itself is the pointer to the called function. So the code calls a function at 0xEFFE and not a function whose address is stored there.
    try
    ((void(*)())(*((int*)APP_RESET_VECTOR)))();
    It means APP_RESET_VECTOR is a pointer to an int value which is the pointer to a function of type void().

**Attention** This is a public forum