EmbeddedRelated.com
Forums

Newbie: Cant write code to HC12

Started by florianschrbr January 21, 2005

Hmm, your trying to write code to an area wich is write protected by
TwinPeeks. Did you have any documentation regarding your board an
TwinPeeks? If you have one look at the Chapter where TwinPeeks and
redirected interrupts are described. The adress 0xFFE0 is the
interrupt jump point for the TC7 interrupt. I've looked into the
example and have no idea why this example uses the TC7 interrupt.

Try this simple example and tell how it works:
====================================================================

#include <hcs12dp256.h> //--> Insert your processor include here
// should be <mc9s12d64.h>
#include <stdio.h>

int putchar(char c){
while((SCI0SR1 & 0x80) == 0);
SCI0DRL = c;
return c;
}

int getchar(void){
while((SCI0SR1 & 0x20) == 0);
return SCI0DRL;
}

void main(void){
printf("Hello World!\r\n");
}

====================================================================

This Example don't use any interrupts and should run with TwinPeeks.
If you want to use interrupts with TwinPeeks you first have to
redirect the necessary interrupt vectors to a RAM Location.

Greets Daniel.
--- In , "florianschrbr" <florianschrbr@y...>
wrote:
>
> Hello Cyrill, hello Daniel!
>
> I downloaded the OC-Console and it works better, but there is
always
> an error!
> Here is my .S19 file:
>
S1238000CF100016804887CE08008E080227056A000820F6CE80C1CD08008E80C12706
> 18FE
>
S12380200A307020F516802A20FECC001A16804D2006CC803B16808920F83D48656C6C
> 6FC1
>
S123804020576F726C640A001D0016073D3B34B775EC027C00C0C60C7B00C3B757301B
> 82C3
>
S12380603D3B34B775FC0800270CE603C10A2606CC000D1680611F00C480FB180D0300
> C7F0
>
S1238080E60387B757301B823D3B34B7751B9ECC00006C1E2016ED02E64087168061EC
> 1ED7
>
S12380A0C300016C1EEC02C300016C02ED02E74026E4CC000A168061CC0001B757301B
> 82B9
>
S12380C03DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
> FF7E
>
S123FFE0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80
> 009B
> S9030000FC
>
> Thats an simple helloworld application from the example folder in
> icc12!
> After erasing my flash and downloading the file, following error
> appears in OC-Console:
> Write error at FFE0
>
3E>S123FFE0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
> F80009B
> 3E>
>
> Have you any idea?
>
> Thanks for the great help!
> Florian
> >
> > Can you sent me your File.s19
> >
> > or show how it looks like you can open it with
> > notepad and copy paste it.and perhaps the code you are compiling
> >
> >
> > http://www.seattlerobotics.org/encoder/jun99/dougl.html
> >
> > tells something about the s record
> >
> > The manual tells something about
> > The monitor is processing each S-Record line seperately. If the
last
> > address of such an S-Record is even, the 2nd byte to form a
complete
> > word is missing. TwinPEEKs will append an $FF byte in this case,
so
> > it
> > is able to perform the word write.
> > The problem occurs, if the byte stream continues with the
following
> > S-Record line.
> > To avoid this problem, it is necessary to align all S-Record data
> > before programming. This can be done using the freely available
> > Motorola Tool SRECCVT:
> > SRECCVT -m 0x00000 0xfffff 32 -o <outfile> <infile>
> > A detailed description of this tool is contained in the SRECCVT
> > Reference Guide (PDF).
> >
> > SAME as
> > daniel winkler says .
> >
> > You get one star * what means one line has been sent
> > Before loading into non-volatile memory (Flash EEPROM), this
> > kind of memory must always be erased. Also, only word writes can
be
> > used in this case. It may be required to prepare S-Record data
> > accordingly,
> > before it can be downloaded (see instructions above).
> > The sending terminal program (such as OC-Console) must wait for
> > the acknowledge byte (*), before starting the transmission of
> another
> > line. This way, the transmission speed of both sides (PC and MCU)
> are
> > synchronized.
> >
> > Try a other file
> >
> > let me know if you have any succes
> > and don't give up !
> >
> > Cyrill





O.k., i copied the sourcecode in my icc12 and try them to compile.
following error in icc12:

C:\icc\bin\imakew -f test.mak
icc12w -o test -LC:\icc\lib\ -btext:0x8000 -bdata:0x0800 -
bextcode:0.0x1FFFF -dinit_sp:0x1000 -fmots19 @test.lk -lc12p
unknown file type @test.lk, passed to linker
!ERROR unknown file type '
C:\icc\bin\imakew.exe: Error code 1

