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
It's more about knowing the conventions, especially when loading code on a machine directly or through a boot loader, than the programming itself. Though, I haven't tested direct hardware programming.
IMHO, the best way to get working with programming tasks riddled with a lot of conventions is to start from a working project, reduce it to its bare minimum, and go from there.
Also, you might want to create your own tools with any programming language you master, in order to have more control on your development process. For example, generating raw binaries with machine code in Python, Ruby or Javascript is rather easy. In order to generate an executable with an entry point at 0x10000 and ten 32-bit instructions, you only need to generate a file with 0x10000 zeros and write the machine code of these ten instructions, in little endian format (e.g. 0x12345678 -> 0x78563412). Python and Ruby have ready made data-packers that already deal with Big endian, Little Endian encodings of short/int/long/float/double data types, so it should not take too much time.
Android systems are great to test ARM assembly code and libraries quickly. However, due to Android's security constraints, if you want to do more advanced operations you might need to go through a NativeActivity setup and use the common libraries available (OpenGL/AL/CV, ...), or try to find a way to create a custom ROM.
Thanks a lot for your help I forgot i also have 2 raspberry pies I can learn a bit there too !