Compiler for Nuttx

September 6, 2010

[Warning: This post is a backup recovery from my previous Wordpress blog. All content was automatically converted accessing a MySQL database using a Python script (details). Mostly are in Portuguese but if you are interest I can translate to English. If you found any problem dont’t hesitate to contact me in comments.]

I was following this thread on Nuttx maillist on recommended compiler to buildNuttx RTOS. As a matter of practicalityI guess that many users use CodeSourcery arm-none-linux-gnueabi but today I decided test the code generated for Cortex-M3 (LPC1768) using the toolchain fromBuildroot. As Greg Nutt said (text adapted):

They were configured using OABI [old arm ABI], but I prefer them because (1) they are not EABI and reliably link code with -O3 or -Os, making it up to half the size, and (2) include nuttx "built in" -- they really should be called arm-nuttx-gcc tools.

Here my stats (defconfig):

$ arm-none-eabi-size nutt text data bss dec hex filename 71000 324 2248 73572 11f64 nuttx

$ arm-elf-size nuttx text data bss dec hex filename 56172 330 2248 58750 e57e nuttx

The final .bin has an delta of 16K. As I'm using one parallel JTAG (flash rates @ 0.2 KiB/S) this means almost1 minute reduction in each flash write_image. If you check Make.defs note that MAXOPTIMIZATION for CodeSourcery isn't using optimize for size option (-Os). As explained on config/<board>/README.txt it doesn't work with this kind of optimization level [tested with 2009q1].