Arduino web page to use FreeRTOS is listed a compatible boards.
I have tried with Arduino UNO board, by using any of the example codes and when it compiling indicates the message of "skecth too big".
If select another type of board (arduino Mega) it seems it compile.
It seems limitation of IDE, any tips recommended on " http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it" it does not work.
Hi @mcgrathr. Please post a link to that page.
The IDE doesn't have any relevance to the compiled program size. You would get the same result even if you compiled the code directly using the avr-gcc compiler. The IDE just runs the complex compilation commands for you.
So if IDE not having any relevance where it come form problem??
Any writing project with Arduino IDE and compiling still on IDE environment, based on a template defined on Tools option item where it refer to board type script code.
What ever search regardless this issues, common reply it link same error message.
An Uno just does not have the ram to run freeRTOS.
The DUE has enough ram to run uMT, a RTOS.
The ESP32 has freeRTOS built in as its OS.
Thanks.
It seems #include FreeRTOS library environment it required and use too much of RAM resources.
By the way in should review on Arduino "listed a compatible boards" to prevent this kind of issues.
By the way, you still haven't posted a link to that web page.
Hi @mcgrathr
Yes, it's possible to use FreeRTOS on an Arduino Uno for small projects. I used it on a Arduino Pro Mini for a radio controlled tank running 4 tasks, 2 timers and 3 queues. You just have to make sure that the task stack size is small. On mine, the stack size is set to 128 bytes.
For more control over the settings copy the FreeRTOS files: "FreeRTOSConfig.h" and "FreeRTOSVariant.h" over to your project's local directory. If you close and restart the Arduino IDE, they'll automatically appear as new tabs.
It's possible, check out this tutorial.
Doesn't mean it's a good idea as you give up all of your resources for the right to use the remains.
The compatibility lists you see on those library reference pages are automatically generated based on the library metadata. The library author can specify the architectures the library is compatible with (it is specified as avr
by this library). The library reference page generator makes a list of some popular official Arduino boards of that architecture.
Unfortunately, architecture compatibility is not granular enough to generate an accurate list of compatible boards in every case because individual boards within that architecture have different properties, and there is no way for the reference generator program determine which properties are required by the library. As you discovered, one such property is available memory and the AVR boards have a wide range of available flash and SRAM memory. Another notable property is native USB support. For example, the official "MIDIUSB" library specifies avr
compatibility, and so the reference page lists Nano, Uno, and Mega as compatible. But this library can only be used with boards that have native USB capabilities, and so in reality of the listed "compatible" avr architecture boards, only the ATmega32U4-based Leonardo, Micro, and Yun are truly compatible.
So it's best to consider these lists to be a selection boards that might possibly work with the library. The human generated documentation that accompanies will often give more specific and accurate information about supported boards.
Hi MartinL
Many thanks for your reply and information. Well it means a new challenge, having to reviewing synchronization between processes concepts and how to deal if using variables (as an array of data) in the design on a very limited code.
Also can't stop ask me how have you achieve a code for 4-task, timers and queues.
By the way I just try to make a code to handler LED display with pt6964-s.
thanks for the info
Why? There are Arduino friendly LED driver chips that you can use right away. Alternatively it shouldn't be that tough to make your own driver functions for that chip. Here is the datasheet: pt6964-s_datasheet.pdf (688.1 KB)
Start on page 11 to get an idea of how driver functions would work.
RTOS is the absolute worst solution for this as you will get the display working then not have enough resources to do anything with it.
in0
Thanks for the information.
As mentioned to MartinL, I am working on a project which the designed code noted certain behaviors that not respond to the logic of the code, forced me to put in practice concepts studied as the synchronization between processes, where from a problem it becomes another and can't make it work as intended or to be useful to analyzing through synchronizing process.
Thanks again.
That is the documentation I have starter used for design the code and it refers to a basic schema.
By way prototype used is from a satellite receiver and outputs connection to led display array is completely different, even for each segment of display.
To make it I have use two 8-bit data to present each digit and can display each digit on any segments.
But for other purpose it doesn't work as expected.
Hi @mcgrathr
To learn FreeRTOS, I can thoroughly recommend this guide: https://www.freertos.org/Documentation/161204_Mastering_the_FreeRTOS_Real_Time_Kernel-A_Hands-On_Tutorial_Guide.pdf.
Here's a really basic example that I've got running on my Arduino Uno with two tasks of the same priority, outputting alternately to the console:
#include <Arduino_FreeRTOS.h> // Include the FreeRTOS library
#include <task.h> // Include tasks
#include <queue.h> // Include queues
#include <timers.h> // Include timers
void setup()
{
Serial.begin(115200);
xTaskCreate(
Task1, // Task1 function
"Task1", // Task name - Task1
128, // Task stack, allocated from heap
NULL, // No param passed to task function
1, // Priority 1
NULL); // Task handle
xTaskCreate(
Task2, // Task2 function
"Task2", // Task name - Task2
128, // Task stack, allocated from heap
NULL, // No param passed to task function
1, // Priority 1
NULL); // Task handle
}
void Task1(void* pvParameters)
{
for(;;) // Loop forever...
{
Serial.println("Running Task1"); // Display Task1 message
vTaskDelay(pdMS_TO_TICKS(100)); // Block Task1 for 100ms
}
}
void Task2(void* pvParameters)
{
for(;;) // Loop forever...
{
Serial.println("Running Task2"); // Display Task2 message
vTaskDelay(pdMS_TO_TICKS(100)); // Block Task2 for 100ms
}
}
void loop() {} // Idle loop task
From here it's possible to integrate examples from the tutorial. Note that each of the task's stack size is limited due to the Atmega328P's 2KB of RAM.
You'll also find there are some differences between FreeRTOS ports, for example with this particular one, the scheduler is automatically started at the end of setup() and the idle loop task is the loop() function itself.
Hi MartinL
Thanks you so much for the information.
I found strange issue that drive me puzzled.
By test a basic code for command 2 LED with FreeRTOS and when it compiles it throw error exceed available space but if try again and again to compile no error message throw.
#include "FreeRTOSConfig.h"
#include "FreeRTOSVariant.h"
void setup() {
DDRD=B11111100;//pin 2 to pin 7 are set as output mode
xTaskCreate(
Task1, // Task1 function
"Task1", // Task name - Task1
128, // Task stack, allocated from heap
NULL, // No param passed to task function
1, // Priority 1
NULL); // Task handle
xTaskCreate(
Task2, // Task2 function
"Task2", // Task name - Task2
128, // Task stack, allocated from heap
NULL, // No param passed to task function
1, // Priority 1
NULL); // Task handle
}
void loop() {
}
void Task1(void* pvParameters){
while(1){
PORTD=B00010000; //make pin 4 high state power on the led
delay(800);
PORTD=B10000000; //make pin 7 high state power on the led
}
}
void Task2(void* pvParameters){
while(1){
PORTD=B10000000; //make pin 7 high state power on the led
delay(800);
PORTD=B00010000; //make pin 4 high state power on the led
}
}
Compile error message...
Sketch uses 45760 bytes (141%) of program storage space. Maximum is 32256 bytes.text section exceeds available space in board
Global variables use 1391 bytes (67%) of dynamic memory, leaving 657 bytes for local variables. Maximum is 2048 bytes.
Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.
Error compiling for board Arduino Uno.
Compile ok …..
Sketch uses 6874 bytes (21%) of program storage space. Maximum is 32256 bytes.
Global variables use 178 bytes (8%) of dynamic memory, leaving 1870 bytes for local variables. Maximum is 2048 bytes.
@mcgrathr I'm not sure what's causing that, but does it function if you upload the code that successfully compiles?
Yes it function when upload code, only when upload it always compiles before, so it have to try several times.
By the way Arduino IDE version is: 1.8.14 Hourly Build 2021/05/07 04:33