SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on how to get your MSP JTAG programmer up and running.
By LookashR
#68279
Hi everybody, I am trying develop the programme, in which the parts of code will be in different parts of flash memory. There should be regular programme, which should start at the begining of the flash memory, and then my own bootloader, which should be at the highest part of flash memory.

So I modified SECTIONS in linker file "lnk_msp430f2132.cmd" as: (uninteresting parts were removed)
Code: Select all
SECTIONS
{
.boot	   : {} > FLASH (HIGH)
.text            : {} > FLASH
.reset          : {} > RESET
}
And then I want from my program to able to do something like this:
Code: Select all
    .cdecls C,LIST, "msp430x21x2.h"

    .sect ".boot"
bootloader
    mov.w	#0, R4
    jmp  back_to_main

    .text
main
    jmp bootloader
back_to_main
    jmp   $

    .sect   ".reset"                
    .short  main	               
    .end
From the reset vector jump to main, perform commands in main, jump to bootloader, perform bootloader and then jump back_to_main. But when the programme gets to the "jmp bootloader" command, it does not jump to "bootloader", but only to "main" :-(

When I look into the memory at the positions, where I want to have the bootloader sections, the commands are there, probably correctly... Only those jumps do not work...

Thank you for any advice...
By LookashR
#68531
Solved, it was neccesary to use BRANCH instruction instead of JMP. (JMP can not jump "far".)