Different code sections

Discussions on how to get your MSP JTAG programmer up and running.

Moderator: phalanx

Different code sections

Postby LookashR » Thu Mar 12, 2009 3:43 am

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
.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"
    mov.w   #0, R4
    jmp  back_to_main

    jmp bootloader
    jmp   $

    .sect   ".reset"               
    .short  main                  

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...
Posts: 6
Joined: Tue Dec 09, 2008 7:28 am

Postby LookashR » Mon Mar 16, 2009 12:01 am

Solved, it was neccesary to use BRANCH instruction instead of JMP. (JMP can not jump "far".)
Posts: 6
Joined: Tue Dec 09, 2008 7:28 am

Return to MSP Microcontrollers

Who is online

Users browsing this forum: No registered users and 1 guest