SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By Mahmoud899
#184047
Hello I am new to the Crossworks ARM complier and the the ARM Microcontrollers. I decided to use the NXP LPC2101 microcontroller and learn it. I downloaded the Crossworks ARM Compiler. I downloaded the following packages:

A) Crossworks Tasking Library Package.

B) NXP LPC2000 CPU Support Package.

I created a new project using the following steps:

1) File -> New Project

2) Choose: An Executable for NXP LPC2100 and Next

3) Choose: Additional Output Format: .hex and Target Processor: LPC2101 and Finish

4) In the sources folder I created main.c file and wrote the following code in it:
Code: Select all
#include <targets/LPC2000.h>
#include <targets/liblpc2000.h>

void main()
{
  GPIO0_IODIR |= (1<<10);
  GPIO0_IOSET |= (1<<10);
}
I get the following errors when I build the project:

" 'GPIO0_IODIR' undeclared (first use in this function) "

" each undeclared identifier is reported only once for each function it appears in "

" 'GPIO0_IOSET' undeclared (first use in this function) "


I have the following questions. First am I using the correct header files that include the names of the registers of the LPC2101? How can I solve the compiler error.


Thank You
By cfb
#184050
If you are using Crossworks (or any other commercial development tool) I recommend that you contact the tool developers first as they are most likely to be able to help you with questions related to the use of their tools. Their support URL is:

https://rowley.zendesk.com/home
By gm
#184100
Looking at LPC2010.h, I did not see a definition of GPIO0_IODIR, but I did see IO0DIR defined. Changing your code to
Code: Select all
#include <targets/LPC2000.h>
#include <targets/liblpc2000.h>

void main()
{
  IO0DIR |= (1<<10);
  IO0SET |= (1<<10);
}
got it past the error but then I got an error saying there wasn't enough RAM for the stack. Looking at the project properties I saw the heap using 1024 bytes. Reducing it down to 128 byte allowed me to compile.