Comments (3)
The original idea was to eliminate any calling overhead with methods that are only called once. As there is only 4K of program space on the smaller xmega chips, throwing out unnecessary code seemed like a good idea. However, now that I look at those methods in the assembly dump, it looks like it didn't work. Also, it seems the calling overhead for some of those functions is rather minimal, so it should be possible to remove the always_inline attributes. I will investigate further and see what the best solution will be in terms of code size.
from xboot.
Hi,
thanks for the response. Of course, I have no objections against
inlining. My point is rather simple: the "always_inline" attribute will
have no effect unless yourgive the compiler a chance to do the actual
inlining, and for this, the compiler needs the function body, not just
the proto-type. Example: uart_init(), let's do a simple grep:
$ grep uart_init *.c *.h
uart.c:void attribute ((always_inline)) uart_init(void)
xboot.c: uart_init();
uart.h:extern void attribute ((always_inline)) uart_init(void);
This means: you place the functions body in the .c-file uart.c, the
proto-type in the header file uart.h, and then the call to uart_init()
into the c-file xboot.c. How could possibly gcc inline the function
uart_init() when it compiles xboot.c? That is impossible. You would have
to place the function definition (not just the proto-type) of
uart_init() into uart.h. "inline" is in principle a matter of copy and
paste, but for this the compiler needs to know what it shall paste into
"xboot.c".
Actually, I just stumbled over it because in my attempt to use the
latest and greatest gcc, I was using gcc-4.7 (pre-release) and that one
emits an error, not just a warning, stating (rightly) that is is
impossible to do the inlining without knowledge about what should
actually be inlined.
Ways out:
- use LTO, but that is still experimental. "Link Time Optimization"
basically puts an internal representation of the source code into the
object files, the linker puts everything together, and then the
compilere is invoked again to do further optimizations (e.g. further
inlining). Basically, LTO is somewhat equivalent to produce one large
source-code file. - or: do just this, concatenate all source-files, then do the
compilation on that "master-file". This has been done before by other
projects. One has to be a little bit carefull with file-local static
variables and functions, but this is probably not an issue. - simply discard always_inline. As "always_inline" had no effect (could
not, think about it!), things will not become worse.
Best,
Claus
On 14.03.2012 19:14, Alex Forencich wrote:
The original idea was to eliminate any calling overhead with methods
that are only called once. As there is only 4K of program space on
the smaller xmega chips, throwing out unnecessary code seemed like a
good idea. However, now that I look at those methods in the assembly
dump, it looks like it didn't work. Also, it seems the calling
overhead for some of those functions is rather minimal, so it should
be possible to remove the always_inline attributes. I will
investigate further and see what the best solution will be in terms
of code size.--- Reply to this email directly or view it on GitHub:
#3 (comment)
Claus-Justus Heine [email protected]
http://http://www.claus-justus-heine.de/
from xboot.
I went ahead and removed all the always_inline attributes for the time being. I suppose I could move most of the code into the header files and put them back in. For the time being, though, it's not a big deal as I don't believe the calling overhead is particularly significant.
from xboot.
Related Issues (20)
- ATmega32u4 HOT 2
- update firmware with Xboot on a micro through SPI bus and micro is slave..
- API not responding HOT 11
- All reset flags cleared by xboot
- EEPROM writing problem
- UEFI Support HOT 1
- Make configurations HOT 15
- make arduino328p fails if i2c is enabled in config file
- xboot for addressable devices HOT 1
- Fails to flash application on xmega384D3 HOT 3
- Problem compiling non modified source in AS 7.0 HOT 2
- blocks in erase page HOT 2
- XBOOT on AS7 HOT 1
- Start bootloader section address HOT 2
- Licensing HOT 1
- USE_LED ... LED not lit when USE_ENTER_DELAY = no and USE_ENTER_PIN = yes
- Generating config.h - syntax error: unexpected end of file HOT 3
- Trouble Flashing Application
- Compiling Issues HOT 3
- Enter Bootloader HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xboot.