Part Number: MSP430FR5964
Other Parts Discussed in Thread: MSP-EXP430FR5994,
Hi everyone,
I have written a custom bootloader and want it to jump to my application. The jump address is calculated by reading the reset vector address from the application image (using a hard-coded address), then jumping to that address. This approach works fine if the application is in the 16-bit address space, but my final design places my application at 0x10000 (reset vector at 0x1007E). My bootloader starts at 0xDC00 and ends at 0xFFFF, and my application starts at 0x10000 and ends at 0x2A000.
My question is this - how do I use the 16-bit value stored in the reset vector of my application to jump to the 20-bit address I need? I have large code and large data models enabled, and can manually jump to the c_init() routine if I hard code its address in my bootloader, but I want to read the proper address from the reset vector as the compiler changes that address with each build.
I am using CCS 8.3, and have tried my code on the MSP-EXP430FR5994 board and my own hardware (I'm using the MSP430FR5964).
I have assembly and C code that jumps to the correct address if I place my application at 0x4000 (or any other 16-bit address), and tried using the following (which doesn't work):
asm( " MOVA #1007Eh, R12" ); // Set R12 to the address of my application reset vector entry (at address 0x1007E)
asm( " MOV.W @R12, R13" ); // Load reset vector value into R13
asm( " MOVA @R13, PC" ); // Jump to the reset vector address value.
The middle line above only loads 16-bits, so the last line jumps to the incorrect location.
I've combed through the TI documentation on large code models and have everything working but this one thing. Any ideas?