Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Sourcery on linux can't build for lpc1768 because of startup code

Status
Not open for further replies.

sazary

Newbie level 3
Newbie level 3
Joined
Jun 30, 2012
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
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:
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
and I get this error:
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"
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top