Discussion:
Building toolchain on OSX
(too old to reply)
Daniel O'Connor
2011-10-07 07:04:28 UTC
Permalink
Hi,
I tried building a toolchain for an STM32F103 (ARM Cortex-M3) but without much luck..
I checked out the tree with..

cd ~/projects
svn co -r4028 https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk nuttx
cd nuttx/misc/buildroot
cp configs/cortexm3-defconfig-4.3.3 .config
[ select 2, 1, 1 ]
make

And I get..
Makefile:129: warning: overriding commands for target `/Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu'
Makefile:90: warning: ignoring old commands for target `/Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu'
NuttX directory .//../nuttx does not exist
make: *** [../nuttx] Error 1

Any ideas?

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
Gregory N
2011-10-07 12:28:27 UTC
Permalink
Post by Daniel O'Connor
cd nuttx/misc/buildroot
cp configs/cortexm3-defconfig-4.3.3 .config
Normally at this point you probably need to run 'menuconfig' and change the path to NuttX. The default path in that configuration is

BR2_NUTTX_DIR="$(TOPDIR)/../nuttx"

Since you checked out the whole tree, the correct path will be (I think):

BR2_NUTTX_DIR="$(TOPDIR)/../../nuttx"
Post by Daniel O'Connor
[ select 2, 1, 1 ]
make
And I get..
Makefile:129: warning: overriding commands for target `/Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu'
Makefile:90: warning: ignoring old commands for target `/Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu'
This are okay. This is may be because you did not do the following before making:

make oldconfig
Post by Daniel O'Connor
NuttX directory .//../nuttx does not exist
make: *** [../nuttx] Error 1
This should go away if you correct the path to the nuttx directory.

Greg
Daniel O'Connor
2011-10-07 12:45:04 UTC
Permalink
Post by Gregory N
Post by Daniel O'Connor
cd nuttx/misc/buildroot
cp configs/cortexm3-defconfig-4.3.3 .config
Normally at this point you probably need to run 'menuconfig' and change the path to NuttX. The default path in that configuration is
BR2_NUTTX_DIR="$(TOPDIR)/../nuttx"
BR2_NUTTX_DIR="$(TOPDIR)/../../nuttx"
Post by Daniel O'Connor
[ select 2, 1, 1 ]
make
And I get..
Makefile:129: warning: overriding commands for target `/Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu'
Makefile:90: warning: ignoring old commands for target `/Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu'
make oldconfig
Post by Daniel O'Connor
NuttX directory .//../nuttx does not exist
make: *** [../nuttx] Error 1
This should go away if you correct the path to the nuttx directory.
OK thanks, this helped :)
I thought I had done this already though, very odd.

I am building on OSX and had to change..
XSED=$HOST_SED_DIR/bin/sed
to..
XSED=/usr/bin/sed

in toolchain/dependencies/dependencies.sh

now it's building..

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
Daniel O'Connor
2011-10-07 13:09:24 UTC
Permalink
Post by Daniel O'Connor
in toolchain/dependencies/dependencies.sh
now it's building..
Now it can't find GMP et al..
checking for correct version of mpfr.h... no
configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.0+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code can be found at their respective
hosting sites as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/.
See also http://gcc.gnu.org/install/prerequisites.html for additional info.
If you obtained GMP and/or MPFR from a vendor distribution package, make
sure that you have installed both the libraries and the header files.
They may be located in separate packages.
make: *** [/Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3-build/.configured] Error 1

I have these in /opt/local courtesy of MacPorts but I'm not sure how to tell the build about them..

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
Gregory N
2011-10-07 13:26:54 UTC
Permalink
Post by Daniel O'Connor
Now it can't find GMP et al..
...
I have these in /opt/local courtesy of MacPorts but I'm not sure how to tell the build about them.
This sounds like it is going to be a difficult job!

I think that you can specify the path to GMP and MPFR. I think that GCC has some special configuration command line options to support this. I can't remember exactly and I don't have an unpacked version of GCC at hand.

Try this: Go to the buildroot/toolchain_build_nofpu_arm/gcc-x.x directory and type:

./configure --help

That should list all of the GCC configuration options. I bet you will see (near the bottom) some options to set the path to these tools.

What you will have to do then is to modify the script at:

buildroot/toolchain/gcc/gcc-nuttx-4.x.mk

You will see that there are several places where $(GCC_DIR)/configure is invoked. I think you would have to hard code those path options into those configure commands.

