EmbeddedRelated.com
Forums
Memfault Beyond the Launch

HC912DG128A : bootloader in non-banked memory ?

Started by yann_37 December 15, 2005
Hello,
I'm working on a HC912DG128A.
Apparently, it is possible to put a bootloader in the non-banked memory
($4000-$7FFF and $C000-$FFFF). You can also erase and program banked
memory (6 pages from $8000-$BFFF).
My problem is about the predefined sections that must be in non-banked
memory : ROM_VAR (application constant variables), STRINGS
(application string constants), COPY (initialization values for the
application variables).
If the new code that the bootloader will put in flash memory contains
new variables, it will create changes in these sections, so it won't
work ?
Is it possible to put these sections in banked memory ?
Does anybody have a solution ?
Am I obliged to copy and run the bootloader in RAM ?


you should look at the Serial Bootloader from Freescale AN2153. The document
explains how he built the bootloader and why you need to move it to move the
bootloader to RAM. You will also find the SW files within AN2153_SW.

_____

From: 68HC12@68HC... [mailto:68HC12@68HC...] On Behalf Of
yann_37
Sent: December 15, 2005 9:16 AM
To: 68HC12@68HC...
Subject: [68HC12] HC912DG128A : bootloader in non-banked memory ? Hello,
I'm working on a HC912DG128A.
Apparently, it is possible to put a bootloader in the non-banked memory
($4000-$7FFF and $C000-$FFFF). You can also erase and program banked
memory (6 pages from $8000-$BFFF).
My problem is about the predefined sections that must be in non-banked
memory : ROM_VAR (application constant variables), STRINGS
(application string constants), COPY (initialization values for the
application variables).
If the new code that the bootloader will put in flash memory contains
new variables, it will create changes in these sections, so it won't
work ?
Is it possible to put these sections in banked memory ?
Does anybody have a solution ?
Am I obliged to copy and run the bootloader in RAM ? SPONSORED LINKS
Freescale
<http://groups.yahoo.com/gads?t=ms&k=Freescale+semiconductor+inc&w1=Freescal
e+semiconductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+micr
oprocessor&c=4&s6&.sig=K2HGv-zFlv5OYUv_QxIq_Q> semiconductor inc
Microcontrollers
<http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Freescale+semicondu
ctor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocessor&
c=4&s6&.sig=SYHwNJjjGQXRvtt_GybT4g> Pic
<http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Freescale+semic
onductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microproces
sor&c=4&s6&.sig=umVbbnUwsPzEzKKD_pQfUw> microcontrollers
8051
<http://groups.yahoo.com/gads?t=ms&k51+microprocessor&w1=Freescale+semico
nductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocess
or&c=4&s6&.sig=NO-nSKjHoAlh9XtZ8LB1_A> microprocessor

_____

> .


_____



AN2166 is about erasing and programming flash EEPROM on DG128A and explains that
you can run a program in non-banked memory to erase or flash banked memory.
So why not a bootloader ?
> you should look at the Serial Bootloader from Freescale AN2153. The document
> explains how he built the bootloader and why you need to move it to move the
> bootloader to RAM. You will also find the SW files within AN2153_SW.
>
> _____
>
> From: 68HC12@68HC... [mailto:68HC12@68HC...] On Behalf Of
> yann_37
> Sent: December 15, 2005 9:16 AM
> To: 68HC12@68HC...
> Subject: [68HC12] HC912DG128A : bootloader in non-banked memory ? > Hello,
> I'm working on a HC912DG128A.
> Apparently, it is possible to put a bootloader in the non-banked memory
> ($4000-$7FFF and $C000-$FFFF). You can also erase and program banked
> memory (6 pages from $8000-$BFFF).
> My problem is about the predefined sections that must be in non-banked
> memory : ROM_VAR (application constant variables), STRINGS
> (application string constants), COPY (initialization values for the
> application variables).
> If the new code that the bootloader will put in flash memory contains
> new variables, it will create changes in these sections, so it won't
> work ?
> Is it possible to put these sections in banked memory ?
> Does anybody have a solution ?
> Am I obliged to copy and run the bootloader in RAM ? > SPONSORED LINKS
> Freescale
> <http://groups.yahoo.com/gads?t=ms&k=Freescale+semiconductor+inc&w1=Freescal
> e+semiconductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+micr
> oprocessor&c=4&s6&.sig=K2HGv-zFlv5OYUv_QxIq_Q> semiconductor inc
> Microcontrollers
> <http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Freescale+semicondu
> ctor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocessor&
> c=4&s6&.sig=SYHwNJjjGQXRvtt_GybT4g> Pic
> <http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Freescale+semic
> onductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microproces
> sor&c=4&s6&.sig=umVbbnUwsPzEzKKD_pQfUw> microcontrollers
> 8051
> <http://groups.yahoo.com/gads?t=ms&k51+microprocessor&w1=Freescale+semico
> nductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocess
> or&c=4&s6&.sig=NO-nSKjHoAlh9XtZ8LB1_A> microprocessor
>
> _____
>
> > . > _____ >
>
> Yahoo! Groups Links >
>


