I Can almost generate AN2250 SW3 for my Wytec 9S12C128 DragonFly,but gets Link Error : L1102

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I Can almost generate AN2250 SW3 for my Wytec 9S12C128 DragonFly,but gets Link Error : L1102

6,283 Views
kwik
Contributor I
The explanation to the Link Error L1102 is :
Out of allocation space in segment ROM_C000 at address 0xC053

Im trying to compile/link AN2250 SW3 on CodeWarrior Ver 5.7.0

I have read Help etc trying to understand why I get this problem.

I have successfully done AN2250 SW2. This application is now producing char arrays from a WAV file.

AN2250 SW3 is to use these char arrays in flash ,and play them.16K pr array.

In Output.h it looks like this ;
-----------------------------------
#pragma CONST_SEG __PPAGE_SEG WAV01
extern const unsigned char wav01[];

#pragma CONST_SEG __PPAGE_SEG WAV02
extern const unsigned char wav02[];

etc etc

#pragma CONST_SEG DEFAULT
-----------------------------------

Each wav01[] etc is exactly 16K .

Here is the start of one such array ;

#pragma CONST_SEG PPAGE WAV02
const unsigned char wav02[]={
0x7E,0x03,0xA1,0x9E,0x98,0x8D,0x7F,0x72,0x6D,0x6F,
0x69,0x56,0x5C,0x77,0x90,0x9F,0xA6,0xA3,0x9A,0x8B,
etc etc


I created the project by starting with the Wizard in Codewarrior;
=================================================================
File->New->Selected New Project Wizard
Set "Project Name" to WavPlay
Set Location to something you like
Click Ok

Wizard starts->
Click Next
Select Correct MCU->MC9S12C128 in my case ,since its a DRAGONfly12 from Wytec
Select C as Language
Select No for Processor Expert
Select No for PCLint
Select ANSI startup code
Select None for float support
Select Banked memory
Select HCS12 Serial Monitor
Click Finish

In AN2250SW3 the main routine is in a file called pwmcontroller.c
=> Copy everything in pwmcontroller.c into main.c in our
wavplay project.
Now the main( ) function from pwmcontroller.c in AN2250SW3
exist in our main.c file.(in our new wavplay project)

try to make/compile/link our new project->you need pwmcontroller.h
Copy pwmcontroller.h from AN2250SW3 to our source directory
right besides main.c

Continue like this ; You will find that you need to copy
the following files from AN2250SW3 to our new source file area;

output.h
peripheral.h

s12_timer.h
s12_pwm.h
s12_pim.h
s12_page.h
s12_common.h
s12_register.h

The rest of the undefines are the wav-arrays from AN2250SW2;
Copy them too.

- Set -CpPPage option for compiler

Now I get

Link Error : L1102: Out of allocation space in segment ROM_C000
at address 0xC02A


Any ideas ,anyone ?
Labels (1)
0 Kudos
Reply
16 Replies

2,729 Views
kwik
Contributor I
I hereby attach the MAP file ....maybe an expert can see whats wrong.

Message Edited by kwik on 2006-09-03 05:19 PM

Message Edited by kwik on 2006-09-03 05:21 PM

0 Kudos
Reply

2,729 Views
CrasyCat
Specialist III
Hello
  From what I could see in your .Map file wav01 & wav02 are both 16K wide.
  You are trying to store more than 32K data into a memory area which is 16K wide.
 
  This cannot work.
 
  Please make the two table smaller.
 
CrasyCat
0 Kudos
Reply

2,729 Views
kwik
Contributor I
Aha ! So they will both end up in the same page ?
 
I was hoping they could be stored in one page each. Wav01 in the first page , wav02 in the second , and so on .... Took it for granted this is how it was made in AN2250 . But one should never take anything for granted !!!
 
Is there a way of  using PRAGMA or something to force each array into different Page's ? ( I believe we have 6 pages = 16 * 6 = 96K in this mcu ) 
 
If there is I will of course post the solution here when its working.
 
 
0 Kudos
Reply

2,729 Views
kwik
Contributor I
Maybe I should use LARGE memory model ? That would mean a linear memory layout ....the wav01 ,wav02 etc upwards in the memory .... ????
0 Kudos
Reply

2,729 Views
CrasyCat
Specialist III
Hello
 
You can place constants on two different pages, but then you have to explicitly place the sections in banked memory.
In your PRM file your placement block should look as follows:
Code:
PLACEMENT  /* Here all predefined and user segments are placed into the SEGMENTS defined above. */    _PRESTART,                   /* Used in HIWARE format: jump to _Startup at the code start */    STARTUP,                     /* startup data structures */    ROM_VAR,                     /* constant variables */    STRINGS,                     /* string literals */    VIRTUAL_TABLE_SEGMENT,       /* C++ virtual table segment */  //.ostext,                     /* OSEK */    NON_BANKED,                  /* runtime routines which must not be banked */    COPY                         /* copy down information: how to initialize variables */                                 /* in case you want to use ROM_4000 here as well, make sure                                    that all files (incl. library files) are compiled with the                                    option: -OnB=b */                                 INTO  ROM_C000/*, ROM_4000*/;    DEFAULT_ROM, WAV01,     WAV02                       INTO   PAGE_3D, PAGE_3C,                                       PAGE_3B, PAGE_3A, PAGE_39, PAGE_38;                                                 //.stackstart,               /* eventually used for OSEK kernel awareness: Main-Stack Start */    SSTACK,                    /* allocate stack first to avoid overwriting variables on overflow */  //.stackend,                 /* eventually used for OSEK kernel awareness: Main-Stack End */    DEFAULT_RAM                  INTO  RAM;  //.vectors                     INTO OSVECTORS; /* OSEK */END

 
 
CrasyCat
0 Kudos
Reply

2,729 Views
kwik
Contributor I
Thanks a lot for your support , CrazyCat ! It looks like Im getting closer !

I experimented a bit in the prm file to see what the syntax might be...

Here is what seems to work the way I hoped ;

COPY INTO ROM_C000;
DEFAULT_ROM INTO PAGE_3D;
WAV01 INTO PAGE_3C;
WAV02 INTO PAGE_3B, PAGE_3A, PAGE_39, PAGE_38;

( Even though the IDE formats it quite ugly ... he he )

Because now it looks like this in the MAP file ,and I get NO LINKER ERROR! :

Please see attachment for map file screendump .

Now I can have each WAV array in one page !!!
Meaning I have space for some sound.

So the joy was on top for a few seconds ..... but then I was to send
the S-Records ......

I'm used to converting to S2 format first. This normally works without a problem....
but I havent tried banked data before .....

I use this command :
sreccvt -m c0000 fffff 32 -of f0000 -o test.s29 test.abs.s19

But SRecCvt.exe fails.....It says Error:smileysad:0) S-Record Data Not In Specified Memory Map
and fails for this line

