Mon Jun 20 12:45:17 2011: Interface dll version 2.3.5.0
Mon Jun 20 12:45:18 2011: Device : MSP430F5438
Mon Jun 20 12:45:18 2011: External voltage : 0.0 V
Mon Jun 20 12:45:18 2011: VCC voltage : 3.0 V
Mon Jun 20 12:45:21 2011: Download complete.
Mon Jun 20 12:45:21 2011: Loaded debugee: U:IAR ProjectsFreeRTOS_7.0.1DebugExefreertos7.d43
Mon Jun 20 12:45:21 2011: Target reset Working order:
1. Download FreeRTOS 7.0.1 c www.freertos.org.
2. Create in IAR Embedded Workbench for MSP430 4.20 empty project.
3. Add to project files from Source(tasks.c, list.c, queu.c) directory, directory Include, and all content of FreeRTOSSourceportableIARMSP430X.
4. Next I add FreeRTOSConfig.h from the folder FreeRTOSDemoMSP430X_MSP430F5438_IAR and create minor changes:
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_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 0
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( 18000000UL )
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 15 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 10 )
#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 configCHECK_FOR_STACK_OVERFLOW 0
#define configUSE_RECURSIVE_MUTEXES 0
#define configUSE_MALLOC_FAILED_HOOK 0
#define configUSE_APPLICATION_TASK_TAG 0
#if __DATA_MODEL__ == __DATA_MODEL_SMALL__
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 110 )
#else
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 80 )
#endif
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 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 0
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
/* The MSP430X port uses a callback function to configure its tick interrupt.
This allows the application to choose the tick interrupt source.
configTICK_VECTOR must also be set in FreeRTOSConfig.h to the correct
interrupt vector for the chosen tick interrupt source. This implementation of
vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this
case configTICK__VECTOR is set to TIMER0_A0_VECTOR. */
#define configTICK_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 volatile unsigned long ulStatsOverflowCount;
#endif /* __ICCARM__ */
/* Configure a 16 bit timer to generate the time base for the run time stats.
The timer is configured to interrupt each time it overflows so a count of
overflows can be kept - that way a 32 bit time value can be constructed from
the timers current count value and the number of overflows. */
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()
/* Construct a 32 bit time value for use as the run time stats time base. This
comes from the current value of a 16 bit timer combined with the number of times
the timer has overflowed. */
#define portALT_GET_RUN_TIME_COUNTER_VALUE( ulCountValue )
{
/* Stop the counter counting temporarily. */
TA1CTL &= ~MC__CONTINOUS;
/* Check to see if any counter overflow interrupts are pending. */
if( ( TA1CTL & TAIFG ) != 0 )
{
/* An overflow has occurred but not yet been processed. */
ulStatsOverflowCount++;
/* Clear the interrupt. */
TA1CTL &= ~TAIFG;
}
/* Generate a 32 bit counter value by combinging the current peripheral
counter value with the number of overflows. */
ulCountValue = ( ulStatsOverflowCount << 16UL );
ulCountValue |= ( unsigned long ) TA1R;
TA1CTL |= MC__CONTINOUS;
}
#endif /* FREERTOS_CONFIG_H */
5. Trying to build and got this errors:
Error: Undefined external “vApplicationSetupTimerInterrupt” referred in port ( U:IAR ProjectsFreeRTOS_7.0.1DebugObjport.r43 )6. Next, I add realisation of this functions in port.c:
Error: Undefined external “vConfigureTimerForRunTimeStats” referred in tasks ( U:IAR ProjectsFreeRTOS_7.0.1DebugObjtasks.r43 )
/* The MSP430X port uses this callback function to configure its tick interrupt.
This allows the application to choose the tick interrupt source.
configTICK_VECTOR must also be set in FreeRTOSConfig.h to the correct
interrupt vector for the chosen tick interrupt source. This implementation of
vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this
case configTICK_VECTOR is set to TIMER0_A0_VECTOR. */
void vApplicationSetupTimerInterrupt( void )
{
const unsigned short usACLK_Frequency_Hz = 32768;
/* Ensure the timer is stopped. */
TA0CTL = 0;
/* Run the timer from the ACLK. */
TA0CTL = TASSEL_1;
/* Clear everything to start with. */
TA0CTL |= TACLR;
/* Set the compare match value according to the tick rate we want. */
TA0CCR0 = usACLK_Frequency_Hz / configTICK_RATE_HZ;
/* Enable the interrupts. */
TA0CCTL0 = CCIE;
/* Start up clean. */
TA0CTL |= TACLR;
/* Up mode. */
TA0CTL |= MC_1;
}
/*-----------------------------------------------------------*/
void vConfigureTimerForRunTimeStats( void )
{
/* Ensure the timer is stopped. */
TA1CTL = 0;
/* Run the timer from the ACLK/2. */
TA1CTL = TASSEL_1 | ID__2;
/* Clear everything to start with. */
TA1CTL |= TACLR;
/* Enable the interrupts. */
TA1CCTL0 = CCIE;
/* Start up clean. */
TA1CTL |= TACLR;
/* Continuous mode. */
TA1CTL |= MC__CONTINOUS;
}
/*-----------------------------------------------------------*/
7. The bulding process has finished successfully, and next I write demo:
#include <stdio.h>
#include <msp430x54x.h>
#include "../include/FreeRTOS.h"
#include "../include/task.h"
#include "../include/queue.h"
void vHelloWorldTask( void *pvParameters ) {
for(;; ) {
printf( "Hello, worldn" );
vTaskDelay( 100 );
}
vTaskDelete( NULL );
}
void main( void )
{
//Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
if( xTaskCreate( vHelloWorldTask, "HelloWorld", 100, NULL, 1, NULL) != pdTRUE ) {
printf( "Can't create task.");
}
vTaskStartScheduler();
for(;; ) {}
}
8. And I get “Target Reset”.
8*. The project structure:
U:IAR ProjectsFreeRTOS_7.0.1includeU:IAR ProjectsFreeRTOS_7.0.1source
13.05.2011 19:41:08 A— 28.675 croutine.h
13.05.2011 19:41:08 A— 3.755 data_model.h
13.05.2011 19:41:08 A— 15.542 FreeRTOS.h
20.06.2011 12:53:07 A— 7.183 FreeRTOSConfig.h
13.05.2011 19:41:08 A— 13.201 list.h
13.05.2011 19:41:08 A— 6.664 mpu_wrappers.h
13.05.2011 19:41:08 A— 12.032 portable.h
13.05.2011 19:41:08 A— 6.688 portmacro.h
13.05.2011 19:41:08 A— 3.778 projdefs.h
13.05.2011 19:41:08 A— 44.443 queue.h
13.05.2011 19:41:08 A— 28.280 semphr.h
13.05.2011 19:41:08 A— 8.832 StackMacros.h
13.05.2011 19:41:08 A— 46.824 task.h
13.05.2011 19:41:08 A— 44.520 timers.h
20.06.2011 12:45:10 A— 15.156 croutine.c
20.06.2011 10:25:32 A— 5.813 heap_1.c
20.06.2011 10:26:17 A— 8.570 list.c
20.06.2011 12:30:44 A— 1.976 main.c
20.06.2011 12:58:13 A— 9.686 port.c
20.06.2011 10:26:19 A— 5.585 portext.s43
20.06.2011 10:26:19 A— 51.605 queue.c
20.06.2011 10:26:20 A— 81.549 tasks.c So, what’s the problem? Regards, Vasiliy.