EmbeddedRelated.com
Forums

BootLoader in Codewarrior for HC12

Started by johnpititto1976 November 2, 2003
Hi ladies and Gents,

I am developing a MC68HCS12DP256B micro using codewarrior v1.2. I am
attempting to develop code so the firmware is field upgradable. Does
anyone have any handy hints on where to find some good documentation
or code example on how to go about this in codewarrior.

Kind Regards,

John Pititto.



John,

Bootcode is really not that much different than application code.
Differences include where you locate it in the memory map (you need to
place it in the protected flash area at the top, in the upper range of
the $3F page). I would also recommend figuring out how to handle
interrupts. The HCS12 has only one ISR location and as such, it
presents an interesting problem when you want to have your boot code and
your main code use their own interrupts. Motorola has an app note on
how to handle that, but I've used an entirely different way. I
basically set my true vector table pointing to a location in ram
($3F64-$3FFF). Then when each app starts up (bootcode, app
code,whatever), it copies its vector table into that RAM location,
before enabling the interrupts. Works really nice.
You should also determine your methods for field upgrades
(RS232/CAN/etc) and work that out as well. For my uses there's no other
way than CAN, but you may decide RS232 is better.
Also, if you are using Codewarrior, you may want to download the
Motorola Flash drivers. They don't work too well with other compilers,
and IMO, they are a bit on the large side, but it's a good start.

Anyway, hope that helps in some way.

John
http://embedded.mistekllc.com
> -----Original Message-----
> From: johnpititto1976 [mailto:]
> Sent: Sunday, November 02, 2003 7:01 AM
> To:
> Subject: [68HC12] BootLoader in Codewarrior for HC12 > Hi ladies and Gents,
>
> I am developing a MC68HCS12DP256B micro using codewarrior v1.2. I am
> attempting to develop code so the firmware is field upgradable. Does
> anyone have any handy hints on where to find some good documentation
> or code example on how to go about this in codewarrior.
>
> Kind Regards,
>
> John Pititto. > ------------------------ Yahoo! Groups Sponsor
> ---------------------~--> Rent DVDs from home. Over 14,500
> titles. Free Shipping & No Late Fees. Try Netflix for FREE!
> http://us.click.yahoo.com/I3w.vC/hP.FAA/3jkFAA/dN_tlB/TM
>
> --------------------------
> -------~->
>
> -------------------- >
> ">http://docs.yahoo.com/info/terms/
>




I am in the middle of developing a bootloader in my application as well. I handle the interrupts exactly as John does.

My bootloader exists from $E000 to $F7FF. The rest of memory I use for the application. How do you handle updating memory in Block 0. in particular how do you handle $C000 to$DFFF? Do you put the actual flash interface code in EEPROM or in RAM?

Thanks for your input on this problem.

Steve Dillier
HighPoint Technology.
----- Original Message -----
From: John Theofanopoulos
To:
Sent: Monday, November 03, 2003 6:26 AM
Subject: RE: [68HC12] BootLoader in Codewarrior for HC12 John,

Bootcode is really not that much different than application code.
Differences include where you locate it in the memory map (you need to
place it in the protected flash area at the top, in the upper range of
the $3F page). I would also recommend figuring out how to handle
interrupts. The HCS12 has only one ISR location and as such, it
presents an interesting problem when you want to have your boot code and
your main code use their own interrupts. Motorola has an app note on
how to handle that, but I've used an entirely different way. I
basically set my true vector table pointing to a location in ram
($3F64-$3FFF). Then when each app starts up (bootcode, app
code,whatever), it copies its vector table into that RAM location,
before enabling the interrupts. Works really nice.
You should also determine your methods for field upgrades
(RS232/CAN/etc) and work that out as well. For my uses there's no other
way than CAN, but you may decide RS232 is better.
Also, if you are using Codewarrior, you may want to download the
Motorola Flash drivers. They don't work too well with other compilers,
and IMO, they are a bit on the large side, but it's a good start.

Anyway, hope that helps in some way.

