Bootloader for MC9S12xDP512 to erase and program at a certain area

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

Bootloader for MC9S12xDP512 to erase and program at a certain area

1,042 Views
serkanakbulut
Contributor I

Hello Everyone,

 

We are using MC9S12xDP512 controller for our project. Currently we are using Softec and P&E tools to flash our .s19 files.

we were using  attached code to erase all are and program all area.(I found the code in community discussion)

But now we need to erase and program at a certain area.

 

I wrote an example function to do it. I am erasing the area but cant programing :S.

So i think  ı am missing somewhere.İf you see please let me now.

Thank You.

Here is the code.;     Consider that function is in the attached project ,boot.c.

http://speedy.sh/dZ6n4/S12XBootLoader.zip

 

uchar MyData= { 0x11,0x22,0x33,0x44,0x55,0x66,0x77, 0x11,0x22,0x33,0x44,0x55,0x66,0x77, 0x11,0x22,0x33,0x44,0x55,0x66,0x77, 0x11,0x22,0x33,0x44,0x55,0x66,0x77, 0x11,0x22,0x33,0x44,0x55,0x66,0x77, 0x11,0x22,0x33,0x44,0x55,0x66,0x77, }; int ProgramCertainArea (void) {  ulong  GlobalAddress=0x7EC000;    uchar *PPAGEWinAddr; if(EraseFlashCmd(GlobalAddress, SectorEraseCmd)==1)  OutStr("E"); else  OutStr("S");  PPAGEVal = (GlobalAddress - 0x400000) / FPageWsize;  PPAGEWinAddr = (uchar *)(((GlobalAddress - 0x400000) % FPageWsize) + FPageWstart); if(ProgFlashBlock(PPAGEVal, (uint *)PPAGEWinAddr, (uint *)&MyData, 21)==1)  OutStr("E"); else  OutStr("S"); }
Labels (1)
0 Kudos
Reply
2 Replies

505 Views
serkanakbulut
Contributor I

Is ıt about unsecuring the MCU in Special Single Chip Mode?

Or I should look Flash Protection and Flash Security topics.

0 Kudos
Reply

505 Views
iggi
NXP Employee
NXP Employee

Hello,

I'm not sure why you cannot program the MCU after erasing it, but i doubt it's because it is secured.

Anyway, regarding the Flash security feature and how to unsecure an MCU, see this document:
https://community.freescale.com/docs/DOC-93803

Attached is a CodeWarrior example project written for MC9S12XDP512 device demonstrating Flash R/W routines.

Regards,

Ivan

0 Kudos
Reply