If you want to place array1 into the paged area you have some options:
- use the banked memory model
in the banked memory model, the compiler requires you to explicitly place this array, as by default it will end up non banked.
E.g.
#pragma DATA_SEG __RPAGE_SEG MyOwnSegName
unsigned char array1[4096];
#pragma DATA_SEG DEFAULT.
With this in place array accesses will work just fine, however if you do have pointers to this array,
then they will also need to be qualified. Either with __rptr or __far (for access via RPAGE or GPAGE)
If this version is an option for you depends on your setup, can you add the pragma? Are there pointers or just array accesses with indexes?
If you dont know or are not sure, well, then this may not be an option for you.
- if the code which is accessing a certain array is just executed in a certain context, then it may be possible to set RPAGE before that code gets executed.
For example in a OS case, every thread may have its global variables on another RPAGE and the OS could set RPAGE before that task would get executed. So the task code would not have to know about the paging at all.
Depends on your setup if this works, but I could imagine that.
- use the large memory model
Well, on the HC12/HCS12 I would think very carefully before using this.
On the HCS12X the overhead is still significant, but much less than for the HC12/S12. Basically in the large memory model the compiler will use 3 byte pointers and set GPAGE for everything and and the new G-load/stores for every access.
So that significantly more code than for the banked memory model, but for the HC12/S12 such far accesses did require a runtime routine call.
So using the large memory model would satisfy all needs for the ANSI compatibility, but it might not be an option because of the code size or execution time behavior. It all depends on your use case.
Especially the OS - task switch approach would be rather efficient. Not sure what does work for your use case though-
Daniel
Message Edited by CompilerGuru on
2007-07-06 01:36 PM