MC68HC908JB16 Codewarrior question

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

MC68HC908JB16 Codewarrior question

2,529 Views
mo
Contributor I
Hi all,
So I am using the MC68HC908JB16JDW via a USB connection and it allows ICP. But I'm not used to using Codewarrior and I need to know how to memory map my C code that I write in Codewarrior to a proper memory location, so that it doesnt overwrite the ICP determination code which I must install in a separate write operation.
Is it even possible to make sure that the code you write goes to a specific memory location or at least redirect the vectors so that the vectors points to the right location.
Any help would be appreciated. I posted earlier in the 16 bit section, but Peg recommended to move to 8 bit section.
Thanks all.
Mo
Labels (1)
0 Kudos
2 Replies

461 Views
Blackwolf
Contributor III

Hello Mo,

yep, absolutely...

you can map your application at any location you want. Please check out the chapter dealing with 'Pragmas' in the compiler manual.

Here is a small (simple, basic and rough:smileyvery-happy:) example:

Subject: let's place the function dummy() at addres 0xC000 and main() as well as dummy2() at 0xD000

In your C file:

#pragma CODE_SEG MYCODE

void dummy()

{

...

}

#pragma CODE_SEG DEFAULT

void main ()

{

...

}

void dummy2()

{

...

}

 

In your PRM file:

SECTIONS
...
   MY_CODE          = READ_ONLY  0xC000 TO 0xCFFF; 
   OTHER_CODE  = READ_ONLY  0xD000 TO 0xFFFF;  
...
END
   
PLACEMENT
...
 DEFAULT_ROM             INTO  OTHER_CODE;
 MYCODE                        INTO  MY_CODE;
...
END

There are some more detailed examples of PRM files in the linker manual, but that's basically the way it should work :smileytongue:

 

Blackwolf

 

0 Kudos

461 Views
mo
Contributor I
cool thanks blackwolf
0 Kudos