EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

CAN Bootloader

Started by Graham Tricker February 15, 2005
I am currently implementing a CAN Bootloader, I am using the Bootloader
saved in the file store of this group and the Bootloader documented in
AN1828/D as reference.
I have a question regarding running the Bootloader from RAM, we currently
use the serial Bootloader from the freescale site, this copies itself into
RAM and moves RAM to the upper 4k of flash to overlay the Bootloader
allowing all other flash locations to be programmed. I cannot see in either
of the CAN Bootloaders RAM being moved to the upper 4k of flash.

Does anyone know if I am missing something here, should the RAM be moved as
with the serial version as I believe it should be?

Thanks in advance

Graham
**********************************************************************
This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.
Although BERU F1 SYSTEMS believe this e-mail and any attachments are free of any virus or other defect which may affect a computer, it is the responsibility of the recipient to ensure that it is virus free and BERU F1 SYSTEMS do not accept any responsibility for any loss or damage arising in any way from its use.
This footnote confirms that this email message has been swept by MAILSweeper.
**********************************************************************



Which mcu are we talking about? I don't know of any where the RAM
would be overlaping the Flash. In fact, I thought moving RAM to upper
4K would in fact cover part of Flash. Or what upper 4K are we talking
about?

--- In , Graham Tricker <Graham.Tricker@F...> wrote:
> I am currently implementing a CAN Bootloader, I am using the Bootloader
> saved in the file store of this group and the Bootloader documented in
> AN1828/D as reference.
> I have a question regarding running the Bootloader from RAM, we
currently
> use the serial Bootloader from the freescale site, this copies
itself into
> RAM and moves RAM to the upper 4k of flash to overlay the Bootloader
> allowing all other flash locations to be programmed. I cannot see in
either
> of the CAN Bootloaders RAM being moved to the upper 4k of flash.
>
> Does anyone know if I am missing something here, should the RAM be
moved as
> with the serial version as I believe it should be?
>
> Thanks in advance
>
> Graham



Graham,

The main reason to copy and execute from RAM is to allow to erase/reprogram
the flash page where bootloader is stored, excepting the bootloader itself.

Jordi Costa

----- Original Message -----
From: "Graham Tricker" <>
To: <>
Sent: Tuesday, February 15, 2005 6:29 PM
Subject: [68HC12] CAN Bootloader >
> I am currently implementing a CAN Bootloader, I am using the Bootloader
> saved in the file store of this group and the Bootloader documented in
> AN1828/D as reference.
> I have a question regarding running the Bootloader from RAM, we currently
> use the serial Bootloader from the freescale site, this copies itself into
> RAM and moves RAM to the upper 4k of flash to overlay the Bootloader
> allowing all other flash locations to be programmed. I cannot see in
either
> of the CAN Bootloaders RAM being moved to the upper 4k of flash.
>
> Does anyone know if I am missing something here, should the RAM be moved
as
> with the serial version as I believe it should be?
>
> Thanks in advance
>
> Graham
>


Hi Jordi,

Yes I understand this, the problem I have is that the serial Bootloader I
use at the minute writes to the INITRM register to move the RAM to the top
16k address location, so the rest of the flash can be programmed except the
Bootloader. The two CAN Bootloaders I am using as reference get copied into
RAM via a LRAE but do not appear to write to this register thus leaving the
RAM in its default location, I am trying to ascertain if there is a reason
for the RAM being left in its default location.

Graham

-----Original Message-----
From: Jordi Costa [mailto:]
Sent: 16 February 2005 08:14
To:
Subject: Re: [68HC12] CAN Bootloader

Graham,

The main reason to copy and execute from RAM is to allow to erase/reprogram
the flash page where bootloader is stored, excepting the bootloader itself.

Jordi Costa

----- Original Message -----
From: "Graham Tricker" <>
To: <>
Sent: Tuesday, February 15, 2005 6:29 PM
Subject: [68HC12] CAN Bootloader >
> I am currently implementing a CAN Bootloader, I am using the Bootloader
> saved in the file store of this group and the Bootloader documented in
> AN1828/D as reference.
> I have a question regarding running the Bootloader from RAM, we currently
> use the serial Bootloader from the freescale site, this copies itself into
> RAM and moves RAM to the upper 4k of flash to overlay the Bootloader
> allowing all other flash locations to be programmed. I cannot see in
either
> of the CAN Bootloaders RAM being moved to the upper 4k of flash.
>
> Does anyone know if I am missing something here, should the RAM be moved
as
> with the serial version as I believe it should be?
>
> Thanks in advance
>
> Graham
>

