Issue using mutex on Arduino Uno R4 Wifi with Phillip Stevens FreeRTOS libary

When uploading the mutex example provided by Phillip Stevens FreeRTOS Library (Arduino_FreeRTOS_Library/examples/Mutex/Mutex.ino at master · feilipu/Arduino_FreeRTOS_Library · GitHub) to the Arduino UNO R4 Wifi, I get this error message:

In file included from C:\Users\Grimme\Documents\Arduino\libraries\FreeRTOS\src\Arduino_FreeRTOS.h:64:0,
                 from C:\Users\Grimme\Documents\Arduino\libraries\FreeRTOS\src\event_groups.c:38:
C:\Users\Grimme\Documents\Arduino\libraries\FreeRTOS\src\FreeRTOSConfig.h:32:10: fatal error: avr/io.h: No such file or directory
 #include <avr/io.h>
          ^~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

I dont recieve this message when uploading it to the Arduino Uno.

How do I make it work on the Arduino Uno R4 Wifi?

You can't use the Phillip Stevens FreeRTOS Library (which is made for AVR MCU) with Arduino UNO R4 ... the Arduino core for R4 already includes, among its libraries, the FreeRTOS library for the RA4M1 Renesas MCU.

Since it "hides" fewer things than Phillip Stevens library, you may want to take a look at the attached examples to understand how to use it.

More info on THIS Phillip Stevens Github issue.

Guglielmo

Thank you Guglielmo for your great answer! Unfortunately, I can't find any examples of the used of Mutex and I don't have enough knowledge about how the jungle of files fit together in these libraries and how to include them in my own code. A simple #include "semphr.h" will tell me "No such file or directory". This is why I like to find examples.

Hi givddul,
you don't need the #include "semphr.h", the various modules are already automatically included when you do #include <Arduino_FreeRTOS.h>, but ...

... you can't expect to use an operating system, like FreeRTOS are, by doing simple copy/paste without first studying the extensive documentation that FreeRTOS provides you and that you find on THIS page :wink:

Next, for each API you find documentation and examples of use HERE (API reference).

Hope this helps you :slight_smile:

Guglielmo

Hi Guglielmo,

You are right, if done properly, you should study the extensive documentation to understand all the details. I guess time is the issue in my case and I'm used to finding shortcuts (worked fine before in freeRTOS projects on the Pico).

I've managed to create some basic programs now by looking at the examples and not including "semphr.h" so should be good from here.

Thanks again :pray:

1 Like