#include "resets.h" #include "gpio.h" #include "uart.h" #include "stdio.h" #include #include StackType_t stack_task1[configMINIMAL_STACK_SIZE]; StackType_t stack_task2[configMINIMAL_STACK_SIZE]; StaticTask_t tcb_task1, tcb_task2; void task1(void *parameters) { static uint32_t count = 0; vTaskDelay(30); while (1) { printf("task1 is running, count = %lu\r\n", count++); vTaskDelay(1000); } } void task2(void *parameters) { static uint32_t count = 0; while (1) { printf("task2 is running, count = %lu\r\n", count++); vTaskDelay(500); } } int main(void) { reset_unreset_blocks_wait(RESETS_BLOCK_IO_BANK0 | RESETS_BLOCK_UART0 | RESETS_BLOCK_TIMER); gpio_init(0, GPIO_FUNC_UART | GPIO_PULL_UP | GPIO_DRIVE_4MA); /* UART_TX pin */ gpio_init(1, GPIO_FUNC_UART | GPIO_PULL_UP | GPIO_SCHMITT | GPIO_PAD_IE | GPIO_PAD_OD); /* UART_RX pin */ uart_init(uart0_hw, 6 * 1000 * 1000, UART_DATABITS_8 | UART_PARITY_NONE | UART_STOPBITS_1); printf("FreeRTOS example\r\n"); xTaskCreateStatic(task1, "task1", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1U, &stack_task1[0], &tcb_task1); xTaskCreateStatic(task2, "task2", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1U, &stack_task2[0], &tcb_task2); vTaskStartScheduler(); return 0; }