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:~$
The actual applications we're going to be creating shouldn't be complex at all. I have the job of satisfying my boss' requirements. At the moment, they simply include running from the command line, which may make automating a great deal of manual work, much easier. My goal for right now, is to get a cross-compiler (the usual Hello.c app with a little floating point because I read this is currently implemented as a weak reference. If I get FP working (soft FP, I believe), it will be one step closer to a working cross-compile.
I would really like a template for gnu make. But to even do that, I need to understand the missing arm-none-eabinosys error encountered below. Also, since Newlib is included with the ARM gcc cross compiler, I'd also really like to know how to use it. For example, can I just say "-l=newlib" or do I still need -l=nosys? It also looks like I need to build Newlib for the M0 and a couple of RPis using the A53 and A72.
I *really* want to read the references for this stuff. I keep running into problems finding the info, though. I realize that I'm probably doing stupid things like scanning instead of reading, I am trying, though.
## Current error/mystery
OK, after several changes to alias' and the gccm script.
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
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 ~$
The syntax for library inclusion is actually -lFOO, rather than -l=FOO as you have written. -lFOO means 'locate libFOO.a (or libFOO.so on some platforms, but .so files don't apply to embedded systems as there's no runtime link loader involved, the entire location of symbols is done at build time).
Since -lnosys expands to 'libnosys.a' and because that file is included in the newlib file set that comes with your toolchain, you don't have to tell the linker WHERE that file is, i.e. which directory/directories to look in. In the general case, and when you are including your own pre-built libraries, you use the -L option to tell the linker where to look. So '-L/path/to/libs -lFOO' informs the linker that the file /path/to/libs/libFOO.a should be included in the link step.
I use gcc and make for all my embedded app builds, and will as time sees fit try to put something together as a tutorial on github that deals with the basics.
Stuart
Stuart (or anyone else with newlib experience),I will try changing -l= to -l. I had read that both versions were valid and equivalent. But since I can't find where I read it, I'll test and see if there's a difference. It would be nice if that solved the "eabinosys" issue. (I also believe I started out using -l but changed it to -l= to look a little nicer. I don't care which is used, though.)In trying to solve the eabinosys problem, since it still looks like a linker error, so since ARM includes newlib as the last download button in the pre-built list, I thought I'd try to build newlib. That is another can of worms.I ran configure and to be honest, I'm not sure if it completed successfully. Assuming it was successful, I ran make, which failed. Have you ran configure and make for newlib? If yes, or if you're willing to keep looking at the problem, I would really like to call you and talk. The mistakes are mine, but I have to get through the process once or I can't graduate to whatever comes after "newbie". To pass phone numbers, my email address is scott_blackledge@suddenlink.net.If you don't like the idea of my calling you, we could continue discussing this thing here.I have the console logs and can attach them. I probably should attach (or paste) them anyway for completeness.
Anyway, thanks for your continuing help.