From 4755bd8fe252ffdc07de99e11ef049402f875108 Mon Sep 17 00:00:00 2001 From: Nis Sarup Date: Tue, 21 Jun 2011 17:02:06 +0200 Subject: FreeRTOS: Added FreeRTOS 7.0.1, including hook in libmaple/systick.c and example blinky. --- libraries/FreeRTOS/MapleFreeRTOS.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 libraries/FreeRTOS/MapleFreeRTOS.h (limited to 'libraries/FreeRTOS/MapleFreeRTOS.h') diff --git a/libraries/FreeRTOS/MapleFreeRTOS.h b/libraries/FreeRTOS/MapleFreeRTOS.h new file mode 100644 index 0000000..3398930 --- /dev/null +++ b/libraries/FreeRTOS/MapleFreeRTOS.h @@ -0,0 +1,14 @@ +#ifndef __FREERTOS__ +#define __FREERTOS__ + +#include "wirish.h" + +extern "C" { + #define GCC_ARMCM3 + #include "utility/FreeRTOS.h" + #include "utility/task.h" + #include "utility/queue.h" + #include "utility/semphr.h" +} + +#endif -- cgit v1.2.3 From e4a791ad5673b86ab30f79d2347fe4ae3b8ef072 Mon Sep 17 00:00:00 2001 From: Nis Sarup Date: Fri, 24 Jun 2011 20:13:19 +0200 Subject: Added MIT license headers. --- libraries/FreeRTOS/MapleFreeRTOS.cpp | 26 ++++++++++++++++++++++++++ libraries/FreeRTOS/MapleFreeRTOS.h | 26 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) (limited to 'libraries/FreeRTOS/MapleFreeRTOS.h') diff --git a/libraries/FreeRTOS/MapleFreeRTOS.cpp b/libraries/FreeRTOS/MapleFreeRTOS.cpp index da06b3d..2d63e0d 100644 --- a/libraries/FreeRTOS/MapleFreeRTOS.cpp +++ b/libraries/FreeRTOS/MapleFreeRTOS.cpp @@ -1,3 +1,29 @@ +/****************************************************************************** + * The MIT License + * + * Copyright (c) 2011 LeafLabs, LLC. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + *****************************************************************************/ + #include "MapleFreeRTOS.h" extern "C" { diff --git a/libraries/FreeRTOS/MapleFreeRTOS.h b/libraries/FreeRTOS/MapleFreeRTOS.h index 3398930..0fcc2ae 100644 --- a/libraries/FreeRTOS/MapleFreeRTOS.h +++ b/libraries/FreeRTOS/MapleFreeRTOS.h @@ -1,3 +1,29 @@ +/****************************************************************************** + * The MIT License + * + * Copyright (c) 2011 LeafLabs, LLC. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + *****************************************************************************/ + #ifndef __FREERTOS__ #define __FREERTOS__ -- cgit v1.2.3 From 1a825f8a475f0b10c5c528cedd6c930a2f248255 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Fri, 24 Jun 2011 14:37:54 -0400 Subject: Make FreeRTOS changes comply with the coding standard. Don't modify the core FreeRTOS code; only change source that's specific to libmaple. --- examples/freertos-blinky.cpp | 11 ++++++++--- libmaple/systick.c | 6 ++++-- libraries/FreeRTOS/MapleFreeRTOS.cpp | 17 +++++++++-------- libraries/FreeRTOS/MapleFreeRTOS.h | 14 +++++++------- 4 files changed, 28 insertions(+), 20 deletions(-) (limited to 'libraries/FreeRTOS/MapleFreeRTOS.h') diff --git a/examples/freertos-blinky.cpp b/examples/freertos-blinky.cpp index acdfc0f..6f82d71 100755 --- a/examples/freertos-blinky.cpp +++ b/examples/freertos-blinky.cpp @@ -1,8 +1,8 @@ #include "wirish.h" #include "libraries/FreeRTOS/MapleFreeRTOS.h" -static void vLEDFlashTask( void *pvParameters ) { - for(;;) { +static void vLEDFlashTask(void *pvParameters) { + for (;;) { vTaskDelay(1000); digitalWrite(BOARD_LED_PIN, HIGH); vTaskDelay(50); @@ -14,7 +14,12 @@ void setup() { // initialize the digital pin as an output: pinMode(BOARD_LED_PIN, OUTPUT); - xTaskCreate( vLEDFlashTask, ( signed portCHAR * ) "Task1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 2, NULL ); + xTaskCreate(vLEDFlashTask, + (signed portCHAR *)"Task1", + configMINIMAL_STACK_SIZE, + NULL, + tskIDLE_PRIORITY + 2, + NULL); vTaskStartScheduler(); } diff --git a/libmaple/systick.c b/libmaple/systick.c index 388f7aa..5025328 100644 --- a/libmaple/systick.c +++ b/libmaple/systick.c @@ -66,7 +66,9 @@ void systick_enable() { } /** - * Attach a callback called each ms. + * @brief Attach a callback to be called from the SysTick exception handler. + * + * To detach a callback, call this function again with a null argument. */ void systick_attach_callback(void (*callback)(void)) { systick_user_callback = callback; @@ -77,7 +79,7 @@ void systick_attach_callback(void (*callback)(void)) { */ void __exc_systick(void) { - if (systick_user_callback) { + if (systick_user_callback) { systick_user_callback(); } systick_uptime_millis++; diff --git a/libraries/FreeRTOS/MapleFreeRTOS.cpp b/libraries/FreeRTOS/MapleFreeRTOS.cpp index 2d63e0d..d235ceb 100644 --- a/libraries/FreeRTOS/MapleFreeRTOS.cpp +++ b/libraries/FreeRTOS/MapleFreeRTOS.cpp @@ -28,16 +28,17 @@ extern "C" { -void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ) -{ - /* This function will get called if a task overflows its stack. If the - parameters are corrupt then inspect pxCurrentTCB to find which was the - offending task. */ +void vApplicationStackOverflowHook(xTaskHandle *pxTask, + signed char *pcTaskName) { + /* This function will get called if a task overflows its stack. + * If the parameters are corrupt then inspect pxCurrentTCB to find + * which was the offending task. */ - ( void ) pxTask; - ( void ) pcTaskName; + (void) pxTask; + (void) pcTaskName; - for( ;; ); + while (1) + ; } } diff --git a/libraries/FreeRTOS/MapleFreeRTOS.h b/libraries/FreeRTOS/MapleFreeRTOS.h index 0fcc2ae..839e3e2 100644 --- a/libraries/FreeRTOS/MapleFreeRTOS.h +++ b/libraries/FreeRTOS/MapleFreeRTOS.h @@ -24,17 +24,17 @@ * SOFTWARE. *****************************************************************************/ -#ifndef __FREERTOS__ -#define __FREERTOS__ +#ifndef __MAPLE_FREERTOS_H__ +#define __MAPLE_FREERTOS_H__ #include "wirish.h" extern "C" { - #define GCC_ARMCM3 - #include "utility/FreeRTOS.h" - #include "utility/task.h" - #include "utility/queue.h" - #include "utility/semphr.h" +#define GCC_ARMCM3 +#include "utility/FreeRTOS.h" +#include "utility/task.h" +#include "utility/queue.h" +#include "utility/semphr.h" } #endif -- cgit v1.2.3