sazary
Newbie level 3
- Joined
- Jun 30, 2012
- Messages
- 3
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,304
Hi
I'm trying to build a simple code to run on a bare-metal arm micro-controller lpc1768 from NXP, that is from cortex-m3 family. I'm using Sourcery toolchain (specifically, Sourcery CodeBench Lite 2013.11-24 4.8.1) on Ubuntu 12.04, and I'm using the startup code found in lpc17xx CMSIS library, provided by NXP, in path /Core/CM3/DeviceSupport/NXP/LPC17xx/startup/gcc/.
I enter this command:
and I get this error:
I can build and run this code (the C parts) on windows using Keil, and using another startup file, but again I can't build it on windows in Keil using Sourcery toolchain; I get the same error there too.
What should I do?
This is the part of startup code that causes error:
I'm trying to build a simple code to run on a bare-metal arm micro-controller lpc1768 from NXP, that is from cortex-m3 family. I'm using Sourcery toolchain (specifically, Sourcery CodeBench Lite 2013.11-24 4.8.1) on Ubuntu 12.04, and I'm using the startup code found in lpc17xx CMSIS library, provided by NXP, in path /Core/CM3/DeviceSupport/NXP/LPC17xx/startup/gcc/.
I enter this command:
Code:
arm-none-eabi-gcc -g -O3 -mcpu=cortex-m3 -mthumb ./main.c ./Display/glcd.c ./startup_LPC17xx.s ./system_LPC17xx.c -I ./LPC_17xx -I ./Display -I . -Werror -o ./lcd_test.o
Code:
./startup_LPC17xx.s: Assembler messages:
./startup_LPC17xx.s:126: Error: non-constant expression in ".if" statement
I can build and run this code (the C parts) on windows using Keil, and using another startup file, but again I can't build it on windows in Keil using Sourcery toolchain; I get the same error there too.
What should I do?
This is the part of startup code that causes error:
Code:
/* Reset Handler */
.section .cs3.reset,"x",%progbits
.thumb_func
.globl __cs3_reset_cortex_m
.type __cs3_reset_cortex_m, %function
__cs3_reset_cortex_m:
.fnstart
.if (RAM_MODE) /* <---------------------- this is line 126, causing error */
/* Clear .bss section (Zero init) */
MOV R0, #0
LDR R1, =__bss_start__
LDR R2, =__bss_end__
CMP R1,R2
BEQ BSSIsEmpty
LoopZI:
CMP R1, R2
BHS BSSIsEmpty
STR R0, [R1]
ADD R1, #4
BLO LoopZI
BSSIsEmpty:
LDR R0, =SystemInit
BLX R0
LDR R0,=main
BX R0
.else
LDR R0, =SystemInit
BLX R0
LDR R0,=_start
BX R0
.endif
.pool
.cantunwind
.fnend
.size __cs3_reset_cortex_m,.-__cs3_reset_cortex_m
.section ".text"