How do you compile a project from the command line using gcc for ARM?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do you compile a project from the command line using gcc for ARM?

1,972 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Vsh3r on Tue Jun 08 20:34:00 MST 2010
Hi,

Can anyone give me the command line arguments to compile and create a programming file for the LPC3154 / LPC1114 demo board using GCC it should be something like arm-elf-gcc?

I would like to compile and link the code from the blinky example project for the LPC1114 demo board.

Thanks,
Vsh3r
0 Kudos
Reply
4 Replies

1,787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by domen on Thu Jun 10 05:09:09 MST 2010
This Makefile example should make your life easier.

Um... it was made for lpc1343, so just replace -mcpu argument to cortex-m0, and you're probably done.
And of course list your source files.

NAME=test
SRCS=main.c clkconfig.c cr_startup_lpc13.c gpio.c timer32.c system_LPC13xx.c core_cm3.c uart.c printf.c
SRCS+=hiduser0.c hiduser1.c usbcore.c usbdesc.c usbhw.c usbuser.c
OBJS=$(SRCS:.c=.o)

default: $(NAME).elf $(NAME).hex

%.o:%.c
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -c -O2 -Wall -I. -o $@ $<

$(NAME).elf:$(OBJS)
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -nostartfiles -Xlinker --gc-sections -Xlinker -M -Xlinker -Map=$(NAME).map -T$(NAME).ld -o $@ $(OBJS)

%.hex:%.elf
arm-none-eabi-objcopy -O ihex $< $@

clean:
rm -f $(OBJS) $(NAME).elf $(NAME).hex
0 Kudos
Reply

1,787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Jun 10 01:14:19 MST 2010
If you want help using generic gnu tools rather than the LPCXpresso software tools, then I would suggest that you are more likely to get help from other places such as the Yahoo LPC1000/LPC2000 groups

http://tech.groups.yahoo.com/group/lpc2000/
http://tech.groups.yahoo.com/group/lpc1000/

The below document may also provide some interesting background information too. Although it focuses on previous generations of ARM cores rather than the Cortex-M family, much of the information is still relevant.

http://www.state-machine.com/arm/Building_bare-metal_ARM_with_GNU.pdf

Regards,
CodeRedSupport
0 Kudos
Reply

1,787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Vsh3r on Wed Jun 09 08:31:04 MST 2010
Hi,

The question was "How do you compile a project from the COMMAND LINE using gcc for ARM?"

I understand that I can download your software but I want to use arm-elf-gcc (GCC) 4.1.0 from the command line using the LPC1114.

Thanks,
Vsh3r
[LEFT][/LEFT]
0 Kudos
Reply

1,787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Wed Jun 09 01:10:43 MST 2010

Quote: Vsh3r

Can anyone give me the command line arguments to compile and create a programming file for the LPC3154 / LPC1114 demo board using GCC it should be something like arm-elf-gcc?

I would like to compile and link the code from the blinky example project for the LPC1114 demo board.


Well the simplest way to build the example is to load the project into the LPCXpresso IDE !!!

If you want to use gcc from the command line, then you can find arm-none-eabi-gcc.exe  in '[I]<install_dir>\Tools\bin[/I]'.

Note that if you control-click on the project name in the bottom right of the LPCXpresso IDE window, then this will open up a command prompt in the project directory with the command line tools set up on the path.

Once you have built the project, there are details of how to program it into flash from the command line in the Code Red LPCXpresso Software Knowledgebase at :

http://lpcxpresso.code-red-tech.com/LPCXpresso/node/51

[login required]

Regards,
CodeRedSupport
0 Kudos
Reply