ARM Technical Support Knowledge Articles

PURPOSE OF ?C?INITEDATA

Applies to: C251 C Compiler

Answer


Information in this article applies to:


QUESTION

What is the ?C?INITEDATA routine inside the ?C_C51STARTUP?2 segment for? It seems to be executed immediately before the jump to main.

ANSWER

The ?C?INITEDATA initializes global near variables (which are stored in edata). For example:

char near string[] = "this is a string in EDATA";

The routine copies the initial values from a table in code memory to the locations of the variables. The table is stored in a segment called ?C_INITEDATA and has the following format:

 Byte 0  Byte 1  Byte 2  Byte 3  Byte 4
+-------+-------+-------+-------+-------+
|Len MSB|Len LSB|Adr MSB|Adr LSB|Content|
+-------+-------+-------+-------+-------+
|                               +Rep Len+
+--- Repeated for each Object ----------+

You can set watchpoints on your global near variables in dScope, then step through the ?C?INITEDATA routine to view the variables being initialized one by one.

The ?C?INITEDATA routine may be found in the file INITEDAT.A51 inside the LIB folder of your C251 installation.

Article last edited on: 2007-03-27 11:31:56

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential