I am trying to find an elegant solution to my problem. I am using the HCS12 256DP with the Metrowerks CodeWarrior IDE.
I am using this device (amongst other functions) to load program code into another device via the SPI Device. I have got the SPI Boot loader working on a small piece of code, but my problems occur now I want to load larger code (i.e. larger than 16K)
The maximum code size I will have to load is 64K (and it will probably be near that mark eventually!). I have imported the code into an assembler file using some tools that seem to work quite reliably, which gives me a file of the structure:
XDEF CodeStartPoint ; Allows my C Code to access this ASM area
BootCodeData: SECTION ; Defines this stuff in its own relocatable section
CodeStartPoint: ; The actual start of the Data
dc 010h, 001h 100h, 200h, 020h
... and so on . ...
To the linker this looks like one HUGE constant array of a size bigger than the Page windows (16K in size), and I am having headaches getting the code into the device!!!
I can get a final executable by removing the SEGMENT definitions for PAGE_32 to PAGE_37 and replacing with BOOT_CODE_SEG = READ_ONLY 0x328000 TO 0x37BFFF;
Then, in the PLACEMENT section, I add BootCodeData INTO BOOT_CODE_SEG;
I think this is a bit of a cheat and causes the linker to "forget" about the 16K windowing for this address range (possibly causing it to think I have an external memory device?) - especially as when I try to load this using the Debugger, I get the error, no memory at 0x338000
How can I get the linker to place my constant data across the different paged memory windows in one continuous block?
Other than this, the only other solution I can see is to cut up my data into 16K chunks and add each chunk into its own Page - very laborious!!