We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I was told to install the latest pre-build (x86_64 to ARM) "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2?revision=ca0cbf9c-9de2-491c-ac48-898b5bbc0443&la=en&hash=68760A8AE66026BCF99F05AC017A6A50C6FD832A", I renamed the file to remove everything following the "...tar.bz2". Once installed, I tried running a "hello world" test which fails with several errors.
I hope the "-v" switch is helpful.
I fully admit to only have used compilers installed by a sysadmin. I have tried googling and reading about everything I could about installing and using the pre-built compiler but I'm just not getting it. Since everybody has a first time for whatever task they're doing, I'd appreciate any help. I'm very willing to do my research, so whatever help, info or pointers to help, is appreciated.
I do know that using both -mcpu=cortex-m0plus and -march=armv6 causes a switch conflict so I just told it what the cpu was and let it pick the architecture.
Regarding the test run, I do not know how to get the includes right, and what is left looks to be link errors. I don't know how to fix that either.
----------
ssh'ing to x86-64 machine running ububtu 20.04, default gcc is 9.3.0.
Installing gcc 10.2.1 which should be a cross-compiler to an ARM Cortex-m0+.
alias gccm=..blah../gcc-10.2.1_m0/gcc-arm-none-eabi/bin/arm-none-eabi-gcc -mcpu=cortex-m0plus'
Running test
$ gccm -v scott/gccsrc/hello.cUsing built-in specs.COLLECT_GCC=/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/arm-none-eabi-gccCOLLECT_LTO_WRAPPER=/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/lto-wrapperTarget: arm-none-eabiConfigured with: /mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/src/gcc/configure --target=arm-none-eabi --prefix=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/install-native --libexecdir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/install-native/lib --infodir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/install-native/arm-none-eabi --build=x86_64-linux-gnu --host=x86_64-linux-gnu --with-gmp=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/build-native/host-libs/usr --with-mpfr=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/build-native/host-libs/usr --with-mpc=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/build-native/host-libs/usr --with-isl=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/build-native/host-libs/usr --with-libelf=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-48_20201124_1606180641/build-native/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Arm Embedded Toolchain 10-2020-q4-major' --with-multilib-list=rmprofile,aprofileThread model: singleSupported LTO compression algorithms: zlibgcc version 10.2.1 20201103 (release) (GNU Arm Embedded Toolchain 10-2020-q4-major)COLLECT_GCC_OPTIONS='-mcpu=cortex-m0plus' '-v' '-mfloat-abi=soft' '-mthumb' '-march=armv6s-m' /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/cc1 -quiet -v -imultilib thumb/v6-m/nofp -iprefix /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/ -isysroot /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi -D__USES_INITFINI__ scott/gccsrc/hello.c -quiet -dumpbase hello.c -mcpu=cortex-m0plus -mfloat-abi=soft -mthumb -march=armv6s-m -auxbase hello -version -o /tmp/ccWn3kSy.sGNU C17 (GNU Arm Embedded Toolchain 10-2020-q4-major) version 10.2.1 20201103 (release) (arm-none-eabi) compiled by GNU C version 4.8.4, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMPGGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072ignoring duplicate directory "/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/10.2.1/include"ignoring nonexistent directory "/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi/usr/local/include"ignoring duplicate directory "/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/10.2.1/include-fixed"ignoring duplicate directory "/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/include"ignoring nonexistent directory "/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi/usr/include"#include "..." search starts here:#include <...> search starts here: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/include /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/include-fixed /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/includeEnd of search list.GNU C17 (GNU Arm Embedded Toolchain 10-2020-q4-major) version 10.2.1 20201103 (release) (arm-none-eabi) compiled by GNU C version 4.8.4, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMPGGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072Compiler executable checksum: e9addb35ad3a920a846c18a834db924dCOLLECT_GCC_OPTIONS='-mcpu=cortex-m0plus' '-v' '-mfloat-abi=soft' '-mthumb' '-march=armv6s-m' /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/as -v -march=armv6s-m -mfloat-abi=soft -meabi=5 -o /tmp/ccizQoAu.o /tmp/ccWn3kSy.sGNU assembler version 2.35.1 (arm-none-eabi) using BFD version (GNU Arm Embedded Toolchain 10-2020-q4-major) 2.35.1.20201028COMPILER_PATH=/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/LIBRARY_PATH=/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/thumb/v6-m/nofp/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi/lib/thumb/v6-m/nofp/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/:/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi/lib/COLLECT_GCC_OPTIONS='-mcpu=cortex-m0plus' '-v' '-mfloat-abi=soft' '-mthumb' '-march=armv6s-m' /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/collect2 -plugin /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/liblto_plugin.so -plugin-opt=/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccuzQXjx.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc --sysroot=/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi -X /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/thumb/v6-m/nofp/crti.o /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/thumb/v6-m/nofp/crtbegin.o /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/crt0.o -L/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/thumb/v6-m/nofp -L/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp -L/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi/lib/thumb/v6-m/nofp -L/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1 -L/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc -L/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib -L/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabi/lib /tmp/ccizQoAu.o --start-group -lgcc -lc --end-group /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/thumb/v6-m/nofp/crtend.o /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/thumb/v6-m/nofp/crtn.o/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-exit.o): in function `exit':exit.c:(.text.exit+0x18): undefined reference to `_exit'/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-sbrkr.o): in function `_sbrk_r':sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-writer.o): in function `_write_r':writer.c:(.text._write_r+0x10): undefined reference to `_write'/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-closer.o): in function `_close_r':closer.c:(.text._close_r+0xc): undefined reference to `_close'/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-lseekr.o): in function `_lseek_r':lseekr.c:(.text._lseek_r+0x10): undefined reference to `_lseek'/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-readr.o): in function `_read_r':readr.c:(.text._read_r+0x10): undefined reference to `_read'/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-fstatr.o): in function `_fstat_r':fstatr.c:(.text._fstat_r+0xe): undefined reference to `_fstat'/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(lib_a-isattyr.o): in function `_isatty_r':isattyr.c:(.text._isatty_r+0xc): undefined reference to `_isatty'collect2: error: ld returned 1 exit statuslocaluser@buildbox:~$
That may stop the Linker complaining but, if the code actually needs those calls, that isn't going to make it work!
Thanks Andy. Sounds like you're a bit tired of newbie questions, but I do appreciate your explanations. Since you mentioned it, do you have a couple of favorite IDEs for cross-compile environments?
I'd recommend that you go with the IDE provided by the chip maker.
Then you should have some ready-to-go examples to start with.
The linker step of the build is failing since implementations of routines like _exit, _sbrk are not available to the linker. If you added the libnosys.a library to the linker command line, via the syntax I suggested, those routines would be found. The use of 'nm' below lists the routines implemented in such a file.
$ arm-none-eabi-nm /path/to/gnu-toolchain/arm-none-eabi/lib/thumb/v6-m/nofp/libnosys.a | grep T 00000000 T _chown 00000000 T _close 00000000 T _execve 00000000 T _fork 00000000 T _fstat 00000000 T _getpid 00000000 T _gettimeofday 00000000 T _isatty 00000000 T _kill 00000000 T _link 00000000 T _lseek 00000000 T _open 00000000 T _read 00000000 T _readlink 00000000 T _sbrk 00000000 T _stat 00000000 T _symlink 00000000 T _times 00000000 T _unlink 00000000 T _wait 00000000 T _write 00000000 T _exit
The 'T' indicates that the file contains an implementation of the routine.
I've made the following changes (including adding -l=nosys):
m0='/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin'
alias gccm='$m0/arm-none-eabi-gcc -o hello -mcpu=cortex-m0plus -l=nosys'
$ gccm ~/scott/gccsrc/hello.c
So, I have one variable (m0), one command alias with your suggested "-l=nosys" switch, and the command to invoke gcc itself. I thought I had all the pieces you wanted me to use, but as you can see with the May 7, 2021, 5:35 PM reply (starting with "The actual applications we're going to be creating shouldn't be complex at all." The linker is still missing something. I don't know what is missing (eabinosys doesn't show up in Google at all), or even if I do find the right library (newlib?), how is it used? (already trying -l=nosys, so should I try -l=newlib or perhaps -l=nosys,eaibnosys ?
In the mean time, I'm going to reread the newlib docs.
Tober, thanks for your patience.
Copied current error here from below:
Results:
~$ gccm ~/scott/gccsrc/hello.c /subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: cannot find -l/subo/Tooling/src/team-sweng/cross-compile/cortexm0/gcc-10.2.1_m0/gcc-arm-none-eabi/bin/../arm-none-eabinosys collect2: error: ld returned 1 exit status