CW: defining C  code memory address

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

CW: defining C  code memory address

2,084 Views
donw
Contributor IV
CW experts please!
I want to 'intergrate' some C code with assembler code.

I have some C code (for JM60) and I want to have it complied starting at a certain
address. (I want to place it higher up in the flash memory address).
I also want to define the starting RAM address of the variables. (again to move them up in higher ram)

Also I want to be able to send this C complied output to the debugger for flashing, along with
a pure assembler file.
I will need to edit/assemble the assembler code, but not the C code.
Labels (1)
0 Kudos
4 Replies

317 Views
CrasyCat
Specialist III
Hello
 
You need to place your C code in a user defined section (using #pragma CODE_SEG) and place this section accordingly in your .PRM file.
 
For your variable I would also recommend defining them in a user defined data section (using #pragma DATA_SEG) and placing the section appropriately in the .prm file.
 
CrasyCat
0 Kudos

317 Views
donw
Contributor IV
Thanks CrazyCat
. I now have the C code compiling at a higher memory address, likewise
its ram useage.
My next problem is how to send the compiled C code to the debugger, along with
an independant CW assembler code.
The C code will not change, but I need to be able to modify and assemble the assembler code
and send it the the debugger/flasher with the C code output.
Is there a way to tell the linker(?) or downloader to combine the two output files?


0 Kudos

317 Views
CrasyCat
Specialist III
Hello
 
Which version of CodeWarrior are you using?
 
If you are using CodeWarrior for MCU V6.1 or higher, this can be done from the debugger command line using command LOAD with option ADD_SYMBOLS.
 
The attached technical note explains how to achieve that.
 
CrasyCat
0 Kudos

317 Views
donw
Contributor IV
thanks. That should solve this problem
- don

0 Kudos