Hi,
I'm trying to get the full address of various labels created by the
linker, e.g. __data_load_end. This should work on devices with more than
64k program space.
After trying several type casts to uint32_t, which all failed, I ended
up with an awfully ugly inline assembler code:
#define LABEL_ADDRESS(label) ({ \
uint32_t result; \
__asm__ \
( \
"ldi r30, lo8(" label ")\n\t" \
"mov %A0, r30\n\t" \
"ldi r30, hi8(" label ")\n\t" \
"mov %B0, r30\n\t" \
"ldi r30, hlo8(" label ")\n\t" \
"mov %C0, r30\n\t" \
"ldi r30, hhi8(" label ")\n\t" \
"mov %D0, r30\n\t" \
: "=r" (result) \
: \
: "r30" \
); \
result; \
})
uint32_t addr = LABEL_ADDRESS("__data_load_end");
There must be a nicer way to get this done. Any idea?
Thanks,
Harald
_______________________________________________
AVR-chat mailing list
AVR-chat@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-chat