The DG128 has two blocks. You can run a program in one block to program the
other block. However, if you want to program parts of the same block that
the bootlader is in then you have to be running the code from RAM. When I
created a bootloader I simply copied the few small writing routines into RAM
rather than the entire bootloader.
-----Original Message-----
From: 68HC12@68HC... [mailto:68HC12@68HC...] On Behalf Of
y...@y.se...
Sent: Thursday, December 15, 2005 9:16 AM
To: 68HC12@68HC...
Subject: RE: [68HC12] HC912DG128A : bootloader in non-banked memory ?

AN2166 is about erasing and programming flash EEPROM on DG128A and explains
that you can run a program in non-banked memory to erase or flash banked
memory.
So why not a bootloader ?
> you should look at the Serial Bootloader from Freescale AN2153. The
> document explains how he built the bootloader and why you need to move
> it to move the bootloader to RAM. You will also find the SW files within
AN2153_SW.
>
> _____
>
> From: 68HC12@68HC... [mailto:68HC12@68HC...] On Behalf
> Of
> yann_37
> Sent: December 15, 2005 9:16 AM
> To: 68HC12@68HC...
> Subject: [68HC12] HC912DG128A : bootloader in non-banked memory ? > Hello,
> I'm working on a HC912DG128A.
> Apparently, it is possible to put a bootloader in the non-banked
> memory ($4000-$7FFF and $C000-$FFFF). You can also erase and program
> banked memory (6 pages from $8000-$BFFF).
> My problem is about the predefined sections that must be in non-banked
> memory : ROM_VAR (application constant variables), STRINGS
> (application string constants), COPY (initialization values for the
> application variables).
> If the new code that the bootloader will put in flash memory contains
> new variables, it will create changes in these sections, so it won't
> work ?
> Is it possible to put these sections in banked memory ?
> Does anybody have a solution ?
> Am I obliged to copy and run the bootloader in RAM ? > SPONSORED LINKS
> Freescale
> <http://groups.yahoo.com/gads?t=ms&k=Freescale+semiconductor+inc&w1=Fr
> eescal
> e+semiconductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w45
> e+semiconductor+1+micr
> oprocessor&c=4&s6&.sig=K2HGv-zFlv5OYUv_QxIq_Q> semiconductor inc
> Microcontrollers
> <http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Freescale+sem
> icondu
> ctor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microproc
> ctor+essor&
> c=4&s6&.sig=SYHwNJjjGQXRvtt_GybT4g> Pic
> <http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Freescale
> +semic
> onductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+micro
> onductor+proces
> sor&c=4&s6&.sig=umVbbnUwsPzEzKKD_pQfUw> microcontrollers
> 8051
> <http://groups.yahoo.com/gads?t=ms&k51+microprocessor&w1=Freescale+
> semico
> nductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microp
> nductor+rocess
> or&c=4&s6&.sig=NO-nSKjHoAlh9XtZ8LB1_A> microprocessor
>
> _____
>
> > . > _____ >
>
> Yahoo! Groups Links >
>

------------------------ Yahoo! Groups Sponsor --------------------~--> Get
Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/dN_tlB/TM
--------------------------------~- Yahoo! Groups Links


