The final FreeRTOS V8.0.0 has been released last week: time to update the Processor Expert component for it, and this time it is really a major release 🙂 : from V7.5.0 to V8.0.0:
FreeRTOS V8.0.0 comes with many small changes, especially it now includes many of the extra casts I have contributed to avoid compiler warnings. And additionally it has a brand new feature: Event Groups.
Event Groups
The new Event Groups are optional, and allows to set one or more bits and to use them as a group. See http://www.freertos.org/FreeRTOS-Event-Groups.html. Such event bits are sometimes named ‘flags’ too. Unlike normal flags, this implementation with FreeRTOS allows to synchronize the tasks on such events.
Upgrading
Upgrading from the earlier FreeRTOS component and RTOS sources is straight forward: load the new FreeRTOS (and Percepio Trace, if used) components, restart Eclipse and things should be ready to go. http://www.freertos.org/upgrading-to-FreeRTOS-V8.html details any other porting issues. FreeRTOS has a compatibility mode, but I recommend to update the application. Here are a few things I had to change:
FRTOS1_vApplicationStackOverflowHook()
The old declaration of FRTOS1_vApplicationStackOverflowHook() in Events.h generated by Processor Expert is using signed PortCHAR:
void FRTOS1_vApplicationStackOverflowHook(xTaskHandle pxTask, signed portCHAR *pcTaskName);
while the new one is simply using ‘char’:
void FRTOS1_vApplicationStackOverflowHook(xTaskHandle pxTask, char *pcTaskName);
So the version in Events.h needs to changed to ‘char’ too.
xTaskCreate() and Character Pointers
V8.0.0 has fixed and aligned usage of ‘char’ pointers. In may code I have properly casted things like this:
if (FRTOS1_xTaskCreate(DriveTask, (signed portCHAR *)"Drive", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+3, NULL) != pdPASS) { for(;;){} /* error */ }
Now I can remove (signed portCHAR*) cast:
if (FRTOS1_xTaskCreate(DriveTask, "Drive", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+3, NULL) != pdPASS) { for(;;){} /* error */ }
Summary
The new V8.0.0 RTOS adds the ‘long time missed’ event flags and groups. Upgrading was easy for me, so I hope it will be for you too :-). The new sources and port files are available on GitHub, and I’m in the process of uploading the new components and updated demo files.
Happy FreeRTOSing 🙂
you did a great job. but I don’t know what different between ‘QueueSet’ and ‘GroupEvent’
LikeLike
Thanks :-). QueueSet and GroupEvent are somewhat similiar, but different in the implementation. QueueSet have queues behind it, while GroupEvent is really about bits. You could mimic GroupEvent bits with a set of binary QueueSet, but in my view that would be too heavy. In my view QueueSets have been added to the RTOS in the past for problems which are solved with GroupEvent bits more elegantly. So far I have not used QueueSet in my application: I have used my own implementation of event bits (see my SimpleEvent Processor Expert component). But that SimpleEvent component is really just an array of bits with atomic bit operations. Event Bits in FreeRTOS add blocking and RTOS synchronization to it which makes it a really nice way to implement task rendevous and checking bits within the RTOS API.
LikeLike
Hello, I did updated my RTOS version today. That was really easy to update
Thanks, Mauricio
LikeLike
Hi Mauricio,
yes, I had the same experience on my side too 🙂
Erich
LikeLike
Pingback: First Steps with the Freescale TWR-K64F120M | MCU on Eclipse
Hi friends i have a problem with updating my FreeRtos. I’m working with Version 7.2 and i can’t find the *.PEupd
LikeLike
Hi Rida,
have a look here:
LikeLike
I’m making use of the xEventGroupSetBitsFromISR() function in your FreeRTOS 8.0.1 component and came across the following build error:
undefined reference to `xTimerPendFunctionCallFromISR’
The fix (taken from the API documentation) is simply to add the following lines to the FreeRTOSConfig.h file:
#define INCLUDE_xEventGroupSetBitFromISR 1
#define INCLUDE_xTimerPendFunctionCall 1
Perhaps these could be added to the PE Driver with a %if statement?
LikeLike
Hi Eric,
I have committed a fix for this:
https://github.com/ErichStyger/mcuoneclipse/commit/bc2a42aadb9f8f0a2933d302334e414f17365a00
Thanks for reporting!
Erich
LikeLike
Hi Erich
Have the FreeRTOS timers been implemented and tested? I have been using them but I have had intermittent errors and unexpected results. These are probably my fault and not the port, but I would be interested to know if you are sure they are robust.
I have emailed Richard Barry at FreeRTOS with some questions – I could copy you, or post here, though it is quite long…
Regards – Charles
LikeLike
Hi Charles,
I have used FreeRTOS timers in some of my projects, and have not had any issues. But I used it for rather slow timers (like 10 ms or 50 ms).
Maybe you face a stack overflow/space problem?
Posting your observations to the FreeRTOS email list is probably the best way: Richard Barry is very active on that list.
Erich
LikeLike
Hi Erich,
There is one thing, I dont understand: in setting the cpu, build options -> generate linker files. Why heap size is defined with length 0x0000 by default? The heap should not be greater than zero, for many reasons, for example to freertos heap fit in memory?
Thanks,
Matheus
LikeLike
In the CPU build options, that’s not the heap size of the RTOS, but the heap size for the malloc() function of the ANSI library.
If you set that size to zero, you do not want (and cannot) use the normal malloc()/free() functions of the library.
LikeLike
But where in the MCU memory the RTOS heap is stored? data, text, …?
LikeLike
The RTOS heap is stored in data (RAM).
LikeLike
It clarified the things to me! Thank you very much for your time!
LikeLike
You are welcome! I’m learning new things everyday too 🙂
LikeLike
Pingback: Tutorial: Playing MP3 Files with VS1053B and FRDM Board | MCU on Eclipse
Hi Erich,
using freeRTOS I saw that the RTOS heap is initialized like a normal variable with 0xA5 in the data flash segment; in my opinion it is a waste since the heap could be initialized later directly in the _vTaskStartScheduler function freeing the flash for more code. Am I wrong and is this possible to do?
Thanks, Michael
LikeLike
Yes, agreed. I wrote an article on that topic:
So it would require a linker file setting. I hope this helps?
I wish the gcc by ARM would implement the noload attribute.
LikeLike
I think I am missing something here. In my setup, with RTOS v8.0.1 using memory allocation scheme 1, if I change my heap size then the bss size changes, but the data size stays unchanged (and small, << than heap size). I do see that in the FRTOS PE component the User Heap Section is set to Disabled – and there is a PE comment to the effect that if it was Enabled I would get an __attribute__ added. Is that what causes the problem that Erich wrote about? And is that the solution to Michael's problem? Why would I want to set User Heap Section to Enabled, anyway?
LikeLike
Hi Charles,
the user heap selection is for dealing with the segmented memory of Kinetis devices. See https://mcuoneclipse.com/2013/07/10/freertos-heap-with-segmented-kinetis-k-sram/
LikeLike
Hi Erich, you’re amazing!
Thanks a lot for the clear explanations.
LikeLike