S2243B80003FFFA19E988D7F726D6F777D8285877E69565C77909FA6A39A8B7B7680847B6CA6

hmmmmm

Message Edited by kwik on 2006-09-05 01:19 PM

0 Kudos
Reply

2,729 Views
kwik
Contributor I
Okay ; I specify SRECORD=S2 and SLINELEN=32 in the file burner.bbl

/* logical s-record file */
OPENFILE "%ABS_FILE%.s19"
format=motorola
busWidth=1
origin=0
len=0x1000000
destination=0
SRECORD=S2
SLINELEN=32
SENDBYTE 1 "%ABS_FILE%"
CLOSE


But the start of the S-Record file looks like this ;

S01B000048435331325F53657269616C5F4D6F6E69746F722E61627339
S22400C000FEC04AFDC048271335E630ED3116C053EC3169700434FB310326EDFEC04CEC31AB
S22400C02027123BE630ED3116C0533A180A30700434F920EA3DCF3500790011CC09395B10AF
S22400C0405A1207BC4A80003D0001C04EC06100350000AB5B303D3696305B30E6405A303264
S20700C0603D00009B
S20600FFFEC03507
S2243B80003FFFA19E988D7F726D6F777D8285877E69565C77909FA6A39A8B7B7680847B6CA6
S2243B802061626A7384979C91847C7C7D7B7877736D6B7485969E9D9FA1A2A09C9383726991

And the monitor dont like it .Using BDM and sending it .....

Doing
S>fbulk
S>fload
*
S-Record Out Of Range

hmmmm

Message Edited by kwik on 2006-09-05 01:38 PM

0 Kudos
Reply

2,729 Views
CrasyCat
Specialist III
Hello
 
May be your loader do not like logical address, but requires physical ones.
If you created your project using the wizard, you get a file with extension .abs.phy in the same location as
the file .abs.s19. This S record file contains logical addresses for the code.
Try to load that one.
 
If this is not working either
  - Make sure your loader is able to program flash
  - Make sure your loader is able to program banked flash?
  - Try to get more information on which address format the loader is expecting.
 
In the .bbl file you can fine tune almost everything. You just need to know what is your goal:smileyhappy:.
 
CrasyCat
0 Kudos
Reply

2,729 Views
kwik
Contributor I
Okay ,thanks again for your support !

Trying to send .phy ;

S>
S>fbulk
S>fload
****
S-Record Size Must Be Even


The beginning of .phy looks like this ;
S01B000048435331325F53657269616C5F4D6F6E69746F722E61627339
S2240FC000FEC04AFDC048271335E630ED3116C053EC3169700434FB310326EDFEC04CEC319C
S2240FC02027123BE630ED3116C0533A180A30700434F920EA3DCF3500790011CC09395B10A0
S2240FC0405A1207BC4A80003D0001C04EC06100350000AB5B303D3696305B30E6405A303255
S2070FC0603D00008C
S2060FFFFEC035F8
S2240EC0003FFFA19E988D7F726D6F777D8285877E69565C77909FA6A39A8B7B7680847B6C93
S2240EC02061626A7384979C91847C7C7D7B7877736D6B7485969E9D9FA1A2A09C938372697E

Even though SLINELEN is set ....
0 Kudos
Reply

2,729 Views
kwik
Contributor I
Here is another example ,were SLINELEN is 16;
(Codewarrior was restarted after setting changed in burner.bbl)

S01B000048435331325F53657269616C5F4D6F6E69746F722E61627339
S2140FC000FEC04AFDC048271335E630ED3116C05343
S2140FC010EC3169700434FB310326EDFEC04CEC3175
S2140FC02027123BE630ED3116C0533A180A3070042B
S2140FC03034F920EA3DCF3500790011CC09395B1071
S2140FC0405A1207BC4A80003D0001C04EC061003541
S2140FC0500000AB5B303D3696305B30E6405A3032F0
S2070FC0603D00008C
S2060FFFFEC035F8
S2140EC0003FFFA19E988D7F726D6F777D8285877EAE
S2140EC01069565C77909FA6A39A8B7B7680847B6C02

So ,nomatter SLINELEN is 16 ,some lines are not 16 ....and the loader in the
Wytec DragonFly is protesting....
0 Kudos
Reply

2,729 Views
kwik
Contributor I
Okay ....here is the solution to the S-Record problem ;

-First ask for S1 fileformat in burner.bbl
(Why? Because if you ask for s2 ,you get lines wit an odd number of bytes ,which the fload command doesnt like !!!!)

-Secondly ; Generate system ! ...and an s1 file with s1 lines are made.

-Now run SRecCvt.exe !!! Best to put it in a bat file ,but the commandline should look like this;

sreccvt -m c0000 fffff 32 -of f0000 -o test.s29 HCS12_Serial_Monitor.abs.s19

(If your outputfile from codewarrior is HCS12_Serial_Monitor.abs.s19)

So the resulting s2 file starts like this;

S21400C000FEC04AFDC048271335E630ED3116C05352
S21400C010EC3169700434FB310326EDFEC04CEC3184
S21400C02027123BE630ED3116C0533A180A3070043A
S21400C03034F920EA3DCF3500790011CC09395B1080
S21400C0405A1207BC4A80003D0001C04EC061003550
S21400C0500000AB5B303D3696305B30E6405A3032FF
S2143B80003FFFA19E988D7F726D6F777D8285877EC1
S2143B801069565C77909FA6A39A8B7B7680847B6C15
S2143B802061626A7384979C91847C7C7D7B78777352
S2143B80306D6B7485969E9D9FA1A2A09C938372694F

etc
etc

All lines have the same length ; Thats what we want !!!!

