EmbeddedRelated.com
Forums

Newbie - Codewarrior and first LED-blink program

Started by sirtiffguy February 3, 2007
Hello everyone,

I am just about at the end with my board. I'm just starting out with
this chip, and I can't seem to get a simple port-toggler to work
using codewarrior. I have the bootloader, and DBug12 V3.0 installed
(I got the bootloader on, then loaded DBug12 myself. All seems to
work ok.

My main.c code***************************************
#include /* common defines and macros */
#include /* derivative information */
int delayP00;
static void setupCANport(void){

DDRCAN=0xF0;
PORTCAN=0x00;
}

static void Delay(void){
int cnt =0;
while(cnt }

static void hBeat(void){
for(;;){
PORTCAN=0x00;
Delay();
PORTCAN=0xFF;
Delay();
}
}

void main(void) {
/* put your own code here */
EnableInterrupts;
setupCANport();

hBeat();
for(;;) {} /* wait forever */
}

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

All seems to be correct. Now, taking into consideration that DBug12
is a monster, I've altered the .prm file to consist of just EEPROM
and RAM... seing as how most of the flash is occupied with the dbug
program.

here is the code just for kicks.****************************
/* This is a linker parameter file for the HC912D60A */
NAMES END /* CodeWarrior will pass all the needed files to the linker
by command line. But here you may add your own files too. */

SEGMENTS /* here all RAM/ROM areas of the device are listed. Used in
PLACEMENT below. */
RAM = READ_WRITE 0x0200 TO 0x07FF;
//FEE28 = READ_ONLY 0x1000 TO 0x7FFF;
//FEE32 = READ_ONLY 0x8000 TO 0xE000;
EEPROM = READ_ONLY 0x0C00 TO 0x0FFF;

//OSVECTORS = READ_ONLY 0xFF8C TO 0xFFFF; /* OSEK interrupt
vectors (use your vector.o) */
END

PLACEMENT /* here all predefined and user segments are placed into
the SEGMENTS defined above. */
OTHER_ROM ,
ROM_VAR, /* constant variables */
STRINGS, /* string literals */
//.ostext, /* OSEK */
DEFAULT_ROM, NON_BANKED /* runtime routines
which must not be banked */
//INTO FEE28, FEE32;
INTO EEPROM;

//.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

ENTRIES /* keep the following unreferenced variables */
/* OSEK: always allocate the vector table and all dependent
objects */
//_vectab OsBuildNumber _OsOrtiStackStart _OsOrtiStart
END

STACKSIZE 0x100

VECTOR 0x0C00 _Startup /* reset vector: this is the default entry
point for a C/C++ application. */
//VECTOR 0 Entry /* reset vector: this is the default entry point
for an Assembly application. */
//INIT Entry /* for assembly applications: that this is as well
the initialization entry point */

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

Now, I load it into eeprom using Load... clicking on the .s19 file
(removing the line in the .s19 file that tries to write to the
bootloader part... the second last line)... and I can verify using
>Upload 0c00 0d00, that the code is present.

Now here's where I loose it.
If I try >G 0c00 the dbug12 interface stops (requiring reset), and
the darn lights don't blink.

I've tried putting the PC at 0C00 by going >RM ... and setting it
manually.

Now, I've also tried to remove the DBug12 as the source, so knowing
that the bootloader has a JumpEE option by setting PAD0 and PAD1, I
tried to get it to run the code manually. Still doesn't make it
blink.

Why is this happening? Please...

I know my XIRQ is high, and the PAD0 PAD1 pins are set correctly (EVB
mode). MODA, MODB =GND... although thoes shouldn't matter.

I'm trying to emerge from the PIC world, not get pushed back into it.

Thanks Everyone