AnsweredAssumed Answered

How to use the HCS12 T-board stand-alone with the use of functions in main.c file.

Question asked by Danny Scheres on Sep 22, 2008
Latest reply on Sep 22, 2008 by Danny Scheres

Hi,

I have a problem using a HCS12 T-board with CodeWarrior for HCS12 V4.7. There is a MC9S12DP512 chip placed on the HCS12 T-board.

I want to use my HCS12 T-board stand-alone and it can be done by placing a jumper on MODA and MODB (connector X6B pin 1 and 2). With this setting the chip will start after reset at address $8000 (0x208000).

I write my code in C and when I put a function above my main the HCS12 T-board won’t start stand-alone (without a PC attached). When I use a function in my main and it is initialized above my main, my main doesn’t start on address 0x208000 but my function (delayms) starts there. This means that my HCS12 T-board won’t start stand-alone because he calls address 0x208000 after reset and this is my function (delayms).

Below is a copy of a little piece of my .map file from codewarrior.   

VECTOR-ALLOCATION SECTION

    Address     InitValue   InitFunction

------------------------------------------------------------------------------------

     0xFFFE        0xC000   _Startup

 

*****************************************************************************************

OBJECT-ALLOCATION SECTION

     Name               Module                 Addr   hSize   dSize     Ref    Section   RLIB

------------------------------------------------------------------------------------

MODULE:                 -- main.c.o --

- PROCEDURES:

     delayms                                 208000      12      18       2   .text      

     main                                    208012      2D      45       2   .text      

- VARIABLES:

MODULE:                 -- Start12.c.o --

- PROCEDURES:

     Init                                    20803F      29      41       2   .text      

     _Startup                                  C000       B      11       0   .init      

- VARIABLES:

     _startupData                              C00B       6       6       3   .startData 

- LABELS:

     __SEG_END_SSTACK                           900       0       0       1              

MODULE:                 -- mc9s12dp512.c.o –

 

 

How could I say to codewarrior that he has to put my main always first on address 0x208000?

Or is there another way to say to codewarrior that he has to start at my main after reset?

 

I use the terminal oc-console and I align the s19 file with SRecCvt.exe to a linear s19 file.

When I use the generated s19 file from codewarrior in SRecCvt.exe and I load the output from it to the chip with oc-console I get the error

 

Loading . . .

**********

Write error at BFF0

20>

 

If I use the .phy file from codewarrior and align it with SRecCvt.exe to a linear s19 file. I get no errors.

 

My .s19 file after I used SRecCvt.exe with the input .s19 file from codewarrior:

 

S2140800003BEE80096E80CE0A630435FDEC8026F14F

S2140800103A0A10EFC6FF5B015B03C6FA873BC601C8

S214080020070E5826FBC640070754C10122F920EEE2

S21408003037515B01EC83C300644A800020333DFEE1

S214080040C00DFDC00B270E35ED31EC316970043458

S214080050FB310326F2FEC00FEC31270BED31180AF0

S21408006030700434F920F10AFFFFFFFFFFFFFFFF9F

S2140FC000CF09004A803F204A8012200000C011C08E

S2140FC01015000000000000FFFFFFFFFFFFFFFFFF00

S2140FFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFC0003B

S9030000FC

 

My .s19 file after I used SRecCvt.exe with the input .phy file from codewarrior:

 

S2140800003BEE80096E80CE0A630435FDEC8026F14F

S2140800103A0A10EFC6FF5B015B03C6FA873BC601C8

S214080020070E5826FBC640070754C10122F920EEE2

S21408003037515B01EC83C300644A800020333DFEE1

S214080040C00DFDC00B270E35ED31EC316970043458

S214080050FB310326F2FEC00FEC31270BED31180AF0

S21408006030700434F920F10AFFFFFFFFFFFFFFFF9F

S9030000FC

 

I’ve noticed that the last 3 s2 lines from the first file aren’t in the second file. Further is there no difference between them.

 

Maybe this info will help when it is possible when I want to say to codewarrior that he has to start at my main after reset?

 

I’ll be very pleased if anyone could help me.

Outcomes