Some ARM gnu / newlib success to report....
2004-10-15 by Mark Gross
I have a 14.7Mhz Olimex lpc-2124 dev board I got from sparkfun.com.
I'm using the gnu tool chain built under Linux as well as the newlib-lpc.
I built the 3.4.0 tool chain without too much trouble.
However; its taken me a bit of trial and error to get the newlib / test programs
to load and work as expected on my development board.
The following is a patch diff of what I needed to do to the newlib-lpc source files
to get the text2.c example program to work as expected. Its still a hack, but I thouht
I'd share it.
I'll have to make a better Makefile for myself one of these days. As well as installing
the linker scripts and crt files in a sensible location, or perhpas an autoconf thing for
newlib-lpc.
BTW So far I've been using the Philips flash utility on my WinXP laptop. (is lpc21isp.c safe?)
--mgross
Only in newlib-lpc: .depend
diff -ur newlib-lpc_rel3/example.mak newlib-lpc/example.mak
--- newlib-lpc_rel3/example.mak 2004-07-21 09:23:28.000000000 -0700
+++ newlib-lpc/example.mak 2004-10-10 19:32:27.000000000 -0700
@@ -6,8 +6,8 @@
#-v means verbose output
#-o $@ means use $@ as output filename
#$+ copies dependancies to link line
-cfgl_arm = -v -o$@ e:/cygwin/home/radsett/arm/crt0.o $+
-cfg_arm_gc = -c -Os -nostdinc -isystem /home/radsett/install/arm-elf/include/ -isystem /home/radsett/install/lib/gcc-lib/arm-elf/3.3.2/include/ -o $@
+cfgl_arm = -v -o$@ crt0.o $+
+cfg_arm_gc = -c -Os -I/usr/local/arm/arm-elf/include/ -I /usr/local/arm/lib/gcc/arm-elf/3.4.0/include/ -o $@
#
# GNU Compiler ARM
@@ -24,8 +24,8 @@
# Providing a named linkfile option here allows programs for
# multiple variants to be built using the same makefile.
- linkfile_LPC210X = -Te:/cygwin/home/radsett/arm/lpc210x.ld
- linkfile_LPC2119 = -Te:/cygwin/home/radsett/arm/lpc2119.ld
+ linkfile_LPC210X = -Tlpc210x.ld
+ linkfile_LPC2119 = -Tlpc2119.ld
### Rules for building ###
Only in newlib-lpc: libnewlib-lpc.a
diff -ur newlib-lpc_rel3/lpc210x.ld newlib-lpc/lpc210x.ld
--- newlib-lpc_rel3/lpc210x.ld 2004-07-21 11:31:02.000000000 -0700
+++ newlib-lpc/lpc210x.ld 2004-10-10 21:02:40.000000000 -0700
@@ -26,10 +26,9 @@
*/
/* Search directories for libraries. Modify as needed. */
-
-SEARCH_DIR( /home/radsett/arm/lib)
-SEARCH_DIR( /home/radsett/install/arm-elf/lib)
-SEARCH_DIR( /home/radsett/install/lib/gcc-lib/arm-elf/3.3.2)
+SEARCH_DIR( /usr/local/arm/lib)
+SEARCH_DIR( /usr/local/arm/arm-elf/lib)
+SEARCH_DIR( /usr/local/arm/lib/gcc/arm-elf/3.4.0)
/* Memory layout for processor. Modify RAM size upwards for 2105 and */
/* 2106 */
diff -ur newlib-lpc_rel3/lpc2119.ld newlib-lpc/lpc2119.ld
--- newlib-lpc_rel3/lpc2119.ld 2004-07-21 11:31:02.000000000 -0700
+++ newlib-lpc/lpc2119.ld 2004-10-10 21:02:47.000000000 -0700
@@ -27,9 +27,9 @@
/* Search directories for libraries. Modify as needed. */
-SEARCH_DIR( /home/radsett/arm/lib)
-SEARCH_DIR( /home/radsett/install/arm-elf/lib)
-SEARCH_DIR( /home/radsett/install/lib/gcc-lib/arm-elf/3.3.2)
+SEARCH_DIR( /usr/local/arm/lib)
+SEARCH_DIR( /usr/local/arm/arm-elf/lib)
+SEARCH_DIR( /usr/local/arm/lib/gcc/arm-elf/3.4.0)
/* Memory layout for processor. Modify RAM size upwards for 2105 and */
/* 2106 */
diff -ur newlib-lpc_rel3/sys_pll.c newlib-lpc/sys_pll.c
--- newlib-lpc_rel3/sys_pll.c 2004-06-14 15:02:40.000000000 -0700
+++ newlib-lpc/sys_pll.c 2004-10-14 17:28:17.768958313 -0700
@@ -58,6 +58,7 @@
#define MAX_OPERATING_SPEED (60000uL)
/**** Local Variables ****/
+//static unsigned long native_speed = 14745uL; /* Default to 14.7MHz */
static unsigned long native_speed = 10000uL; /* Default to 10MHz */
/********************* SetNativeSpeed ***********************************/
diff -ur newlib-lpc_rel3/sys_time.c newlib-lpc/sys_time.c
--- newlib-lpc_rel3/sys_time.c 2004-06-14 15:14:42.000000000 -0700
+++ newlib-lpc/sys_time.c 2004-10-10 21:28:13.000000000 -0700
@@ -70,7 +70,8 @@
/* TIME_TO_COUNTS_USE_DIV must be defined OR UsToCounts and */
/* divx must be changed to reflect the new value. */
/* #define TIME_TO_COUNTS_USE_DIV */
-#define CLOCK_SPEED (10000000) /* Nominal speed for internal */
+#define CLOCK_SPEED (14745600) /* Nominal speed for internal */
+//#define CLOCK_SPEED (10000000) /* Nominal speed for internal */
/* clock in Hz. */
/* Used for converting between counts and uS for time function.*/
Only in newlib-lpc: tags
diff -ur newlib-lpc_rel3/test10.c newlib-lpc/test10.c
--- newlib-lpc_rel3/test10.c 2004-07-14 09:48:28.000000000 -0700
+++ newlib-lpc/test10.c 2004-10-14 17:27:50.667287215 -0700
@@ -37,7 +37,7 @@
struct interrupt_param irq;
- (void)SetNativeSpeed( 10000uL);
+ (void)SetNativeSpeed( 14745uL);
/* Desired serial line characteristics 9600,n82 */
sp.baud = 9600uL;
Only in newlib-lpc_rel3: test10.hex
diff -ur newlib-lpc_rel3/test2.c newlib-lpc/test2.c
--- newlib-lpc_rel3/test2.c 2004-07-13 10:45:38.000000000 -0700
+++ newlib-lpc/test2.c 2004-10-14 17:29:09.021662965 -0700
@@ -39,7 +39,7 @@
struct serial_param sp;
- (void)SetNativeSpeed( 10000uL);
+ (void)SetNativeSpeed( 14745uL);
/* Desired serial line characteristics 9600,n82 */
sp.baud = 9600uL;
Only in newlib-lpc_rel3: test2.hex
diff -ur newlib-lpc_rel3/test3.c newlib-lpc/test3.c
--- newlib-lpc_rel3/test3.c 2004-07-13 10:46:20.000000000 -0700
+++ newlib-lpc/test3.c 2004-10-14 17:29:19.388389629 -0700
@@ -39,7 +39,7 @@
struct serial_param sp;
- (void)SetNativeSpeed( 10000uL);
+ (void)SetNativeSpeed( 14745uL);
/* Desired serial line characteristics 9600,n82 */
sp.baud = 9600uL;
Only in newlib-lpc_rel3: test3.hex
diff -ur newlib-lpc_rel3/test6.c newlib-lpc/test6.c
--- newlib-lpc_rel3/test6.c 2004-07-13 10:47:20.000000000 -0700
+++ newlib-lpc/test6.c 2004-10-14 17:30:30.440662380 -0700
@@ -41,7 +41,7 @@
unsigned int i;
- (void)SetNativeSpeed( 10000uL);
+ (void)SetNativeSpeed( 14745uL);
/* Desired serial line characteristics 9600,n82 */
sp.baud = 9600uL;
Only in newlib-lpc_rel3: test6.hex
diff -ur newlib-lpc_rel3/test7.c newlib-lpc/test7.c
--- newlib-lpc_rel3/test7.c 2004-07-13 10:47:48.000000000 -0700
+++ newlib-lpc/test7.c 2004-10-14 17:30:39.701524886 -0700
@@ -45,7 +45,7 @@
unsigned int i;
- (void)SetNativeSpeed( 10000uL);
+ (void)SetNativeSpeed( 14745uL);
/* Desired serial line characteristics 9600,n82 */
sp.baud = 9600uL;
Only in newlib-lpc_rel3: test7.hex
diff -ur newlib-lpc_rel3/test8.c newlib-lpc/test8.c
--- newlib-lpc_rel3/test8.c 2004-07-13 10:48:28.000000000 -0700
+++ newlib-lpc/test8.c 2004-10-14 17:30:45.975754236 -0700
@@ -41,7 +41,7 @@
unsigned int i;
- (void)SetNativeSpeed( 10000uL);
+ (void)SetNativeSpeed( 14745uL);
/* Desired serial line characteristics 9600,n82 */
sp.baud = 9600uL;
Only in newlib-lpc_rel3: test8.hex
diff -ur newlib-lpc_rel3/test9.c newlib-lpc/test9.c
--- newlib-lpc_rel3/test9.c 2004-06-16 15:46:18.000000000 -0700
+++ newlib-lpc/test9.c 2004-10-14 17:30:01.832176311 -0700
@@ -32,7 +32,7 @@
{
unsigned int count, output;
- (void)SetNativeSpeed( 10000uL);
+ (void)SetNativeSpeed( 14745uL);
PINSEL0 = 0; /* Set pin P0.0 - P0.16 to I/O. */
PINSEL1 = 0; /* Set pin P0.16 - P0.32 to I/O. */
Only in newlib-lpc_rel3: test9.hex