i have no idea why? do you have a idea?

thanks and king regards
florian
Done: there are error(s). Exit code: 1
>
> Hmm, your trying to write code to an area wich is write protected by
> TwinPeeks. Did you have any documentation regarding your board an
> TwinPeeks? If you have one look at the Chapter where TwinPeeks and
> redirected interrupts are described. The adress 0xFFE0 is the
> interrupt jump point for the TC7 interrupt. I've looked into the
> example and have no idea why this example uses the TC7 interrupt.
>
> Try this simple example and tell how it works:
> ====================================================================
>
> #include <hcs12dp256.h> //--> Insert your processor include here
> // should be <mc9s12d64.h>
> #include <stdio.h>
>
> int putchar(char c){
> while((SCI0SR1 & 0x80) == 0);
> SCI0DRL = c;
> return c;
> }
>
> int getchar(void){
> while((SCI0SR1 & 0x20) == 0);
> return SCI0DRL;
> }
>
> void main(void){
> printf("Hello World!\r\n");
> }
>
> ====================================================================
>
> This Example don't use any interrupts and should run with TwinPeeks.
> If you want to use interrupts with TwinPeeks you first have to
> redirect the necessary interrupt vectors to a RAM Location.
>
> Greets Daniel. >
> --- In , "florianschrbr" <florianschrbr@y...>
> wrote:
> >
> > Hello Cyrill, hello Daniel!
> >
> > I downloaded the OC-Console and it works better, but there is
> always
> > an error!
> > Here is my .S19 file:
> >
>
S1238000CF100016804887CE08008E080227056A000820F6CE80C1CD08008E80C12706
> > 18FE
> >
>
S12380200A307020F516802A20FECC001A16804D2006CC803B16808920F83D48656C6C
> > 6FC1
> >
>
S123804020576F726C640A001D0016073D3B34B775EC027C00C0C60C7B00C3B757301B
> > 82C3
> >
>
S12380603D3B34B775FC0800270CE603C10A2606CC000D1680611F00C480FB180D0300
> > C7F0
> >
>
S1238080E60387B757301B823D3B34B7751B9ECC00006C1E2016ED02E64087168061EC
> > 1ED7
> >
>
S12380A0C300016C1EEC02C300016C02ED02E74026E4CC000A168061CC0001B757301B
> > 82B9
> >
>
S12380C03DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
> > FF7E
> >
>
S123FFE0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80
> > 009B
> > S9030000FC
> >
> > Thats an simple helloworld application from the example folder in
> > icc12!
> > After erasing my flash and downloading the file, following error
> > appears in OC-Console:
> > Write error at FFE0
> >
>
3E>S123FFE0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
> > F80009B
> > 3E>
> >
> > Have you any idea?
> >
> > Thanks for the great help!
> > Florian
> > >
> > > Can you sent me your File.s19
> > >
> > > or show how it looks like you can open it with
> > > notepad and copy paste it.and perhaps the code you are compiling
> > >
> > >
> > > http://www.seattlerobotics.org/encoder/jun99/dougl.html
> > >
> > > tells something about the s record
> > >
> > > The manual tells something about
> > > The monitor is processing each S-Record line seperately. If the
> last
> > > address of such an S-Record is even, the 2nd byte to form a
> complete
> > > word is missing. TwinPEEKs will append an $FF byte in this case,
> so
> > > it
> > > is able to perform the word write.
> > > The problem occurs, if the byte stream continues with the
> following
> > > S-Record line.
> > > To avoid this problem, it is necessary to align all S-Record
data
> > > before programming. This can be done using the freely available
> > > Motorola Tool SRECCVT:
> > > SRECCVT -m 0x00000 0xfffff 32 -o <outfile> <infile>
> > > A detailed description of this tool is contained in the SRECCVT
> > > Reference Guide (PDF).
> > >
> > > SAME as
> > > daniel winkler says .
> > >
> > > You get one star * what means one line has been sent
> > > Before loading into non-volatile memory (Flash EEPROM), this
> > > kind of memory must always be erased. Also, only word writes can
> be
> > > used in this case. It may be required to prepare S-Record data
> > > accordingly,
> > > before it can be downloaded (see instructions above).
> > > The sending terminal program (such as OC-Console) must wait for
> > > the acknowledge byte (*), before starting the transmission of
> > another
> > > line. This way, the transmission speed of both sides (PC and
MCU)
> > are
> > > synchronized.
> > >
> > > Try a other file
> > >
> > > let me know if you have any succes
> > > and don't give up !
> > >
> > > Cyrill





