summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Boone <ideas@sharebrained.com>2011-04-10 23:46:38 +0000
committerJared Boone <ideas@sharebrained.com>2011-04-10 23:46:38 +0000
commita8fda6b28b8baff3df2117ea16d035a5e64af16e (patch)
treec784fe8fe1cbe90f54cc1f66060eb7ebf8876978
parentb942306f8c45d80bb7d8525812bc19cc37037433 (diff)
Extracted start-up code from interrupt vector table -- it's now in a separate file named "LPC17xx_Startup.c". This makes it a bit easier to relocate the vector table to SRAM from flash.
-rw-r--r--firmware/blinky/Makefile1
-rw-r--r--firmware/bluetooth_rxtx/Makefile1
-rw-r--r--firmware/bootloader/Makefile3
-rw-r--r--firmware/bt_simple/Makefile1
-rw-r--r--firmware/cc2400_test/Makefile1
-rw-r--r--firmware/clock_test/Makefile1
-rw-r--r--firmware/common/LPC17xx_Interrupts.c37
-rw-r--r--firmware/common/LPC17xx_Startup.c63
-rw-r--r--firmware/usb_test/Makefile1
9 files changed, 72 insertions, 37 deletions
diff --git a/firmware/blinky/Makefile b/firmware/blinky/Makefile
index f01c12a..b3d4585 100644
--- a/firmware/blinky/Makefile
+++ b/firmware/blinky/Makefile
@@ -66,6 +66,7 @@ TARGET = blinky
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \
+ ../common/LPC17xx_Startup.c \
../common/LPC17xx_Interrupts.c \
../common/ubertooth.c
diff --git a/firmware/bluetooth_rxtx/Makefile b/firmware/bluetooth_rxtx/Makefile
index a750c22..2f5e740 100644
--- a/firmware/bluetooth_rxtx/Makefile
+++ b/firmware/bluetooth_rxtx/Makefile
@@ -75,6 +75,7 @@ LPCUSB_PATH = $(LIBS_PATH)/lpcusb/target
SRC = $(TARGET).c \
$(LIBS_PATH)/usb_serial.c \
$(LIBS_PATH)/serial_fifo.c \
+ $(LIBS_PATH)/LPC17xx_Startup.c \
$(LIBS_PATH)/LPC17xx_Interrupts.c \
$(LIBS_PATH)/ubertooth.c \
$(LPCUSB_PATH)/usbcontrol.c \
diff --git a/firmware/bootloader/Makefile b/firmware/bootloader/Makefile
index 94c62bb..aa5686d 100644
--- a/firmware/bootloader/Makefile
+++ b/firmware/bootloader/Makefile
@@ -73,7 +73,8 @@ LIBS_PATH = ../common
LPCUSB_PATH = $(LIBS_PATH)/lpcusb/target
# List C source files here. (C dependencies are automatically generated.)
-SRC = $(LIBS_PATH)/LPC17xx_Interrupts.c \
+SRC = $(LIBS_PATH)/LPC17xx_Startup.c \
+ $(LIBS_PATH)/LPC17xx_Interrupts.c \
$(LIBS_PATH)/ubertooth.c \
$(LPCUSB_PATH)/usbcontrol.c \
$(LPCUSB_PATH)/usbinit.c \
diff --git a/firmware/bt_simple/Makefile b/firmware/bt_simple/Makefile
index 88d68fe..a3aceae 100644
--- a/firmware/bt_simple/Makefile
+++ b/firmware/bt_simple/Makefile
@@ -75,6 +75,7 @@ LPCUSB_PATH = $(LIBS_PATH)/lpcusb/target
SRC = $(TARGET).c \
$(LIBS_PATH)/usb_serial.c \
$(LIBS_PATH)/serial_fifo.c \
+ $(LIBS_PATH)/LPC17xx_Startup.c \
$(LIBS_PATH)/LPC17xx_Interrupts.c \
$(LIBS_PATH)/ubertooth.c \
$(LPCUSB_PATH)/usbcontrol.c \
diff --git a/firmware/cc2400_test/Makefile b/firmware/cc2400_test/Makefile
index a2039e2..21a8fac 100644
--- a/firmware/cc2400_test/Makefile
+++ b/firmware/cc2400_test/Makefile
@@ -66,6 +66,7 @@ TARGET = cc2400_test
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \
+ ../common/LPC17xx_Startup.c \
../common/LPC17xx_Interrupts.c \
../common/ubertooth.c
diff --git a/firmware/clock_test/Makefile b/firmware/clock_test/Makefile
index ada37ba..1d37d18 100644
--- a/firmware/clock_test/Makefile
+++ b/firmware/clock_test/Makefile
@@ -66,6 +66,7 @@ TARGET = clock_test
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \
+ ../common/LPC17xx_Startup.c \
../common/LPC17xx_Interrupts.c \
../common/ubertooth.c
diff --git a/firmware/common/LPC17xx_Interrupts.c b/firmware/common/LPC17xx_Interrupts.c
index 2d32282..351e087 100644
--- a/firmware/common/LPC17xx_Interrupts.c
+++ b/firmware/common/LPC17xx_Interrupts.c
@@ -28,47 +28,12 @@
/* Reset_Handler variables defined in linker script */
extern unsigned long _StackTop;
-extern unsigned long _data;
-extern unsigned long _edata;
-extern unsigned long _etext;
-extern unsigned long _bss;
-extern unsigned long _ebss;
-
-extern void __libc_init_array(void);
-extern int main(void);
-
-/* Reset Handler */
-void Reset_Handler(void)
-{
- unsigned long *src, *dest;
-
- // Copy the data segment initializers from flash to SRAM
- src = &_etext;
- for(dest = &_data; dest < &_edata; )
- {
- *dest++ = *src++;
- }
-
- // Initialize the .bss segment of memory to zeros
- src = &_bss;
- while (src < &_ebss)
- {
- *src++ = 0;
- }
-
- __libc_init_array();
-
- main();
-
- // In case main() fails, have something to breakpoint
- while (1) {;}
-}
+extern void Reset_Handler(void);
/* Default interrupt handler */
static void Default_Handler(void) { while(1) {;} }
-
/* Empty handlers aliased to the default handler */
void NMI_Handler(void) __attribute__ ((weak, alias ("Default_Handler")));
void HardFault_Handler(void) __attribute__ ((weak, alias ("Default_Handler")));
diff --git a/firmware/common/LPC17xx_Startup.c b/firmware/common/LPC17xx_Startup.c
new file mode 100644
index 0000000..6bb1219
--- /dev/null
+++ b/firmware/common/LPC17xx_Startup.c
@@ -0,0 +1,63 @@
+/*
+ Copyright 2010-07 By Opendous Inc. (www.MicropendousX.org)
+ NVIC handler info copied from NXP User Manual UM10360
+
+ Start-up code for LPC17xx. See TODOs for
+ modification instructions.
+
+ Permission to use, copy, modify, and distribute this software
+ and its documentation for any purpose and without fee is hereby
+ granted, provided that the above copyright notice appear in all
+ copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaim all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+
+/* Reset_Handler variables defined in linker script */
+extern unsigned long _data;
+extern unsigned long _edata;
+extern unsigned long _etext;
+extern unsigned long _bss;
+extern unsigned long _ebss;
+
+extern void __libc_init_array(void);
+extern int main(void);
+
+/* Reset Handler */
+void Reset_Handler(void)
+{
+ unsigned long *src, *dest;
+
+ // Copy the data segment initializers from flash to SRAM
+ src = &_etext;
+ for(dest = &_data; dest < &_edata; )
+ {
+ *dest++ = *src++;
+ }
+
+ // Initialize the .bss segment of memory to zeros
+ src = &_bss;
+ while (src < &_ebss)
+ {
+ *src++ = 0;
+ }
+
+ __libc_init_array();
+
+ main();
+
+ // In case main() fails, have something to breakpoint
+ while (1) {;}
+}
diff --git a/firmware/usb_test/Makefile b/firmware/usb_test/Makefile
index b441b7a..b68c230 100644
--- a/firmware/usb_test/Makefile
+++ b/firmware/usb_test/Makefile
@@ -75,6 +75,7 @@ LPCUSB_PATH = $(LIBS_PATH)/lpcusb/target
SRC = $(TARGET).c \
$(LIBS_PATH)/usb_serial.c \
$(LIBS_PATH)/serial_fifo.c \
+ $(LIBS_PATH)/LPC17xx_Startup.c \
$(LIBS_PATH)/LPC17xx_Interrupts.c \
$(LIBS_PATH)/ubertooth.c \
$(LPCUSB_PATH)/usbcontrol.c \