Failure when compiling for cortex-m4

Robert Baruch robert.c.baruch at gmail.com
Thu Mar 24 19:18:30 UTC 2016


Note: Cortex-M4 only has Thumb mode, and implements the Thumb-2 instruction
set. It does not have ARM mode and cannot execute ARM instructions.

GMP 6.1.0.

Configure command line:

$ CFLAGS="-mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16
--specs=nosys.specs" ./configure --build sandybridge-pc-linux-gnu --host
arm-none-eabi --prefix /media/sf_robuntu-shared/gmp-install

Make fails when attempting to assemble mpn/add_n.asm:

/bin/bash ../libtool --mode=compile --tag=CC ../mpn/m4-ccas --m4="m4"
arm-none-eabi-gcc -std=gnu99 -c -DHAVE_CONFIG_H -I. -I..
 -D__GMP_WITHIN_GMP -I.. -DOPERATION_`echo add_n | sed 's/_$//'`
-mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16
--specs=nosys.specs  `test -f 'add_n.asm' || echo './'`add_n.asm

libtool: compile:  ../mpn/m4-ccas --m4=m4 arm-none-eabi-gcc -std=gnu99 -c
-DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_add_n
-mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16
--specs=nosys.specs add_n.asm -o add_n.o

m4  -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_add_n add_n.asm
>tmp-add_n.s

 arm-none-eabi-gcc -std=gnu99 -c -DHAVE_CONFIG_H -I. -I..
-D__GMP_WITHIN_GMP -I.. -DOPERATION_add_n -mcpu=cortex-m4 -mthumb
-mfloat-abi=hard -mfpu=fpv4-sp-d16 --specs=nosys.specs tmp-add_n.s -o
add_n.o

tmp-add_n.s: Assembler messages:
tmp-add_n.s:74: Error: lo register required -- `ldr r12,[r13,#0]'
tmp-add_n.s:75: Error: lo register required -- `stmfd r13!,{ r8,r9,r14 }'
tmp-add_n.s:76: Error: only lo regs allowed with immediate -- `cmp r12,#1'
tmp-add_n.s:85: Error: lo register required -- `stmfd r13!,{ r8,r9,r14 }'
tmp-add_n.s:86: Error: unshifted register required -- `cmn r0,#0'
tmp-add_n.s:87: Error: unshifted register required -- `tst r3,#1'
tmp-add_n.s:89: Error: lo register required -- `ldr r12,[r1],#4'
tmp-add_n.s:90: Error: lo register required -- `ldr r14,[r2],#4'
tmp-add_n.s:91: Error: instruction not supported in Thumb16 mode -- `adcs
r12,r12,r14'
tmp-add_n.s:92: Error: lo register required -- `str r12,[r0],#4'
tmp-add_n.s:94: Error: unshifted register required -- `tst r3,#2'
tmp-add_n.s:96: Error: lo register required -- `ldmia r1!,{ r8,r9 }'
tmp-add_n.s:97: Error: lo register required -- `ldmia r2!,{ r12,r14 }'
tmp-add_n.s:98: Error: instruction not supported in Thumb16 mode -- `adcs
r8,r8,r12'
tmp-add_n.s:99: Error: instruction not supported in Thumb16 mode -- `adcs
r9,r9,r14'
tmp-add_n.s:100: Error: lo register required -- `stmia r0!,{ r8,r9 }'
tmp-add_n.s:102: Error: instruction not supported in Thumb16 mode -- `bics
r3,r3,#3'
tmp-add_n.s:104: Error: lo register required -- `stmfd r13!,{ r4,r5,r6,r7 }'
tmp-add_n.s:107: Error: lo register required -- `ldmia r2!,{ r8,r9,r12,r14
}'
tmp-add_n.s:108: Error: instruction not supported in Thumb16 mode -- `adcs
r4,r4,r8'
tmp-add_n.s:110: Error: instruction not supported in Thumb16 mode -- `adcs
r5,r5,r9'
tmp-add_n.s:111: Error: instruction not supported in Thumb16 mode -- `adcs
r6,r6,r12'
tmp-add_n.s:112: Error: instruction not supported in Thumb16 mode -- `adcs
r7,r7,r14'
tmp-add_n.s:114: Error: instruction not supported in Thumb16 mode -- `teq
r3,#0'
tmp-add_n.s:117: Error: lo register required -- `ldmfd r13!,{ r4,r5,r6,r7 }'
tmp-add_n.s:119: Error: unshifted register required -- `adc r0,r3,#0'
tmp-add_n.s:120: Error: lo register required -- `ldmfd r13!,{ r8,r9,r15 }'
Makefile:768: recipe for target 'add_n.lo' failed
make[2]: *** [add_n.lo] Error 1
make[2]: Leaving directory '/media/sf_robuntu-shared/gmp-6.1.0/mpn'
Makefile:954: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/media/sf_robuntu-shared/gmp-6.1.0'
Makefile:773: recipe for target 'all' failed
make: *** [all] Error 2


Using arm-none-eabi-gcc 4.8.4. This version is present in the (freely
available) Kinetis Development Studio
<http://www.nxp.com/products/software-and-tools/run-time-software/kinetis-software-and-tools/ides-for-kinetis-mcus/kinetis-design-studio-integrated-development-environment-ide:KDS_IDE>
(it's
basically Eclipse) if you'd like to play along at home.

$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.8.4 20140725
(release) [ARM/embedded-4_8-branch revision 213147]

$ uname -a
Linux robuntu 4.2.0-16-generic #19-Ubuntu SMP Thu Oct 8 15:35:06 UTC 2015
x86_64 x86_64 x86_64 GNU/Linux

Attachments: config.log, config.m4, mpn/tmp-add_n.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.m4
Type: application/octet-stream
Size: 1152 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20160324/03764267/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.log.gz
Type: application/x-gzip
Size: 26410 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20160324/03764267/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tmp-add_n.s
Type: application/octet-stream
Size: 1051 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20160324/03764267/attachment-0003.obj>


More information about the gmp-bugs mailing list