EmbeddedRelated.com
Forums

-bs Cosmic Link option

Started by Longworth, Kevin February 11, 2003
The Cosmic manual says -bs is 14 for 68HC12 processors. For the Star12,
DP256, -bs causes the PPAGE register to be incorrect for far calls to banked
memory. The manual calls the -bs "bank size" however it appears to be a
shift offset of 16 bits. I address $328000 the PPAGE should be 32, shifted
16 bits to the left. I can't find any documentation which explains how the
Star12 is different from the 68HC12 in this respect. Can anyone explain how
the -bs works with the PPAGE for the STAR12? For now I will continue to use
the -bs16. - Kevin Longworth



Dear Sir,

There is no difference between the HC12 and HCS12 regarding the banking
mechanism. The -bs value *must* be set to 14, and is set by default to this
value unless you specify explicitly something different. The compiler works
with physical and logical addresses, entered at link time respectively with
-b and -o options. Address $328000 is none of them. It is a composite
address catenating a page value and a logical address. It must be handled as
physical address $C8000. Please have a look at the link files provided with
the compiler showing how pages are defined and filled, manually
(dp256_m.lkf) or automatically (dp256_a.lkf).

Best Regards,
Jean-Pierre Lavandier
COSMIC Software -----Message d'origine-----
De : Longworth, Kevin [mailto:]
Envoy: mardi 11 frier 2003 18:20
:
Objet : [68HC12] -bs Cosmic Link option The Cosmic manual says -bs is 14 for 68HC12 processors. For the Star12,
DP256, -bs causes the PPAGE register to be incorrect for far calls to banked
memory. The manual calls the -bs "bank size" however it appears to be a
shift offset of 16 bits. I address $328000 the PPAGE should be 32, shifted
16 bits to the left. I can't find any documentation which explains how the
Star12 is different from the 68HC12 in this respect. Can anyone explain how
the -bs works with the PPAGE for the STAR12? For now I will continue to use
the -bs16. - Kevin Longworth
--------------------
<http://www.motorola.com/mcu ">http://docs.yahoo.com/info/terms/> .



Kevin,

The -bs does not specify shift offset. Rather the number after -bs fits
into the equation 2^n, or 2^14 = 16384 or 16K Bytes is the size of a bank
for this processor. You told Cosmic that the bank is 2^16 or 65535 bytes
wide. I don't explicitly define the -bs option. Instead I specify
the -b, -o, and -m options in my linker file. The -b tells the logical
address of the code, the -o tells the compiler the bank window is at 0x8000
(I'm using the A4 but I think all HC12's have the code window here) and
the -m says the window at 0x8000 is 0x4000 (or 16K) bytes wide. Maybe we an
get a look at your linker +seg entry for .text. This may shed some light on
things. I don't know what the compiler thinks 328000 is. I think you are
getting logical and banked memory mixed up.

Jared

-----Original Message-----
From: Longworth, Kevin [mailto:]
Sent: Tuesday, February 11, 2003 12:20 PM
To:
Subject: [68HC12] -bs Cosmic Link option

The Cosmic manual says -bs is 14 for 68HC12 processors. For the Star12,
DP256, -bs causes the PPAGE register to be incorrect for far calls to banked
memory. The manual calls the -bs "bank size" however it appears to be a
shift offset of 16 bits. I address $328000 the PPAGE should be 32, shifted
16 bits to the left. I can't find any documentation which explains how the
Star12 is different from the 68HC12 in this respect. Can anyone explain how
the -bs works with the PPAGE for the STAR12? For now I will continue to use
the -bs16. - Kevin Longworth

--------------------
">http://docs.yahoo.com/info/terms/



I can break on the call to the following function using -bs-16 but w but
with -bs-14, the ram clear function doesn't even work, which makes no sense.
The symbol __memory is still $4000 which indicates the end of Ram, but I
don't break on the branch to main after the cpx #__memory command. when the
incremented x register should be >= __memory. I have no idea why the -bs
option affects that, but here's the evidence that the bs-16 works:

