EmbeddedRelated.com
Forums

Metrowerks SmartLinker doesn't include Banked Flash code in S-Record generation

Started by phylacjoe February 20, 2003
I've recently been studying M.Doughman's AN2153: Serial Bootloader
for MC9S12DP256. It is stated that S-records generated by Cosmic
software works fine, but I'm on Metrowerks CodeWarrior, so...

I had no problems installing the bootloader into the Protected High
area (Starting at 0xF000) and no problems using it: I've sucessfully
downloaded a small 7-Seg display application which resided into the
lower FLASH segment. This application was programmed with CodeWarrior
and I've correctly converted my S19 file with SRECCVT.
(Used SRecCvt -b 16 0x30 infile.s19)

The problem comes with my Banked Flash application: The generated S-
Record doesn't include my Paged Flash data. It contains my START12
module, located at 0xC000 (or the lower 0x3F Flash window), some RAM
data and my secondary interrupt vector table (0xEF80 to 0xEFFE).

I've verified my MAP file, my Main function should have been on PPAGE
0x30 but my converted S19 record only contains addresses from 0xFC000
to 0xFEFE0, wich all correspond to 0xC000 Flash segment, or PPAGE
0x3F is you prefer.

Does someone else have experienced the same kind of problems?
I wonder if a mysterious dark option needs to be checked in the
Linker preference window...




Hi.

Please read below: It is a copy of something I already posted once in this
mailing list.
At the end, I also pasted the BURNER.BBL (burner batch file) which
generates a physical/linear SRecord file and logical/banked SRecord file.
You can upgrade it in your "prm" folder (usually there) of your CodeWarrior
project.
This file is now typically delivered with CodeWarrior for HC12 v2.0 projects.

Regards,
Gilles

***********************

As clearly explained in the introduction of Gordon's document "Reference Guide
For SRecCvt" from March 21, 2001, some debuggers, like the CodeWarrior
(former HIWARE) debugger used the "banked" S-Record format.
The Gordon's "SrecCvt" has been specially designed to convert the "banked"
S-Record format to "linear" S-Record format.
Why did we decide to use the "banked" S-Record format?
------------------
If Gordon's document covers the problem of application code, it does not
cover the banked ram data (as not to be programmed).
However, when the HC12 debugger started, one of the most featured device
was the HC812A4 chip, handling 256 code pages via PPAGE in 0x8000-0xBFFF
window, but also handling 256 ram data pages via DPAGE in 0x7000-0x7FFF
window and handling 256 extra pages via EPAGE in 0x0400-0x07FF window.
Then we immediately featured our debugger with all data and code bank
handling, and we had to reproduce also the data pages and extra pages.
To avoid code and data memory representation overlap, we used also the same
logical representation for data and extra pages:
(PPAGE<<16) + 16-bit physical address (only for address in 0x..8000-0x..BFFF)
(DPAGE<<16) + 16-bit physical address (only for address in 0x..7000-0x..7FFF)
(EPAGE<<16) + 16-bit physical address (only for address in 0x..0400-0x..07FF)
And all HC812A4 device memory - 4 Mbytes of rom, 1 Mbyte of ram - was
visible in a single memory window/range within the debugger and from the
entire tool chain without any confusion.
Also the onchip EEPROM code is stored in the "banked" S-Record format.

Just in case:
-------------
The burner delivered within the CodeWarrior tool chain can easily generate
at build time the linear srecord file.
If someone needs the .bbl burner script file, please contact
<>.
The next CodeWarrior HC12 product will provide this bbl script file to
generate automatically linear srecord and logical (banked) srecord at build
time within Stationery projects. ****** BURNER.BBL file begin ********************

/* logical s-record file */
OPENFILE "%ABS_FILE%.s19"
format=motorola
busWidth=1
origin=0
len=0x1000000
destination=0
SRECORD=Sx
SENDBYTE 1 "%ABS_FILE%"
CLOSE

/* physical s-record file */
OPENFILE "%ABS_FILE%.phy"
format = motorola
busWidth = 1
len = 0x4000

