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.

MSP430F5438A: How to execute my Program code from 0x010000 location instead of 0x5c00 up on reset.

Part Number: MSP430F5438A
Other Parts Discussed in Thread: MSP-FET

Hi ,

I would like to execute the code at memory location (0x010000) instead of (0x5C00) up on reset. How do I tell my reset vector to jump to location (0x10000) up on reset instead of (0x5C00). Any Pointers on this is highly appreciated.

Thanks in Advance. 

  • You can't. The reset vector is 16 bits so your program must begin execution in lower memory. Place code at 0x5c00 to transfer execution to 0x10000.

    If you were really lucky you could set the vector to 0xfffe and have that value be a benign instruction so that execution would continue on to your code.

  • Hi David,

    With reference to  [If you were really lucky you could set the vector to 0xfffe and have that value be a benign instruction so that execution would continue on to your code]

    can you please direct me how to do this?

    Thanks in advance

  • No. You will have to figure that out on your own as it will certainly be very tricky. First you have to figure out if the instruction encoding will allow for it. Then you have to figure out how to convince your tools (compiler/linker) to let you do it.

    Good luck with that.

  • hi David,

    I just gave a second thought about my implementation. I could place sample piece of code at (0x5C00) which can jump to location 0x10000 up on reset. Now my quest would be how to modify my linker file so that I can place my Application code in the location 0x10000.

    Note: I am willing to implement my application code with out interrupt vectors as I have to place the code at location 0x10000.

    I am attaching the linker file for my application code which should start from location 0x10000-0x1FFFF but not working(tested using JTAG gives disassembly:UNAVAILABLE WHEN EXECUTING), please suggest me the required modifications that needs to be done on linker file for storing my application from location 0x10000.  

    // ************************************************
    //
    // XLINK configuration file for MSP430F5438A
    //
    // Copyright 1996-2017 IAR Systems AB.
    //
    // See the file 430/doc/licenses/IARSourceLicense.txt for detailed
    // license information.
    //
    // $Revision: 14570 $
    //
    // ************************************************

    // ---------------------------------------------------------
    // Description
    //

    //
    // Usage:
    //
    //   xlink [file file ...] -f lnk430f5438a.xcl
    //
    // -----------------------------------------------
    // Device summary
    //

    //
    // Core:                           MSP430Xv2
    //
    // Interrupt vectors:              64
    //
    // Peripheral units:               00100-00FFF
    //
    // Information memory (FLASH):     01800-019FF
    //
    // Read/write memory (RAM):        01C00-05BFF
    //
    // Read-only memory (FLASH):       010000-0FFFF
    //                                 10000-45BFF
    //


    // -----------------------------------------------
    // Segments
    //

    // -------------------------------------
    // Data read/write segments (RAM)
    //

    //
    // The following segments are available for both
    // the DATA16 and DATA20 segment groups.
    //
    // segment         Usage
    // -------         --------------------------
    // DATA<nn>_Z      Data initialized to zero
    // DATA<nn>_I      Data initialized by copying from DATA<nn>_ID
    // DATA<nn>_N      Data defined using __no_init
    // DATA<nn>_HEAP   The heap used by 'malloc' and 'free'
    //
    // segment         Usage
    // -------         --------------------------
    // CSTACK          Runtime stack
    // TLS16_I         Thread-local storage for main thread
    //


    // -------------------------------------
    // Program and data read-only segments (FLASH)
    //

    //
    // The following segments are available for both
    // the DATA16 and DATA20 segment groups.
    //
    // segment         Usage
    // -------         --------------------------
    // DATA<nn>_C      Constant data, including string literals
    // DATA<nn>_ID     Initializers for DATA<nn>_I
    //
    // segment         Usage
    // -------         --------------------------
    // INFO            Information memory
    // INFOA           Information memory, bank A
    // INFOB           Information memory, bank B
    // INFOC           Information memory, bank C
    // INFOD           Information memory, bank D
    // CSTART          Program startup code
    // CODE            Program code
    // ISR_CODE        Program code for interrupt service routines
    // DIFUNCT         Dynamic initialization vector used by C++
    // CHECKSUM        Checksum byte(s) generated by the -J option
    // INTVEC          Interrupt vectors
    // RESET           The reset vector
    // TLS16_ID        Thread-local initializers for main thread
    //
    // Notes:
    //
    // * The segments CSTART, ISR_CODE, and DIFUNCT, as well as the segments in
    //   the DATA16 and TLS16 segment groups must be placed in in the range
    //   0000-FFFD.
    //
    // * The INFOx and INFO segments overlap, this allows data either to be
    //   placed in a specific bank or anywhere in the info memory.
    //
    // * The INTVEC and RESET segments overlap. This allows an application to
    //   either use the reset vector provided by the runtime library, or
    //   provide a reset function by defining an interrupt function associated
    //   with the reset vector.
    //


    // ---------------------------------------------------------
    // Configuation
    //

    // -----------------------------------------------
    // Stack and heap sizes
    //

    // Uncomment for command line use
    //-D_STACK_SIZE=160
    //-D_DATA16_HEAP_SIZE=160
    //-D_DATA20_HEAP_SIZE=160


    // -----------------------------------------------
    // Define cpu
    //

    -cmsp430

    // Compensate for hardware bug in CPU
    -D?CPU30_OFFSET=2


    // -----------------------------------------------
    // Support for placing functions in read/write memory
    //

    -QCODE_I=CODE_ID


    // -----------------------------------------------
    // Support for thread local storage
    //

    -QTLS16_I=TLS16_ID


    // -----------------------------------------------
    // Hardware multiplier location
    //

    -D__iar_HWMUL=4C0


    // ---------------------------------------------------------
    // Placement directives
    //

    // -----------------------------------------------
    // Information memory
    //

    -Z(CONST)INFO=1800-19FF
    -Z(CONST)INFOA=1980-19FF
    -Z(CONST)INFOB=1900-197F
    -Z(CONST)INFOC=1880-18FF
    -Z(CONST)INFOD=1800-187F


    // -----------------------------------------------
    // RAM memory
    //

    -Z(DATA)DATA16_I,DATA16_Z,DATA16_N,TLS16_I=1C00-5BFF
    -Z(DATA)DATA16_HEAP+_DATA16_HEAP_SIZE
    -Z(DATA)CODE_I
    -Z(DATA)DATA20_I,DATA20_Z,DATA20_N,DATA20_HEAP+_DATA20_HEAP_SIZE
    -Z(DATA)CSTACK+_STACK_SIZE#


    // -----------------------------------------------
    // Read-only memory
    //

    // -------------------------------------
    // Low memory 0-0FFFF
    //

    // ---------------------------
    // Constant data
    //

    -Z(CONST)DATA16_C,DATA16_ID,TLS16_ID,DIFUNCT,CHECKSUM=10000-1FFFF

    // ---------------------------
    // Code
    //

    -Z(CODE)CSTART,ISR_CODE,CODE16=10000-1FFFF


    // -------------------------------------
    // All memory 0-FFFFF
    //

    // ---------------------------
    // Code
    //

    -P(CODE)CODE=10000-1FFFF,10000-45BFF

    // ---------------------------
    // Constant data
    //

    -Z(CONST)DATA20_C,DATA20_ID,CODE_ID=10000-1FFFF,10040-45BFF

    // -------------------------------------
    // Interrupt vectors
    //

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

    Thanks in advance

  • Hi,

    I have a question. Why you want to execute your Program code from 0x010000 location?

    My suggestion is you can refer to the Main Memory BSL(http://www.ti.com/lit/an/slaa600d/slaa600d.pdf). Just remove the communication. I am sorry there is only CCS version.

    The method is once you reset, you jump to first code. In the first code, you will jump to second code, which is above 0x10000. 

    Eason

  • hi ,

    I am not going to use internal BSL ,since BSL need MSP-Rocket /MSP-FET for programming which is not suitable for my final application I'd rather make a simple bootloader in code memory, 

    Hence executing bootloader at 10000 location is the only option I have with out interrupts.

    My requirements are:

    1.I need to make a bootloader(10000) which initially checks my Application code(0x5c00) integrity(checksum) and verify with the correct check sum stored in information memory(1800)

    2.Bootloader application should receive hex data on UART and reprogram my application memory (at 0x5c00).

    Please provide any pointers on how to achieve this.

    Thanks

    Anand

  • Hi Anand,

    Please look into the link I send. This BSL is not the one programmed in production. It talks about customer BSL in main memory. It support interrupts and UART.

    But the BSL can't save in 0x10000, because the address saved in 0xfffe is 16-bit.

    Eason

**Attention** This is a public forum