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: Updating Application Firmware with the MSP BSL , I meet some problems.

Part Number: MSP430F5418A

Address allocation

boot:0x5c00-0x6bff

xcl file of the boot:
-Z(CODE)INTVEC=0xFF80-0xFFFF
-Z(CODE)RESET=0xFFFE-0xFFFF

app:0x6c00-0xfcff   0x10000-0x15672

xcl file of the app:
-Z(CODE)INTVEC=0x15F80-0x15FFF
-Z(CODE)RESET=0x15FFE-0x15FFF

I want to jump to the app from the boot,and  try to use the mov command -----asm("mov &0x15FFE,PC;");   , but  compile error.

the error information is:

Error[Og006]: Error in inline assembly: "Error[433]: Address out of range. Valid range is 0 to 65535 (0xFFFF)." 

so  how to jump to the address 0x15ffe in the boot code?

thanks!

  • The reset vector and the interrupt vectors are fixed by the design and need to be at the addresses give in the linker command file (at the top of the 64k Boundary

    -Z(CODE)INTVEC=FF90-FFFF
    -Z(CODE)RESET=FFFE-FFFF

    So you should not change this lines.

    Also the entry of the CSTARTUP code and also for the interrupt handlers need to by in the lower 64k memory area as the vectors are only available as 16 bit..

    Of course you can then jump immediately to a function in the higher memory area and have the main part of the function there.

    If you would like to tell the linker to place your code segments of the normal function into the upper memory change this lines to:

    -P(CODE)CODE=0x15F80-0x15FFF
    -Z(CODE)CODE_PAD

  • Thank you for your reply.

    OK , now I change Address allocation.

    xcl file of the boot:

    -Z(CODE)CSTART,ISR_CODE,CODE16=5C00-6BFF
    -P(CODE)CODE=5C00-6BFF

    -Z(CODE)INTVEC=0xFF80-0xFFFF
    -Z(CODE)RESET=0xFFFE-0xFFFF

    xcl file of the app:

    -Z(CODE)CSTART,ISR_CODE,CODE16=6C00-FC7F

    -P(CODE)CODE=6C00-FC7F,10000-25BFF

    -Z(CODE)INTVEC=FC80-FCFF
    -Z(CODE)RESET=FCFE-FCFF

    I write two APP codes.  the two codes take up flash memory actually as follows:

    APP code 1:  6C00-6F8E

    APP code 2:   6C00-FC7F   10000-15482  

    In the boot code ,  use the command 【asm("mov &0xFCFE,PC;");】   in order to jump to the APP.

    when I download the app code 1 , it can work normally.

    when I download the app code 2,  it can not work normally.

  • For the RESET Vector this looks OK but do you also handle the Interrupt functions the same way?

    You need to add a interrupt handler for all function you are using in the bootloader and the application.

    Once a interrupt occurs and it is enabled it will jump at the program address which is define in the interrupt vector table of the device (memory locations below the RESET vector), which will then based on your configuration jump into an handler which is part of the bootloader. Here you then need to decide if this needs to be handled by the bootloader or if you further branch into the application similar what you have already done with the reset.

  • I don't quite understand.

    the app interrupt handler is -Z(CODE)INTVEC=FC80-FCFF.
    the boot interrupt handler is -Z(CODE)INTVEC=FF80-FFFF.

    Do you have any bootloader examples (the app code >0xffff) ?
  • Anytime an interrupt occurs the hardware check for the interrupt vector in the range of 0xFF80 - 0xFFFF.
    This is fixed in the hardware of the device and can not be changed - see also datasheet for mapping of the interrupt source to the interrupt vector.

    Now is this is based on our setup and configuration always in the bootloader area you need to generate for each interrupt a trampoline function which forward jumps into your interrupt handler function of the application.

    Unfortunately i do not have a bootloader example available.
    Have you already checked if you can use the BSL which is part of most MSP430 devices. This is an integrated Bootstrap loader which can be used to update the Firmware inside an MSP430. Just search in the Datasheet for BSL to find more information if needed.
  • Hello,

    As there has been no further discussion for a longer time i assume that you could solve the issue and find a solution.
    May you can push the resolved button and close the thread.
    If there are any follow up discussions on this topic, you can open the thread at any time again.

**Attention** This is a public forum