Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SAM3X8E(Arduino到期)xTaskCreate未运行的FreeRTOS 10_Arduino_Freertos_Arduino Due - Fatal编程技术网

SAM3X8E(Arduino到期)xTaskCreate未运行的FreeRTOS 10

SAM3X8E(Arduino到期)xTaskCreate未运行的FreeRTOS 10,arduino,freertos,arduino-due,Arduino,Freertos,Arduino Due,我正在通过SAM端口使用Microchip Studio 7.0.2542和Atmel ICE JTAG调试器,所有调试器都已连接,可以单步执行程序 尽管xTaskCreate返回1,但通过xTimerCreate创建的计时器无法启动,我也无法进入FreeRTOS任务,而且vTaskStartScheduler仍停留在它自己的循环中(我的程序永远不会结束,正如预期的那样) #include <asf.h> // Prototypes for the standard FreeRTO

我正在通过SAM端口使用Microchip Studio 7.0.2542和Atmel ICE JTAG调试器,所有调试器都已连接,可以单步执行程序

尽管
xTaskCreate
返回
1
,但通过
xTimerCreate
创建的计时器无法启动,我也无法进入FreeRTOS任务,而且
vTaskStartScheduler
仍停留在它自己的循环中(我的程序永远不会结束,正如预期的那样)

#include <asf.h>

// Prototypes for the standard FreeRTOS callback/hook functions implemented within this file.
void vApplicationMallocFailedHook( void );
void vApplicationIdleHook( void );
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );
void vApplicationTickHook( void );

static void prvLEDTimerCallback(void *pvParameters);

volatile int ran = 0;

// Task Handles.
// xTaskHandle worker1_id;

static void worker1_task(void *pvParameters)
{
    ran = 1;
    static uint32_t idelay;
    static uint32_t Delay;
    Delay = 100000;

    for(;;)
    {
        // Simulate work
        for (idelay = 0; idelay < Delay; ++idelay);     
    }
    // Should never reach here.
}

int main (void)
{
    volatile int taskCreateResult = -1;
    sysclk_init();  
    NVIC_SetPriorityGrouping(0); // Ensure all priority bits are assigned as preemption priority bits.
    board_init();

    xLEDTimer = xTimerCreate((const signed char * const) "LED timer",/* A text name, purely to help debugging. */
    (200 / portTICK_RATE_MS),   /* The timer period. */
    pdTRUE,                     /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
    NULL,                       /* The timer does not use its ID, so the ID is just set to NULL. */
    prvLEDTimerCallback         /* The function that is called each time the timer expires. */
    );

    xTimerStart(xLEDTimer, 0);


    
    taskCreateResult = xTaskCreate(worker1_task, (const signed char * const) "worker1", configMINIMAL_STACK_SIZE*2, NULL, 1, NULL);
    vTaskStartScheduler();
    
    // The scheduler will now be running, and the following line should never be reached.
    while(1);
}

static void prvLEDTimerCallback(void *pvParameters)
{
    int i = 0;
}

void vApplicationMallocFailedHook( void )
{
    taskDISABLE_INTERRUPTS();
    for( ;; );
}

void vApplicationIdleHook( void )
{
}

void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
{
    ( void ) pcTaskName;
    ( void ) pxTask;

    taskDISABLE_INTERRUPTS();
    for( ;; );
}

void vApplicationTickHook( void )
{
}
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H

/* For definition of BOARD_MCK. */
#ifndef __IAR_SYSTEMS_ASM__
    /* Prevent chip.h being included when this file is included from the IAR
    port layer assembly file. */
    #include "board.h"
#endif

#define configUSE_PREEMPTION                    1

#define configUSE_QUEUE_SETS                    1
#define configUSE_IDLE_HOOK                     0
#define configUSE_TICK_HOOK                     1
#define configCPU_CLOCK_HZ                      ( 8000000)
#define configTICK_RATE_HZ                      ( 1000 )
#define configMAX_PRIORITIES                    ( 5 )
#define configMINIMAL_STACK_SIZE                ( ( unsigned short ) 130 )
#define configTOTAL_HEAP_SIZE                   ( ( size_t ) ( 46 * 1024 ) )
#define configMAX_TASK_NAME_LEN                 ( 10 )
#define configUSE_TRACE_FACILITY                1
#define configUSE_16_BIT_TICKS                  0
#define configIDLE_SHOULD_YIELD                 1
#define configUSE_MUTEXES                       1
#define configQUEUE_REGISTRY_SIZE               8
#define configCHECK_FOR_STACK_OVERFLOW          2
#define configUSE_RECURSIVE_MUTEXES             1
#define configUSE_MALLOC_FAILED_HOOK            1
#define configUSE_APPLICATION_TASK_TAG          0
#define configUSE_COUNTING_SEMAPHORES           1

/* The full demo always has tasks to run so the tick will never be turned off.
The blinky demo will use the default tickless idle implementation to turn the
tick off. */
#define configUSE_TICKLESS_IDLE                 0

/* Run time stats gathering definitions. */
#define configGENERATE_RUN_TIME_STATS   0

/* This demo makes use of one or more example stats formatting functions.  These
format the raw data provided by the uxTaskGetSystemState() function in to human
readable ASCII form.  See the notes in the implementation of vTaskList() within
FreeRTOS/Source/tasks.c for limitations. */
#define configUSE_STATS_FORMATTING_FUNCTIONS    1

/* Co-routine definitions. */
#define configUSE_CO_ROUTINES           0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )

/* Software timer definitions. */
#define configUSE_TIMERS                1
#define configTIMER_TASK_PRIORITY       ( configMAX_PRIORITIES - 1 )
#define configTIMER_QUEUE_LENGTH        5
#define configTIMER_TASK_STACK_DEPTH    ( configMINIMAL_STACK_SIZE * 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             1
#define INCLUDE_vTaskCleanUpResources   1
#define INCLUDE_vTaskSuspend            1
#define INCLUDE_vTaskDelayUntil         1
#define INCLUDE_vTaskDelay              1
#define INCLUDE_eTaskGetState           1
#define INCLUDE_xTimerPendFunctionCall  1

/* Cortex-M specific definitions. */
#ifdef __NVIC_PRIO_BITS
    /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
    #define configPRIO_BITS             __NVIC_PRIO_BITS
#else
    #define configPRIO_BITS             3        /* 7 priority levels */
#endif

/* The lowest interrupt priority that can be used in a call to a "set priority"
function. */
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY         0x07

/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions.  DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY    4

/* Interrupt priorities used by the kernel port layer itself.  These are generic
to all Cortex-M ports, and do not rely on any particular library functions. */
#define configKERNEL_INTERRUPT_PRIORITY         ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY    ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )

/* Normal assert() semantics without relying on the provision of an assert.h
header file. */
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }

/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
standard names.Based on the architecture  choosen, the below definitons may be needed*/

/*#define xPortPendSVHandler PendSV_Handler
#define vPortSVCHandler SVC_Handler
#define xPortSysTickHandler SysTick_Handler */

#endif /* FREERTOS_CONFIG_H */