Newlib for armv6-m (ARM cortex-m0) and wrong assembly in trap.S
Mon Jul 13 12:03:00 GMT 2015
I've been compiling newlib 2.2.0 for cortex-m0 (arch armv6-m), and I got the following error:
"trap.S:88: Error: lo register required -- `sub ip,sp,ip'"
As an ugly workaround I just commented out that line, and newlib compiled with no further issues.
The "sub ip,sp,ip" is clearly wrong for cortex-m0 - sub op can work on r0÷r7 only.
trap.S checks for !defined(__thumb2__) , but this arch is thumb.
My GCC was build with --with-cpu=cortex-m0 --with-mode=thumb, and, were it not, I'd probably get garbage machine code from trap.S regardless.
I rested the resulting code on a real mcu, and the libs seem fine.
Would you please consider fixing this file somehow?
Longer context of build messages:
arm-none-eabi-gcc -B/tmp/portage/cross-arm-none-eabi/newlib-2.2.0/work/build/arm-none-eabi/newlib/ -isystem /tmp/portage/cross-arm-none-eabi/newlib-2.2.0/work/build/arm-none-eabi/newlib/targ-include -isystem /tmp/portage/cross-arm-none-eabi/newlib-2.2.0/work/newlib-2.2.0
/newlib/libc/include -B/tmp/portage/cross-arm-none-eabi/newlib-2.2.0/work/build/arm-none-eabi/libgloss/arm -L/tmp/portage/cross-arm-none-eabi/newlib-2.2.0/work/build/arm-none-eabi/libgloss/libnosys -L/tmp/portage/cross-arm-none-eabi/newlib-2.2.0/work/newlib-2.2.0/libglos
s/arm -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"2.2.0\" -DPACKAGE_STRING=\"newlib\ 2.2.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I. -I/tmp/portage/cross-arm-none-eabi/newlib-2.2.0/work/newlib-2.2.0/newlib/libc/sys/arm -D__SINGLE
_THREAD__ -DARM_RDI_MONITOR -fno-builtin -D__SINGLE_THREAD__ -DARM_RDI_MONITOR -fno-builtin -g -O2 -Os -ffunction-sections -fdata-sections -pipe -fomit-frame-pointer -c -o lib_a-trap.o `test -f 'trap.S' || echo '/tmp/portage/cross-arm-none-eabi/newlib-2.2.0/work/ne
/tmp/portage/cross-arm-none-eabi/newlib-2.2.0/work/newlib-2.2.0/newlib/libc/sys/arm/trap.S: Assembler messages:
/tmp/portage/cross-arm-none-eabi/newlib-2.2.0/work/newlib-2.2.0/newlib/libc/sys/arm/trap.S:88: Error: lo register required -- `sub ip,sp,ip'
Makefile:268: recipe for target 'lib_a-trap.o' failed
More information about the Newlib