Compiling NuttX for Cortex-M0

NuttX has support to Cortex-M0 (Nuvoton NUC1xx), then let us to test it:

$ export PATH=/usr/local/gcc-arm-embedded/bin:$PATH
$ cd tools
$ ./configure.sh nutiny-nuc120/nsh
$ cd ..

Modify .config to use Linux Host instead of Windows:

-# CONFIG_HOST_LINUX is not set
+CONFIG_HOST_LINUX=y
-CONFIG_HOST_WINDOWS=y
+#CONFIG_HOST_WINDOWS is not set
-CONFIG_WINDOWS_CYGWIN=y
+#CONFIG_WINDOWS_CYGWIN is not set

Compile passing CROSSDEV and ARCROSSDEV:

$ make CROSSDEV=arm-none-eabi- ARCROSSDEV=arm-none-eabi-

Now let see final binary size:

$ ls -l nuttx.bin 
-rwxrwxr-x 1 alan alan 31378 Abr  2 09:51 nuttx.bin

Very good, just 31KB of Flash!

Now let to test setting directly on .config file and using “make” with no parameter:

$ make distclean
$ cd tools
$ ./configure.sh nutiny-nuc120/nsh
$ cd ..

Modify your .config to Linux host and GNU EABI toolchain:

-# CONFIG_HOST_LINUX is not set
+CONFIG_HOST_LINUX=y
-CONFIG_HOST_WINDOWS=y
+#CONFIG_HOST_WINDOWS is not set
-CONFIG_WINDOWS_CYGWIN=y
+#CONFIG_WINDOWS_CYGWIN is not set
-CONFIG_ARMV6M_TOOLCHAIN_BUILDROOT=y
+#CONFIG_ARMV6M_TOOLCHAIN_BUILDROOT is not set
-# CONFIG_ARMV6M_TOOLCHAIN_GNU_EABI is not set
+CONFIG_ARMV6M_TOOLCHAIN_GNU_EABI=y

Now let see its size:

$ ls -l nuttx.bin 
-rwxrwxr-x 1 alan alan 46192 Abr  2 10:05 nuttx.bin

Strange, when defining toolchain directly on .config the final size is bigger.

I used gcc-arm-none-eabi-4_7-2012q4-20121208-linux.tar.bz2 as toolchain, I’m going to test new version and will put my results here.

UPDATE: Gregory Nutt pointed out the issue is because arch/arm/src/armv6-m/Toolchain.defs was defining -O3 instead of -Os when the CONFIG_ARMV6M_TOOLCHAIN was defined to GNU_EABI. Just replacing -O3 by -Os fixed it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s