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.

MSP430FR5969: Custom bootloader issue

Part Number: MSP430FR5969


Hi all Experts,

I'm trying a code where I want to jump from one location to another. Here is my code

#include <msp430FR5969.h>
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>

#pragma location="FLASHCODE" // Define flash segment code

void dummy_code()@ "FLASHCODE"
{
int a=0,b=0;
for (a=0;a<10;a++)
{
b=b+1;
//_NOP();
}
_NOP();
asm("BR #0x4432");
}

unsigned char BSL_Flag = 0;

void TI_MSPBoot_JumpToBoot( void )
{
__disable_interrupt(); // Disable all interrupts
dummy_code();
}

static void clock_init(void)
{
CSCTL0_H = CSKEY_H;
CSCTL1 = DCOFSEL_6; // Set DCO = 8Mhz
CSCTL2 = SELA__VLOCLK + SELM__DCOCLK + SELS__DCOCLK; // set ACLK = VLO
// MCLK=SMCLK=DCO

CSCTL3 = DIVA__1 + DIVS__8 + DIVM__8; // Divide DCO/8
}

void test_jump_application()
{
int l;

for(l = 0; l<10 ; l++)
{
_NOP();
}
}

int main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;

// Initialize MPU
//MPU_init();

clock_init();

TI_MSPBoot_JumpToBoot();

BSL_Flag = 0xED;

BSL_Flag = 0xE0;

test_jump_application(); // address location 0x4432

return 0;
}

Issue is when it goes to dummy_code() it is directly jumping to test_jump_application up to this flow is good as expected. But after executing the test_jump_application it is executing

BSL_Flag = 0xED;
BSL_Flag = 0xE0;
test_jump_application();

I want to skip these above three statements.

why program counter is executing these above statement when I use asm("BR #0x4432"); statement.

Can anyone please clearify me this doubt?

**Attention** This is a public forum