I'd like to program only one part but apparently, some sections used by the
assembler must be in the same part than the bootloader (see my first post).
I'm trying to use the bootloader without copying it in RAM because the examples
I've found use "pcr" or relative addressing mode and my assembler fails with
that. The bootloader is in assembler and I put it in a C program by using the
"asm" command. I have a lot of label addressing mode errors or something like
this.
Do I have to put the bootloader in an asm file, then assembly it and then
include it in the main project with the C program ? > The DG128 has two blocks. You can run a program in one block to program the
> other block. However, if you want to program parts of the same block that
> the bootlader is in then you have to be running the code from RAM. When I
> created a bootloader I simply copied the few small writing routines into RAM
> rather than the entire bootloader. >
> -----Original Message-----
> From: 68HC12@68HC... [mailto:68HC12@68HC...] On Behalf Of
> y...@y.se...
> Sent: Thursday, December 15, 2005 9:16 AM
> To: 68HC12@68HC...
> Subject: RE: [68HC12] HC912DG128A : bootloader in non-banked memory ?
>
> AN2166 is about erasing and programming flash EEPROM on DG128A and explains
> that you can run a program in non-banked memory to erase or flash banked
> memory.
> So why not a bootloader ? >
> > you should look at the Serial Bootloader from Freescale AN2153. The
> > document explains how he built the bootloader and why you need to move
> > it to move the bootloader to RAM. You will also find the SW files within
> AN2153_SW.
> >
> > _____
> >
> > From: 68HC12@68HC... [mailto:68HC12@68HC...] On Behalf
> > Of
> > yann_37
> > Sent: December 15, 2005 9:16 AM
> > To: 68HC12@68HC...
> > Subject: [68HC12] HC912DG128A : bootloader in non-banked memory ?
> >
> >
> > Hello,
> > I'm working on a HC912DG128A.
> > Apparently, it is possible to put a bootloader in the non-banked
> > memory ($4000-$7FFF and $C000-$FFFF). You can also erase and program
> > banked memory (6 pages from $8000-$BFFF).
> > My problem is about the predefined sections that must be in non-banked
> > memory : ROM_VAR (application constant variables), STRINGS
> > (application string constants), COPY (initialization values for the
> > application variables).
> > If the new code that the bootloader will put in flash memory contains
> > new variables, it will create changes in these sections, so it won't
> > work ?
> > Is it possible to put these sections in banked memory ?
> > Does anybody have a solution ?
> > Am I obliged to copy and run the bootloader in RAM ?
> >
> >
> >
> >
> >
> >
> >
> >
> > SPONSORED LINKS
> > Freescale
> > <http://groups.yahoo.com/gads?t=ms&k=Freescale+semiconductor+inc&w1=Fr
> > eescal
> > e+semiconductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w45
> > e+semiconductor+1+micr
> > oprocessor&c=4&s6&.sig=K2HGv-zFlv5OYUv_QxIq_Q> semiconductor inc
> > Microcontrollers
> > <http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Freescale+sem
> > icondu
> > ctor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microproc
> > ctor+essor&
> > c=4&s6&.sig=SYHwNJjjGQXRvtt_GybT4g> Pic
> > <http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Freescale
> > +semic
> > onductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+micro
> > onductor+proces
> > sor&c=4&s6&.sig=umVbbnUwsPzEzKKD_pQfUw> microcontrollers
> > 8051
> > <http://groups.yahoo.com/gads?t=ms&k51+microprocessor&w1=Freescale+
> > semico
> > nductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microp
> > nductor+rocess
> > or&c=4&s6&.sig=NO-nSKjHoAlh9XtZ8LB1_A> microprocessor
> >
> > _____
> >
> > > .
> >
> >
> > _____
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
>
> ------------------------ Yahoo! Groups Sponsor --------------------~--> Get
> Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
> http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/dN_tlB/TM
> --------------------------------~- > Yahoo! Groups Links >
> Yahoo! Groups Links


Have you tried codewarrior special edition? This free edition will allow you
to compile, program and debug up to 12k of user code. The version I have
(3.1) does support relative addressing (pcr).

_____

