[chbot] GCC / Codesourcery #pragma for ARM Cortex M3
Volker Kuhlmann
list0570 at paradise.net.nz
Sat Oct 15 22:04:43 BST 2011
Hi Mark,
> I need tight optimization around a small code block (can be made into
> a function if need be).
>
> The main body (10k lines) has been tested without any optimization,
> so, I am loathed to change optimization for the whole system and then
> have to re-test.
>
> Anyone know of an optimization pragma I can use just for this tight piece ?
The gcc manual is pretty comprehensive, I'd look there, but I haven't
heard of or seen any way of influencing compiler switches during the
compilation of a module.
You can however change compiler option per module. So if you move this 1
function (10k lines for a function does sound badly structured though)
into a separate module, you can use different switches.
Re-testing would be the better way though, after constructing some test
automation. You want to enter a bet that you don't ever want to make any
other changes later?
> I guess the other option is do-it-in-assembler, which isn't such a
> bad idea now I come to think of it. The M3 is such a lovely target...
There is never a case for assembler unless you are under extreme code
space or extreme performance limits and that applies only to high-volume
products where the high expense of development time pays off. For a
few-off you drop another gold coin on a bigger CPU.
Or you like beautiful assembler and its asthetics, but then you're not
looking at cost/benefit, you're entertaining yourself... ;-)
Volker
--
Volker Kuhlmann
http://volker.dnsalias.net/ Please do not CC list postings to me.
More information about the Chchrobotics
mailing list