From 0bca29fc053cfa78bdd908b6c6d5d26c1ac18bff Mon Sep 17 00:00:00 2001 From: richardbarry Date: Fri, 31 Dec 2010 14:51:15 +0000 Subject: [PATCH] Continue to develop the MSP430X IAR demo project - still a work in progress. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1196 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Demo/MSP430X_MSP430F5438_IAR/FreeRTOSConfig.h | 16 +- Demo/MSP430X_MSP430F5438_IAR/ParTest.c | 136 ++++++++++ Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewd | 4 +- Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewp | 12 + .../lnk430F5438A_mod.xcl | 4 +- Demo/MSP430X_MSP430F5438_IAR/low_level_init.c | 5 +- Demo/MSP430X_MSP430F5438_IAR/main.c | 137 ++++++++-- Demo/MSP430X_MSP430F5438_IAR/serial.c | 240 ++++++++++++++++++ 8 files changed, 522 insertions(+), 32 deletions(-) create mode 100644 Demo/MSP430X_MSP430F5438_IAR/ParTest.c create mode 100644 Demo/MSP430X_MSP430F5438_IAR/serial.c diff --git a/Demo/MSP430X_MSP430F5438_IAR/FreeRTOSConfig.h b/Demo/MSP430X_MSP430F5438_IAR/FreeRTOSConfig.h index ebafb803f..5024dbfe5 100644 --- a/Demo/MSP430X_MSP430F5438_IAR/FreeRTOSConfig.h +++ b/Demo/MSP430X_MSP430F5438_IAR/FreeRTOSConfig.h @@ -69,18 +69,18 @@ #define configUSE_PREEMPTION 1 #define configUSE_IDLE_HOOK 1 #define configUSE_TICK_HOOK 1 -#define configCPU_CLOCK_HZ ( 16000000UL ) +#define configCPU_CLOCK_HZ ( 8000000UL ) #define configTICK_RATE_HZ ( ( portTickType ) 1000 ) #define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 60 ) -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 5 * 1024 ) ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10 * 1024 ) ) #define configMAX_TASK_NAME_LEN ( 16 ) #define configUSE_TRACE_FACILITY 0 #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 1 #define configUSE_MUTEXES 1 #define configQUEUE_REGISTRY_SIZE 5 -#define configGENERATE_RUN_TIME_STATS 0 +#define configGENERATE_RUN_TIME_STATS 1 #define configCHECK_FOR_STACK_OVERFLOW 2 #define configUSE_RECURSIVE_MUTEXES 0 #define configUSE_MALLOC_FAILED_HOOK 1 @@ -103,6 +103,16 @@ to exclude the API function. */ #define configTICK_INTERRUPT_VECTOR TIMER0_A0_VECTOR +/* Prevent the following definitions being included when FreeRTOSConfig.h +is included from an asm file. */ +#ifdef __ICC430__ + extern void vConfigureTimerForRunTimeStats( void ); + extern inline unsigned long ulGetRunTimeStatsTime( void ); + extern volatile unsigned long ulStatsOverflowCount; +#endif /* __ICCARM__ */ + +#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats() +#define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeStatsTime() #endif /* FREERTOS_CONFIG_H */ diff --git a/Demo/MSP430X_MSP430F5438_IAR/ParTest.c b/Demo/MSP430X_MSP430F5438_IAR/ParTest.c new file mode 100644 index 000000000..477ff9836 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_IAR/ParTest.c @@ -0,0 +1,136 @@ +/* + FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd. + + *************************************************************************** + * * + * If you are: * + * * + * + New to FreeRTOS, * + * + Wanting to learn FreeRTOS or multitasking in general quickly * + * + Looking for basic training, * + * + Wanting to improve your FreeRTOS skills and productivity * + * * + * then take a look at the FreeRTOS books - available as PDF or paperback * + * * + * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * + * http://www.FreeRTOS.org/Documentation * + * * + * A pdf reference manual is also available. Both are usually delivered * + * to your inbox within 20 minutes to two hours when purchased between 8am * + * and 8pm GMT (although please allow up to 24 hours in case of * + * exceptional circumstances). 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 exception 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. +*/ + +/*----------------------------------------------------------- + * Simple parallel port IO routines to flash LEDs. + *-----------------------------------------------------------*/ + +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Hardware includes. */ +#include "msp430.h" +#include "hal_MSP-EXP430F5438.h" + +/*-----------------------------------------------------------*/ + +void vParTestInitialise( void ) +{ + /* The port used by the two LEDs is configured from halBoardInit() so + nothing needs to be done here. */ +} +/*-----------------------------------------------------------*/ + +void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ) +{ + taskENTER_CRITICAL(); + { + if( xValue != pdFALSE ) + { + switch( uxLED ) + { + case 0: LED_PORT_OUT |= LED_1; + break; + + case 1: LED_PORT_OUT |= LED_2; + break; + } + } + else + { + switch( uxLED ) + { + case 0: LED_PORT_OUT &= ~LED_1; + break; + + case 1: LED_PORT_OUT &= ~LED_2; + break; + } + } + } + taskEXIT_CRITICAL(); +} +/*-----------------------------------------------------------*/ + +void vParTestToggleLED( unsigned portBASE_TYPE uxLED ) +{ + taskENTER_CRITICAL(); + { + switch( uxLED ) + { + case 0: if( ( LED_PORT_OUT & LED_1 ) == 0 ) + { + LED_PORT_OUT |= LED_1; + } + else + { + LED_PORT_OUT &= ~LED_1; + } + break; + + case 1: if( ( LED_PORT_OUT & LED_2 ) == 0 ) + { + LED_PORT_OUT |= LED_2; + } + else + { + LED_PORT_OUT &= ~LED_2; + } + break; + } + } + taskEXIT_CRITICAL(); +} +/*-----------------------------------------------------------*/ + diff --git a/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewd b/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewd index 64ed02cb4..aba9d35fc 100644 --- a/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewd +++ b/Demo/MSP430X_MSP430F5438_IAR/RTOSDemo.ewd @@ -158,7 +158,7 @@