使用GD32330C-START运行一个最简单的FreeRTOS程序,两个任务,分别闪烁LED灯。程序如下,编译无错误,但是写入板子后无反应。Debug时报错:Cannot access target. 以及: Error: Could not load file: '...Project.axf.' Debugger aborted. 请诸位大神帮忙看看:#include "gd32f3x0.h"#include "gd32f330c_start.h"
#include "freeRTOS.h"
#include "freeRTOSConfig.h"
#include "task.h"
#include "queue.h"
/* Define Task Priority */
#define task1LED1_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define task2LED2_PRIORITY ( tskIDLE_PRIORITY + 1 )
static void task1LED1(void *pvParameters);
static void task2LED2(void *pvParameters);
/*!
\brief main function
\param[in] none
\param[out] none
\retval none
*/
int main(void)
{
nvic_priority_group_set(NVIC_PRIGROUP_PRE4_SUB0);
// enable the LED GPIO clock /
rcu_periph_clock_enable(RCU_GPIOF);
// configure led GPIO port /
gpio_mode_set(GPIOF, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_6|GPIO_PIN_7);
gpio_output_options_set(GPIOF, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_6|GPIO_PIN_7);
gpio_bit_reset(GPIOF, GPIO_PIN_6|GPIO_PIN_7);
xTaskCreate( task1LED1, (const portCHAR*)"Task1 LED1", 1024, NULL, task1LED1_PRIORITY, NULL);
xTaskCreate( task2LED2, (const portCHAR*)"Task2 LED2", 1024, NULL, task2LED2_PRIORITY, NULL);
vTaskStartScheduler();
}
void task1LED1(void *pvParameters)
{
while(1)
{
gpio_bit_write(GPIOF, GPIO_PIN_6, SET);
vTaskDelay(pdMS_TO_TICKS(1000));
gpio_bit_write(GPIOF, GPIO_PIN_6, RESET);
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
void task2LED2(void *pvParameters)
{
while(1)
{
gpio_bit_write(GPIOF, GPIO_PIN_7, SET);
vTaskDelay(pdMS_TO_TICKS(1000));
gpio_bit_write(GPIOF, GPIO_PIN_7, RESET);
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
|