Hi fiends. I am using FreeRTOS that I downloaded from LearnEmbeddedSystems/rp2040-freertos-template github, and I am compiling wirh VSCode.
When trying to compile the first example (Example001), I get the following error:
cannot open source file “supporting_functions.h”
supporting_functions.h: No such file or directory
What I did in cmakelist.txt in the Example001 folder was add the address of the location of the “Support_Functions” folder:
target_include_directories(Example001 PRIVATE
${CMAKE_CURRENT_LIST_DIR}
D:/RP2040/rp2040-freertos-template/Supporting_Functions
)
Now I have the following error: #error configUSE_TIMERS must be set to 1 to make the xTimerPendFunctionCall() function available.
Why is this, since the main code does not use timers?
Hi @utper
Welcome to the FreeRTOS Community Forums.
According to this code block in timers.c
#if ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 0 )
#error configUSE_TIMERS must be set to 1 to make the xTimerPendFunctionCall() function available.
#endif
both INCLUDE_xTimerPendFunctionCall and configUSE_TIMERS should be set to 1 in FreeRTOSConfig.h
Since your code does not use timers, you can set INCLUDE_xTimerPendFunctionCall to 0 in FreeRTOSConfig.h , which I see is set to 1 here.
Hello karahulx.
Remember that I am trying to compile the first of the examples in the book through the freertos template that I downloaded from github. You tell me to look at the file LearnEmbeddedSystems/rp2040-freertos-template/blob/main/src/FreeRTOSConfig.h, but this has nothing to do with the examples in the book, since they have their own FreeRTOSConfig.h file.
I assume the examples in the book are well implemented, but I notice I’m having trouble compiling them. I did what you suggested(), but now I see several errors (INCLUDE_xTimerPendFunctionCall = 0), like:
/* Define to trap errors during development. */
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
the vAssertCalled callback as well.
Or adjust the definition e.g. to this simplified version #define configASSERT( x ) if( ( x ) == pdFALSE ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
The vAssertCalled is defined in the FReeRTOSConfig.h file in the example-001 .
The one thing you can verify, since the src folder of your template, also has a FreeRTOSConfig.h file, if the project uses this file to build, instead of the example001 FreeRTOSConfig.h file.
Hello hs2.
I did what you suggested, but new errors arose, which is why I have not modified that part. What I did was declare in supporting_functions.h: void vAssertCalled( uint32_t ulLine, const char * const pcFile );, since it didn’t appear anywhere.
I get the following:
Sorry - I can’t say anything about the examples you’re using. The problems seem related to the example project setup/configuration.
Perhaps you ask the authors or try another demo/example. I’m sure there are a number of them available for your hardware / board and hopefully working out of the box.
However, those embedded systems are a bit more demanding than an example application for Linux or something because usually you have to deal with your specific hardware and the software adoption to this actual platform resp. your desired application with some constraints like small RAM, low CPU clock etc. There is no comfortable big OS on a big PC abstracting away all those gory details
Good luck !
/*
* Copyright Amazon. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: MIT-0
*
* VISIT FreeRTOS TO ENSURE YOU ARE USING THE LATEST *VERSION.
*
* This file is part of the FreeRTOS distribution.
*
* This contains the Windows port implementation of the examples listed in the
* FreeRTOS book Mastering_the_FreeRTOS_Real_Time_Kernel.
*
*/
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
/* Demo includes. */
#include "supporting_functions.h"
/* Used as a loop counter to create a very crude delay. */
#define mainDELAY_LOOP_COUNT ( 0xffffff )
/* The task functions. */
void vTask1( void * pvParameters );
void vTask2( void * pvParameters );
/*-----------------------------------------------------------*/
int main( void )
{
/* Create one of the two tasks. */
xTaskCreate( vTask1, /* Pointer to the function that implements the task. */
"Task 1", /* Text name for the task. This is to facilitate debugging only. */
1000, /* Stack depth - most small microcontrollers will use much less stack than this. */
NULL, /* We are not using the task parameter. */
1, /* This task will run at priority 1. */
NULL ); /* We are not using the task handle. */
/* Create the other task in exactly the same way. */
xTaskCreate( vTask2, "Task 2", 1000, NULL, 1, NULL );
/* Start the scheduler to start the tasks executing. */
vTaskStartScheduler();
/* The following line should never be reached because vTaskStartScheduler()
* will only return if there was not enough FreeRTOS heap memory available to
* create the Idle and (if configured) Timer tasks. Heap management, and
* techniques for trapping heap exhaustion, are described in the book text. */
for( ; ; )
{
}
return 0;
}
/*-----------------------------------------------------------*/
void vTask1( void * pvParameters )
{
const char * pcTaskName = "Task 1 is running\r\n";
volatile uint32_t ul;
/* As per most tasks, this task is implemented in an infinite loop. */
for( ; ; )
{
/* Print out the name of this task. */
vPrintString( pcTaskName );
/* Delay for a period. */
for( ul = 0; ul < mainDELAY_LOOP_COUNT; ul++ )
{
/* This loop is just a very crude delay implementation. There is
* nothing to do in here. Later exercises will replace this crude
* loop with a proper delay/sleep function. */
}
}
}
/*-----------------------------------------------------------*/
void vTask2( void * pvParameters )
{
const char * pcTaskName = "Task 2 is running\r\n";
volatile uint32_t ul;
/* As per most tasks, this task is implemented in an infinite loop. */
for( ; ; )
{
/* Print out the name of this task. */
vPrintString( pcTaskName );
/* Delay for a period. */
for( ul = 0; ul < mainDELAY_LOOP_COUNT; ul++ )
{
/* This loop is just a very crude delay implementation. There is
* nothing to do in here. Later exercises will replace this crude
* loop with a proper delay/sleep function. */
}
}
}
//*****************************************************************
The template and the examples downloaded from the internet are indicated in a previous comment, as well as the first of the examples I have placed in the template to compile it.
Sorry for my english very poor.
Thanks.