Greg
Daniel O'Connor
2011-10-07 23:12:51 UTC
Permalink
Post by Gregory N
Post by Daniel O'Connor
Now it can't find GMP et al..
...
I have these in /opt/local courtesy of MacPorts but I'm not sure how to tell the build about them.
This sounds like it is going to be a difficult job!
I hope not :)

MacPorts has arm-none-eabi-gcc and I did get NuttX to build with it but I can't seem to talk to it on my board. I have build a basic program with the same compiler that works on the board.

It also has arm-elf-gcc but it defaults to hard FP and building with soft FP doesn't work.
Post by Gregory N
That should list all of the GCC configuration options. I bet you will see (near the bottom) some options to set the path to these tools.
Yep.
Post by Gregory N
buildroot/toolchain/gcc/gcc-nuttx-4.x.mk
You will see that there are several places where $(GCC_DIR)/configure is invoked. I think you would have to hard code those path options into those configure commands.
OK, I could only see one place, I modified that like so..
Index: toolchain/gcc/gcc-nuttx-4.x.mk
===================================================================
--- toolchain/gcc/gcc-nuttx-4.x.mk (revision 4028)
+++ toolchain/gcc/gcc-nuttx-4.x.mk (working copy)
@@ -39,6 +39,8 @@
# Setup some initial stuff
#
#############################################################
+EXTRA_GCC_CONFIG_OPTIONS:=--with-mpfr=/opt/local \
+ --with-gmp=/opt/local

GCC_TARGET_LANGUAGES:=c

