 |
Technical Support |
 |
|
|
Technical Support
Support Resources
Product Information
|
BL51: CREATING DATA-ONLY HEX FILES
Information in this article applies to:
- C51 Version 6.20
- µVision2 Version 2.20
QUESTION
I want to create a program that is comprised of only constant
data. I need to locate the data starting at 7800h. I don't have any
code and don't want any included from the library. Is this
possible?
ANSWER
Yes.
-
Create the C data file. For example:
struct NV_stuff
{
int a1;
int a2;
int a3;
int a4;
};
const struct NV_stuff code NV_tab =
{
1, 2, 3, 4
};
-
Add the NODEFAULTLIBRARY linker directive so that the
linker doesn't include any modules from the standard C library. You
may add this in the Misc Controls box under the BL51 Misc Tab in
the Project Options Dialog in µVision2.
-
On the Output Tab in the Project Options, make sure that the
Create HEX File checkbox is checked.
-
Compile and link the program. You will receive the following
warnings from the linker:
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?CO?TEST
*** WARNING L10: CANNOT DETERMINE ROOT SEGMENT
It is safe to ignore these.
-
Open the MAP (*.m51) file created by the linker. Look at the
link Map for the segment name.
LINK MAP OF MODULE: test (TEST)
TYPE BASE LENGTH RELOCATION SEGMENT NAME
-----------------------------------------------------
* * * * * * * C O D E M E M O R Y * * * * * * *
CODE 0000H 0008H UNIT ?CO?TEST
In this case, it is ?CO?TEST. ?CO? for constant data and TEST
for the name of the C file.
-
On the BL51 Locate Tab in the Project Options Dialog, enter
?CO?TEST(0x7800) in the CODE Space input line. This command
instructs the linker to locate the ?CO?TEST segment starting at
address 7800h.
-
Re-compile and link the project. The resulting HEX file appears
as follows:
:08780000000100020003000476
:00000001FF
MORE INFORMATION
SEE ALSO
FORUM THREADS
The following Discussion Forum threads may
provide information related to this topic.
Last Reviewed: Tuesday, February 03, 2009
|
|
|