jason-mitchell / AlphaX

Alpha-X Headphone project
1 stars 0 forks source link

FLASH Usage #1

Closed jason-mitchell closed 7 years ago

jason-mitchell commented 7 years ago

It has occurred to me the original code I used as a template, is implementing the stub functions to make printf() work. This means all the overhead of stdin and stdout is being compiled into the project, which is partly the reason why the code size was reported the other day as being insufficient. To my knowledge, a full blown printf() implementation consumes around 88kbytes!

This also means, any printf() doesn't immediately appear at the serial port... you have to use fflush(stdout) This is kind of inconvenient, and abysmally slow!

TODO: We can write to the serial port directly, we don't need printf() if we have to display numbers we can use sprintf() instead. In fact we already did. - Get rid of dependence on and remove the stub putch() getch() and friends....

jason-mitchell commented 7 years ago

I installed the free version of Atollic TrueStudio, and it appears that despite the very best efforts of the developers and myself, the emIDE development suite still generates large code (due to printf() and the lack of some items. It also appears that the compiler toolchain does not correctly handle include guards.

jason-mitchell commented 7 years ago

As I expected, porting the project to Atollic TrueStudio, resolves the issue.. code size in flash is a mere 11%