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.

MSP430 reset vector

Other Parts Discussed in Thread: MSP430G2553, MSP430-GCC-OPENSOURCE

I am working on a project that contains both a bootloader and application software.  I am using the MSP430G2553.  I am using MSP430-GCC running under Linux.  On startup I would like the bootloader code to run to see if there is any new code available, if not jump to the application code.  My problem is that I need to place the address of the bootloader 0xC000 at the reset vector 0xFFFE and not the address of the application code 0xC400.  I have tried various schemes but have been unable to get the code to overwrite the reset vector,  I can overwrite all of the other interrupt vectors, but not the reset. I believe I will have to modify the MSP430.x linker file to do this, but do not have a clue how to do it.  Any help would be appreciated.     

  • Hi Alice,

    I am wondering if you have seen our MSP-BOOT application note, concerning how to have a main-memory area BSL program? www.ti.com/lit/pdf/slaa600 Maybe this will prove helpful as an example of one way to handle having a main-memory area BSL.

    I also wanted to know - are you aware of the UART-based bootstrap loader located already in the ROM of the MSP430G2553? Is there a reason that you need a custom loader rather than using this one that is already provided (maybe you need to use a different interface like I2C or SPI or something)?

    Regards,

    Katie

  • Initially I wanted to use the bootstrap loader in the MSP430G2553 but that was not an option. I have no link to the outside world other than a serial communications line to the UART. This line is configured for 4800 baud, with a proprietary format. Code is sent in blocks of 28 bytes to be programmed as well as a running block count and checksum. Much of what is discussed in slaa600 I have already implemented where applicable.
  • Is there anyway to modify the msp430.x linker script so as to all the reset vector to be modified by my bootloader code?
  • Hi Alice,

    Here's a similar question: http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/335839
    The approach suggested by old_cow_yellow seems good and simpler to me.

    And a few more threads discussing using linker flags or overriding the reset_vector:
    http://blog.gmane.org/gmane.comp.hardware.texas-instruments.msp430.gcc.user/month=20140401, or
    http://sourceforge.net/p/mspgcc/mailman/message/32253902/


    Regards,
    Luis R
  • Another option:

    - Declare your Reset ISR in code:

    void __attribute__ ((interrupt(RESET_VECTOR))) _reset_vector (void)

    {

        // Your code 

    }

    In the linker file (modified from \gcc\include\msp430g2553.ld), add a section for the Application vector:

     APPRESET         : ORIGIN = 0xFFD0, LENGTH = 0x02 /* END=0xFFDF, size 16352 */

    And the original reset vector remains:

     RESETVEC         : ORIGIN = 0xFFFE, LENGTH = 0x0002

    Then, redirect the .resetvec to APPRESET, and force your ISR in the reset vector:

     __reset_vector :

     {

       KEEP (*(__interrupt_vector_16))

       KEEP (*(__interrupt_vector_reset))

     } > RESETVEC

     __appreset_vector :

     {

       KEEP (*(.resetvec))

     } > APPRESET

    Note that you need to make sure that the MCU is initialized properly (stack, variables) since this method overrides the reset vector and startup routine. 

    Regards,

    Luis R

  • I am using MSP430-gcc so I have msp430.x and memory.x instead of msp430g2553.ld. I am trying to make the changes there, but with no luck so far. Not 100% sure I understand what you are trying to do here. When I tried it out in my code it placed a value of 0x0002 in the reset vector address 0xFFFE, Will I have to modify your code above for msp430-gcc? I am not familiar with modifying linker scripts. Trying to learn to do it. Any suggestions for any good tutorials? I have not had much success searching for some.
  • Hi Alice,

    Unfortunately, I'm not aware of any tutorials, but I googled "gcc linker file" and found some links like: https://sourceware.org/binutils/docs/ld/Scripts.html
    http://www.math.utah.edu/docs/info/ld_3.html

    Did you download GCC from here? http://www.ti.com/tool/msp430-gcc-opensource
    You should find examples of linker files for all MSP430 derivatives in C:\ti\gcc\include

    Regards,
    Luis R

**Attention** This is a public forum