9s12XET256 bootloader/ Reporting a Bug

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

9s12XET256 bootloader/ Reporting a Bug

1,684 Views
Embedded-Lover
Contributor I

Hello 

This post is for reporting a bug in the application note AN4258: Serial Bootloader for S12(X)

 In the main file and in the function for erasing flash we have the following code for S12XE 256k:

 

//S12XE 256k flash
case MASK_0M53J: //Falling to next case
case MASK_1M53J_2M53J:
//erase whole P-Flash block 0 except bootloader area
if(Error = PFlash_EraseSectorBySector(0x7E0000UL, 0x7FEFDFUL))
return(Error);
//and erase all remaining blocks
if(Error = PFlash_EraseBlock(0x7A0000UL))
return(Error);
if(Error = PFlash_EraseBlock(0x780000UL))
return(Error);
return(noErr);

 

According to the above code, it tries to erase the flash at address 0x7A0000, but according to data sheet for 9s12 microcontroller page37, under the table 1-4, it has said.

"The 256K memory map is split into a 128K block from 0x78_0000 to 0x79_FFFF and a 128K block from 0x7E_0000 to 0x7F_FFFF".

So there is no 0x7A0000 block in microcontroller with 256K flash to erase and because of this, the program stock in this part of the code. Therefore, the true code for erasing is:

//erase whole P-Flash block 0 except bootloader area
if(Error = PFlash_EraseSectorBySector(0x7E0000UL, 0x7FEFDFUL))
return(Error);
DDRP_DDRP1 = 1;
//and erase all remaining blocks
//if(Error = PFlash_EraseBlock(0x7A0000UL))
if(Error = PFlash_EraseBlock(0x790000UL))
return(Error);
DDRP_DDRP2 = 1;
if(Error = PFlash_EraseBlock(0x780000UL))
return(Error);
DDRP_DDRP3 = 1;
return(noErr);

I attached the picture of the related page in datasheet an also the code of erase function in serial bootloader.

Please give me your opinion in this regard.

Sincerely Mohammad

 

0 Kudos
Reply
1 Reply

1,588 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Mohammad,

You are right, thanks for poiting it out.

I just reported it to the owners of the application note.

I can't guarantee the SW will be updated anytime soon though.

 

Best regards,

Daniel

 

 

0 Kudos
Reply