LNK_OPTS= -bs16 -m $(OUTFILE).map

#############################################
# PAGE -2- $32
#############################################
+seg .text -b0x328000 -o0x8000 -m0x3fff -nDCX_IO -sROM
#+seg .const.w -aDCX_IO -nDCX_IO_CONSTW -sROM
#+seg .const -aDCX_IO_CONSTW -nDCX_IO_CONST -sROM # -f0
dcx_io.o
canapplfar.o

I have a function: void @far WriteDataByLId(void);

The call to WriteDataByLId in .la file with -bs-16;

3170 0cd70 _apdiagWriteDataByLId:
3174 ; 1104 WriteDataByLId();
3176 0cd70 4a8d9232 call f_WriteDataByLId
3178 ; 1105 }
3181 0cd74 3d rts

The call to WriteDataByLId in .la file with -bs-14;

3170 0cd70 _apdiagWriteDataByLId:
3174 ; 1104 WriteDataByLId();
3176 0cd70 4a8d92ca call f_WriteDataByLId
3178 ; 1105 }
3181 0cd74 3d rts
3183 0cd75 00 even - Kevin




Kevin,

You have the -b0x328000 incorrect. -b is physical (in my last I think I
said logical) address so think of a linear address space. I think
Jean-Pierre said that works out to 0xC8000? Is there any reason you
specified the size to be 0x3FFF with the -m option instead of 0x4000?
Remember, we count location 0 (or 0x8000 in this case) as the first spot, so
0x8000 with size 0x4000, the last location is 0xBFFF and the new page starts
at 0xC000.

Good luck,

Jared

-----Original Message-----
From: Longworth, Kevin [mailto:]
Sent: Tuesday, February 11, 2003 2:05 PM
To:
Subject: RE: [68HC12] -bs Cosmic Link option

I can break on the call to the following function using -bs-16 but w but
with -bs-14, the ram clear function doesn't even work, which makes no sense.
The symbol __memory is still $4000 which indicates the end of Ram, but I
don't break on the branch to main after the cpx #__memory command. when the
incremented x register should be >= __memory. I have no idea why the -bs
option affects that, but here's the evidence that the bs-16 works:

LNK_OPTS= -bs16 -m $(OUTFILE).map

#############################################
# PAGE -2- $32
#############################################
+seg .text -b0x328000 -o0x8000 -m0x3fff -nDCX_IO -sROM
#+seg .const.w -aDCX_IO -nDCX_IO_CONSTW -sROM
#+seg .const -aDCX_IO_CONSTW -nDCX_IO_CONST -sROM # -f0
dcx_io.o
canapplfar.o

I have a function: void @far WriteDataByLId(void);

The call to WriteDataByLId in .la file with -bs-16;

3170 0cd70 _apdiagWriteDataByLId:
3174 ; 1104 WriteDataByLId();
3176 0cd70 4a8d9232 call f_WriteDataByLId
3178 ; 1105 }
3181 0cd74 3d rts

The call to WriteDataByLId in .la file with -bs-14;

3170 0cd70 _apdiagWriteDataByLId:
3174 ; 1104 WriteDataByLId();
3176 0cd70 4a8d92ca call f_WriteDataByLId
3178 ; 1105 }
3181 0cd74 3d rts
3183 0cd75 00 even - Kevin --------------------
">http://docs.yahoo.com/info/terms/



Kevin,

As Jared pointed out, the address following the -b option is incorrect. Have a
look at AN2213, Using Cosmic Softwares M68HC12 Compiler for MC9S12DP256
Software Development, for an explanation of addresses and some example link
files.

Regards,
Gordon

"Longworth, Kevin" wrote:

