S12ZVLA128 bootloader

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S12ZVLA128 bootloader

503 Views
oceansea
Contributor III

hello,

       i use the S12ZVLA128 MCU ,and follow the Simple_serial_bootlader example  development my bootlader.

the bootloader: 

pastedImage_1.png

pastedImage_2.png

pastedImage_6.png

i do not use the eeprom , and wen the MCU power ,i want run the bootloader ,and then the bootloader

will check the app is ready ,if yes it will jump

__DI();

 setReg16(IVBR, 0xFE00U);
app_vector = *(unsigned long int *) (0XFFDFFC);
asm LD X,app_vector;
asm JMP (0,X);//jmp app

the app:

pastedImage_7.png

pastedImage_8.png

pastedImage_9.png

now, the bootlader can run ,and i use the multilink-fx loding the app to flash ,and debug the bootlader,

when jum ,i found  the No source available for "0x022E00 (0x022E00)() "  .then i see de app.sx file ,it show

 S903022ECC , it show the start addr is 022E, so i think the jmp is successful,but why it can't  run the app?

and i try  pull-out the multilink-fx ,the same to no pull-out .can you help ,my friend?

    haiyang 

Labels (1)
0 Kudos
2 Replies

391 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

you are inserting 32bit number to a 24 bit number. The numbers are copied from left to right

data                   0x00_FF_DF_FC

X register         0xDD_DD_DD

result of operation data->X is 0x00_FF_DF    ....... FC is lost

Try following construction somewhere else to see what data is loaded into X register.

unsigned long int app_vector;

app_vector = 0x00FFDFFCUL<<8;    // UL means conversion of constant to unsigned long
asm LD X,app_vector;
asm JMP (0,X);//jmp app

You must be carefull when you wark with 32 bit data (from C) and 24 bit addresses (from ASM). The C language does not work with 24bit data. I suggest always test such operations to be sure everything is written/Read corectly.

Best regards,

Ladislav

0 Kudos

391 Views
kef2
Senior Contributor IV

or, skipping intermediate app_vector and using indirect addressing:

asm LD X, (0xFFDFFC+1); 

asm JMP (0,X);//jmp app

Edward

0 Kudos