And configure passed but now I get..
gcc -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -o cc1-dummy c-lang.o stub-objc.o attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o c-objc-common.o c-dump.o c-pch.o c-parser.o arm-c.o c-gimplify.o tree-mudflap.o c-pretty-print.o c-omp.o dummy-checksum.o \
main.o libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a -liconv ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/opt/local/lib -L/opt/local/lib -lmpfr -lgmp
Undefined symbols for architecture x86_64:
"_iconv_close", referenced from:
__cpp_destroy_iconv in libcpp.a(charset.o)
__cpp_convert_input in libcpp.a(charset.o)
"_iconv", referenced from:
_convert_using_iconv in libcpp.a(charset.o)
(maybe you meant: __cpp_destroy_iconv, _cpp_init_iconv )
"_iconv_open", referenced from:
_init_iconv_desc in libcpp.a(charset.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[3]: *** [cc1-dummy] Error 1
make[2]: *** [all-gcc] Error 2
make[1]: *** [all] Error 2
make: *** [/Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3-build/.compiled] Error 2

However libiconv DOES have those functions..
[Ur 9:41] ~/projects/nuttx/misc/buildroot >gobjdump -T /usr/lib/libiconv.2.dylib| egrep 'iconv_(open|close)'
unable to read unknown load command 0x24
unable to read unknown load command 0x26
unable to read unknown load command 0x24
unable to read unknown load command 0x26
0000000000013164 g 0f SECT 01 0000 .text _iconv_close
0000000000013171 g 0f SECT 01 0000 .text _iconv_open
00012ceb g 0f SECT 01 0000 .text _iconv_close
00012d1b g 0f SECT 01 0000 .text _iconv_open
00012d03 g 0f SECT 01 0000 .text _libiconv_close
00013ddf g 0f SECT 01 0000 .text _libiconv_open

I can't see any iconv related configure options and config.log in toolchain_build_arm_nofpu/gcc-4.3.3-build doesn't mention it at all..
Post by Gregory N
Greg
------------------------------------
Yahoo! Groups Links
--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
Daniel O'Connor
2011-10-08 03:54:58 UTC
Permalink
Post by Daniel O'Connor
main.o libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a -liconv ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/opt/local/lib -L/opt/local/lib -lmpfr -lgmp
__cpp_destroy_iconv in libcpp.a(charset.o)
__cpp_convert_input in libcpp.a(charset.o)
_convert_using_iconv in libcpp.a(charset.o)
(maybe you meant: __cpp_destroy_iconv, _cpp_init_iconv )
_init_iconv_desc in libcpp.a(charset.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[3]: *** [cc1-dummy] Error 1
make[2]: *** [all-gcc] Error 2
make[1]: *** [all] Error 2
make: *** [/Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3-build/.compiled] Error 2
After some googling I modified.. toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile
--- toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile.orig 2011-10-08 14:23:45.000000000 +1030
+++ toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile 2011-10-08 14:21:49.000000000 +1030
@@ -558,7 +558,7 @@
LIBINTL_DEP =

# Character encoding conversion library.
-LIBICONV = -liconv
+LIBICONV = -L/usr/lib -liconv
LIBICONV_DEP =

# The GC method to be used on this system.

This isn't a final solution though since that is a generated file.. Is there some way I can have the build infrastructure modify the corresponding .in file before configure runs?

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
Daniel O'Connor
2011-10-08 06:24:25 UTC
Permalink
Post by Daniel O'Connor
Post by Daniel O'Connor
main.o libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a -liconv ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/opt/local/lib -L/opt/local/lib -lmpfr -lgmp
__cpp_destroy_iconv in libcpp.a(charset.o)
__cpp_convert_input in libcpp.a(charset.o)
_convert_using_iconv in libcpp.a(charset.o)
(maybe you meant: __cpp_destroy_iconv, _cpp_init_iconv )
_init_iconv_desc in libcpp.a(charset.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[3]: *** [cc1-dummy] Error 1
make[2]: *** [all-gcc] Error 2
make[1]: *** [all] Error 2
make: *** [/Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3-build/.compiled] Error 2
After some googling I modified.. toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile
--- toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile.orig 2011-10-08 14:23:45.000000000 +1030
+++ toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile 2011-10-08 14:21:49.000000000 +1030
@@ -558,7 +558,7 @@
LIBINTL_DEP =
# Character encoding conversion library.
-LIBICONV = -liconv
+LIBICONV = -L/usr/lib -liconv
LIBICONV_DEP =
# The GC method to be used on this system.
This isn't a final solution though since that is a generated file.. Is there some way I can have the build infrastructure modify the corresponding .in file before configure runs?
<snip>
Target: arm-elf
Configured with: /Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3/configure --prefix=/Users/darius/projects/nuttx/misc/buildroot/build_arm_nofpu/staging_dir --build=i386-pc-elf --host=i386-pc-elf --target=arm-elf --enable-languages=c,c++ --disable-__cxa_atexit --disable-libssp --enable-target-optspace --with-gnu-ld --disable-shared --disable-nls --enable-threads --disable-multilib --with-float=soft --with-abi=apcs-gnu --with-arch=armv7-m --with-tune=cortex-m3 --with-mode=thumb --with-mpfr=/opt/local --with-gmp=/opt/local
Thread model: single
gcc version 4.3.3 (GCC)
configure:2374: $? = 0
configure:2376: /Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3-build/./gcc/xgcc -B/Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3-build/./gcc/ -B/Users/darius/projects/nuttx/misc/buildroot/build_arm_nofpu/staging_dir/arm-elf/bin/ -B/Users/darius/projects/nuttx/misc/buildroot/build_arm_nofpu/staging_dir/arm-elf/lib/ -isystem /Users/darius/projects/nuttx/misc/buildroot/build_arm_nofpu/staging_dir/arm-elf/include -isystem /Users/darius/projects/nuttx/misc/buildroot/build_arm_nofpu/staging_dir/arm-elf/sys-include -V </dev/null >&5
xgcc: '-V' must come at the start of the command line
configure:2379: $? = 1
configure:2398: /Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3-build/./gcc/xgcc -B/Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3-build/./gcc/ -B/Users/darius/projects/nuttx/misc/buildroot/build_arm_nofpu/staging_dir/arm-elf/bin/ -B/Users/darius/projects/nuttx/misc/buildroot/build_arm_nofpu/staging_dir/arm-elf/lib/ -isystem /Users/darius/projects/nuttx/misc/buildroot/build_arm_nofpu/staging_dir/arm-elf/include -isystem /Users/darius/projects/nuttx/misc/buildroot/build_arm_nofpu/staging_dir/arm-elf/sys-include -o conftest -g -Os conftest.c >&5
conftest.c:1: internal compiler error: Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
configure:2401: $? = 1

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
Gregory N
2011-10-08 12:37:34 UTC
Permalink
Post by Daniel O'Connor
Post by Daniel O'Connor
After some googling I modified.. toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile
--- toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile.orig 2011-10-08 14:23:45.000000000 +1030
+++ toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile 2011-10-08 14:21:49.000000000 +1030
@@ -558,7 +558,7 @@
LIBINTL_DEP =
# Character encoding conversion library.
-LIBICONV = -liconv
+LIBICONV = -L/usr/lib -liconv
LIBICONV_DEP =
# The GC method to be used on this system.
This isn't a final solution though since that is a generated file.. Is there some way I can have the build infrastructure modify the corresponding .in file before configure runs?
There is probably a file called Makefile.in in that same directory. That would be the template that Makefile is generated from.
Post by Daniel O'Connor
Configured with: /Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3/configure --prefix=/Users/darius/projects/nuttx/misc/buildroot/build_arm_nofpu/staging_dir --build=i386-pc-elf --host=i386-pc-elf --target=arm-elf --enable-languages=c,c++ --disable-__cxa_atexit --disable-libssp --enable-target-optspace --with-gnu-ld --disable-shared --disable-nls --enable-threads --disable-multilib --with-float=soft --with-abi=apcs-gnu --with-arch=armv7-m --with-tune=cortex-m3 --with-mode=thumb --with-mpfr=/opt/local --with-gmp=/opt/local
NOTE that EABI is not selected. The NuttX buildroot builds the old-style (but very reliable) OABI toolchain.
Post by Daniel O'Connor
conftest.c:1: internal compiler error: Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
configure:2401: $? = 1
My least favorite result. There is probably some fix (perhaps a mismatch of libraries?), but I don't know would be.

Greg
Daniel O'Connor
2011-10-08 22:39:14 UTC
Permalink
Post by Gregory N
Post by Daniel O'Connor
Post by Daniel O'Connor
After some googling I modified.. toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile
--- toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile.orig 2011-10-08 14:23:45.000000000 +1030
+++ toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile 2011-10-08 14:21:49.000000000 +1030
@@ -558,7 +558,7 @@
LIBINTL_DEP =
# Character encoding conversion library.
-LIBICONV = -liconv
+LIBICONV = -L/usr/lib -liconv
LIBICONV_DEP =
# The GC method to be used on this system.
This isn't a final solution though since that is a generated file.. Is there some way I can have the build infrastructure modify the corresponding .in file before configure runs?
There is probably a file called Makefile.in in that same directory. That would be the template that Makefile is generated from.
OK, I was more wondering if there is a way to modify the buildroot code to tell it to modify that file rather than me doing it by hand. That would also allow me to nuke the build directory and try it from scratch.
Post by Gregory N
Post by Daniel O'Connor
Configured with: /Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3/configure --prefix=/Users/darius/projects/nuttx/misc/buildroot/build_arm_nofpu/staging_dir --build=i386-pc-elf --host=i386-pc-elf --target=arm-elf --enable-languages=c,c++ --disable-__cxa_atexit --disable-libssp --enable-target-optspace --with-gnu-ld --disable-shared --disable-nls --enable-threads --disable-multilib --with-float=soft --with-abi=apcs-gnu --with-arch=armv7-m --with-tune=cortex-m3 --with-mode=thumb --with-mpfr=/opt/local --with-gmp=/opt/local
NOTE that EABI is not selected. The NuttX buildroot builds the old-style (but very reliable) OABI toolchain.
Post by Daniel O'Connor
conftest.c:1: internal compiler error: Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
configure:2401: $? = 1
My least favorite result. There is probably some fix (perhaps a mismatch of libraries?), but I don't know would be.
OK, I will clean it up and try building again after modifying the .in file.
Post by Gregory N
Greg
------------------------------------
Yahoo! Groups Links
--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
Gregory Nutt
2011-10-09 00:09:35 UTC
Permalink
Post by Daniel O'Connor
OK, I was more wondering if there is a way to modify the buildroot code to tell it to modify that file rather than me doing it by hand. That would also allow me to nuke the build directory and try it from scratch.
Yes.  You can provide a patch that does this.  In the configs directory there are a few (at least on path file).  In the README file, it says if you are building under certain conditions, then you should add the patch file to the GCC build directory.
Greg
Ekawahyu Susilo
2011-10-08 12:46:09 UTC
Permalink
Hi Daniel,

About a week ago, I managed to build the toolchain on OS X (with minor modification here and there). I could even build application, however, it doesn't seems to work on my board.

I have my gmp, mpc, and mpfr built from source and I used those to build my own arm-none-eabi long time ago. I could send you my changes if you would like.

I am still struggling to build application using my toolchain. The .ihx exists, but it doesn't seem to work on STM32F103.

Regards,

Eka
Post by Daniel O'Connor
Post by Daniel O'Connor
main.o libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a -liconv ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/opt/local/lib -L/opt/local/lib -lmpfr -lgmp
__cpp_destroy_iconv in libcpp.a(charset.o)
__cpp_convert_input in libcpp.a(charset.o)
_convert_using_iconv in libcpp.a(charset.o)
(maybe you meant: __cpp_destroy_iconv, _cpp_init_iconv )
_init_iconv_desc in libcpp.a(charset.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[3]: *** [cc1-dummy] Error 1
make[2]: *** [all-gcc] Error 2
make[1]: *** [all] Error 2
make: *** [/Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3-build/.compiled] Error 2
After some googling I modified.. toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile
--- toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile.orig 2011-10-08 14:23:45.000000000 +1030
+++ toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile 2011-10-08 14:21:49.000000000 +1030
@@ -558,7 +558,7 @@
LIBINTL_DEP =
# Character encoding conversion library.
-LIBICONV = -liconv
+LIBICONV = -L/usr/lib -liconv
LIBICONV_DEP =
# The GC method to be used on this system.
This isn't a final solution though since that is a generated file.. Is there some way I can have the build infrastructure modify the corresponding .in file before configure runs?
--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
Daniel O'Connor
2011-10-08 22:40:57 UTC
Permalink
Post by Ekawahyu Susilo
About a week ago, I managed to build the toolchain on OS X (with minor modification here and there). I could even build application, however, it doesn't seems to work on my board.
I have my gmp, mpc, and mpfr built from source and I used those to build my own arm-none-eabi long time ago. I could send you my changes if you would like.
I am still struggling to build application using my toolchain. The .ihx exists, but it doesn't seem to work on STM32F103.
I have used arm-none-eabi from MacPorts to compile code for exactly that chip :)

I also got NuttX to build with arm-none-eabi but the generated code appears broken (so much so that it confuses the STLink debugger..)
Post by Ekawahyu Susilo
Regards,
Eka
Post by Daniel O'Connor
Post by Daniel O'Connor
main.o libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a -liconv ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/opt/local/lib -L/opt/local/lib -lmpfr -lgmp
__cpp_destroy_iconv in libcpp.a(charset.o)
__cpp_convert_input in libcpp.a(charset.o)
_convert_using_iconv in libcpp.a(charset.o)
(maybe you meant: __cpp_destroy_iconv, _cpp_init_iconv )
_init_iconv_desc in libcpp.a(charset.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[3]: *** [cc1-dummy] Error 1
make[2]: *** [all-gcc] Error 2
make[1]: *** [all] Error 2
make: *** [/Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3-build/.compiled] Error 2
After some googling I modified.. toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile
--- toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile.orig 2011-10-08 14:23:45.000000000 +1030
+++ toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile 2011-10-08 14:21:49.000000000 +1030
@@ -558,7 +558,7 @@
LIBINTL_DEP =
# Character encoding conversion library.
-LIBICONV = -liconv
+LIBICONV = -L/usr/lib -liconv
LIBICONV_DEP =
# The GC method to be used on this system.
This isn't a final solution though since that is a generated file.. Is there some way I can have the build infrastructure modify the corresponding .in file before configure runs?
--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
------------------------------------
Yahoo! Groups Links
--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
Daniel O'Connor
2011-10-08 23:33:19 UTC
Permalink
Post by Ekawahyu Susilo
About a week ago, I managed to build the toolchain on OS X (with minor modification here and there). I could even build application, however, it doesn't seems to work on my board.
I have my gmp, mpc, and mpfr built from source and I used those to build my own arm-none-eabi long time ago. I could send you my changes if you would like.
That would be good, thanks!
Post by Ekawahyu Susilo
I am still struggling to build application using my toolchain. The .ihx exists, but it doesn't seem to work on STM32F103.
Regards,
Eka
Post by Daniel O'Connor
Post by Daniel O'Connor
main.o libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a -liconv ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/opt/local/lib -L/opt/local/lib -lmpfr -lgmp
__cpp_destroy_iconv in libcpp.a(charset.o)
__cpp_convert_input in libcpp.a(charset.o)
_convert_using_iconv in libcpp.a(charset.o)
(maybe you meant: __cpp_destroy_iconv, _cpp_init_iconv )
_init_iconv_desc in libcpp.a(charset.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[3]: *** [cc1-dummy] Error 1
make[2]: *** [all-gcc] Error 2
make[1]: *** [all] Error 2
make: *** [/Users/darius/projects/nuttx/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3-build/.compiled] Error 2
After some googling I modified.. toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile
--- toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile.orig 2011-10-08 14:23:45.000000000 +1030
+++ toolchain_build_arm_nofpu/gcc-4.3.3-build/gcc/Makefile 2011-10-08 14:21:49.000000000 +1030
@@ -558,7 +558,7 @@
LIBINTL_DEP =
# Character encoding conversion library.
-LIBICONV = -liconv
+LIBICONV = -L/usr/lib -liconv
LIBICONV_DEP =
# The GC method to be used on this system.
This isn't a final solution though since that is a generated file.. Is there some way I can have the build infrastructure modify the corresponding .in file before configure runs?
--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
------------------------------------
Yahoo! Groups Links
--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
Ekawahyu Susilo
2011-10-10 03:42:12 UTC
Permalink
This is the patch required to build buildroot 1.10 on Mac OS X. The toolchain is not yet tested to work, but it can generate .ihx from examples.

Tested on Mac OS X 10.6.8 with Macports installed. You might need to build gmp, mpfr, mpc and m4 from source or you could also get it from Macports by running under terminal, for example:

sudo port installed m4

How to apply the patch:
1. Extract the buildroot-1.10.tar.gz
2. Copy the buildroot-1.10-macosxbuild.patch to misc/buildroot-1.10
3. Under terminal, change directory to misc/buildroot-1.10
4. Execute command: patch -p2 -i buildroot-1.10-macosxbuild.patch
5. You can now follow the rest of the buildroot build process as written in the NuttX manual.

Regards,

Eka


N.B: Anyone who successfully built NuttX on Mac OS X, please let me know if you can generate .ihx and execute it under STM3210E-EVAL. Because I am struggling to make it work on my board with the same STM32F103ZET6 microcontroller but not STM3210E-EVAL.
i_hate_your_alias_scheme
2011-12-26 20:37:09 UTC
Permalink
Was this patch archived anywhere?

I've successfully built NuttX using a modified summon-arm-toolchain (https://github.com/MikeSmith/summon-arm-toolchain) but it would be nice to have the mainline build scheme supported on Mac OS X.

Also, is there a Cortex-M4 buildroot config at this time? Based on my experience with SAT, it probably needs to use a newer gcc if you want to build with the hardfp ABI.

(Yes, I'm experimenting with these, but it would be good to know if I'm duplicating work being done elsewhere.)

= Mike
Post by Ekawahyu Susilo
This is the patch required to build buildroot 1.10 on Mac OS X. The toolchain is not yet tested to work, but it can generate .ihx from examples.
sudo port installed m4
1. Extract the buildroot-1.10.tar.gz
2. Copy the buildroot-1.10-macosxbuild.patch to misc/buildroot-1.10
3. Under terminal, change directory to misc/buildroot-1.10
4. Execute command: patch -p2 -i buildroot-1.10-macosxbuild.patch
5. You can now follow the rest of the buildroot build process as written in the NuttX manual.
Regards,
Eka
N.B: Anyone who successfully built NuttX on Mac OS X, please let me know if you can generate .ihx and execute it under STM3210E-EVAL. Because I am struggling to make it work on my board with the same STM32F103ZET6 microcontroller but not STM3210E-EVAL.
Gregory N
2011-12-26 21:11:55 UTC
Permalink
Hi, Mike,
Post by i_hate_your_alias_scheme
Was this patch archived anywhere?
Check here: http://tech.groups.yahoo.com/group/nuttx/files/Patches/
Post by i_hate_your_alias_scheme
I've successfully built NuttX using a modified summon-arm-toolchain (https://github.com/MikeSmith/summon-arm-toolchain) but it would be nice to have the mainline build scheme supported on Mac OS X.
Also, is there a Cortex-M4 buildroot config at this time? Based on my experience with SAT, it probably needs to use a newer gcc if you want to build with the hardfp ABI.
(Yes, I'm experimenting with these, but it would be good to know if I'm duplicating work being done elsewhere.)
I put all of the support in for the M4 Neon/VFP floating pointing point, but I haven't found any version of GCC that supports it. If you know of a version that does support the FPU, I would be interest in knowing which.

I've been using the latest free CodeSourcery tools and they don't support the VFP.

Greg
Mike Smith
2011-12-26 23:45:55 UTC
Permalink
Post by i_hate_your_alias_scheme
**
Also, is there a Cortex-M4 buildroot config at this time? Based on my
experience with SAT, it probably needs to use a newer gcc if you want to
build with the hardfp ABI.
(Yes, I'm experimenting with these, but it would be good to know if I'm
duplicating work being done elsewhere.)
I put all of the support in for the M4 Neon/VFP floating pointing point,
but I haven't found any version of GCC that supports it. If you know of a
version that does support the FPU, I would be interest in knowing which.
The summon-arm-toolchain fork I mentioned (
https://github.com/MikeSmith/summon-arm-toolchain) builds a GCC with the
following multilibs supported:

thumb/arm7tdmi-s;@***@mcpu=arm7tdmi-s
thumb/cortex-m0;@***@mcpu=cortex-m0
thumb/cortex-m3;@***@mcpu=cortex-m3
thumb/cortex-m4;@***@mcpu=cortex-m4
thumb/cortex-m4/float-abi-hard/fpuv4-sp-d16;@mthumb
@mcpu=cortex-***@mfloat-abi=***@mfpu=fpv4-sp-d16

The last of those is the one you're looking for, but the configuration as a
whole covers the footprint for all of the Cortex-M family that most folks
are likely to care about.

It's based off the Linaro GCC distribution, which is more Cortex-A than
Cortex-M oriented, but they have generally had more of the generic
ARM-related fixes than mainline GCC, and they update much more frequently
than the CodeSourcery drops.

= Mike
Mike Smith
2011-12-27 02:32:50 UTC
Permalink
Post by Gregory N
Hi, Mike,
Post by i_hate_your_alias_scheme
Was this patch archived anywhere?
Check here: http://tech.groups.yahoo.com/group/nuttx/files/Patches/
Thanks. Sadly, gcc blows up (the built xgcc is broken internally) building either 4.3.3 or 4.5.2 on Mac OS X out of the buildroot:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
mark_reg_pointer (reg=0x0, align=32) at emit-rtl.c:1118
1118 if (! REG_POINTER (reg))
(gdb) where
#0 mark_reg_pointer (reg=0x0, align=32) at emit-rtl.c:1118
#1 0x0000000100282976 in init_emit_once () at emit-rtl.c:5805
#2 0x0000000100456c09 in backend_init [inlined] () at /Users/msmith/work/Mike/Nuttx/build/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.5.2/gcc/toplev.c:2204
#3 do_compile [inlined] () at /Users/msmith/work/Mike/Nuttx/build/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.5.2/gcc/toplev.c:2413
#4 0x0000000100456c09 in toplev_main (argc=29, argv=0x7fff5fbff5f0) at toplev.c:2459
#5 0x0000000100000f14 in start ()
(gdb) p reg
$1 = (struct rtx_def *) 0x0
(gdb) list
1113 as ALIGN, if nonzero. */
1114
1115 void
1116 mark_reg_pointer (rtx reg, int align)
1117 {
1118 if (! REG_POINTER (reg))
1119 {
1120 REG_POINTER (reg) = 1;
1121
1122 if (align)

I've built vanilla 4.5.2 on this system before (SAT will build it if not doing the Linaro thing), but I can't find anything in the NuttX buildroot patches that would account for this, so I'm a bit puzzled right now.

= Mike
erknie
2012-04-08 00:18:10 UTC
Permalink
I tried the patch, still can't get buildroot to build on 10.6.8. I am using the svn current version and this is the error:


touch /usr/local/src/Nuttx/nuttx/trunk/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3-build/.libs_installed
zcat toolchain/genromfs/genromfs-0.5.2.tar.gz | tar -C /usr/local/src/Nuttx/nuttx/trunk/misc/buildroot/toolchain_build_arm_nofpu -xf -
zcat: toolchain/genromfs/genromfs-0.5.2.tar.gz.Z: No such file or directory
toolchain/patch-kernel.sh /usr/local/src/Nuttx/nuttx/trunk/misc/buildroot/toolchain_build_arm_nofpu/genromfs-0.5.2 toolchain/genromfs \*.patch
Aborting. '/usr/local/src/Nuttx/nuttx/trunk/misc/buildroot/toolchain_build_arm_nofpu/genromfs-0.5.2' is not a directory.
make: *** [/usr/local/src/Nuttx/nuttx/trunk/misc/buildroot/toolchain_build_arm_nofpu/genromfs-0.5.2/.unpacked] Error 1


Has anyone successfully build Nuttx on Mac OS 10.6.8? If so what tool chain did you use? I am trying to build for an STM32F4DISCOVERY board.
Post by Ekawahyu Susilo
This is the patch required to build buildroot 1.10 on Mac OS X. The toolchain is not yet tested to work, but it can generate .ihx from examples.
sudo port installed m4
1. Extract the buildroot-1.10.tar.gz
2. Copy the buildroot-1.10-macosxbuild.patch to misc/buildroot-1.10
3. Under terminal, change directory to misc/buildroot-1.10
4. Execute command: patch -p2 -i buildroot-1.10-macosxbuild.patch
5. You can now follow the rest of the buildroot build process as written in the NuttX manual.
Regards,
Eka
N.B: Anyone who successfully built NuttX on Mac OS X, please let me know if you can generate .ihx and execute it under STM3210E-EVAL. Because I am struggling to make it work on my board with the same STM32F103ZET6 microcontroller but not STM3210E-EVAL.
Gregory N
2012-04-08 12:51:58 UTC
Permalink
Post by erknie
touch /usr/local/src/Nuttx/nuttx/trunk/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3-build/.libs_installed
zcat toolchain/genromfs/genromfs-0.5.2.tar.gz | tar -C /usr/local/src/Nuttx/nuttx/trunk/misc/buildroot/toolchain_build_arm_nofpu -xf -
zcat: toolchain/genromfs/genromfs-0.5.2.tar.gz.Z: No such file or directory
...

Notice that the file is toolchain/genromfs/genromfs-0.5.2.tar.gz

But the version of zcat that you are using is complaining about toolchain/genromfs/genromfs-0.5.2.tar.gz.Z

Why the extra .Z on the end? Looks like your zcat has some different behavior.

Greg
erknie
2012-04-08 14:46:46 UTC
Permalink
I noticed the extra Z, is the standard /usr/bin/zcat on Mac OS 10.6.8.


bash-3.2# zcat -V
zcat 1.3.12
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Jean-loup Gailly.
Post by Gregory N
Post by erknie
touch /usr/local/src/Nuttx/nuttx/trunk/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3-build/.libs_installed
zcat toolchain/genromfs/genromfs-0.5.2.tar.gz | tar -C /usr/local/src/Nuttx/nuttx/trunk/misc/buildroot/toolchain_build_arm_nofpu -xf -
zcat: toolchain/genromfs/genromfs-0.5.2.tar.gz.Z: No such file or directory
...
Notice that the file is toolchain/genromfs/genromfs-0.5.2.tar.gz
But the version of zcat that you are using is complaining about toolchain/genromfs/genromfs-0.5.2.tar.gz.Z
Why the extra .Z on the end? Looks like your zcat has some different behavior.
Greg
Michael Smith
2012-04-08 17:42:52 UTC
Permalink
Making buildroot work on Mac OS X is an exercise in frustration; you are better off just invoking 'make all' at the top of the NuttX source tree once you have a toolchain sorted out.

I built a simple build framework that keeps the object files out of my working directory by using rsync to merge the checked-out NuttX sources and a local overlay (this is ghetto multi-branch support, it's how I support quickly building for multiple targets) into a scratch directory, then configures and builds it there.

= Mike
Post by erknie
touch /usr/local/src/Nuttx/nuttx/trunk/misc/buildroot/toolchain_build_arm_nofpu/gcc-4.3.3-build/.libs_installed
zcat toolchain/genromfs/genromfs-0.5.2.tar.gz | tar -C /usr/local/src/Nuttx/nuttx/trunk/misc/buildroot/toolchain_build_arm_nofpu -xf -
zcat: toolchain/genromfs/genromfs-0.5.2.tar.gz.Z: No such file or directory
toolchain/patch-kernel.sh /usr/local/src/Nuttx/nuttx/trunk/misc/buildroot/toolchain_build_arm_nofpu/genromfs-0.5.2 toolchain/genromfs \*.patch
Aborting. '/usr/local/src/Nuttx/nuttx/trunk/misc/buildroot/toolchain_build_arm_nofpu/genromfs-0.5.2' is not a directory.
make: *** [/usr/local/src/Nuttx/nuttx/trunk/misc/buildroot/toolchain_build_arm_nofpu/genromfs-0.5.2/.unpacked] Error 1
Has anyone successfully build Nuttx on Mac OS 10.6.8? If so what tool chain did you use? I am trying to build for an STM32F4DISCOVERY board.
Post by Ekawahyu Susilo
This is the patch required to build buildroot 1.10 on Mac OS X. The toolchain is not yet tested to work, but it can generate .ihx from examples.
sudo port installed m4
1. Extract the buildroot-1.10.tar.gz
2. Copy the buildroot-1.10-macosxbuild.patch to misc/buildroot-1.10
3. Under terminal, change directory to misc/buildroot-1.10
4. Execute command: patch -p2 -i buildroot-1.10-macosxbuild.patch
5. You can now follow the rest of the buildroot build process as written in the NuttX manual.
Regards,
Eka
N.B: Anyone who successfully built NuttX on Mac OS X, please let me know if you can generate .ihx and execute it under STM3210E-EVAL. Because I am struggling to make it work on my board with the same STM32F103ZET6 microcontroller but not STM3210E-EVAL.
Continue reading on narkive:
Loading...