> I can break on the call to the following function using -bs-16 but w but
> with -bs-14, the ram clear function doesn't even work, which makes no sense.
> The symbol __memory is still $4000 which indicates the end of Ram, but I
> don't break on the branch to main after the cpx #__memory command. when the
> incremented x register should be >= __memory. I have no idea why the -bs
> option affects that, but here's the evidence that the bs-16 works:
>
> LNK_OPTS= -bs16 -m $(OUTFILE).map
>
> #############################################
> # PAGE -2- $32
> #############################################
> +seg .text -b0x328000 -o0x8000 -m0x3fff -nDCX_IO -sROM
> #+seg .const.w -aDCX_IO -nDCX_IO_CONSTW -sROM
> #+seg .const -aDCX_IO_CONSTW -nDCX_IO_CONST -sROM # -f0
> dcx_io.o
> canapplfar.o
>
> I have a function: void @far WriteDataByLId(void);
>
> The call to WriteDataByLId in .la file with -bs-16;
>
> 3170 0cd70 _apdiagWriteDataByLId:
> 3174 ; 1104 WriteDataByLId();
> 3176 0cd70 4a8d9232 call f_WriteDataByLId
> 3178 ; 1105 }
> 3181 0cd74 3d rts
>
> The call to WriteDataByLId in .la file with -bs-14;
>
> 3170 0cd70 _apdiagWriteDataByLId:
> 3174 ; 1104 WriteDataByLId();
> 3176 0cd70 4a8d92ca call f_WriteDataByLId
> 3178 ; 1105 }
> 3181 0cd74 3d rts
> 3183 0cd75 00 even
>
> - Kevin >
> -------------------- >
> ">http://docs.yahoo.com/info/terms/

--
===============================================================
Gordon Doughman Ph: 937-438-6811
Motorola Semiconductor Fax: 937-434-7457
Field Applications Engineer Pager: 800-759-8352 Pin: 1304089
Suite 175
3131 Newmark Drive
Miamisburg, OH 45342

Check out my HC12 book at:
http://www.rtcgroup.com/books/




I changed the .lkf to this,

#############################################
# PAGE -2- $32
#############################################
+seg .text -b0xC8000 -o0x8000 -m0x3fff -nDCX_IO -sROM
#+seg .const.w -aDCX_IO -nDCX_IO_CONSTW -sROM
#+seg .const -aDCX_IO_CONSTW -nDCX_IO_CONST -sROM # -f0
dcx_io.o
canapplfar.o

and changed the link option to bs-14.
Now it still links, but the Isystem Winidea says all the paged code is out
of emulated area.
Here's a portion of the mapfile: start 00000000 end 00013eec length 81644 segment .debug
start 000c0000 end 000c200a length 8202 segment PAGE1_CODE
start 000c4000 end 000c4656 length 1622 segment PAGE2_CODE
start 000c8000 end 000c90aa length 4266 segment DCX_IO

Why does using the -b0x328000 with the -bs16 appear to work? -----Original Message-----
From: Jean-Pierre Lavandier [mailto:]
Sent: Tuesday, February 11, 2003 12:37 PM
To: '
Subject: RE: [68HC12] -bs Cosmic Link option Dear Sir,

There is no difference between the HC12 and HCS12 regarding the banking
mechanism. The -bs value *must* be set to 14, and is set by default to this
value unless you specify explicitly something different. The compiler works
with physical and logical addresses, entered at link time respectively with
-b and -o options. Address $328000 is none of them. It is a composite
address catenating a page value and a logical address. It must be handled as
physical address $C8000. Please have a look at the link files provided with
the compiler showing how pages are defined and filled, manually
(dp256_m.lkf) or automatically (dp256_a.lkf).

Best Regards,
Jean-Pierre Lavandier
COSMIC Software -----Message d'origine-----
De : Longworth, Kevin [mailto:]
Envoy: mardi 11 frier 2003 18:20
:
Objet : [68HC12] -bs Cosmic Link option The Cosmic manual says -bs is 14 for 68HC12 processors. For the Star12,
DP256, -bs causes the PPAGE register to be incorrect for far calls to banked
memory. The manual calls the -bs "bank size" however it appears to be a
shift offset of 16 bits. I address $328000 the PPAGE should be 32, shifted
16 bits to the left. I can't find any documentation which explains how the
Star12 is different from the 68HC12 in this respect. Can anyone explain how
the -bs works with the PPAGE for the STAR12? For now I will continue to use
the -bs16. - Kevin Longworth
--------------------
<http://www.motorola.com/mcu>
<http://www.motorola.com/mcu <http://www.motorola.com/mcu> ">http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/> > .

