I've only used AVR and Arduino before which really don't count as embed! so I have a little trouble compiling my blinky.
I'm mainly a PC programmer. I have an LPC1768 dev board!
Here's what I did:
I first installed arm-none-eabi-gcc on my Ubuntu virtual machine (I have a ubuntu dual boot but I wanted to try it here first to learn)
Secondly I wrote a small code which uses the lpc17xx.h header and does nothing but turn a GPIO on and high, I then compiled it with
arm-none-eabi-gcc -Wall -mcpu=cortex-m3 -mlittle-endian -mthumb -DLPX17xx -Os -c main.c -o main.o
It worked! I repeated this for all of the files("core_cm3.h", "LPC17xx.h", "system_LPC17xx.c") and it worked too, but when I tried to compile "startup_lpc17xx.s" it gave me a bunch of errors saying "startup_LPC17xx.s:272: Error: bad instruction".
So I found an already compiled .o version of this file in keil folders and used it instead.
I googled and found an lpc1768 linker script and ran this:
arm-none-eabi-gcc -mcpu=cortex-m3 -mlittle-endian -mthumb -DLPC17xx -TLPC17xx.ld -Wl,--gc-sections system_LPC17xx.o main.o startup_LPC17xx.o -o main.elf
and I get this error: "startup_LPC17xx.o: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status"
Can anyone help me I also edited the linker script, I changed "FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K" to "FLASH (rx) : ORIGIN = 0x2000 , LENGTH = 512K" because the board says the code should start from here as it has a bootloader and my pc recogonizes it as a USB storage
also the board manual says I should add "NO_CRP" to asm tab of keil project options. I don't know what this is so I've no idea what to do.
I did manage to create a file in windows with CrossStudios but my board didn't blink the leds the same code worked in keil but I rather fix my GCC toolchain
I'm a begginer and I don't know how to use makefile or write a linker script or a startup code! I don't know much on how the code runs either
View all questions in GNU Toolchain forum