>> -bootloader section cannot have calls to the application section ! > > That's only your problem though. The compiler can reasonably expect > you to include all its helper functions into the resulting binary. Yeah, it's my problem alright :) And it will be included, just won't work...
> I agree it's a pessimization here, but it's correct code. The > compiler cannot have any idea about you distinguishing between an > application and a bootloader area. The compilet might not have any idea about it, but I argue that it could! And maybe should. If it's generating calls from my function (unwanted), it could be so kind to put the callee next to the caller. > Rule of thumb: whenever you are tempted to create a separate > ..bootloader section, you are usually wrong. The bootloader is simply > a standalone application of its own, so compile/link it that way. In this case you are wrong. Don't let the name of the bootloader section mislead you. It's not a bootloader! It's part of an application, it's just needs to use spm instructions (which if i'm not mitaken can only be used from the NRWW section) to update a table with used data. But while we writing the flash "software can never read any code that is located inside the RWW section" ... "software might end up in an unknown state". So the problem not even that the called function wont be there, but that it wont be accessible. >> if I wanted modulo, I would have written % > > It's a machine. The optimizer is tuned to catch situations which the > developer didn't write in a machine-friendly (but usually in a > user-friendly) way, and from its point of view, your code probably > just looks like a poor attempt to write down a simple division/modulus > operation. The only fault of the optimizer here is to not recognize > that including the library function will result in larger code. Please stop making the compiler "think" it's smarter than me! Ppl who think they can write a program that is smarter than other humans (with programming experience) are usually wrong! Maybe someday AI-s will be smart enough, but we are not there yet. With this pattern recognition the compiler's writer might made some shitty programmers code better, but made a decent programmers code worse... At least let me turn it off, ...pretty please I had the pleasure to some TV card software that thought they knew everything best and had county profiles as channel list, and didn't have manual/fine tuning. Of course they never found more than half of the channels... OK, i know most programmers don't know about instruction pairing, pipeline and cache architecture, so it's a valid goal to do that optimization by default (unless explicitly asked otherwise ) but converting a loop to modulo... If someone written a loop he/she deserves a loop! regards, Istvan _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list