Open suborb opened 3 years ago
Thanks for the tips. I used the pragma printf and scanf to cut about 1k of code space.
No worries, one other thing, --c-code-in-asm
will prevent some of the optimisation rules from firing so you might want to consider removing that at some point.
More thoughts on this aspect of the project.
Hope you don't mind, I'm just going to drop some hints on size trimming at link time.
From this I can see a lot of printf formatters being pulled in. You can configure which ones are pulled in by adding the following to zpragma.inc:
Which probably covers most of the cases you've got, this will save a few hundred bytes. You can do the same with the scan formatters (#pragma scanf)
-lndos
to the linking options will replace them with stubs. This will save 4k or so. If it gets really tight, I'm sure we could write a simplified version that would be a lot smaller.Some compile time ones that may not be obvious:
htons/htonl should be available in the standard library via
<net/hton.h>
- the peepholer additionally has some rules to handle these so you end up with both a performance and size advantage.If your hardware ports are known at compile time then using
__sfr
s will inline the IO code, saving time and size.