John
http://embedded.mistekllc.com
> -----Original Message-----
> From: johnpititto1976 [mailto:]
> Sent: Sunday, November 02, 2003 7:01 AM
> To:
> Subject: [68HC12] BootLoader in Codewarrior for HC12 > Hi ladies and Gents,
>
> I am developing a MC68HCS12DP256B micro using codewarrior v1.2. I am
> attempting to develop code so the firmware is field upgradable. Does
> anyone have any handy hints on where to find some good documentation
> or code example on how to go about this in codewarrior.
>
> Kind Regards,
>
> John Pititto. > ------------------------ Yahoo! Groups Sponsor
> ---------------------~--> Rent DVDs from home. Over 14,500
> titles. Free Shipping & No Late Fees. Try Netflix for FREE!
> http://us.click.yahoo.com/I3w.vC/hP.FAA/3jkFAA/dN_tlB/TM
>
> --------------------------
> -------~->
>
> -------------------- >
> ">http://docs.yahoo.com/info/terms/
>


Yahoo! Groups Sponsor
--------------------



Steve
Why not just use a Tech Arts BDM POD and their bootloader software? We
use this technique along with Hyperterminal to change firmware in
student lab experiments all the time. We take the .s19 file out of
codewarrior, use setrectvect to re-align it, then use Hterminal to send
it. Takes about 20 seconds.
Stewart Prince
Professor, Mech Eng
CSUN

Steve-HighPoint wrote:

>I am in the middle of developing a bootloader in my application as well. I handle the interrupts exactly as John does.
>
>My bootloader exists from $E000 to $F7FF. The rest of memory I use for the application. How do you handle updating memory in Block 0. in particular how do you handle $C000 to$DFFF? Do you put the actual flash interface code in EEPROM or in RAM?
>
>Thanks for your input on this problem.
>
>Steve Dillier
>HighPoint Technology.
> ----- Original Message -----
> From: John Theofanopoulos
> To:
> Sent: Monday, November 03, 2003 6:26 AM
> Subject: RE: [68HC12] BootLoader in Codewarrior for HC12 > John,
>
> Bootcode is really not that much different than application code.
> Differences include where you locate it in the memory map (you need to
> place it in the protected flash area at the top, in the upper range of
> the $3F page). I would also recommend figuring out how to handle
> interrupts. The HCS12 has only one ISR location and as such, it
> presents an interesting problem when you want to have your boot code and
> your main code use their own interrupts. Motorola has an app note on
> how to handle that, but I've used an entirely different way. I
> basically set my true vector table pointing to a location in ram
> ($3F64-$3FFF). Then when each app starts up (bootcode, app
> code,whatever), it copies its vector table into that RAM location,
> before enabling the interrupts. Works really nice.
> You should also determine your methods for field upgrades
> (RS232/CAN/etc) and work that out as well. For my uses there's no other
> way than CAN, but you may decide RS232 is better.
> Also, if you are using Codewarrior, you may want to download the
> Motorola Flash drivers. They don't work too well with other compilers,
> and IMO, they are a bit on the large side, but it's a good start.
>
> Anyway, hope that helps in some way.
>
> John
> http://embedded.mistekllc.com >
> > -----Original Message-----
> > From: johnpititto1976 [mailto:]
> > Sent: Sunday, November 02, 2003 7:01 AM
> > To:
> > Subject: [68HC12] BootLoader in Codewarrior for HC12
> >
> >
> > Hi ladies and Gents,
> >
> > I am developing a MC68HCS12DP256B micro using codewarrior v1.2. I am
> > attempting to develop code so the firmware is field upgradable. Does
> > anyone have any handy hints on where to find some good documentation
> > or code example on how to go about this in codewarrior.
> >
> > Kind Regards,
> >
> > John Pititto.
> >
> >
> > ------------------------ Yahoo! Groups Sponsor
> > ---------------------~--> Rent DVDs from home. Over 14,500
> > titles. Free Shipping & No Late Fees. Try Netflix for FREE!
> > http://us.click.yahoo.com/I3w.vC/hP.FAA/3jkFAA/dN_tlB/TM
> >
> > --------------------------
> > -------~->
> >
> > --------------------
> >
> >
> >
> > ">http://docs.yahoo.com/info/terms/
> > Yahoo! Groups Sponsor >
> -------------------- >
> ">http://docs.yahoo.com/info/terms/


John,

See AN2153, A Serial Bootloader for Reprogramming the MC9S12DP256 FLASH
Memory.

Regards,
Gordon

johnpititto1976 wrote:

>Hi ladies and Gents,
>
>I am developing a MC68HCS12DP256B micro using codewarrior v1.2. I am
>attempting to develop code so the firmware is field upgradable. Does
>anyone have any handy hints on where to find some good documentation
>or code example on how to go about this in codewarrior.
>
>Kind Regards,
>
>John Pititto. >
>-------------------- >
>">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.rtcbooks.com/programming.php