SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By Blue_Science_Geek
#179666
Let me just say that I am new to ARM, but not new to this field. I have been working with PIC's the last few years and want to get into ARM for personal projects.

Setup:
Windows 8.1
Eclipse Luna
Most recent WinARM
LPC11U68 Demo board from NXP

So I downloaded eclipse, installed CDT, and connected it with the GCC Arm compiler. I have eclipse compiling code and I think its working. It produces a list file that makes sense to me as its primarily just loads and stores needed anyways. My code is very simple, I just turn off PIO2_18 as can be seen in the code below. I have an LED connected to power and then back to the pin. A low signal would then illuminate the LED.
Code: Select all

#define GPIO_ADDR_PIO2_18		   0x4004413C
#define DIR2 (((volatile unsigned int *) (0xA0002008)))
#define PORT2 (((volatile unsigned int *)(0xA0002108)))

int main (void) {
	//setup pin functions
	*GPIO2_18 = 0x0000;
	//setup pin direction
	*DIR2 = (1 << 18);
        *PORT2 = (1 << 18);
	//disable clock to conserve power
	while (1)    /* Loop forever */
	{
		*PORT2 = (0 << 18);
	}
}
I setup a linker file to put the .text section at 0x0000001C. This is the start of code after the reset vector table.

The only output from eclipse that I can get are a .elf and a .hex file. I need a .bin as the LPC11U68 appears as a thumb drive to load code. In order to do this I am using arm-elf-objdump. I dont remember the exact command off the top of my head though. This produces a .bin file that I than copy and paste into the LPC board. When I reset/apply power it jumps right back into the bootloader as if my code was never even installed.

Anybody have any experience with this? Are there any specific toolchain settings I need to know of?
One thought that I had was the format of the ELF file. Is there any ELF parser out there that can read the elf file and give me a view of what it has?
Another thought is that there is actually more initialization needed. Is this so?

I just need a push in the right direction...