|
From: | Graham Davies |
Subject: | Re: Re: [avr-gcc-list] Allocating variables to a fixed address] |
Date: | Tue, 12 May 2009 07:22:29 -0400 |
Robert von Knobloch wrote:
Why would the compiler respect assembler any more than my C calls (it changes the order of them as they are stored in memory, so I cannot guarantee the address of "test_func_1()")
There is nothing in the C language that tells the compiler to preserve the ordering of global and static objects. GCC is perfectly within its rights to change the order of your functions. To preserve their relative order, you need to use function pointers and make them elements in a single array or structure which, if you avoid padding, will have the memory layout you expect. Or, use assembler, which the compiler won't mess with.
Graham.
[Prev in Thread] | Current Thread | [Next in Thread] |