Hi Daniel!

Now your sourcecode works!

Thanks
Florian
>
> Hmm, your trying to write code to an area wich is write protected by
> TwinPeeks. Did you have any documentation regarding your board an
> TwinPeeks? If you have one look at the Chapter where TwinPeeks and
> redirected interrupts are described. The adress 0xFFE0 is the
> interrupt jump point for the TC7 interrupt. I've looked into the
> example and have no idea why this example uses the TC7 interrupt.
>
> Try this simple example and tell how it works:
> ====================================================================
>
> #include <hcs12dp256.h> //--> Insert your processor include here
> // should be <mc9s12d64.h>
> #include <stdio.h>
>
> int putchar(char c){
> while((SCI0SR1 & 0x80) == 0);
> SCI0DRL = c;
> return c;
> }
>
> int getchar(void){
> while((SCI0SR1 & 0x20) == 0);
> return SCI0DRL;
> }
>
> void main(void){
> printf("Hello World!\r\n");
> }
>
> ====================================================================
>
> This Example don't use any interrupts and should run with TwinPeeks.
> If you want to use interrupts with TwinPeeks you first have to
> redirect the necessary interrupt vectors to a RAM Location.
>
> Greets Daniel. >
> --- In , "florianschrbr" <florianschrbr@y...>
> wrote:
> >
> > Hello Cyrill, hello Daniel!
> >
> > I downloaded the OC-Console and it works better, but there is
> always
> > an error!
> > Here is my .S19 file:
> >
>
S1238000CF100016804887CE08008E080227056A000820F6CE80C1CD08008E80C12706
> > 18FE
> >
>
S12380200A307020F516802A20FECC001A16804D2006CC803B16808920F83D48656C6C
> > 6FC1
> >
>
S123804020576F726C640A001D0016073D3B34B775EC027C00C0C60C7B00C3B757301B
> > 82C3
> >
>
S12380603D3B34B775FC0800270CE603C10A2606CC000D1680611F00C480FB180D0300
> > C7F0
> >
>
S1238080E60387B757301B823D3B34B7751B9ECC00006C1E2016ED02E64087168061EC
> > 1ED7
> >
>
S12380A0C300016C1EEC02C300016C02ED02E74026E4CC000A168061CC0001B757301B
> > 82B9
> >
>
S12380C03DFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
> > FF7E
> >
>
S123FFE0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80
> > 009B
> > S9030000FC
> >
> > Thats an simple helloworld application from the example folder in
> > icc12!
> > After erasing my flash and downloading the file, following error
> > appears in OC-Console:
> > Write error at FFE0
> >
>
3E>S123FFE0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
> > F80009B
> > 3E>
> >
> > Have you any idea?
> >
> > Thanks for the great help!
> > Florian
> > >
> > > Can you sent me your File.s19
> > >
> > > or show how it looks like you can open it with
> > > notepad and copy paste it.and perhaps the code you are compiling
> > >
> > >
> > > http://www.seattlerobotics.org/encoder/jun99/dougl.html
> > >
> > > tells something about the s record
> > >
> > > The manual tells something about
> > > The monitor is processing each S-Record line seperately. If the
> last
> > > address of such an S-Record is even, the 2nd byte to form a
> complete
> > > word is missing. TwinPEEKs will append an $FF byte in this case,
> so
> > > it
> > > is able to perform the word write.
> > > The problem occurs, if the byte stream continues with the
> following
> > > S-Record line.
> > > To avoid this problem, it is necessary to align all S-Record
data
> > > before programming. This can be done using the freely available
> > > Motorola Tool SRECCVT:
> > > SRECCVT -m 0x00000 0xfffff 32 -o <outfile> <infile>
> > > A detailed description of this tool is contained in the SRECCVT
> > > Reference Guide (PDF).
> > >
> > > SAME as
> > > daniel winkler says .
> > >
> > > You get one star * what means one line has been sent
> > > Before loading into non-volatile memory (Flash EEPROM), this
> > > kind of memory must always be erased. Also, only word writes can
> be
> > > used in this case. It may be required to prepare S-Record data
> > > accordingly,
> > > before it can be downloaded (see instructions above).
> > > The sending terminal program (such as OC-Console) must wait for
> > > the acknowledge byte (*), before starting the transmission of
> > another
> > > line. This way, the transmission speed of both sides (PC and
MCU)
> > are
> > > synchronized.
> > >
> > > Try a other file
> > >
> > > let me know if you have any succes
> > > and don't give up !
> > >
> > > Cyrill