summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2011-01-24 08:54:54 +0100
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2011-01-24 08:57:27 +0100
commite46ea682c1aa214ccb59c9871914993c9375e5c2 (patch)
tree6cb321024598fcc2a6cb9b3968834d7655bb26b1
parent6a6e8752bdf9b7c11921c502f2433b8fdbf0c525 (diff)
Fixing a few templates, and making the various needed functions available.
-rw-r--r--FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c8
-rw-r--r--FreeRTOS/config.mk2
-rw-r--r--Makefile2
-rw-r--r--arch/Makefile3
-rw-r--r--arch/arm/lpc17xx/hooks.c7
-rw-r--r--os/src/init.c23
6 files changed, 36 insertions, 9 deletions
diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c
index 66dd5ba..d2f1de3 100644
--- a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c
+++ b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c
@@ -153,7 +153,7 @@ static void prvRestoreContextOfFirstTask( void ) __attribute__(( naked )) PRIVIL
* C portion of the SVC handler. The SVC handler is split between an asm entry
* and a C wrapper for simplicity of coding and maintenance.
*/
-static void prvSVCHandler( unsigned long *pulRegisters ) __attribute__(( noinline )) PRIVILEGED_FUNCTION;
+void prvSVCHandler( unsigned long *pulRegisters ) PRIVILEGED_FUNCTION;
/*
* Prototypes for all the MPU wrappers.
@@ -246,14 +246,10 @@ void vPortSVCHandler( void )
" b prvSVCHandler \n"
:::"r0"
);
-
- /* This will never get executed, but is required to prevent prvSVCHandler
- being removed by the optimiser. */
- prvSVCHandler( NULL );
}
/*-----------------------------------------------------------*/
-static void prvSVCHandler( unsigned long *pulParam )
+void prvSVCHandler( unsigned long *pulParam )
{
unsigned char ucSVCNumber;
diff --git a/FreeRTOS/config.mk b/FreeRTOS/config.mk
index 188050d..d45722a 100644
--- a/FreeRTOS/config.mk
+++ b/FreeRTOS/config.mk
@@ -1,4 +1,4 @@
-TARGET_INCLUDES = $(ROOTDIR)/FreeRTOS/Source/include
+TARGET_INCLUDES += $(ROOTDIR)/FreeRTOS/Source/include
ifeq ($(USE_MPU),true)
TARGET_CPPFLAGS += -DportUSING_MPU_WRAPPERS=1
diff --git a/Makefile b/Makefile
index f3331ed..6670cb7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
TARGET = demo.bin
-LIBS = -LFreeRTOS -Larch -lFreeRTOS -larch
+LIBS = -LFreeRTOS -Larch -Los -lFreeRTOS -larch -los
export ROOTDIR = $(CURDIR)
diff --git a/arch/Makefile b/arch/Makefile
index 60f44bf..d5c09d1 100644
--- a/arch/Makefile
+++ b/arch/Makefile
@@ -4,12 +4,13 @@ all: $(TARGET_LIB)
include $(ROOTDIR)/common.mk
include config.mk
+include $(ROOTDIR)/FreeRTOS/config.mk
ifeq ($(CPU),arm)
ifeq ($(CPU_FLAVOR),lpc1768)
TARGET_SRCS += arm/lpc17xx/Core/CM3/DeviceSupport/NXP/LPC17xx/system_LPC17xx.c arm/lpc17xx/Core/CM3/CoreSupport/core_cm3.c
TARGET_SRCS += $(addprefix arm/lpc17xx/Drivers/source/lpc17xx_, spi.c rit.c exti.c wdt.c uart.c dac.c rtc.c i2s.c pwm.c mcpwm.c pinsel.c nvic.c emac.c systick.c ssp.c can.c gpio.c libcfg_default.c i2c.c timer.c gpdma.c clkpwr.c qei.c adc.c)
-TARGET_SRCS += arm/lpc17xx/startup.s
+TARGET_SRCS += arm/lpc17xx/startup.s arm/lpc17xx/hooks.c
endif
endif
diff --git a/arch/arm/lpc17xx/hooks.c b/arch/arm/lpc17xx/hooks.c
new file mode 100644
index 0000000..8230d15
--- /dev/null
+++ b/arch/arm/lpc17xx/hooks.c
@@ -0,0 +1,7 @@
+#include "FreeRTOS.h"
+#include "task.h"
+
+void vConfigureTimerForRunTimeStats() { }
+void vApplicationTickHook() { }
+void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR *pcTaskName ) { }
+void vApplicationIdleHook() { }
diff --git a/os/src/init.c b/os/src/init.c
index e69de29..d161355 100644
--- a/os/src/init.c
+++ b/os/src/init.c
@@ -0,0 +1,23 @@
+#include <stdlib.h>
+
+extern void __libc_init_array(void) __attribute__ ((weak));
+extern void __libc_fini_array(void) __attribute__ ((weak));
+extern void exit(int) __attribute__ ((noreturn, weak));
+extern void __main() __attribute__ ((weak));
+extern int main(int, char **, char **);
+
+void _start() {
+ if (__libc_init_array)
+ __libc_init_array();
+
+ if (__main)
+ __main();
+
+ int return_code = main(0, NULL, NULL);
+
+ if (__libc_fini_array)
+ __libc_fini_array();
+
+ if (exit)
+ exit(return_code);
+}