origin = 0x008000
destination = 0x000000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x018000
destination = 0x004000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x028000
destination = 0x008000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x038000
destination = 0x00C000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x048000
destination = 0x010000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x058000
destination = 0x014000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x068000
destination = 0x018000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x078000
destination = 0x01C000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x088000
destination = 0x020000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x098000
destination = 0x024000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x0A8000
destination = 0x028000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x0B8000
destination = 0x02C000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x0C8000
destination = 0x030000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x0D8000
destination = 0x034000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x0E8000
destination = 0x038000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x0F8000
destination = 0x03C000
SENDBYTE 1 "%ABS_FILE%"

origin = 0x108000
destination = 0x040000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x018000
destination = 0x044000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x128000
destination = 0x048000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x138000
destination = 0x04C000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x148000
destination = 0x050000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x158000
destination = 0x054000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x168000
destination = 0x058000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x178000
destination = 0x05C000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x188000
destination = 0x060000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x198000
destination = 0x064000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x1A8000
destination = 0x068000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x1B8000
destination = 0x06C000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x1C8000
destination = 0x070000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x1D8000
destination = 0x074000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x1E8000
destination = 0x078000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x1F8000
destination = 0x07C000
SENDBYTE 1 "%ABS_FILE%"

origin = 0x208000
destination = 0x080000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x218000
destination = 0x084000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x228000
destination = 0x088000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x238000
destination = 0x08C000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x248000
destination = 0x090000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x258000
destination = 0x094000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x268000
destination = 0x098000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x278000
destination = 0x09C000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x288000
destination = 0x0A0000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x298000
destination = 0x0A4000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x2A8000
destination = 0x0A8000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x2B8000
destination = 0x0AC000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x2C8000
destination = 0x0B0000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x2D8000
destination = 0x0B4000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x2E8000
destination = 0x0B8000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x2F8000
destination = 0x0BC000
SENDBYTE 1 "%ABS_FILE%"

origin = 0x308000
destination = 0x0C0000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x318000
destination = 0x0C4000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x328000
destination = 0x0C8000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x338000
destination = 0x0CC000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x348000
destination = 0x0D0000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x358000
destination = 0x0D4000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x368000
destination = 0x0D8000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x378000
destination = 0x0DC000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x388000
destination = 0x0E0000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x398000
destination = 0x0E4000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x3A8000
destination = 0x0E8000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x3B8000
destination = 0x0EC000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x3C8000
destination = 0x0F0000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x3D8000
destination = 0x0F4000
SENDBYTE 1 "%ABS_FILE%"

origin = 0x3E8000
destination = 0x0F8000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x004000
destination = 0x0F8000
SENDBYTE 1 "%ABS_FILE%"

origin = 0x3F8000
destination = 0x0FC000
SENDBYTE 1 "%ABS_FILE%"
origin = 0x00C000
destination = 0x0FC000
SENDBYTE 1 "%ABS_FILE%"

CLOSE

*********** BURNER.BBL file end ************************
At 04:28 PM 2/20/2003, you wrote:
>I've recently been studying M.Doughman's AN2153: Serial Bootloader
>for MC9S12DP256. It is stated that S-records generated by Cosmic
>software works fine, but I'm on Metrowerks CodeWarrior, so...
>
>I had no problems installing the bootloader into the Protected High
>area (Starting at 0xF000) and no problems using it: I've sucessfully
>downloaded a small 7-Seg display application which resided into the
>lower FLASH segment. This application was programmed with CodeWarrior
>and I've correctly converted my S19 file with SRECCVT.
>(Used SRecCvt -b 16 0x30 infile.s19)
>
>The problem comes with my Banked Flash application: The generated S-
>Record doesn't include my Paged Flash data. It contains my START12
>module, located at 0xC000 (or the lower 0x3F Flash window), some RAM
>data and my secondary interrupt vector table (0xEF80 to 0xEFFE).
>
>I've verified my MAP file, my Main function should have been on PPAGE
>0x30 but my converted S19 record only contains addresses from 0xFC000
>to 0xFEFE0, wich all correspond to 0xC000 Flash segment, or PPAGE
>0x3F is you prefer.
>
>Does someone else have experienced the same kind of problems?
>I wonder if a mysterious dark option needs to be checked in the
>Linker preference window... >
>-------------------- >
>">http://docs.yahoo.com/info/terms/