This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
> Is there any way I can obtain info from the linker script's MEMORY spec
> from within my code? Are the parameters made available as symbols by the
> linker or anything?
>
> - Toralf
>
You can certainly do it if you have your own linker script. For example,
you might have something like this in your linker file:
.bss (NOLOAD) :
{
. = ALIGN(0x4);
__bss_start = .;
*(.shbss)
*(.bss)
*(COMMON)
_end = ALIGN (0x8); /* Used by sbrk() as start of heap */
__bss_end = _end;
} > IRam
You can then have C code like:
extern unsigned long int __bss_start, __bss_end;
void clearBss(void)
{
unsigned long int *p;
unsigned short int n;
p = &__bss_start; // Source for clear
n = &__bss_end - &__bss_start; // Total size (in 32-bit dwords)
while (n--) {
*p++ = 0; // Clear bss
};
}
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |