test: Buildable old FreeRTOS.
This commit is contained in:
@@ -8,37 +8,83 @@
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
#if defined (__USE_LPCOPEN)
|
||||
#if defined(NO_BOARD_LIB)
|
||||
#include "chip.h"
|
||||
#else
|
||||
#include "board.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#include <cr_section_macros.h>
|
||||
|
||||
int main(void) {
|
||||
|
||||
#if defined (__USE_LPCOPEN)
|
||||
// Read clock settings and update SystemCoreClock variable
|
||||
SystemCoreClockUpdate();
|
||||
#if !defined(NO_BOARD_LIB)
|
||||
// Set up and initialize all required blocks and
|
||||
// functions related to the board hardware
|
||||
Board_Init();
|
||||
// Set the LED to the state of "On"
|
||||
Board_LED_Set(0, true);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// Force the counter to be placed into memory
|
||||
volatile static int i = 0 ;
|
||||
// Enter an infinite loop, just incrementing a counter
|
||||
while(1) {
|
||||
i++ ;
|
||||
__asm volatile ("nop");
|
||||
}
|
||||
return 0 ;
|
||||
/* Sets up system hardware */
|
||||
static void prvSetupHardware(void)
|
||||
{
|
||||
SystemCoreClockUpdate();
|
||||
Board_Init();
|
||||
}
|
||||
|
||||
/* LED0 toggle thread */
|
||||
static void vLEDTask0(void *pvParameters) {
|
||||
bool LedState = false;
|
||||
while (1) {
|
||||
Board_LED_Set(0, LedState);
|
||||
LedState = (bool) !LedState;
|
||||
|
||||
vTaskDelay(configTICK_RATE_HZ / 2);
|
||||
}
|
||||
}
|
||||
|
||||
/* LED1 toggle thread */
|
||||
static void vLEDTask1(void *pvParameters) {
|
||||
bool LedState = false;
|
||||
while (1) {
|
||||
Board_LED_Set(1, LedState);
|
||||
LedState = (bool) !LedState;
|
||||
|
||||
vTaskDelay(configTICK_RATE_HZ * 2);
|
||||
}
|
||||
}
|
||||
|
||||
/* LED2 toggle thread */
|
||||
static void vLEDTask2(void *pvParameters) {
|
||||
bool LedState = false;
|
||||
while (1) {
|
||||
Board_LED_Set(2, LedState);
|
||||
LedState = (bool) !LedState;
|
||||
|
||||
vTaskDelay(configTICK_RATE_HZ);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Public functions
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief main routine for FreeRTOS blinky example
|
||||
* @return Nothing, function should not exit
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
prvSetupHardware();
|
||||
|
||||
/* LED1 toggle thread */
|
||||
xTaskCreate(vLEDTask1, (signed char *) "vTaskLed1",
|
||||
configMINIMAL_STACK_SIZE, NULL, (tskIDLE_PRIORITY + 1UL),
|
||||
(xTaskHandle *) NULL);
|
||||
|
||||
/* LED2 toggle thread */
|
||||
xTaskCreate(vLEDTask2, (signed char *) "vTaskLed2",
|
||||
configMINIMAL_STACK_SIZE, NULL, (tskIDLE_PRIORITY + 1UL),
|
||||
(xTaskHandle *) NULL);
|
||||
|
||||
/* LED0 toggle thread */
|
||||
xTaskCreate(vLEDTask0, (signed char *) "vTaskLed0",
|
||||
configMINIMAL_STACK_SIZE, NULL, (tskIDLE_PRIORITY + 1UL),
|
||||
(xTaskHandle *) NULL);
|
||||
|
||||
/* Start the scheduler */
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* Should never arrive here */
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user