EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

linking libraries to banked segments with cosmic c

Started by Randy Yates August 24, 2013
I'm using the cosmic c tools version 4.4.22 (for the Freescale 9S12 MCU)
and would like to be able to link MY OWN libraries to banked segments.

I am thinking that if I compile the code that goes into the libraries
with the +modf option, all functions will then be "far" and I can locate
them in banked segments.

However, I am not sure what technique to use in the linker command file
(.lkf file) to place libraries in specific banks. For example, will this
work:

# PIX = 38
+seg .ftext   -b 0xe0000 -o 0x08000 -m 0x4000 -w 0x4000 -n Page0   -s CODE            # Page 0 of banked code  PPAGE=0x38
mylib.a

if I just want to put the whole library in one segment? Do I have the
option of locating the individual functions in the library to different
segments? If so, what's the syntax?

# PIX = 38
+seg .ftext   -b 0xe0000 -o 0x08000 -m 0x4000 -w 0x4000 -n Page0   -s CODE            # Page 0 of banked code  PPAGE=0x38
mylib.a:myfunction1

# PIX = 30
+seg .ftext   -b 0xe4000 -o 0x08400 -m 0x4000 -w 0x4000 -n Page1   -s CODE            # Page 1 of banked code  PPAGE=0x39
mylib.a:myfunction2

or somesuch? 
-- 
Randy Yates
Digital Signal Labs
http://www.digitalsignallabs.com

The 2024 Embedded Online Conference