From: 68HC12@68HC... [mailto:68HC12@68HC...] On Behalf Of
y...@y.se...
Sent: December 15, 2005 4:56 PM
To: 68HC12@68HC...
Subject: RE: [68HC12] HC912DG128A : bootloader in non-banked memory ? I'd like to program only one part but apparently, some sections used by the
assembler must be in the same part than the bootloader (see my first post).
I'm trying to use the bootloader without copying it in RAM because the
examples
I've found use "pcr" or relative addressing mode and my assembler fails with
that. The bootloader is in assembler and I put it in a C program by using
the
"asm" command. I have a lot of label addressing mode errors or something
like
this.
Do I have to put the bootloader in an asm file, then assembly it and then
include it in the main project with the C program ? > The DG128 has two blocks. You can run a program in one block to program
the
> other block. However, if you want to program parts of the same block that
> the bootlader is in then you have to be running the code from RAM. When I
> created a bootloader I simply copied the few small writing routines into
RAM
> rather than the entire bootloader. >
> -----Original Message-----
> From: 68HC12@68HC... [mailto:68HC12@68HC...] On Behalf Of
> y...@y.se...
> Sent: Thursday, December 15, 2005 9:16 AM
> To: 68HC12@68HC...
> Subject: RE: [68HC12] HC912DG128A : bootloader in non-banked memory ?
>
> AN2166 is about erasing and programming flash EEPROM on DG128A and
explains
> that you can run a program in non-banked memory to erase or flash banked
> memory.
> So why not a bootloader ? >
> > you should look at the Serial Bootloader from Freescale AN2153. The
> > document explains how he built the bootloader and why you need to move
> > it to move the bootloader to RAM. You will also find the SW files within
> AN2153_SW.
> >
> > _____
> >
> > From: 68HC12@68HC... [mailto:68HC12@68HC...] On Behalf
> > Of
> > yann_37
> > Sent: December 15, 2005 9:16 AM
> > To: 68HC12@68HC...
> > Subject: [68HC12] HC912DG128A : bootloader in non-banked memory ?
> >
> >
> > Hello,
> > I'm working on a HC912DG128A.
> > Apparently, it is possible to put a bootloader in the non-banked
> > memory ($4000-$7FFF and $C000-$FFFF). You can also erase and program
> > banked memory (6 pages from $8000-$BFFF).
> > My problem is about the predefined sections that must be in non-banked
> > memory : ROM_VAR (application constant variables), STRINGS
> > (application string constants), COPY (initialization values for the
> > application variables).
> > If the new code that the bootloader will put in flash memory contains
> > new variables, it will create changes in these sections, so it won't
> > work ?
> > Is it possible to put these sections in banked memory ?
> > Does anybody have a solution ?
> > Am I obliged to copy and run the bootloader in RAM ?
> >
> >
> >
> >
> >
> >
> >
> >
> > SPONSORED LINKS
> > Freescale
> > <http://groups.yahoo.com/gads?t=ms
<http://groups.yahoo.com/gads?t=ms&k=Freescale+semiconductor+inc&w1=Fr>
&k=Freescale+semiconductor+inc&w1=Fr
> > eescal
> > e+semiconductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w45
> > e+semiconductor+1+micr
> > oprocessor&c=4&s6&.sig=K2HGv-zFlv5OYUv_QxIq_Q> semiconductor inc
> > Microcontrollers
> > <http://groups.yahoo.com/gads?t=ms
<http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Freescale+sem>
&k=Microcontrollers&w1=Freescale+sem
> > icondu
> > ctor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microproc
> > ctor+essor&
> > c=4&s6&.sig=SYHwNJjjGQXRvtt_GybT4g> Pic
> > <http://groups.yahoo.com/gads?t=ms
<http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Freescale>
&k=Pic+microcontrollers&w1=Freescale
> > +semic
> > onductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+micro
> > onductor+proces
> > sor&c=4&s6&.sig=umVbbnUwsPzEzKKD_pQfUw> microcontrollers
> > 8051
> > <http://groups.yahoo.com/gads?t=ms
<http://groups.yahoo.com/gads?t=ms&k51+microprocessor&w1=Freescale+>
&k51+microprocessor&w1=Freescale+
> > semico
> > nductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microp
> > nductor+rocess
> > or&c=4&s6&.sig=NO-nSKjHoAlh9XtZ8LB1_A> microprocessor
> >
> > _____
> >
> > > .
> >
> >
> > _____
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > .


_____



I am digging back in memory here so this may not be 100%. I made my bootloader lie in f800 to ffff and I did not use any pcr addressing. for the pseudovector table I simply did something along the lines of (in pseudocode)

FFDO:
ldx FFD0 - BOOTBLOCKSIZE
jmp 0,x

I did one of these labels and offsets for each possible interrupt.

For the Flash writing routines, instead of using PCR, I simply wrote it carefully in a fashion that would allow a jump to that address in RAM (where the routine would be copied to) and then, within that routine, used all relative addressing. Before I jumped to ram I woudl save the PC on the stack. At the end of the routine I think I simply popped the top of the stack into the program counter to return to FLASH. I would have to double check but if I recall, that is pretty close to what I did.

