Просмотр исходного кода

finally able to get freeRTOS run with current mouse + keyboard example
NOTES: print_greeting if is executed before the start of freeRTOS scheduler --> hardfault
- print_greeting->vsprintf->systick -> bunch of ISR --> hardfault.

printf using serial after the start of scheduler is ok though

hathach 13 лет назад
Родитель
Сommit
1ae5484320

+ 9 - 2
demos/bsp/boards/board.c

@@ -37,15 +37,22 @@
 
 #include "board.h"
 
+#if TUSB_CFG_OS == TUSB_OS_NONE
 volatile uint32_t system_ticks = 0;
 
 void SysTick_Handler (void)
 {
   system_ticks++;
-#if TUSB_CFG_OS == TUSB_OS_NONE
   tusb_tick_tock(); // TODO temporarily
-#endif
 }
+#endif
+
+//void board_delay_blocking(uint32_t ms)
+//{
+//  volatile uint32_t delay_us = 1000*ms;
+//  delay_us *= (SystemCoreClock / 1000000) / 3;
+//  while(delay_us--);
+//}
 
 void check_failed(uint8_t *file, uint32_t line)
 {

+ 2 - 0
demos/bsp/boards/board.h

@@ -68,6 +68,8 @@
 #define PRINTF_TARGET_SWO           3 // aka SWV, ITM
 #define PRINTF_TARGET_NONE          4
 
+#define PRINTF(...) printf(__VA_ARGS__)
+
 #if BOARD == 0
   #error BOARD is not defined or supported yet
 #elif BOARD == BOARD_NGX4330

+ 38 - 17
demos/host/src/main.c

@@ -76,8 +76,6 @@ OSAL_TASK_DEF(led_blinking_task_def, led_blinking_task, 128, LED_BLINKING_APP_TA
 int main(void)
 {
   board_init();
-  print_greeting();
-
   tusb_init();
 
   //------------- application task init -------------//
@@ -91,12 +89,12 @@ int main(void)
   mouse_app_init();
 #endif
 
-  //------------- start OS scheduler -------------//
+  //------------- start OS scheduler (never return) -------------//
 #if TUSB_CFG_OS == TUSB_OS_FREERTOS
   vTaskStartScheduler();
 
 #elif TUSB_CFG_OS == TUSB_OS_NONE
-
+  print_greeting();
   while (1)
   {
     tusb_task_runner();
@@ -134,25 +132,48 @@ void print_greeting(void)
 
 OSAL_TASK_FUNCTION( led_blinking_task ) (void* p_task_para)
 {
-  static uint32_t current_tick = 0;
+#if TUSB_CFG_OS != TUSB_OS_NONE // TODO abstract to approriate place
+  print_greeting();
+#endif
 
   OSAL_TASK_LOOP_BEGIN
 
-  if (current_tick + CFG_TICKS_PER_SECOND < system_ticks)
+  vTaskDelay(CFG_TICKS_PER_SECOND);
+
+  /* Toggle LED once per second */
+  if ( (xTaskGetTickCount()/CFG_TICKS_PER_SECOND) % 2)
   {
-    current_tick += CFG_TICKS_PER_SECOND;
-
-    /* Toggle LED once per second */
-    if ( (current_tick/CFG_TICKS_PER_SECOND) % 2)
-    {
-      board_leds(0x01, 0x00);
-    }
-    else
-    {
-      board_leds(0x00, 0x01);
-    }
+    board_leds(0x01, 0x00);
+  }
+  else
+  {
+    board_leds(0x00, 0x01);
   }
 
   OSAL_TASK_LOOP_END
 }
 
+//OSAL_TASK_FUNCTION( led_blinking_task ) (void* p_task_para)
+//{
+//  static uint32_t current_tick = 0;
+//
+//  OSAL_TASK_LOOP_BEGIN
+//
+//  if (current_tick + CFG_TICKS_PER_SECOND < system_ticks)
+//  {
+//    current_tick += CFG_TICKS_PER_SECOND;
+//
+//    /* Toggle LED once per second */
+//    if ( (current_tick/CFG_TICKS_PER_SECOND) % 2)
+//    {
+//      board_leds(0x01, 0x00);
+//    }
+//    else
+//    {
+//      board_leds(0x00, 0x01);
+//    }
+//  }
+//
+//  OSAL_TASK_LOOP_END
+//}
+

+ 1 - 1
tinyusb/common/assertion.h

@@ -76,7 +76,7 @@ extern "C"
 
   //#if ( defined CFG_PRINTF_UART || defined CFG_PRINTF_USBCDC || defined CFG_PRINTF_DEBUG )
 #if TUSB_CFG_DEBUG == 3
-  #define _PRINTF(...)	printf(__VA_ARGS__)
+  #define _PRINTF(...)	printf(__VA_ARGS__) // PRINTF
 #else
   #define _PRINTF(...)
 #endif

+ 9 - 159
vendor/freertos/FreeRTOSConfig.h

@@ -1,162 +1,12 @@
-/*
-    FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd.
-	
-
-    ***************************************************************************
-     *                                                                       *
-     *    FreeRTOS tutorial books are available in pdf and paperback.        *
-     *    Complete, revised, and edited pdf reference manuals are also       *
-     *    available.                                                         *
-     *                                                                       *
-     *    Purchasing FreeRTOS documentation will not only help you, by       *
-     *    ensuring you get running as quickly as possible and with an        *
-     *    in-depth knowledge of how to use FreeRTOS, it will also help       *
-     *    the FreeRTOS project to continue with its mission of providing     *
-     *    professional grade, cross platform, de facto standard solutions    *
-     *    for microcontrollers - completely free of charge!                  *
-     *                                                                       *
-     *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *
-     *                                                                       *
-     *    Thank you for using FreeRTOS, and thank you for your support!      *
-     *                                                                       *
-    ***************************************************************************
-
-
-    This file is part of the FreeRTOS distribution.
-
-    FreeRTOS is free software; you can redistribute it and/or modify it under
-    the terms of the GNU General Public License (version 2) as published by the
-    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
-    >>>NOTE<<< The modification to the GPL is included to allow you to
-    distribute a combined work that includes FreeRTOS without being obliged to
-    provide the source code for proprietary components outside of the FreeRTOS
-    kernel.  FreeRTOS is distributed in the hope that it will be useful, but
-    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-    more details. You should have received a copy of the GNU General Public
-    License and the FreeRTOS license exception along with FreeRTOS; if not it
-    can be viewed here: http://www.freertos.org/a00114.html and also obtained
-    by writing to Richard Barry, contact details for whom are available on the
-    FreeRTOS WEB site.
-
-    1 tab == 4 spaces!
-
-    http://www.FreeRTOS.org - Documentation, latest information, license and
-    contact details.
-
-    http://www.SafeRTOS.com - A version that is certified for use in safety
-    critical systems.
-
-    http://www.OpenRTOS.com - Commercial support, development, porting,
-    licensing and training services.
-*/
-
-#ifndef FREERTOS_CONFIG_H
-#define FREERTOS_CONFIG_H
-
-#include "hal/hal.h"
-
-/*-----------------------------------------------------------
- * Application specific definitions.
- *
- * These definitions should be adjusted for your particular hardware and
- * application requirements.
- *
- * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
- * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
- *----------------------------------------------------------*/
-
-#define configUSE_PREEMPTION		1
-#define configUSE_IDLE_HOOK			1
-#define configMAX_PRIORITIES		( ( unsigned portBASE_TYPE ) 16 )
-#define configUSE_TICK_HOOK			0
-#define configCPU_CLOCK_HZ			( ( unsigned long ) SystemCoreClock )
-#define configTICK_RATE_HZ			( ( portTickType ) 1000 )
-#define configMINIMAL_STACK_SIZE	( ( unsigned short ) 128 )
-#ifdef __CODE_RED
-#define configTOTAL_HEAP_SIZE		( ( size_t ) ( 16*1024 ) )
-#else
-#define configTOTAL_HEAP_SIZE		( ( size_t ) ( 0 ) )
-#endif
-#define configMAX_TASK_NAME_LEN		( 20 )
-#define configUSE_TRACE_FACILITY	1
-#define configUSE_16_BIT_TICKS		0
-#define configIDLE_SHOULD_YIELD		1
-#define configUSE_CO_ROUTINES 		0
-#define configUSE_MUTEXES			1
-#define configUSE_TICKLESS_IDLE		1
-
-#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
-
-#define configUSE_COUNTING_SEMAPHORES 	1
-#define configUSE_ALTERNATIVE_API 		0
-#define configCHECK_FOR_STACK_OVERFLOW	0
-#define configUSE_RECURSIVE_MUTEXES		1
-#define configQUEUE_REGISTRY_SIZE		10
-#define configGENERATE_RUN_TIME_STATS	0
-
-/* Set the following definitions to 1 to include the API function, or zero
-to exclude the API function. */
-
-#define INCLUDE_vTaskPrioritySet			1
-#define INCLUDE_uxTaskPriorityGet			1
-#define INCLUDE_vTaskDelete					1
-#define INCLUDE_vTaskCleanUpResources		0
-#define INCLUDE_vTaskSuspend				1
-#define INCLUDE_vTaskDelayUntil				1
-#define INCLUDE_vTaskDelay					1
-#define INCLUDE_uxTaskGetStackHighWaterMark	1
-
-/* Use the system definition, if there is one */
-#ifdef __NVIC_PRIO_BITS
-	#define configPRIO_BITS       __NVIC_PRIO_BITS
-#else
-	#define configPRIO_BITS       5        /* 32 priority levels */
-#endif
-
-#if defined(CORE_M3)
-/* The lowest interrupt priority that can be used in a call to a "set priority"
-function. */
-#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY			0x1f
-
-/* The highest interrupt priority that can be used by any interrupt service
-routine that makes calls to interrupt safe FreeRTOS API functions.  DO NOT CALL
-INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
-PRIORITY THAN THIS! (higher priorities are lower numeric values. */
-#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY	5
-
-/* Interrupt priorities used by the kernel port layer itself.  These are generic
-to all Cortex-M ports, and do not rely on any particular library functions. */
-#define configKERNEL_INTERRUPT_PRIORITY 		( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
-#define configMAX_SYSCALL_INTERRUPT_PRIORITY 	( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
+#ifndef __FREERTOS_CONFIG__H
+#define __FREERTOS_CONFIG__H
 
+#ifdef CORE_M4
+#include "lpc43xx_m4_FreeRTOSConfig.h"
+#elif defined(CORE_M0)
+	#include "lpc43xx_m0_FreeRTOSConfig.h"
 #else
+	#error "For LPC43XX one of CORE_M0 or CORE_M4 must be defined!"
+#endif /* ifdef CORE_M4 */
 
-#if defined(CORE_M4)
-/* The lowest interrupt priority that can be used in a call to a "set priority"
-function. */
-#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY			0x3f
-
-/* The highest interrupt priority that can be used by any interrupt service
-routine that makes calls to interrupt safe FreeRTOS API functions.  DO NOT CALL
-INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
-PRIORITY THAN THIS! (higher priorities are lower numeric values. */
-#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY	5
-
-/* Interrupt priorities used by the kernel port layer itself.  These are generic
-to all Cortex-M ports, and do not rely on any particular library functions. */
-#define configKERNEL_INTERRUPT_PRIORITY 		( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
-/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
-See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
-#define configMAX_SYSCALL_INTERRUPT_PRIORITY 	( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
-
-#else
-#if defined(CORE_M0)
-#error FreeRTOS CM0 support NOT YET DEFINED
-
-#else
-#error FreeRTOS setup NOT DEFINED
-#endif /* defined(CORE_M0) */
-#endif /* defined(CORE_M4) */
-#endif /* defined(CORE_M3) */
-#endif /* FREERTOS_CONFIG_H */
+# endif /* __FREERTOS_CONFIG__H */

+ 2 - 2
vendor/freertos/freertoslpc/FreeRTOSCommonHooks.c

@@ -33,7 +33,7 @@
 #include "task.h"
 #include "FreeRTOSCommonHooks.h"
 
-//#include "hal/hal.h"
+#include "boards/board.h"
 
 /*****************************************************************************
  * Private types/enumerations/variables
@@ -81,7 +81,7 @@ void vApplicationStackOverflowHook(xTaskHandle pxTask, signed char *pcTaskName)
 	(void) pxTask;
 	(void) pcTaskName;
 
-	DEBUGOUT("DIE:ERROR:FreeRTOS: Stack overflow in task %s\r\n", pcTaskName);
+	PRINTF("DIE:ERROR:FreeRTOS: Stack overflow in task %s\r\n", pcTaskName);
 	/* Run time stack overflow checking is performed if
 	   configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2.  This hook
 	   function is called if a stack overflow is detected. */

+ 149 - 0
vendor/freertos/lpc43xx_dualcore_config.h

@@ -0,0 +1,149 @@
+/*
+ * @brief LPC43xx dual-core example configuration file
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2012
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products.  This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights.  NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers.  This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __LPC43XX_DUALCORE_CONFIG_H_
+#define __LPC43XX_DUALCORE_CONFIG_H_
+
+#include "board.h"
+
+/*
+ * Users can enable any of the following macros so that the examples will be
+ * built with that functionality.
+ */
+#define EXAMPLE_BLINKY
+#undef  EXAMPLE_USB_DEVICE
+#undef  EXAMPLE_USB_HOST
+#undef  EXAMPLE_LWIP
+#undef  EXAMPLE_EMWIN
+
+/*
+ * Users can define any one of the following macros to use the appropriate OS.
+ * For standalone executables both the macros should be disabled.
+ */
+#define OS_FREE_RTOS
+#undef  OS_UCOS_III
+
+/*
+ * The Stack sizes are currently used by Code Red LPCXpresso tool chain
+ * only. In future, this will be used by Keil & IAR tool chains also
+ */
+#define STACK_SIZE  0x200
+#define HEAP_SIZE   0x4000
+
+/*
+ * The following defines are used by the M4 image to locate the M0 image, and
+ * one of the below macro must be defined based on your linker definition file.
+ * If the linker file is made to generate image in SPIFI area then define
+ * TARGET_SPIFI macro (so that M4 image will locate the corresponding M0 in the
+ * SPIFI region). If none of them r defined the following defaults will be used
+ * For LPC4330 NGX XPLORER BOARD:      TARGET_SPIFI
+ * For LPC4357 KEIL MCB BOARD:         TARGET_IFLASH
+ * For LPC4350 HITEX EVALUATION BOARD: TARGET_SPIFI
+ */
+#undef TARGET_SPIFI     /* SPIFI Flash */
+#undef TARGET_IFLASH    /* Internal Flash */
+#undef TARGET_XFLASH    /* External NOR Flash */
+
+/* Priority of various tasks in dual-core examples */
+/* LWIP thread priority should always be greater than the
+ * MAC priority ie., greater than TASK_PRIO_ETHERNET
+ */
+#ifdef OS_FREE_RTOS
+/* higher the number higher the priority */
+#define TASK_PRIO_LCD             (tskIDLE_PRIORITY + 0UL)
+#define TASK_PRIO_TOUCHSCREEN     (tskIDLE_PRIORITY + 1UL)
+#define TASK_PRIO_BLINKY_EVENT    (tskIDLE_PRIORITY + 1UL)
+#define TASK_PRIO_ETHERNET        (tskIDLE_PRIORITY + 2UL)
+#define TASK_PRIO_IPC_DISPATCH    (tskIDLE_PRIORITY + 3UL)
+#define TASK_PRIO_USBDEVICE       (tskIDLE_PRIORITY + 4UL)
+#define TASK_PRIO_LWIP_THREAD     (tskIDLE_PRIORITY + 5UL)
+
+#elif defined(OS_UCOS_III)
+/* lower the number higher the priority */
+#define TASK_PRIO_BLINKY_EVENT    14
+#define TASK_PRIO_LCD             14
+#define TASK_PRIO_TOUCHSCREEN     13
+#define TASK_PRIO_ETHERNET        13
+#define TASK_PRIO_IPC_DISPATCH    12
+#define TASK_PRIO_USBDEVICE       11
+#define TASK_PRIO_LWIP_THREAD     10
+#endif
+
+/* Priority of various IRQs used in dual-core examples */
+/* lower the number higher the priority */
+#define IRQ_PRIO_IPC              7
+#define IRQ_PRIO_ETHERNET         6
+#define IRQ_PRIO_USBDEV           5
+
+/* Minimum stack size for UCOS-III Tasks */
+#define UCOS_MIN_STACK_SZ         128
+
+/*
+ * Offset of M0 image from the starting of M4 image
+ * Usually the size allocated for M0 image in scatter
+ * file/ Linker Definition file / Memory configuration
+ * in the IDE.
+ * ####Don't change this value unless you are sure about what you are doing ####
+ */
+#define M0_IMAGE_OFFSET      0x40000
+
+/*
+ * Absolute addresses used by both cores.
+ * ####Don't change these values unless you are sure about what you are doing ####
+ */
+#define SHARED_MEM_M0          0x20000000
+#define SHARED_MEM_M4          0x20000020
+
+/* Size & location of RAM DISK used by FAT Filesystem */
+#define RAMDISK_LOCATION    0x20002000
+#define RAMDISK_SIZE        0x2000
+
+#ifdef CORE_M4
+/* Delay and LED to be blinked by M4 Core */
+#define BLINKY_DEFAULT_DELAY         1000
+#define BLINK_LED                    1
+#endif /* CORE_M4 */
+
+#ifdef CORE_M0
+/* Delay and LED to be blinked by M4 Core */
+#define BLINK_LED                    0
+#define BLINKY_DEFAULT_DELAY         500
+#endif /* CORE_M0 */
+
+/* Base address of various flashes */
+#define SPIFI_BASE_ADDR      0x14000000
+#define XFLASH_BASE_ADDR     0x1C000000
+#define IFLASH_BASE_ADDR     0x1A000000
+
+/* Include Common header here */
+#include "dualcore_common.h"
+
+#endif /* ifndef __LPC43XX_DUALCORE_CONFIG_H_ */

+ 154 - 0
vendor/freertos/lpc43xx_m0_FreeRTOSConfig.h

@@ -0,0 +1,154 @@
+/*
+    FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd.
+
+
+    ***************************************************************************
+     *                                                                       *
+     *    FreeRTOS tutorial books are available in pdf and paperback.        *
+     *    Complete, revised, and edited pdf reference manuals are also       *
+     *    available.                                                         *
+     *                                                                       *
+     *    Purchasing FreeRTOS documentation will not only help you, by       *
+     *    ensuring you get running as quickly as possible and with an        *
+     *    in-depth knowledge of how to use FreeRTOS, it will also help       *
+     *    the FreeRTOS project to continue with its mission of providing     *
+     *    professional grade, cross platform, de facto standard solutions    *
+     *    for microcontrollers - completely free of charge!                  *
+     *                                                                       *
+     *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *
+     *                                                                       *
+     *    Thank you for using FreeRTOS, and thank you for your support!      *
+     *                                                                       *
+    ***************************************************************************
+
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    >>>NOTE<<< The modification to the GPL is included to allow you to
+    distribute a combined work that includes FreeRTOS without being obliged to
+    provide the source code for proprietary components outside of the FreeRTOS
+    kernel.  FreeRTOS is distributed in the hope that it will be useful, but
+    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+    more details. You should have received a copy of the GNU General Public
+    License and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    http://www.FreeRTOS.org - Documentation, latest information, license and
+    contact details.
+
+    http://www.SafeRTOS.com - A version that is certified for use in safety
+    critical systems.
+
+    http://www.OpenRTOS.com - Commercial support, development, porting,
+    licensing and training services.
+*/
+
+
+#ifndef FREERTOS_CONFIG_H
+#define FREERTOS_CONFIG_H
+
+#ifndef __IASMARM__
+/* For SystemCoreClock */
+#include "board.h"
+#endif
+
+/*-----------------------------------------------------------
+ * Application specific definitions.
+ *
+ * These definitions should be adjusted for your particular hardware and
+ * application requirements.
+ *
+ * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
+ * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
+ *
+ * See http://www.freertos.org/a00110.html.
+ *----------------------------------------------------------*/
+
+#define configUSE_PREEMPTION			1
+#define configUSE_IDLE_HOOK				1
+#define configUSE_TICK_HOOK				0
+#define configCPU_CLOCK_HZ				( SystemCoreClock )
+#define configTICK_RATE_HZ				( ( portTickType ) 1000 )
+#define configMAX_PRIORITIES			( ( unsigned portBASE_TYPE ) 8 )
+#define configMINIMAL_STACK_SIZE		( ( unsigned short ) 128 )
+#define configTOTAL_HEAP_SIZE			( ( size_t ) ( 0 ) )
+#define configMAX_TASK_NAME_LEN			( 10 )
+#define configUSE_TRACE_FACILITY		1
+#define configUSE_16_BIT_TICKS			0
+#define configIDLE_SHOULD_YIELD			1
+#define configUSE_MUTEXES				1
+#define configQUEUE_REGISTRY_SIZE		8
+#define configCHECK_FOR_STACK_OVERFLOW	2
+#define configUSE_RECURSIVE_MUTEXES		1
+#define configUSE_MALLOC_FAILED_HOOK	1
+#define configUSE_APPLICATION_TASK_TAG	0
+#define configUSE_COUNTING_SEMAPHORES	1
+#define configGENERATE_RUN_TIME_STATS	0
+
+/* Co-routine definitions. */
+#define configUSE_CO_ROUTINES 		0
+#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
+
+/* Software timer definitions.  This example uses I2C to write to the LEDs.  As
+this takes a finite time, and because a timer callback writes to an LED, the
+priority of the timer task is kept to a minimum to ensure it does not disrupt
+test tasks that check their own execution times. */
+#define configUSE_TIMERS				0
+#define configTIMER_TASK_PRIORITY		( 0 )
+#define configTIMER_QUEUE_LENGTH		5
+#define configTIMER_TASK_STACK_DEPTH	( configMINIMAL_STACK_SIZE * 2 )
+
+/* Set the following definitions to 1 to include the API function, or zero
+to exclude the API function. */
+#define INCLUDE_vTaskPrioritySet		1
+#define INCLUDE_uxTaskPriorityGet		1
+#define INCLUDE_vTaskDelete				1
+#define INCLUDE_vTaskCleanUpResources	1
+#define INCLUDE_vTaskSuspend			1
+#define INCLUDE_vTaskDelayUntil			1
+#define INCLUDE_vTaskDelay				1
+#define INCLUDE_xTaskGetCurrentTaskHandle 1
+
+/* Cortex-M specific definitions. */
+#ifdef __NVIC_PRIO_BITS
+	/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
+	#define configPRIO_BITS       		__NVIC_PRIO_BITS
+#else
+	#define configPRIO_BITS       		5        /* 32 priority levels */
+#endif
+
+/* The lowest interrupt priority that can be used in a call to a "set priority"
+function. */
+#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY			0x1f
+
+/* The highest interrupt priority that can be used by any interrupt service
+routine that makes calls to interrupt safe FreeRTOS API functions.  DO NOT CALL
+INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
+PRIORITY THAN THIS! (higher priorities are lower numeric values. */
+#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY	5
+
+/* Interrupt priorities used by the kernel port layer itself.  These are generic
+to all Cortex-M ports, and do not rely on any particular library functions. */
+#define configKERNEL_INTERRUPT_PRIORITY 		( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
+#define configMAX_SYSCALL_INTERRUPT_PRIORITY 	( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
+	
+/* Normal assert() semantics without relying on the provision of an assert.h
+header file. */
+#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }	
+
+#define configUSE_CUSTOM_TICK 1
+
+#define vPortSVCHandler       SVC_Handler
+#define xPortPendSVHandler    PendSV_Handler
+#define xPortSysTickHandler   RIT_IRQHandler
+
+#endif /* FREERTOS_CONFIG_H */
+

+ 154 - 0
vendor/freertos/lpc43xx_m4_FreeRTOSConfig.h

@@ -0,0 +1,154 @@
+/*
+    FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd.
+
+
+    ***************************************************************************
+     *                                                                       *
+     *    FreeRTOS tutorial books are available in pdf and paperback.        *
+     *    Complete, revised, and edited pdf reference manuals are also       *
+     *    available.                                                         *
+     *                                                                       *
+     *    Purchasing FreeRTOS documentation will not only help you, by       *
+     *    ensuring you get running as quickly as possible and with an        *
+     *    in-depth knowledge of how to use FreeRTOS, it will also help       *
+     *    the FreeRTOS project to continue with its mission of providing     *
+     *    professional grade, cross platform, de facto standard solutions    *
+     *    for microcontrollers - completely free of charge!                  *
+     *                                                                       *
+     *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *
+     *                                                                       *
+     *    Thank you for using FreeRTOS, and thank you for your support!      *
+     *                                                                       *
+    ***************************************************************************
+
+
+    This file is part of the FreeRTOS distribution.
+
+    FreeRTOS is free software; you can redistribute it and/or modify it under
+    the terms of the GNU General Public License (version 2) as published by the
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
+    >>>NOTE<<< The modification to the GPL is included to allow you to
+    distribute a combined work that includes FreeRTOS without being obliged to
+    provide the source code for proprietary components outside of the FreeRTOS
+    kernel.  FreeRTOS is distributed in the hope that it will be useful, but
+    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+    more details. You should have received a copy of the GNU General Public
+    License and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
+    by writing to Richard Barry, contact details for whom are available on the
+    FreeRTOS WEB site.
+
+    1 tab == 4 spaces!
+
+    http://www.FreeRTOS.org - Documentation, latest information, license and
+    contact details.
+
+    http://www.SafeRTOS.com - A version that is certified for use in safety
+    critical systems.
+
+    http://www.OpenRTOS.com - Commercial support, development, porting,
+    licensing and training services.
+*/
+
+
+#ifndef FREERTOS_CONFIG_H
+#define FREERTOS_CONFIG_H
+
+//#include "hal/hal.h"
+#include "LPC43xx.h"
+#include "core_cm4.h"
+
+/*-----------------------------------------------------------
+ * Application specific definitions.
+ *
+ * These definitions should be adjusted for your particular hardware and
+ * application requirements.
+ *
+ * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
+ * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
+ *
+ * See http://www.freertos.org/a00110.html.
+ *----------------------------------------------------------*/
+
+#define configUSE_PREEMPTION			1
+#define configUSE_IDLE_HOOK				1
+#define configUSE_TICK_HOOK				0
+#define configCPU_CLOCK_HZ				( SystemCoreClock )
+#define configTICK_RATE_HZ				( ( portTickType ) 1000 )
+#define configMAX_PRIORITIES			( ( unsigned portBASE_TYPE ) 16 )
+#define configMINIMAL_STACK_SIZE		( ( unsigned short ) 128 )
+#define configTOTAL_HEAP_SIZE			( ( size_t ) ( 16*1024 ) )
+#define configMAX_TASK_NAME_LEN			( 20 )
+#define configUSE_TRACE_FACILITY		1
+#define configUSE_16_BIT_TICKS			0
+#define configIDLE_SHOULD_YIELD			1
+#define configUSE_MUTEXES				1
+#define configQUEUE_REGISTRY_SIZE		8
+#define configCHECK_FOR_STACK_OVERFLOW	2
+#define configUSE_RECURSIVE_MUTEXES		1
+#define configUSE_MALLOC_FAILED_HOOK	1
+#define configUSE_APPLICATION_TASK_TAG	0
+#define configUSE_COUNTING_SEMAPHORES	1
+#define configGENERATE_RUN_TIME_STATS	0
+
+/* Co-routine definitions. */
+#define configUSE_CO_ROUTINES 		0
+#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
+
+/* Software timer definitions.  This example uses I2C to write to the LEDs.  As
+this takes a finite time, and because a timer callback writes to an LED, the
+priority of the timer task is kept to a minimum to ensure it does not disrupt
+test tasks that check their own execution times. */
+#define configUSE_TIMERS				0
+#define configTIMER_TASK_PRIORITY		( 0 )
+#define configTIMER_QUEUE_LENGTH		5
+#define configTIMER_TASK_STACK_DEPTH	( configMINIMAL_STACK_SIZE * 2 )
+
+/* Set the following definitions to 1 to include the API function, or zero
+to exclude the API function. */
+#define INCLUDE_vTaskPrioritySet		1
+#define INCLUDE_uxTaskPriorityGet		1
+#define INCLUDE_vTaskDelete				1
+#define INCLUDE_vTaskCleanUpResources	1
+#define INCLUDE_vTaskSuspend			1
+#define INCLUDE_vTaskDelayUntil			1
+#define INCLUDE_vTaskDelay				1
+#define INCLUDE_xTaskGetCurrentTaskHandle 1
+
+/* Cortex-M specific definitions. */
+#ifdef __NVIC_PRIO_BITS
+	/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
+	#define configPRIO_BITS       		__NVIC_PRIO_BITS
+#else
+	#define configPRIO_BITS       		5        /* 32 priority levels */
+#endif
+
+/* The lowest interrupt priority that can be used in a call to a "set priority"
+function. */
+#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY			0x1f
+
+/* The highest interrupt priority that can be used by any interrupt service
+routine that makes calls to interrupt safe FreeRTOS API functions.  DO NOT CALL
+INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
+PRIORITY THAN THIS! (higher priorities are lower numeric values. */
+#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY	5
+
+/* Interrupt priorities used by the kernel port layer itself.  These are generic
+to all Cortex-M ports, and do not rely on any particular library functions. */
+#define configKERNEL_INTERRUPT_PRIORITY 		( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
+/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
+See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
+#define configMAX_SYSCALL_INTERRUPT_PRIORITY 	( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
+	
+/* Normal assert() semantics without relying on the provision of an assert.h
+header file. */
+#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }	
+
+/* FreeRTOS hooks to NVIC vectors */
+#define xPortPendSVHandler    PendSV_Handler
+#define xPortSysTickHandler   SysTick_Handler
+#define vPortSVCHandler       SVC_Handler
+
+#endif /* FREERTOS_CONFIG_H */
+