c - Address Of (&) To Get Value From Symbol Table -
Text after "itemprop =" text ">
I have a question about how the symbols are placed in the symbol table and then how you reference those symbols from within C is.
So suppose I have a startup assembly file where some of the main things are done before main calling (). One of the exchanges is a pair of symbols that define the heap.
St_Length EQU 0x00000400 area stack, NOINIT, READWRITE, align = 3 Export St_Length Export ra_Stack ra_Stack Space St_Length
Then in a source.c file in which I I want to refer to those symbols to me:
extern uint32_t St_Length; Exported from / * asm.s * / void func (zero) {uint32_t i; (I = 0; I & lt; (uint32_t) (& amp; St_Length); ++ i) Do something for \\}
To work correctly, That is, it seems that the display will loop 0x400 times my question is the reason why I use Ampersand to think I like it, not value symbol, not Let's know the symbol should get to do?
Note: This is an ARM Cortex-M3 thank you for helping to use toolchain provided with Keil
Edit : .. Here is the relevant part of my symbol table from the generated symbol file:
Global Signal Icons Name Value OVE Type Size Object (Section) St_Length 0x00000400 Number 0 Startup_Storm32F10X_MDO ABSOLUTE
Any explanation of the symbol table 'type' column will also be very useful.
After
Because EQU
using St_Length
The symbol for the address is defined as 0x400
. To define it as a variable at a suitable address, you need some lines of the following:
St_Length DCD 0x400
Keep in the area.)
Comments
Post a Comment