Now I can send it ;

S>

S>fbulk

S>fload

*******************************************************************
*******************************************************************
*******************************************************************
*******************************************************************
*******************************************************************
*******************************************************************
******************************
S>

Nothing happened when I pressed reset and started the program ....
But that has to be investigated now .The main thing is ...I managed to
download it into flash !!!!
0 Kudos
Reply

2,729 Views
kwik
Contributor I
What I did next ; The program didnt start ; I know this because I put in some lines I had from another test-prog that lits up one of the diodes on the DragonFly board ,and blink it in a while loop ....it didnt blink...

So next step ; I removed everything except the diode - blink lines ...still didnt blink ... something must be wrong with linking ...

Did a small change in the prm file ...and voila ...the diode blinks .

Next step ; Put in the sound-play code again .

The prm file that works is atached here ; (Has to rename to .txt to be accepted) ;
0 Kudos
Reply

2,729 Views
kwik
Contributor I
There seems to be on common problem to all the examples I find ...
The structs or defines seems to have changed between the time the examples were written ,and today. This means that almost none of the examples can be run using the include files produced by Codewarrior....

A good example is AN2250.

Had to change from AN2250
-------------------------
Pim.piej.byte = 0x40;
Pim.ppsj.byte = 0x00;
Pim.perj.byte = 0x40;

to Codewarriors
------------------
_PIEJ.Byte = 0x40;
_PPSJ.Byte = 0x00;
_PERJ.Byte = 0x40;

And had to change from AN2250
-----------------------------
Pwm.pwme.byte = 0x08;
Pwm.pwmpol.byte = 0xFF;
Pwm.pwmclk.byte = 0x00;
Pwm.pwmprclk.byte = 0x00;
Pwm.pwmcae.byte = 0x00;
Pwm.pwmctl.byte = 0x00;

to Codewarriors
----------------------
_PWME.Byte = 0x08;
_PWMPOL.Byte = 0xFF;
_PWMCLK.Byte = 0x00;
_PWMPRCLK.Byte = 0x00;
_PWMCAE.Byte = 0x00;
_PWMCTL.Byte = 0x00;

And had to change from AN2250
-----------------------------
Timer.tscr1.byte = 0x80;
Timer.mcctl.byte = 0x48;
Timer.mcflg.byte = 0x80;

to Codewarriors
----------------------
_TSCR1.Byte = 0x80;/*Timer system control register set to enable timer*/
xxxx.Byte = 0x48; /*Enables modulus down counter and enables loads of count start value*/
yyyy.Byte = 0x80; /*Write 1 to modulus down counter register to clear flag*/

Yes ,here is the problem .....what should xxx and yyy be ?
0 Kudos
Reply

2,729 Views
kwik
Contributor I
HELP ! Nobody knows what these two statemements from AN2250
is to be replaced with nowadays? ; (CrazyCat ,were are you ????)


Timer.tscr1.byte = 0x80;/*Timer system cnt-regs set to enable timer*/
Timer.mcctl.byte = 0x48;/*Enab moduldown cnt and enab load of startval*/
Timer.mcflg.byte = 0x80;/*Write 1 to moduldown cnt-regs to clear flag*/




Timer.tscr1.byte = 0x80 is okay ;
Its supposed to to be _TSCR1.Byte = 0x80;

Message Edited by kwik on 2006-09-13 11:50 AM

0 Kudos
Reply

2,729 Views
CrasyCat
Specialist III
Hello
 
Sorry I have been busy with other stuff lately.
 
Did you try
     TSCR1 = 0x80;
for the first one?
 
For the two others, I have no clue. There are no registers MCCTL and MCFLG on HCS12C128 (according to MC9S12C Family Device User Guide.
 
You may have to rewrite this part using different registers...
 
CrasyCat
0 Kudos
Reply

2,729 Views
kwik
Contributor I
Hmmm ... I have discovered that making S1 file isnt the solution after all ; All the addresses in banked area is missing in the s1 file ...because they cannot be represented with a 2-byte address in a s1 file ... I believe a 3-byte address is needed ,so an s2 file is needed .

But I cannot manage to create an s2 file that the boards monitor will accept .... hmmmm
0 Kudos
Reply