May I move ANSI C lib from NON_BANKED memory to a BANKED memory?

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

May I move ANSI C lib from NON_BANKED memory to a BANKED memory?

Jump to solution
1,953 Views
jameshdx80
Contributor II

Hello,

I've been working with S12 microcontrollers for many years and we have migrated our product to HCS12XE two years ago. Due to our extended use of NON_BANKED memory for OS and other legacy codes, we are now out of non banked space.

Inspecting .map files we've noticed that ANSI C occupies a significant area of our non banked memory with several function such as:

F_DIVKL 3D30 84 132 1 NON_BANKED

F_MULKL 3DB4 57 87 1 NON_BANKED

In the following post it has been said that you don't encourage user modify ansi lib file.

https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-relocate-memory-library-function-using-pragm...

Is there any specific reason? 

Thanks

 

 

Tags (3)
0 Kudos
Reply
1 Solution
1,832 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

I am a little bit confused what you are doing (and not only me) but if we are not talking about flash (which was not originally mentioned, I supposed that we are talking about unpaged flash) but the issue is the unbanked RAM size then there is a possibility to make 16kB unbanked RAM by means of combination of RAMHM and ROMHM bits. I have never used it but I see it will needs more than only change these bits at appropriate place but also think about how the application is compiled, to change prm file.

The linear RAM space of 16kB size can be created at address space 0x4000~0x7FFF. I suggest you to look at attached memory map…lines 35~42.

Best regards,

Ladislav

 

 

View solution in original post

4 Replies
1,903 Views
jameshdx80
Contributor II

Dr. Ladislav,

Thank you for replying(@lama)! In order to anticipate the answer, we are not using 0xC000-0xFFFF. But not so sure if this will solve my problem. I am sorry for posting a vague question like that. Let me give you a more detailed perspective.

We have chunks of code the are stored in a SD CARD. Different chunks of code are loaded from time to time from our SD CARD and mostly stored in a external RAM memory. However, non banked functions (such as  F_DIVKL ) and some variable are stored internally in our 8K RAM (non paged RAM).  Now, we are out of non banked space RAM and we are trying to move ANSI C out of it. 

Another resource that is draining our non banked RAM are the stacks used by the tasks from uCOS. Unfortunately, I am not sure if I can move all uCOS stacks to a paged RAM since we have always used non-paged RAM for this purpose. 

 

Thank you!

 

 

 

 

0 Kudos
Reply
1,833 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

I am a little bit confused what you are doing (and not only me) but if we are not talking about flash (which was not originally mentioned, I supposed that we are talking about unpaged flash) but the issue is the unbanked RAM size then there is a possibility to make 16kB unbanked RAM by means of combination of RAMHM and ROMHM bits. I have never used it but I see it will needs more than only change these bits at appropriate place but also think about how the application is compiled, to change prm file.

The linear RAM space of 16kB size can be created at address space 0x4000~0x7FFF. I suggest you to look at attached memory map…lines 35~42.

Best regards,

Ladislav

 

 

1,811 Views
jameshdx80
Contributor II

Hi, Ladislav.

I am so sorry for my poorly asked question. Anyways, your suggestion solves partially my non banked RAM outage, thank you! I have already tested and now I am using the linear RAM space of 16kB size from 0x4000~0x7FFF. 

Is it possible to extend the linear RAM space from 0x4000~0x7FFF as you suggested to 0x2000~0x7FFF? or even 0x1000~0x7FFF? Based on S12XE memory map state on manual I believe the answer is yes.

If either 0x2000~0x7FFF or 0x1000~0x7FFF (FA to FF RAM pages) could be used, would F0 to F9 RAM pages still be available via RPAGE or global addressing?

Thanks!

 

James

0 Kudos
Reply
1,947 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

before I'll continue I would like to ask you whether you use both nonbanked spaces

0x4000-0x7FFF  and 0xC000-0xFFFF. Of  course, the second one I am sure you are using but  what about the first one? 

I am asking because usually the space is disabled by defualt in the prm file. (on botton of following Placement)

PLACEMENT /* here all predefined and user segments are placed into the SEGMENTS defined above. */
_PRESTART, /* Used in HIWARE format: jump to _Startup at the code start */
STARTUP, /* startup data structures */
ROM_VAR, /* constant variables */
STRINGS, /* string literals */
VIRTUAL_TABLE_SEGMENT, /* C++ virtual table segment */
//.ostext, /* eventually OSEK code */
NON_BANKED, /* runtime routines which must not be banked */
COPY /* copy down information: how to initialize variables */
/* in case you want to use ROM_4000 here as well, make sure
that all files (incl. library files) are compiled with the
option: -OnB=b */
INTO ROM_C000/*, ROM_4000*/;
...

...

...

Best regards,

Ladislav