AnsweredAssumed Answered

Bootloader for MC9S12xDP512 to erase and program at a certain area

Question asked by Serkan Akbulut on Nov 13, 2013
Latest reply on Nov 25, 2013 by iggi

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"); }

Outcomes