Hello,
I have been having this issue for a little while now, and I am not sure how to fix it. I am using a Teensy 4.1 Board, with an ARM Cortex-M7.
I am also using PlatformIO in VSCode, and I have added all files necessary for building FreeRTOS, including the port specific files, which I used from the GCC/ARM_CM4F port, which I learned that it is also compatible with the Cortex-M7.
Now, everything builds perfectly fine, but I don’t get any output from my created task. I get Serial output throughout the entire setup()
of the program, but once I start the scheduler, I get nothing outputted at all.
Here is the program:
#include <Arduino.h>
extern "C"
{
#include "FreeRTOS.h"
#include "task.h"
}
void vExampleTask(void *pvParameters)
{
for (;;)
{
Serial.println("Hello from FreeRTOS!");
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
void setup()
{
Serial.begin(9600);
Serial.println("Creating tasks.");
BaseType_t result = xTaskCreate(
vExampleTask,
"ExampleTask",
configMINIMAL_STACK_SIZE,
NULL,
1,
NULL);
Serial.println("Ensuring tasks were created successfully.");
configASSERT(result == pdPASS);
Serial.println("Starting scheduler...");
vTaskStartScheduler();
}
void loop()
{
}
And here is the FreeRTOSConfig.h
:
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
#include <stdint.h>
/*-----------------------------------------------------------
* Application specific definitions.
*
* See http://www.freertos.org/a00110.html for configuration details.
*----------------------------------------------------------*/
/*-----------------------------------------------------------
* Hardware specifics.
*----------------------------------------------------------*/
#define configCPU_CLOCK_HZ (600000000UL) /* 600 MHz for Teensy 4.1 */
/*-----------------------------------------------------------
* Tick rate configuration.
*----------------------------------------------------------*/
#define configTICK_RATE_HZ (100) /* 100 ticks per second = 10ms tick period */
/*-----------------------------------------------------------
* Tick type settings.
*----------------------------------------------------------
* Use a 32-bit tick type by setting configUSE_16_BIT_TICKS to 0.
* Do not define configTICK_TYPE_WIDTH_IN_BITS when using configUSE_16_BIT_TICKS.
*----------------------------------------------------------*/
#define configUSE_16_BIT_TICKS 0
/*-----------------------------------------------------------
* Memory allocation related definitions.
*----------------------------------------------------------*/
#define configMINIMAL_STACK_SIZE (128)
#define configTOTAL_HEAP_SIZE ((size_t)(32 * 1024)) /* 32 KB heap */
/*-----------------------------------------------------------
* Scheduler related definitions.
*----------------------------------------------------------*/
#define configMAX_PRIORITIES (5)
#define configIDLE_SHOULD_YIELD 1
#define configUSE_PREEMPTION 1
#define configUSE_TIME_SLICING 1
/*-----------------------------------------------------------
* Hook function related definitions.
*----------------------------------------------------------*/
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
/*-----------------------------------------------------------
* Software timer definitions.
*----------------------------------------------------------*/
#define configUSE_TIMERS 0
/*-----------------------------------------------------------
* Co-routine definitions.
*----------------------------------------------------------*/
#define configUSE_CO_ROUTINES 0
/*-----------------------------------------------------------
* Optional functions.
*----------------------------------------------------------*/
#define INCLUDE_vTaskDelay 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_xTaskGetCurrentTaskHandle 1
/*-----------------------------------------------------------
* Cortex-M specific definitions.
*----------------------------------------------------------*/
#ifdef __NVIC_PRIO_BITS
#define configPRIO_BITS __NVIC_PRIO_BITS
#else
#define configPRIO_BITS 4 /* default value */
#endif
/* The lowest interrupt priority that can be used in a call to a "safe" FreeRTOS API function. */
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
/* The highest interrupt priority from which FreeRTOS API functions can be called (lower numbers = higher priority). */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
/* These definitions are required to set the correct priority for the RTOS kernel and
interrupts. */
#define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
#define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
#endif /* FREERTOS_CONFIG_H */
I also tried removing the Serial print statements from the task, and just blinking the builtin LED, but that didn’t work either, so it isn’t a problem with the Serial command.
Do you have any ideas as to what could have caused this?
Thanks.