<http://us.ard.yahoo.com/SIG9nov242/M)8184.6018725.7038619.3001176/D=gr
oups/S06554205:HM/EXP08627889/A%32114/R=2/SIGko0j2b6/*http://clk.
atdmt.com/NFX/go/yhxxxnfx0020000014nfx/direct/01/&time08541489367695 <http://us.adserver.yahoo.com/l?M)8184.6018725.7038619.3001176/D=groups/S=
:HM/A%32114/rand@6768377>

_____

> Service.




Graham,

The main reason to move the RAM to the top of the memory, is if you want to
process interrupts while executing the Flash programming algorithms from
the internal RAM (since the high Flash page is available to supply the
interrupt vector when this Flash block is being updated).

If you are sure there will be no interrupt requests, moving the RAM is not
necessary - you can execute from the RAM in its default Reset location.

Hope this helps,
Doron
Nohau Corporation
HC12 In-Circuit Emulators
www.nohau.com/emul12pc.html

At 08:53 16/02/2005 +0000, you wrote:

>Hi Jordi,
>
>Yes I understand this, the problem I have is that the serial Bootloader I
>use at the minute writes to the INITRM register to move the RAM to the top
>16k address location, so the rest of the flash can be programmed except the
>Bootloader. The two CAN Bootloaders I am using as reference get copied into
>RAM via a LRAE but do not appear to write to this register thus leaving the
>RAM in its default location, I am trying to ascertain if there is a reason
>for the RAM being left in its default location.
>
>Graham
>
>-----Original Message-----
>From: Jordi Costa [mailto:]
>Sent: 16 February 2005 08:14
>To:
>Subject: Re: [68HC12] CAN Bootloader
>
>Graham,
>
>The main reason to copy and execute from RAM is to allow to erase/reprogram
>the flash page where bootloader is stored, excepting the bootloader itself.
>
>Jordi Costa
>
>----- Original Message -----
>From: "Graham Tricker" <>
>To: <>
>Sent: Tuesday, February 15, 2005 6:29 PM
>Subject: [68HC12] CAN Bootloader > >
> > I am currently implementing a CAN Bootloader, I am using the Bootloader
> > saved in the file store of this group and the Bootloader documented in
> > AN1828/D as reference.
> > I have a question regarding running the Bootloader from RAM, we currently
> > use the serial Bootloader from the freescale site, this copies itself into
> > RAM and moves RAM to the upper 4k of flash to overlay the Bootloader
> > allowing all other flash locations to be programmed. I cannot see in
>either
> > of the CAN Bootloaders RAM being moved to the upper 4k of flash.
> >
> > Does anyone know if I am missing something here, should the RAM be moved
>as
> > with the serial version as I believe it should be?
> >
> > Thanks in advance
> >
> > Graham
> >
>
><http://us.ard.yahoo.com/SIG9nov242/M)8184.6018725.7038619.3001176/D=gr
>oups/S06554205:HM/EXP08627889/A%32114/R=2/SIGko0j2b6/*http://clk.
>atdmt.com/NFX/go/yhxxxnfx0020000014nfx/direct/01/&time08541489367695 ><http://us.adserver.yahoo.com/l?M)8184.6018725.7038619.3001176/D=groups/S=
>:HM/A%32114/rand@6768377>
>
> _____
>
>> Service. >
>
>Yahoo! Groups Links >
>





It would paint a better picture if you could say
- Which MCU (MC68HC912BC32 ?)
- What value of INITRM is being written (0xf8 ?)

--- In , Graham Tricker <Graham.Tricker@F...> wrote:
> Hi Jordi,
>
> Yes I understand this, the problem I have is that the serial
Bootloader I
> use at the minute writes to the INITRM register to move the RAM to
the top
> 16k address location, so the rest of the flash can be programmed
except the
> Bootloader. The two CAN Bootloaders I am using as reference get
copied into
> RAM via a LRAE but do not appear to write to this register thus
leaving the
> RAM in its default location, I am trying to ascertain if there is a
reason
> for the RAM being left in its default location.
>
> Graham
>
> -----Original Message-----
> From: Jordi Costa [mailto:bvjordi@b...]
> Sent: 16 February 2005 08:14
> To:
> Subject: Re: [68HC12] CAN Bootloader
>
> Graham,
>
> The main reason to copy and execute from RAM is to allow to
erase/reprogram
> the flash page where bootloader is stored, excepting the bootloader
itself.
>
> Jordi Costa
>
> ----- Original Message -----
> From: "Graham Tricker" <Graham.Tricker@F...>
> To: <>
> Sent: Tuesday, February 15, 2005 6:29 PM
> Subject: [68HC12] CAN Bootloader > >
> > I am currently implementing a CAN Bootloader, I am using the
Bootloader
> > saved in the file store of this group and the Bootloader documented in
> > AN1828/D as reference.
> > I have a question regarding running the Bootloader from RAM, we
currently
> > use the serial Bootloader from the freescale site, this copies
itself into
> > RAM and moves RAM to the upper 4k of flash to overlay the Bootloader
> > allowing all other flash locations to be programmed. I cannot see in
> either
> > of the CAN Bootloaders RAM being moved to the upper 4k of flash.
> >
> > Does anyone know if I am missing something here, should the RAM be
moved
> as
> > with the serial version as I believe it should be?
> >
> > Thanks in advance
> >
> > Graham
>
<http://us.ard.yahoo.com/SIG9nov242/M)8184.6018725.7038619.3001176/D=gr
>
oups/S06554205:HM/EXP08627889/A%32114/R=2/SIGko0j2b6/*http://clk.
>
atdmt.com/NFX/go/yhxxxnfx0020000014nfx/direct/01/&time08541489367695>
<http://us.adserver.yahoo.com/l?M)8184.6018725.7038619.3001176/D=groups/S=
> :HM/A%32114/rand@6768377>
>
> _____
>
> > Service. >



I think Doron has answered my question in his mail earlier, the CAN
bootloaders I am using as reference do not use interrupts and hence do not
need RAM to be moved. It will be a few days before I can test this as I have
just got the LRAE compiled and running within our environment and have to
write the PC app to load the Bootloader and get this running before I even
think about flashing the processor. Just trying to pre-empt any pitfalls in
advance.

Just to clarify our MCU is the MC9S12DP256 and my existing serial Bootloader
writes 0xC1 to the INITRM register.

Cheers

Graham

-----Original Message-----
From: Jefferson Smith [mailto:]
Sent: 16 February 2005 16:02
To:
Subject: [68HC12] Re: CAN Bootloader It would paint a better picture if you could say
- Which MCU (MC68HC912BC32 ?)
- What value of INITRM is being written (0xf8 ?)

--- In , Graham Tricker <Graham.Tricker@F...> wrote:
> Hi Jordi,
>
> Yes I understand this, the problem I have is that the serial
Bootloader I
> use at the minute writes to the INITRM register to move the RAM to
the top
> 16k address location, so the rest of the flash can be programmed
except the
> Bootloader. The two CAN Bootloaders I am using as reference get
copied into
> RAM via a LRAE but do not appear to write to this register thus
leaving the
> RAM in its default location, I am trying to ascertain if there is a
reason
> for the RAM being left in its default location.
>
> Graham
>
> -----Original Message-----
> From: Jordi Costa [mailto:bvjordi@b...]
> Sent: 16 February 2005 08:14
> To:
> Subject: Re: [68HC12] CAN Bootloader
>
> Graham,
>
> The main reason to copy and execute from RAM is to allow to
erase/reprogram
> the flash page where bootloader is stored, excepting the bootloader
itself.
>
> Jordi Costa
>
> ----- Original Message -----
> From: "Graham Tricker" <Graham.Tricker@F...>
> To: <>
> Sent: Tuesday, February 15, 2005 6:29 PM
> Subject: [68HC12] CAN Bootloader > >
> > I am currently implementing a CAN Bootloader, I am using the
Bootloader
> > saved in the file store of this group and the Bootloader documented in
> > AN1828/D as reference.
> > I have a question regarding running the Bootloader from RAM, we
currently
> > use the serial Bootloader from the freescale site, this copies
itself into
> > RAM and moves RAM to the upper 4k of flash to overlay the Bootloader
> > allowing all other flash locations to be programmed. I cannot see in
> either
> > of the CAN Bootloaders RAM being moved to the upper 4k of flash.
> >
> > Does anyone know if I am missing something here, should the RAM be
moved
> as
> > with the serial version as I believe it should be?
> >
> > Thanks in advance
> >
> > Graham
>
<
http://us.ard.yahoo.com/SIG9nov242/M)8184.6018725.7038619.3001176/D=gr
<http://us.ard.yahoo.com/SIG9nov242/M)8184.6018725.7038619.3001176/D=gr
>
>
oups/S06554205:HM/EXP08627889/A%32114/R=2/SIGko0j2b6/*
http://clk. <http://clk.>
>
atdmt.com/NFX/go/yhxxxnfx0020000014nfx/direct/01/&time08541489367695>
<
http://us.adserver.yahoo.com/l?M)8184.6018725.7038619.3001176/D=groups/S=
<http://us.adserver.yahoo.com/l?M)8184.6018725.7038619.3001176/D=groups/S=
>
> :HM/A%32114/rand@6768377>
>
> _____
>
> <http://docs.yahoo.com/info/terms/> >
Service.


<http://us.ard.yahoo.com/SIG997kohg/M)8184.6018725.7038619.3001176/D=gr
oups/S06554205:HM/EXP08656142/A%32114/R=2/SIGkc51rq0/*http://clk.
atdmt.com/NFX/go/yhxxxnfx0020000014nfx/direct/01/&time08569742201664 <http://us.adserver.yahoo.com/l?M)8184.6018725.7038619.3001176/D=groups/S=
:HM/A%32114/rand2706984>

_____

> Service.





Does the serial bootloader you got from freescale actually work? The
one I have is in assembly and it is from freescale. I have found
several errors just by looking at the code. Did you have to rewrite
the code to get it to work and if you did may I have a copy of the
rewritten code. If not may I have your number to get a few pointers?

Bob Elliott

--- In , Graham Tricker <Graham.Tricker@F...>
wrote:
> I am currently implementing a CAN Bootloader, I am using the
Bootloader
> saved in the file store of this group and the Bootloader
documented in
> AN1828/D as reference.
> I have a question regarding running the Bootloader from RAM, we
currently
> use the serial Bootloader from the freescale site, this copies
itself into
> RAM and moves RAM to the upper 4k of flash to overlay the
Bootloader
> allowing all other flash locations to be programmed. I cannot see
in either
> of the CAN Bootloaders RAM being moved to the upper 4k of flash.
>
> Does anyone know if I am missing something here, should the RAM be
moved as
> with the serial version as I believe it should be?
>
> Thanks in advance
>
> Graham >
>
*********************************************************************
*
> This message contains confidential information and is intended
only for the individual named. If you are not the named addressee
you should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this e-
mail by mistake and delete this e-mail from your system.
> Although BERU F1 SYSTEMS believe this e-mail and any attachments
are free of any virus or other defect which may affect a computer,
it is the responsibility of the recipient to ensure that it is virus
free and BERU F1 SYSTEMS do not accept any responsibility for any
loss or damage arising in any way from its use.
> This footnote confirms that this email message has been swept by
MAILSweeper.
>
*********************************************************************
*
>




Re: CAN Bootloader
I'm investigating a CAN bootloader for my myself and I have a couple of
general uninformed questions:

Is this loader conformant with any of the higher level CAN implementations
like canopen, etc?

I had a cursory look under the hood and see two builds - one for the flash
the other for sram. Could not a single bootload sector have been feasible
using a stack copy scheme for the flash programming func?

What server side issues do I need to consider?


The Bootloader I have is also assembler, I compiled the Bootloader using
Cosmic Idea, and don't recall having any major problems especially
considering my assembler is quite limited. I found one bug which I believe I
documented on this group a while ago, I had a product with a keypad
connected to port A and moving the keypad caused the Bootloader to fail. I
tracked it down to the line.

cmpb SRecLow,pcr

this was comparing b against the value at address $00 which happens to be
port A input register, I changed to the following and all seems ok now

cmpb #SRecLow>>16

We have been running this Bootloader in several products for the past couple
of years and has been running fine, bar the occasional unexplained failure
to bootload in the field.

Hope this helps, I would be interested to hear if you have found any other
bugs which may manifest themselves in the future though.

Graham

-----Original Message-----
From: robertodellelliott [mailto:]
Sent: 23 February 2005 13:34
To:
Subject: [68HC12] Re: CAN Bootloader Does the serial bootloader you got from freescale actually work? The
one I have is in assembly and it is from freescale. I have found
several errors just by looking at the code. Did you have to rewrite
the code to get it to work and if you did may I have a copy of the
rewritten code. If not may I have your number to get a few pointers?

Bob Elliott

--- In , Graham Tricker <Graham.Tricker@F...>
wrote:
> I am currently implementing a CAN Bootloader, I am using the
Bootloader
> saved in the file store of this group and the Bootloader
documented in
> AN1828/D as reference.
> I have a question regarding running the Bootloader from RAM, we
currently
> use the serial Bootloader from the freescale site, this copies
itself into
> RAM and moves RAM to the upper 4k of flash to overlay the
Bootloader
> allowing all other flash locations to be programmed. I cannot see
in either
> of the CAN Bootloaders RAM being moved to the upper 4k of flash.
>
> Does anyone know if I am missing something here, should the RAM be
moved as
> with the serial version as I believe it should be?
>
> Thanks in advance
>
> Graham >
>
*********************************************************************
*
> This message contains confidential information and is intended
only for the individual named. If you are not the named addressee
you should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this e-
mail by mistake and delete this e-mail from your system.
> Although BERU F1 SYSTEMS believe this e-mail and any attachments
are free of any virus or other defect which may affect a computer,
it is the responsibility of the recipient to ensure that it is virus
free and BERU F1 SYSTEMS do not accept any responsibility for any
loss or damage arising in any way from its use.
> This footnote confirms that this email message has been swept by
MAILSweeper.
>
*********************************************************************
*
>


_____

> Service.





The 2024 Embedded Online Conference