kenneth wikeroey

Cannot read banked Data in a MC9S12C128, DRAGONfly12 from Wytec. Using CodeWarrior Ver 5.7.0

Discussion created by kenneth wikeroey on Oct 9, 2006
Latest reply on Oct 16, 2006 by CompilerGuru
Using CodeWarrior Ver 5.7.0.

I have read Help etc trying to understand why I get this problem.
(I have read A LOT)

Here is the code that fails ;

const unsigned char *far wavPtr;

wavPtr = wav01;

char val = *(wavPtr+j);

Nomatter what j is ,I read 0xff ;

A little background ;
============================================
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

Sooo I try to read the contents of the wav01 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

In Output1.c it looks like this ;
----------------------------------------------
#pragma CONST_SEG PPAGE WAV01
const unsigned char wav01[]={
0x7E,0x03,0xA1,0x9E,0x98,0x8D,0x7F,0x72,0x6D,0x6F,
0x69,0x56,0x5C,0x77,0x90,0x9F,0xA6,0xA3,0x9A,0x8B,
etc etc

In the .prm file it looks like this
----------------------------------------------
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 */
DEFAULT_ROM,NON_BANKED, /* runtime routines which must not be banked */
COPY INTO ROM_C000;
WAV06 INTO PAGE_3D;
WAV05 INTO PAGE_3C;
WAV04 INTO PAGE_3B;
WAV03 INTO PAGE_3A;
WAV02 INTO PAGE_39;
WAV01 INTO 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

Compilator Command line arguments;
-------------------------------------------
-CpPPAGE=RUNTIME -CPUHCS12 -D__NO_FLOAT__ -D_HCS12_SERIALMON -Mb



I wonder what I forgot ?

Outcomes