Topic : how to place a variable at a determined code address

Forum : 8051

Original Post
Post Information Post
March 23, 2009 - 11:51am
Guest

Dear sirs, I wanna place a string (the firmware version) on a determined code address.
I've tried using such a line
code at 0x7f00 unsigned char stringaVersioneCnc[]=defVersioneCNC;
where:
#define defVersioneCNC "0.11 "

but this way the reference to the variable in placed at 0x7f00 in xdata...
X:7F00H PUBLIC stringaVersioneCnc

Is there any chance to place a code variable in a determined address in the range 0..0x7fff (code memory common area)?
Thx

Replies
Post Information Post
+1
0
-1
March 23, 2009 - 12:10pm
Guest

I've solved using assembler rsource
; Startup relocatable CODE segment name is set here.
?PR?VERSION? SEGMENT CODE

NAME VERSION

CSEG AT 07F00H ;
stringFirmwareVersion:
DB '0.10 '

end

But is there any chance to do the same from C?
Thx

+1
0
-1
March 23, 2009 - 12:36pm
Guest

Solved!
Ok sirs, sorry for the n-th autoreply.
The problem was caused by a dirty define
#define code //bad!!!!!!

using
code at 0x7f00 unsigned char stringaVersioneCnc[]=defVersioneCNC;
works well
best regards