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

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

Re: [Fwd: Re: [avr-gcc-list] Allocating variables to a fixed address]


From: Jan Waclawek
Subject: Re: [Fwd: Re: [avr-gcc-list] Allocating variables to a fixed address]
Date: Tue, 12 May 2009 14:26:38 +0200

>Why would the compiler respect assembler any more than my C calls 


Because the compiler knows nothing on assembly language. It simply passes it as 
a string to the assembler: it does not attempt to parse it (except for the 
escape sequences), so it has no chance to modify the order of anything.

On the other hand, a compiler is free to do whatever it wants to do with 
statements you pass to it: it can reorder and insert voids wherever and 
whenever it wants. This is the very principle of high level languages: you give 
up part of control in exchange of increase in convenience. If you want to 
re-gain control for whatever reason, the best thing to do is to revert to 
assembler.

As I said, you can make this a standalone assembler source, if you feel more 
comfortable with it, and the link it together. The same thing can be done with 
variables, see attachment - this avoids the need to put all variables into a 
single struct (to ensure their fixed order); but I don't say this is the best 
way to do with variables.

JW


Attachment: tmp.zip
Description: Zip compressed data


reply via email to

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