Перейти к содержанию
    

FreeRTOS 7.0.1 + MSP430F5438

Добрый день. Помогите побороть FreeRTOS, на данный момент все собирается, запускаю в Debug и в Debug Log вижу:

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 Projects\FreeRTOS_7.0.1\Debug\Exe\freertos7.d43

Mon Jun 20 12:45:21 2011: Target reset

 

Порядок действий такой:

1. Скачал FreeRTOS 7.0.1 c www.freertos.org.

2. Создал в IAR Embedded Workbench for MSP430 4.20 пустой проект.

3. Добавил к проекту файлы из папки Source(tasks.c, list.c, queu.c), папку Include, все содержимое папки FreeRTOS\Source\portable\IAR\MSP430X.

4. Из папки FreeRTOS\Demo\MSP430X_MSP430F5438_IAR добавляю FreeRTOSConfig.h его немного правлю и в результате получаю:

/*
    FreeRTOS V7.0.1 - 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

/*-----------------------------------------------------------
* 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. Пробую собрать, получаю следующие ошибки:

Error[e46]: Undefined external "vApplicationSetupTimerInterrupt" referred in port ( U:\IAR Projects\FreeRTOS_7.0.1\Debug\Obj\port.r43 )

Error[e46]: Undefined external "vConfigureTimerForRunTimeStats" referred in tasks ( U:\IAR Projects\FreeRTOS_7.0.1\Debug\Obj\tasks.r43 )

6. Добавляю в port.c реализацию данных функций:

/* 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. Все собирается, делаю демо проект, следующего содержания:

#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, world\n" );          
        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. Получаю Target Reset и все.

8*. Полученная структура проекта:

U:\IAR Projects\FreeRTOS_7.0.1\include

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

 

 

U:\IAR Projects\FreeRTOS_7.0.1\source

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

 

Что не так, или может я изначально не правильно подошел к процессу запуска системы?

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Присоединяйтесь к обсуждению

Вы можете написать сейчас и зарегистрироваться позже. Если у вас есть аккаунт, авторизуйтесь, чтобы опубликовать от имени своего аккаунта.

Гость
Ответить в этой теме...

×   Вставлено с форматированием.   Вставить как обычный текст

  Разрешено использовать не более 75 эмодзи.

×   Ваша ссылка была автоматически встроена.   Отображать как обычную ссылку

×   Ваш предыдущий контент был восстановлен.   Очистить редактор

×   Вы не можете вставлять изображения напрямую. Загружайте или вставляйте изображения по ссылке.

×
×
  • Создать...