Release 2.1.1 supports memory bank switching for 68HC12.
To load correctly your program, your upload program must know the
special mapping that the linker and gdb use.
Basically, everything between 0..0x00ffff must/can be loaded as is (not
paged).
Everything >= 0x10000 is banked and is decomposed in 16K area that must
be put in the correct page. The page number is given by the formula:
(addr - 0x1000000) / 16K
(ie, addr 0x1000000 corresponds to page0, 0x1004000 to page1, 0x1008000 to
page2, ...)
The - 0x1000000 is annoying but it is necesary for the current
implementation of the linker so that it links correctly.
To link in several areas, you must define several regions, like:
MEMORY
{
page0 (rwx) : ORIGIN = 0x0, LENGTH = 256
text (rx) : ORIGIN = 0x0C000, LENGTH = 0x10000 - 0x0C000
bank0 (rx) : ORIGIN = 0x1000000, LENGTH = 16K
bank1 (rx) : ORIGIN = 0x1004000, LENGTH = 16K
...
data : ORIGIN = 0x001040, LENGTH = 0x08000 - 0x01040
}
And you must manage to put what you want in either text or bankN.
For example:
.text_low :
{
/* Put startup code at beginning so that _start keeps same address.
*/
/* Startup code. */
KEEP (*(.install0)) /* Section should setup the stack
pointer. */
KEEP (*(.install1)) /* Place holder for applications. */
KEEP (*(.install2)) /* Optional installation of data
sections in RAM. */
KEEP (*(.install3)) /* Place holder for applications. */
KEEP (*(.install4)) /* Section that calls the main. */
KEEP (*(.init))
ebcs.o(.text)
date-panel.o(.text)
main-panel.o(.text)
info-panel.o(.text)
debug.o(.text)
} > text
And put the banked code using:
.bank0 {
my_file.o(.text)
my_file.o(.text.*)
my_file.o(.rodata)
my_file.o(.rodata.*)
} > bank0
Now, be careful that the current linker does not yet check for function
that cross a page boundary (Release 2.1.1 at least; it will be fixed
in future releases). So, I would recommend to define as many banks
as you need in MEMORY and give them the fixed size 16K.
You can put several files in the same bank as long as it fits.
|