Easier than it sounds I am sure. :)

----
From: y...@y.se...
Sent: December 15, 2005 2:56 PM
To: 68HC12@68HC...
Subject: RE: [68HC12] HC912DG128A : bootloader in non-banked memory ?

I'd like to program only one part but apparently, some sections used by the
assembler must be in the same part than the bootloader (see my first post).
I'm trying to use the bootloader without copying it in RAM because the examples
I've found use "pcr" or relative addressing mode and my assembler fails with
that. The bootloader is in assembler and I put it in a C program by using the
"asm" command. I have a lot of label addressing mode errors or something like
this.
Do I have to put the bootloader in an asm file, then assembly it and then
include it in the main project with the C program ?

> The DG128 has two blocks. You can run a program in one block to program the
> other block. However, if you want to program parts of the same block that
> the bootlader is in then you have to be running the code from RAM. When I
> created a bootloader I simply copied the few small writing routines into RAM
> rather than the entire bootloader. >
> -----Original Message-----
> From: 68HC12@68HC... [mailto:68HC12@68HC...] On Behalf Of
> y...@y.se...
> Sent: Thursday, December 15, 2005 9:16 AM
> To: 68HC12@68HC...
> Subject: RE: [68HC12] HC912DG128A : bootloader in non-banked memory ?
>
> AN2166 is about erasing and programming flash EEPROM on DG128A and explains
> that you can run a program in non-banked memory to erase or flash banked
> memory.
> So why not a bootloader ? >
> > you should look at the Serial Bootloader from Freescale AN2153. The
> > document explains how he built the bootloader and why you need to move
> > it to move the bootloader to RAM. You will also find the SW files within
> AN2153_SW.
> >
> > _____
> >
> > From: 68HC12@68HC... [mailto:68HC12@68HC...] On Behalf
> > Of
> > yann_37
> > Sent: December 15, 2005 9:16 AM
> > To: 68HC12@68HC...
> > Subject: [68HC12] HC912DG128A : bootloader in non-banked memory ?
> >
> >
> > Hello,
> > I'm working on a HC912DG128A.
> > Apparently, it is possible to put a bootloader in the non-banked
> > memory ($4000-$7FFF and $C000-$FFFF). You can also erase and program
> > banked memory (6 pages from $8000-$BFFF).
> > My problem is about the predefined sections that must be in non-banked
> > memory : ROM_VAR (application constant variables), STRINGS
> > (application string constants), COPY (initialization values for the
> > application variables).
> > If the new code that the bootloader will put in flash memory contains
> > new variables, it will create changes in these sections, so it won't
> > work ?
> > Is it possible to put these sections in banked memory ?
> > Does anybody have a solution ?
> > Am I obliged to copy and run the bootloader in RAM ?
> >
> >
> >
> >
> >
> >
> >
> >
> > SPONSORED LINKS
> > Freescale
> > > > eescal
> > e+semiconductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w45
> > e+semiconductor+1+micr
> > oprocessor&c=4&s6&.sig=K2HGv-zFlv5OYUv_QxIq_Q> semiconductor inc
> > Microcontrollers
> > > > icondu
> > ctor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microproc
> > ctor+essor&
> > c=4&s6&.sig=SYHwNJjjGQXRvtt_GybT4g> Pic
> > > > +semic
> > onductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+micro
> > onductor+proces
> > sor&c=4&s6&.sig=umVbbnUwsPzEzKKD_pQfUw> microcontrollers
> > 8051
> > > > semico
> > nductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microp
> > nductor+rocess
> > or&c=4&s6&.sig=NO-nSKjHoAlh9XtZ8LB1_A> microprocessor
> >
> > _____
> >
> > YAHOO! GROUPS LINKS
> >
> >
> >
> > *
> > .
> >
> >
> > _____
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
>
> ------------------------ Yahoo! Groups Sponsor --------------------~--> Get
> Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
> http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/dN_tlB/TM
> --------------------------------~- > Yahoo! Groups Links >
> Yahoo! Groups Links

------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income homes are not online. Make a difference this holiday season!
http://us.click.yahoo.com/5UeCyC/BWHMAA/TtwFAA/dN_tlB/TM
--------------------------------~->

Yahoo! Groups Links




Memfault Beyond the Launch