FREERTOS拆卸

时间:2020-09-21 12:00:35

标签: freertos atmel

我刚开始在atmel Studio学习FREERTOS。 首先,我尝试编写最简单的代码“切换LED”。 我可以构建代码的解决方案,但是当我尝试调试代码时,每次都会在反汇编文件处停止。 我的代码有什么问题?我认为这段代码也无法进入主要功能。 我在“ MKR1300”中使用了“ ATSAMD21G18A”

我在汇编代码中停止了此部分。 00001B68推{r0,r1,r2,r4,r5,r6,r7,lr}

#include <asf.h>
#include <FreeRTOSConfig.h>
#include <FreeRTOS.h>
#include <task.h>
#include <io.h>


#define LED0 IOPORT_CREATE_PIN(IOPORT_PORTA, 20)
#define LED0_ACTIVE 1
#define LED0_INACTIVE 0


void vLED_ON(void *pvParameters)
{
    const TickType_t xDelay = pdMS_TO_TICKS(500);
    ioport_set_pin_dir(LED0,IOPORT_DIR_OUTPUT);
    
while(1)
    {
        ioport_set_pin_level(LED0,LED0_ACTIVE);
        vTaskDelay(xDelay);
        
    }
}

void vLED_OFF(void *pvParameters)
{
    const TickType_t xDelay = pdMS_TO_TICKS(500);

    while(1)
    {
        ioport_set_pin_level(LED0,!LED0_ACTIVE);
        vTaskDelay(xDelay);
        
    }
}

int main(void)
{    
    system_init();
    system_clock_init();
    ioport_init();
    
    // RTOS start 
    xTaskCreate(vLED_ON, "LED_ON",128,NULL,1,NULL);
    xTaskCreate(vLED_OFF, "LED_OFF",128,NULL,2,NULL);
    vTaskStartScheduler();
    while(1);
}

void vApplicationMallocFailedHook()
{
    while(1);
}

void vApplicationStackOverflowHook()
{
    while(1);
}

0 个答案:

没有答案
相关问题