Amazon has released in the past week the FreeRTOS version V10.4.0. Time to upgrade, actually the most recent version 10.4.1! The same time the SEGGER SystemView V3.12 was released back in April this year. No surprise: with the FreeRTOS changes they don’t work out of the box: but no worries, I have you covered and applied all the needed patches and changes to have them working again together: the latest FreeRTOS v10.4.x with Segger SystemView v3.12:
FreeRTOS
In case you have not noticed: FreeRTOS is now hosted on GitHub which makes it easy to follow of it. The release V10.4.0 was announced 9-Sept-2020, but with GitHub it was easy to jump on the most recent V10.4.1 version.
The big change with V10.4.x is that the Direct Task Notification has been extended to support an array of notification values. Direct Task Notification has been a great feature to me, as it is efficient, fast and I’m using it in nearly all of my applications. But it has been limited to 32bits (on a 32bit processor like ARM Cortex) and if you hit that limit, other ways of notifications had to be used for the extra needs. Now the number of (32bit) entries can be specified.
I have successfully ported the RTOS and applied all the patches. For example it runs now with the MCUXpresso SDK in the MCUXpresso (Eclipse based) IDE with all the ‘bells & whistles’:
To add some ‘icing on top of the cake’: updated Processor Expert components are included:
SystemView
The Segger SystemView has been upgraded to Version 3.12. SystemView uses SEGGER RTT and is a great tool to get insights into the application RTOS and runtime behavior.
The FreeRTOS Kernel requires several patches and tweaks to work correctly with SystemView. To stream the trace data directly to the host the SEGGER RTT needs to be present and configured. Because of the FreeRTOS API changes the patches from SEGGER had to be extended and have been applied to the Kernel sources. In addition to that, all the latest patches to make the GNU Link Time optimization to work with the Kernel (e.g. to prevent wrong removal of objects by the linker).
Summary
Both the SystemView component and FreeRTOS are available as Processor Expert components which can be used with the MCUXpresso IDE:
All the ported files (FreeRTOS, RTT, SystemView) are available on GitHub (see links at the end of this article) and work nicely with the latest IDE and SDK, gcc (including the most aggressive optimizations, including LTO).
Summary
I have now the latest and greatest FreeRTOS and SystemView working together, with all the patches applied. The extended direct task notification in FreeRTOS is a great extension and I plan to use it in one of my next application. With the MCUXpresso IDE and SDK I have everything integrated and can use the SystemView to inspect the performance of my FreeRTOS applications with the latest version.
You can get the source files from the links below.
Happy FreeRTOSing 🙂
Links
- FreeRTOS and SEGGER Files on GitHub: https://github.com/ErichStyger/McuOnEclipseLibrary
- Processor Expert Port and components: https://github.com/ErichStyger/McuOnEclipse_PEx
- FreeRTOS Kernel on GitHub: https://github.com/FreeRTOS/FreeRTOS-Kernel
- Segger SystemView download page: https://www.segger.com/downloads/systemview/
- Tracing with FreeRTOS: New FreeRTOS V10.0.0: Amazon, Segger SystemView and Percepio Tracealyzer
- FreeRTOS examples and more: https://github.com/ErichStyger/mcuoneclipse
I was just starting a new project with freertos and I saw your post.
You save me a lot of time to patch freertos ! thanks !!
LikeLike
Now I know that my efforts are paying off 🙂
LikeLike
I just open and compare with the”official” version and port.c for M4 is very very different !
I will try to adapt it to my needs as I don’t use MCUXpresso
LikeLike
It is different because
a) it contains all the extra support for tracing (Percepio/Segger)
b) not only supports Cortex-M4, but M0, M0+, M4 and M4
c) it support gcc, IAR and Keil
I do support as well HCS12, HCS08, DSC, …: the original FreeRTOS way to support each port in single files is one way, but leaves a lot of duplication.
Because we use FreeRTOS with many different architectures, it is easier to have the common things together.
If you are interested in M4 only: this is guarded in the code with macros, so you easily can single that out.
LikeLike
Pingback: Steps to use FreeRTOS with newlib reentrant Memory Allocation | MCU on Eclipse
Pingback: RTOS Trace: TraceX with Microsoft Azure RTOS (aka ThreadX) | MCU on Eclipse
@Erich Your blog is remarkable. I am using FreeRtos10.4.3. I am also facing patch issues with Segger systemview. I don;t know where is the problem.
LikeLike
Hi Muhammad,
thanks :).
Can you try my FreeRTOS port? Or compare with it? It is available on GitHub: https://github.com/ErichStyger/McuOnEclipseLibrary/tree/master/lib/FreeRTOS
I hope this helps,
Erich
LikeLike
I am using FreeRtosv10.4.3 and segger v3.20. IDE I am using is system workbench for stm32. I am having patch issues with FreeRtos.
LikeLike
Hi Muhammad,
What kind of patch issues?
Can you try my FreeRTOS port? Or compare with it? It is available on GitHub: https://github.com/ErichStyger/McuOnEclipseLibrary/tree/master/lib/FreeRTOS
I hope this helps,
Erich
LikeLike
can you send me your email? I will send you screenshots. There is no available options to attach screenshots in message
LikeLike
You can find my contact information on the About page of this blog. Have you tried my FreeRTOS port already?
LikeLike
I have sent you friend request on facebook. I can share screenshots on facebook?
LikeLike
I’m not really using facebook, I’m sorry.
LikeLike
Hi Erich, I really don’t understand what do you mean by port?
LikeLike
A ‘port’ in FreeRTOS is a version/adaption for a device.
LikeLike
Pingback: Debug Firmware Switching for the LPC4322 | MCU on Eclipse
Hi I am very very newbie, but I have a question. How to apply the patch file e.g FreeRTOS_10_4_3.patch on windows. I dont know what should be the command or app to do that.
the official systemview guide show this command for linux patch -p1 -r . < FreeRTOS_10_4_3.patch
thanks
LikeLiked by 1 person
I think you can use git to apply the patch (see https://devconnected.com/how-to-create-and-apply-git-patch-files/). But I simply have read the .patch file with a text editor and applied the patches by hand.
LikeLike
yes, it is true. I used the git-bash.exe to apply the command. Thanks, it worked.
LikeLiked by 1 person
Hi Alex,
great that it worked 🙂
LikeLike
hello Erich, I have a doubt. I have also a patch file called FreeRTOSV10_Amazon_Core.patch but when I try to use it always I get the message can’t find file to patch at input line xxx.
Is it necessary to use the amazon file or when to use it ?
LikeLiked by 1 person
Just open that patch file with a text editor and apply the patches by hand. You have to have the exact files needed for the patch, otherwise it won’t work.
LikeLike
thanks for your reply, maybe I need to rephrase the question. I downloaded the SystemView_Src_V330.zip and inside of this there are two patch files for FreeRTOSV10 why? FreeRTOSV10_Amazon_Core.patch
FreeRTOSV10_Core.patch
I applied the file FreeRTOSV10_Core.patch to my FreeRTOS source generated by CubeMX but the FreeRTOSV10_Amazon_Core.patch doesnt work. It has different path inside.
LikeLiked by 1 person
There is the ‘Amazon’ port (I never used it), I always used the ‘core’. But as STM does things differently, you have to apply the patch ‘by hand’ anyway.
LikeLike
thanks very much for your reply, i didn’t know that
LikeLiked by 1 person
the core patch has file path like this
diff -rupN org/Source/include/FreeRTOS.h new/Source/include/FreeRTOS.h
and the amazon patch has paths like this
diff -rupN org/lib/FreeRTOS/portable/GCC/ARM_CM0/port.c new/lib/FreeRTOS/portable/GCC/ARM_CM0/port.c
maybe amazon FreeRTOS is not the same source files I generate from STM32CubeMX. I dont know, I hope you can give an advice
LikeLiked by 1 person
Yes, the STM32CubeMX files are different, and most ports from all vendors. The patch file really only applies to the official FreeRTOS releases. I recommend that you open the patch file with a text editor and apply the patches by hand. This is what I did for my port(s)
LikeLike