avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] linker issue, resolving a pointer as uint32_t


From: Torsten Mohr
Subject: Re: [avr-gcc-list] linker issue, resolving a pointer as uint32_t
Date: Wed, 29 Jun 2005 02:09:41 +0200
User-agent: KMail/1.8

Hi,

> const uint32_t app_info_end __attribute__ ((section(".fini0"))) =
>  APP_INFO_END;  // place a special number at the end of the program
>
> const APP_INFO app_info __attribute__ ((section(".vectors"))) = {
>   APP_INFO_MAGIC,
>   1,
>   &app_info + sizeof(APP_INFO),
>   &app_info_end,  // place a pointer to that special number for checking
>   0xadde,
>   "a_____b",
>   "c_____________________________d"
> };

I looked in the generated assembler listing file and generated some
inline assembler from that, except that i changed the type .word to
.long for the struct members .begin and .end.

Additionally, i added a filled section .fini5 so the section .fini0 is
now above 64 kB.


const uint32_t app_info_end __attribute__ ((section(".fini0"))) = 
APP_INFO_END;

asm (
".global        app_info\n"
"       .section        .vectors,\"a\",@progbits\n"
"       .type   app_info, @object\n"
"       .size   app_info, 54\n"
"app_info:\n"
"       .long   826366246\n"
"       .long   1\n"
"       .long   app_info\n"
"       .long   app_info_end\n"
"       .word   -21026\n"
"       .text\n"
);


asm (
".global        filler\n"
"       .section        .fini5,\"a\",@progbits\n"
"       .type   filler, @object\n"
"       .size   filler, 65536\n"
"filler:\n"
"       .fill   65536, 1, 160\n"
"       .text\n"
);


Now i get in the listing generated with avr-objdump -h -S:

0000008c <app_info>:
      8c:       26 59 41 31 01 00 00 00 8c 00 00 00 4a 0f 01 00     
&YA1........J...

And that is correct, at the address 0x10f4a i get the symbol app_info_end
and it contains the value APP_INFO_END = 0x47110815.


00010f4a <app_info_end>:
   10f4a:       15 08 11 47                                         ...G


So what i wanted to do can be achieved with some inline assembler.


Best regards,
Torsten.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]