Forum Discussion
Altera_Forum
Honored Contributor
19 years ago --- Quote Start --- originally posted by david_cai@Aug 17 2006, 06:10 AM thanks very much for your reply...
i am still a little confuse...
__bss_start is a pointer, it's value equal to the start address of bss section
why
printf("%u\n",(unsigned int)&__bss_start); but not
printf("%u\n",(unsigned int)__bss_start);
thanks again,
david
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17677)
--- quote end ---
--- Quote End --- You've told the compiler that __bss_start is a pointer, with space allocated elsewhere. But there is no space allocated, so the only way to use your new pointer is to take the address of it, which gives you the value of __bss_start. I do it this way when the symbol is within range of the global pointer:
extern unsigned char __some_near_symbol;
unsigned int NearSymbolAddr;
NearSymbolAddr = (unsigned int) &__some_near_symbol; or if not in range of the global pointer: extern unsigned char __some_far_symbol; // Use to force compiler to not use global pointer.
unsigned int FarSymbolAddr;
FarSymbolAddr = (unsigned int) __some_far_symbol;