Programming multiple ppages MC9S12DP512

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

Programming multiple ppages MC9S12DP512

982 Views
astro_goto
Contributor III

My "goto" telescope built around an MC9S12DP512 programmed in assembly is working just great! The program uses floating point routines from AN974 and occupies 11463 bytes of unpaged memory (ppage $3F) plus 12745 bytes in ppage $22.  The unpaged code loads with the S12Dx512 Boot-loader v1.0.1 and a BDM POD loads ppage $22 with D-Bug12 4.0.b32 using the FLOAD 8000 ;np command. I know how to calculate the FLOAD addresses for other ppages.


However, I am needing to write more code beyond the ~3600 bytes remaining in ppage $22 and am uncertain how to proceed.  The program uses an ORG $C000 for the unpaged Fixed Flash Array (ppage $3F) and ORG $8000 for the code in ppage $22. The last byte of code in ppage $22 must  load in $BFFF.  Anymore code will just overlap the stuff at ORG $C000. The additional proposed code must access global variables and subroutines in ppage $3F and also subroutines in ppage $22. How to calculate an ORG statement for additional ppages of code when the FTS512K4 User Guide says that ppages $20 through $3E must be accessed through the 16K window $8000-$BFFF as I'm doing for ppage $22 ?

 

My development tool is MGTEK's MiniIDE running on a laptop PC. Downloading to the MC9SDP512 flash is with HyperTerminal.

Labels (1)
0 Kudos
2 Replies

341 Views
kef
Specialist I

page $3E is also fixed unpaged page (like paae $3F) available at $4000.

You could org all your code to start at $4000 and end at $Fxxx, including page window $8000-$BFFF. Reset default PPAGE value on S12 parts is 0. In single chip modes, PPAGE=0 maps the least available page to page window. PPAGE=0 on S12DP512 is the same like PPAGE=$20, PPAGE=1 the same like PPAGE=$21 etc, only 5 least order bits of PPAGE are used. Hovewer breakpoints in page window may not work wen PPAGE<$20, so you may need to load $8000 to page $20 and setup PPAGE=$20 soon after reset.

0 Kudos

341 Views
astro_goto
Contributor III

I deeply appreciate the org $4000 clue by kef. However, it took some work to flesh out the details. This note may help
others with a similar problem. All the unpaged org $4000 and org $C000 code, along with the vector table additions,
can be converted together by SRecCvt-Gui with settings input=banked, output=linear and then downloaded to Flash with
the Serial BootLoader. Other paged code, like $22, need the "Linear $4000-$FFFF to paged" box checked in SRecCvt-Gui
and downloaded with BDM POD using LOAD or FLOAD and the proper offset. Conversion of paged .S19 files with SRecCvt-Gui generates S2 addresses = 80000. On loading, an offset must be added to place the code in the proper linear address range in memory. Example, 80000 + offset 54000 =  linear address $D4000 for page $35.

0 Kudos