Investigate use of default debian arm compiler instead of provided mpstools toolchain
In the Debian 10 repository there is the gcc-arm-none-eabi
package which provides a gcc crosscompiler for arm (gcc version 7.3.1 instead of 4.4.5 from mpstools).
The first problem occours with the arm-elf-insight
debugger which throws the following error:
Error loading "prog.elf":
wrong version in compilation unit header (is 4, should be 2) [in module prog.elf]
This refers to the DWARF version for the included debug information in the executable. This should only be in issue if this particular version of the insight debugger is used. Nevertheless this can be fixed by specifying the DWARF version that gcc
should use. To use version 2, -gdwarf-2
must be added to the compiler calls.
The next problem is that the ligcc.a
provided by mpstools is somehow incompatible since it has EABI version set to 0 (which means undefined?) while the compiled c code is on EABI version 5. This problem can be solved by using the libgcc.a
provided by the default compiler which is located at /usr/lib/gcc/arm-none-eabi/{version}/libgcc.a
.
At this point everything works in the insight debugger but it most likely would not work on the real hardware. It is pretty safe to assume the mpstools toolchain was either compiled especially to target the AT91M63200, or it was used because the configuration is close enough. This special configuration at compiletime results in certain default parameters so that everything works with no need for special parameters when compiling. However all those parameters can be just set in the makefile for the default toolchain. The default parameters of the mpstools gcc can be inspected using arm-elf-gcc -Q -v
and arm-elf-gcc -Q --help=target
. The same needs to be done with the default gcc to see if there are any problematic defaults active.
Important options in the mpstools gcc:
-mabi=
-march=armv4t
-mcpu=
-mfloatabi=soft
-mlittle-endian=[enabled]
-mtune=arm7tdmi
For some reason, abi and cpu are not set which seems strange.
Important options in the default gcc:
-mabi=aapcs
-march=armv2
-mcpu=[default]
-mfloatabi=soft
-mlittle-endian=[enabled]
-mtune=[default]
This is not testes on the hardware, but the following options should result in a binary executable that runs on the AT91M63200: -gdwarf-2 -march=armv4t -mtune=arm7tdmi
and maybe optionally -mcpu=arm7tdmi
The rest of the options are either the same or are likely to be irrelevant.
The command arm-none-eabi-gcc --help-target
shows some of the possible values for the options.