does anybody know if it is possible to tell gcc in the same source file to leave certain blocks unoptimized.
IMHO you cannot do that.
Why would you want it?
Please don't send me PMs, use email if you want to approach me personally.
I'd like to be able to have different optimization for different pieces/functions. IAR allows to do that, GCC as far as I know doesn't.
The option of creation different files doesn't always work because of encapsulation issues for example.
I´m writing a LIN 2.0 driver and I want to leave an interrupt routine, which is used to calibrate the internal rc - oscillator unoptimized, but optimize the rest for code size. The reason behind this is, that I don´t want that the user of the driver has to set the optimization level for the isr in his make file.
I´m writing a LIN 2.0 driver and I want to leave an interrupt routine, which is used to calibrate the internal rc - oscillator unoptimized, but optimize the rest for code size.
No chance. Better use inline asm or such for those things where you want to
make sure about the timing.
FYI, the GCC folks are aware that this is a desired feature (different levels of optimization within a single file). And I think that someone might be working on that, but it may take some time before it's implemented and released. This is just from browsing the gcc mailing list.
© 2019 Microchip Technology Inc.