--------------------
<http://www.motorola.com/mcu ">http://docs.yahoo.com/info/terms/> .



Using the +page option when converting S19 to .695 file, I was able to get
the file to download properly to the BDM with bs-14 and using the
Table 1. Linear Address to PPAGE/Window Address Correspondence as in
Gordon's app note 2213. It looks like both solutions work. Kind of like
doing the same operation to both sides of an equasion.

AN2213/D

.-Kevin -----Original Message-----
From: Longworth, Kevin
Sent: Tuesday, February 11, 2003 2:44 PM
To:
Subject: RE: [68HC12] -bs Cosmic Link option

I changed the .lkf to this,

#############################################
# PAGE -2- $32
#############################################
+seg .text -b0xC8000 -o0x8000 -m0x3fff -nDCX_IO -sROM
#+seg .const.w -aDCX_IO -nDCX_IO_CONSTW -sROM
#+seg .const -aDCX_IO_CONSTW -nDCX_IO_CONST -sROM # -f0
dcx_io.o
canapplfar.o

and changed the link option to bs-14.
Now it still links, but the Isystem Winidea says all the paged code is out
of emulated area.
Here's a portion of the mapfile: start 00000000 end 00013eec length 81644 segment .debug
start 000c0000 end 000c200a length 8202 segment PAGE1_CODE
start 000c4000 end 000c4656 length 1622 segment PAGE2_CODE
start 000c8000 end 000c90aa length 4266 segment DCX_IO

Why does using the -b0x328000 with the -bs16 appear to work? -----Original Message-----
From: Jean-Pierre Lavandier [mailto:]
Sent: Tuesday, February 11, 2003 12:37 PM
To: '
Subject: RE: [68HC12] -bs Cosmic Link option Dear Sir,

There is no difference between the HC12 and HCS12 regarding the banking
mechanism. The -bs value *must* be set to 14, and is set by default to this
value unless you specify explicitly something different. The compiler works
with physical and logical addresses, entered at link time respectively with
-b and -o options. Address $328000 is none of them. It is a composite
address catenating a page value and a logical address. It must be handled as
physical address $C8000. Please have a look at the link files provided with
the compiler showing how pages are defined and filled, manually
(dp256_m.lkf) or automatically (dp256_a.lkf).

Best Regards,
Jean-Pierre Lavandier
COSMIC Software -----Message d'origine-----
De : Longworth, Kevin [mailto:]
Envoy: mardi 11 frier 2003 18:20
:
Objet : [68HC12] -bs Cosmic Link option The Cosmic manual says -bs is 14 for 68HC12 processors. For the Star12,
DP256, -bs causes the PPAGE register to be incorrect for far calls to banked
memory. The manual calls the -bs "bank size" however it appears to be a
shift offset of 16 bits. I address $328000 the PPAGE should be 32, shifted
16 bits to the left. I can't find any documentation which explains how the
Star12 is different from the 68HC12 in this respect. Can anyone explain how
the -bs works with the PPAGE for the STAR12? For now I will continue to use
the -bs16. - Kevin Longworth
--------------------
<http://www.motorola.com/mcu>
<http://www.motorola.com/mcu <http://www.motorola.com/mcu> >
<http://www.motorola.com/mcu <http://www.motorola.com/mcu>
<http://www.motorola.com/mcu <http://www.motorola.com/mcu> > ">http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/>
<http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/> > > . --------------------
<http://www.motorola.com/mcu>
<http://www.motorola.com/mcu <http://www.motorola.com/mcu> ">http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/> > .

--------------------
<http://www.motorola.com/mcu ">http://docs.yahoo.com/info/terms/> .