Forum > Embedded - ARM

Code generation for Cortex-M4 - "lo register required"

(1/1)

AndyPreston:
I'm trying to compile a basic test program using a cross compiler for STM32F401CC / ARM / Cortex-M4 using a cross compiler built from trunk hosted on Linux.


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---fpc -Parm -Tembedded -WpSTM32F401CC -XP$fpctarget-generates an assembly file as expected but then when it calls

--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---arm-embedded-as -march=armv7e-m -mfpu=softvfp -o test.o  test.s(arm-embedded-as --> arm-none-eabi-as) reports the following messages:


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---test.s:11: Error: lo register required -- `stmfd r13!,{r11,r12,r14,r15}'test.s:12: Error: lo register required -- `sub r11,r12,#4'test.s:29: Error: lo register required -- `sub r0,r11,#52'test.s:31: Error: lo register required -- `ldr r1,[r11,#-52]'test.s:32: Error: lo register required -- `ldr r2,[r11,#-48]'test.s:44: Error: unshifted register required -- `and r0,r0,#255'test.s:50: Error: lo register required -- `ldmea r11,{r11,r13,r15}'test.s:67: Error: lo register required -- `stmfd r13!,{r14}'test.s:68: Error: lo register required -- `ldmfd r13!,{r15}'test.s:73: Error: lo register required -- `stmfd r13!,{r14}'test.s:74: Error: lo register required -- `ldmfd r13!,{r15}'test.s:15: Error: invalid offset, target not word aligned (0x00000042)test.s:15: Error: invalid offset, value too big (0x0000003A)test.s:16: Error: invalid offset, target not word aligned (0x00000046)test.s:16: Error: invalid offset, value too big (0x0000003E)test.s:17: Error: invalid offset, target not word aligned (0x0000004A)test.s:17: Error: invalid offset, value too big (0x0000003E)test.s:22: Error: invalid offset, target not word aligned (0x00000052)test.s:22: Error: invalid offset, value too big (0x0000003E)test.s:24: Error: invalid offset, target not word aligned (0x0000004E)test.s:24: Error: invalid offset, value too big (0x00000036)test.s:25: Error: invalid offset, target not word aligned (0x00000056)test.s:25: Error: invalid offset, value too big (0x0000003E)test.s:27: Error: invalid offset, target not word aligned (0x0000004A)test.s:27: Error: invalid offset, value too big (0x0000002E)test.s:33: Error: invalid offset, target not word aligned (0x0000004A)test.s:33: Error: invalid offset, value too big (0x00000026)test.s:37: Error: invalid offset, target not word aligned (0x0000005E)test.s:37: Error: invalid offset, value too big (0x00000032)test.s:38: Error: invalid offset, target not word aligned (0x0000005A)test.s:38: Error: invalid offset, value too big (0x0000002E)test.s:39: Error: invalid offset, target not word aligned (0x00000056)test.s:39: Error: invalid offset, value too big (0x00000026)test.s:41: Error: invalid offset, target not word aligned (0x0000004A)test.s:41: Error: invalid offset, value too big (0x00000016)
my compiler was built with:

--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7em
I've had a Google around but can only find old conversations from 2012
https://lists.freepascal.org/pipermail/fpc-devel/2012-October/030182.html
https://lists.freepascal.org/pipermail/fpc-devel/2012-October/030183.html
Saying there may be a problem with fpc generating the "wrong" code in certain circumstances with armv7 ??????

Versions:
arm-embedded-as --> GNU assembler (2.27-9ubuntu1+9) 2.27
fpc --> 3.3.1

If anyone's got any tips on how I can work around (or, better still, fix) this issue I'd greatly appreciate it.

Jonas Maebe:
Try adding -Cparmv7em. That's what was also used when compiling FPC when you speified SUBARCH=armv7em

AndyPreston:

--- Quote from: Jonas Maebe on January 14, 2021, 09:09:51 pm ----Cparmv7em
--- End quote ---

Thanks... that seems to have worked.

Navigation

[0] Message Index

Go to full version