Time is passing by so fast, and the year end is approache fast! I’m pleased to announce that a new release of the McuOnEclipse components is available in SourceForge:
- Percepio Trace V3.1 for FreeRTOS which includes both Segger RTT continuous streaming and snapshot tracing in a single API
- Generation of sources and drivers so they can be used without Processor Expert using McuLibConfig, removal of dependency to NXP Kinetis SDK: components use a generic API approach to have them working with other SDKs.
- New contributed ExceptionsHandler component
- Callback Setter and Getter in USB CDC stack for simpler option handling
- GenericTimeDate with flexible RTC support and added Unix Timestamp functions
- LongKey events in Key component
- FreeRTOS with optimized task selection on Cortex-M4/M7
- Many smaller bug fixes and enhancements
Percepio Tracealizer V3.1
Percepio has released a new Tracealizer for FreeRTOS with many improvements.
I have it now working and ported for all devices the McuOnEclipse library supports. On Cortex-M with Segger I can stream the data to the host while the target is running:
The new unified trace API supports both streaming and snapshot API combined:
The component settings including support in FreeRTOS has been updated to support the new version. The settings have been regrouped, plus there is now the option to place the files into folders:
With the new options I can collect streaming trace right from the startup:
The new library offers alternative streaming methods as USB CDC or Ethernet, but I have not explored these (yet).
The new library and host application has a powerful way to spot memory leaks.
ExceptionsHandler
Omar Isai Pinales Ayala has contributed the new component ‘ExceptionsHandler‘:
With that component a simple try/catch/throw exception handling can be used with C. I had not much time to try it out, but this concept is very promising.
GenericTimeDate with Unix Timestamp Functions
The GenericTimeDate component can now be used as software RTC or in combination with hardware RTC, both internally or externally. It can be used as internal or external RTC without internal software counters now. Additionally initialization and default values can be configured:
Additionally it the driver implements flexible Unix time stamp (seconds after 1970) conversions:
Long Key Debouncing Events
The Key component is used to debounce one or multiple push buttons. It features dedicated events for long key press and release events:
FreeRTOS Optimized Task Switching
In FreeRTOS, the configUSE_PORT_OPTIMISED_TASK_SELECTION setting is used for an optimized task selection by the kernel:
It is only implemented for ARM Cortex-M4/M7 and with configMAX_PRIORITIES less than 32 (which is not really a limitation in normal systems). With that enabled, task selection is using the ‘clz’ (count leading zeros) assembly instruction for the task selection.
The effect is a small but measurable decrease of Kernel time: in one of my robotics application the Scheduler time was reduced from an average of 1.30% to 1.18%:
McuLibConfig
To help a broader usage of the drivers and code, I have added a new component: McuLibConfig. It replaces the KinetisSDK component plus fixes several limitations introduced by the SDK. One issue is that both Processor Expert and the SDK depend on types like ‘bool’ or ‘uint8_t’: depending on the inclusion order of header files, this can result in ‘incompatible type’ errors produced by the compiler. The McuLibConfig component allows to specify which API (and from where the standard types are coming):
The McuLibConfig component creates a configuration header file which is used in all the other drivers. That way the proper API (SDK or Processor Expert) is selected:
#ifndef __McuLib_CONFIG_H #define __McuLib_CONFIG_H /* Identifiers used to identify the SDK */ #define McuLib_CONFIG_SDK_GENERIC 0 /* using a generic API/SDK */ #define McuLib_CONFIG_SDK_PROCESSOR_EXPERT 1 /* using Processor Expert SDK */ #define McuLib_CONFIG_SDK_KINETIS_1_3 2 /* using NXP Kinetis SDK V1.3 */ #define McuLib_CONFIG_SDK_KINETIS_2_0 3 /* using NXP Kinetis SDK V2.0 */ #define McuLib_CONFIG_SDK_MCUXPRESSO_2_0 4 /* same as Kinetis SDK v2.0 */ /* specify the SDK and API used */ #ifndef McuLib_CONFIG_SDK_VERSION_USED #define McuLib_CONFIG_SDK_VERSION_USED McuLib_CONFIG_SDK_PROCESSOR_EXPERT #endif /* special macro to identify a set of SDKs used */ #define McuLib_CONFIG_NXP_SDK_USED ( (McuLib_CONFIG_SDK_VERSION_USED==McuLib_CONFIG_SDK_KINETIS_1_3) \ || (McuLib_CONFIG_SDK_VERSION_USED==McuLib_CONFIG_SDK_KINETIS_2_0) \ || (McuLib_CONFIG_SDK_VERSION_USED==McuLib_CONFIG_SDK_MCUXPRESSO_2_0) \ ) /* 1: project is a NXP/Kinetis SDK project; 0: Normal Processor Expert project or generic project */ #endif /* __McuLib_CONFIG_H */Each driver now will generate such a configuration file which is either configured by Processor Expert graphically through the component properties. Or you can use it without Processor Expert and simply edit that configuration file. Each configuration is guarded with a #ifndef so you can set the configuration through compiler switches too.
The other feature is that I can specify a folder name for configuration files:
With this, each generated driver creates a configuration header file <Driver>config.h which has the user configuration.
For example the XFormat component creates the following files:
- McuXFormat.h: driver interface
- McuXFormat.c: driver implementation
- McuXformatconfig.h: driver configuration header file
That way the configuration is separated from the driver. And best of all: the driver now can be used without Processor Expert :-). This is still work in progress, but if you would like to check out how this looks: I have pushed several driver files to GitHub here: https://github.com/ErichStyger/McuOnEclipseLibrary
The plan is to extend the set of drivers and level of configuration in the configuration header files. The goal is to offer a library you can pull from GitHub and configure it with the IDE and tool you want.
Migrating from KinetisSDK to McuLibConfig
Because the interface has been changed from using the KinetisSDK component to the McuLibConfig one, existing projects need to be updated. The easiest way is to
- Add the McuLibConfig component to the project
- Remove the Kinetis SDK component from the project
- Close the project (Project > Close)
- Reopen the project (Project > Open)
With these steps all components previously using the Kinetis SDK one are using the new McuLibConfig component.
Summary
There are now around 14’000 component downloads every year (thanks to you all!). The McuLibConfig component is a step towards an even broader usage of the software and libraries provided through the McuOnEclipse project.
The changes are documented on GitHub. The release is available on SourceForge: https://sourceforge.net/projects/mcuoneclipse/files/PEx%20Components/. See “McuOnEclipse Releases on SourceForge” how to install the update.
I hope you find the new release useful.
Happy Eclipsing 🙂
Links
- Release on Sourceforge: https://sourceforge.net/projects/mcuoneclipse/files/PEx%20Components/
- Component installation instructions: McuOnEclipse Releases on SourceForge
- McuOnEclipse Library on GitHub: https://github.com/ErichStyger/McuOnEclipseLibrary
- Percepio Trace Streaming: FreeRTOS Continuous Trace Streaming
sound promising, will be tested in next project, hopefully beginning of next year
LikeLike
Great job and thanks for the update! Will it be possible to take advantage of all this work in next MCUXpresso? As far as I know PEx won’t be used anymore in the new IDE.
LikeLike
Hi Gaston,
that’s why I have introduced the conecpt of the McuOnEclipse Library and the McuLibConfig component. That way the code is normal C/C++ code which can be consumed by any IDE. I’ll plan to generate the code e.g. from Kinetis Design Studio which still should be around the coming years (or with standard Eclipse), and then hopefully it can be used that way in MCUXpresso IDE too when it will be available. Similar to what I have described in https://mcuoneclipse.com/2016/05/15/mother-of-components-processor-expert-with-nxp-kinetis-sdk-v2-0-projects/. Of course it won’t come with all the low level hardware drivers, I expect them to be provided with the SDK or whatever the drivers are using.
LikeLike
Good morning, Erich:
First of all, thank you for teaching us day to day. It’s really a great job and I hope it continues like this for a long time 🙂
I have uploaded the new components and simply share that I can not complete the configuration of a project with the MK24FN1M0VLL12 and a USB CDC Device.
I have completed similar projects previusly with the K22F, but now I can´t with the MK24F
The problem is that when I load the FSL_USB_Stack or the FSL_USB_CDC_Device I can configure everything except the Clock setting part of the USB0: Init_USB_OTG component.
Can you please help me on this? Thanks in advance, Beny
LikeLike
Hi Beny,
you need to create a project with the Processor Expert option, but *without* the Kinetis SDK.
Erich
LikeLike
Thanks Erich. As allways It works :-).
LikeLike
Hi Erich,
I just downloaded the new PE files so I could take a look at the updated GenericTimeDate. I added it to the project to look at it, but then removed it before clicking the Generate Code button. When I recompiled I got 2 errors and red X on FreeRTOS and UTIL1:Utility. I did not change either of them. Any ideas?
Description Resource Path Location Type
Generator: FAILURE: at line 2961: Inherited symbol not found: “ConfigFilesFolderName” (file: Drivers\sw\Utility.drv) MySensors_KL25Z_Project UTIL1 Processor Expert Problem
Description Resource Path Location Type
Generator: FAILURE: at line 4641: Inherited symbol not found: “ConfigFilesFolderName” (file: Drivers\sw\FreeRTOS.drv) MySensors_KL25Z_Project FRTOS1 Processor Expert Problem
LikeLike
With the new component, you have to assign McuLibConfig to other components like FreeRTOS or Utility. Go into the properites of these and select the McuLibConfig instead of the previous KinetisSDK component, then things should be fine.
About the GenericTimeDate component: a bug has been found with the Unix time conversion routines. This is already fixed on GitHub, but not released as component yet.
LikeLike
Thanks again for the quick fix.
LikeLike
Hello Erich,
I notice that some components like e.g. the nRF24L01 do not notice the McuLibConfig and therefore they do not include the header file of the McuLibConfig component correctly. If I’m adding
manually an #include … the ‘bool’ / ‘uint8_t’ conflict (becoming apparent in an ‘incompatible type’ compiler error) disappears.
LikeLike
Hi Henning,
yes, some components have not been moved over. That should not be an issue as long as you do not have anywhere else an include to stdbool.h. Maybe this is the problem that you have somewhere in your non-generated code such an include? I had two projects where I had this, and after removing that include from my code the problem was solved. Can you try this?
LikeLike
I’m starting to study about the freedom boards, I have the KL46Z board and in this web I have learned a lot. Thanks for that.
Can somebody tell me how to use the LedMatrix component? I don’t find any tutorial for code warrior, please help me.
Other thing is: how about the keypads? Is the processor expert compatible? There are any component or tutorial for that?
LikeLike
Hi Victor,
thanks for your feedback :-). I have used the LedMatrix component for the MCF51JM128 Badgeboard (http://www.nxp.com/products/microcontrollers-and-processors/more-processors/coldfire-plus-coldfire-32-bit-mcus/coldfire-microcontrollers-mcus/coldfire-v1-microcontrollers-mcus/flexis-jm-badge-board:JMBADGE), see https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/CodeWarrior/MCF51JM128_BadgeBoard for example projects. For KDS there is only a very simple example there, plus two projects for CodeWarrior classic (which does not run any more on my Windows 10 machine). If I find time, I will port it to KDS.
The LedMatrix component is for an array of LEDs with both the anode/cathodes (rows/colums) connected to the microcontroller.
(capacitive) keypads: I have a tutorial for KL25Z here: https://mcuoneclipse.com/2012/09/30/tutorial-touching-the-freedom-kl25z-board/. However, that touch library from Freescale was not working well for me and was provided as a blob only.
I hope this helps,
Erich
LikeLike
Thanks for your quickly reply Erich 🙂
I’ve been seeing the example about the LedMatrix component but sadly that example only turn on and off the full matrix, no more.I’m looking for a tutorial o example about how to create these arrays and how to make the codes, my matrix is an 8×8 Red LED.
About your post called: “touching the freedom” I saw this post before and it works perfectly, but when I say keypad I’m talking about the number keyboards of blue buttons: http://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2015/07/how-it-works-keypad.png
I didn’t find any component or trick to use it.
LikeLike
Hi Victor,
I did not write a tutorial for the LedMatrix, sorry :-(. But I hope that example I mention helps you. In the rows you specify the pins which are driving the rows, and in the columns you use the pins which are for the columns. Check the schematics of the Badgeboard how they are in the hardware: I hope your 8×8 matrix is using the same matrix wiring, otherwise it will not work.
I would have to check how the classic CodeWarrior project worked (there must be a higher level part which turns on/off individual pixels), but I’m travelling and with my Windows 10 machine I cannot open these projects.
About key pad (well, actually key matrix): I had started a tutorial about this a while back, but due lack of time never finished. The concept is the same as for the LED matrix, but here you use the pins as input/output pins to probe the rows and colums. So you don’t need any special components for this.
LikeLike
Hi Victor,
I have added the GDisplay component to the project on GitHub with some example code. I was not able to test it because I have no hardware with me. But hopefully this gets you started.
LikeLike
Thanks for your help, I didn’t be able to download the example but now I now more or less that the LedMatrix component and the Gdisplay component will work together.
I hope you can finish the key matrix tutorial because that would be useful to the beginners and we all really appreciate it 🙂 .
The matrix things in the freedom boards haven’t information in the whole internet so that’s pretty sad. Thanks for all Erich
LikeLike
Hi Victor,
you can download the full repository in a zip file with the following link: https://github.com/ErichStyger/mcuoneclipse/archive/master.zip
“The matrix things in the freedom boards”: I’m not aware of any FRDM board with a matrix keyboard, or I have missed it?
LikeLike
I’m talking about external components like ultrasonic module or LCDs, for those you bring us tutorials and we are really appreciate it. Sadly about the matrix components, external, there aren’t information in the internet.
I’m started with the example you give me and I thing that the LedMatrix component it’s not compatible with my freedom board. I have the KL46Z, and the component configurations (specifically the BitsIO components) require 8 consecutive pins of a single port (pta,ptb,…) for the columns. In the schematic and in the pinouts of the kl46z you can see that this requirement is impossible to satisfy, not all the pins of the ports are available in the headers, not all follow the number order, ect . That isn’t the case of the 8 pins of the rows, you can choose any pin.
That’s the problem with my board, you recommend me to change the board? or another components I don’t know. Sorry for ask you too much questions
LikeLike
Hi Erich,
I am user of MQX, but now I understand that it’s better to start with FreeRTOS.
It’s the first time I use FreeRTOS. I made a new project with KDS3.2, PE and MCULib with target FRDMK64.
My project works fine with FreeRTOS and 4 tasks, now I want to add Lwip. How to do that? I don’t find the component.
Do you have any tutorial to add Ethernet on this simple project with FRTOS and PE under KDS3.2?
Thanks for your help.
LikeLike
Hi Bernard,
maybe the following is helpful for you: https://mcuoneclipse.com/2015/10/28/tutorial-lwip-with-the-freertos-and-the-freescale-frdm-k64f-board/
Erich
LikeLike
Erich,
I tried this link.
I made a project ksdk130 with lwip from kdsk130, but with freertos9 from MCULib component 2016-12-12 and MCUlib. I plan to use last FreeRTOS.
I can’t compile the project, always a lot of errors like that, see below two examples.
In file included from ../Generated_Code/Cpu.h:80:0,
from ../Generated_Code/MCUC1.h:65,
from ../Generated_Code/FreeRTOSConfig.h:73,
from ../Generated_Code/FreeRTOS.h:97,
from ../SDK/platform/osa/inc/fsl_os_abstraction_free_rtos.h:78,
from ../SDK/platform/osa/inc/fsl_os_abstraction.h:80,
from ..\lwip\port/lwipopts.h:39,
from ..\lwip\src\include/lwip/opt.h:45,
from ../lwip/src/netif/ppp/chap.c:69:
../Generated_Code/osa1.h:95:1: error: unknown type name ‘task_param_t’
typedef task_param_t os_task_param_t;
^
In file included from ../Generated_Code/Cpu.h:82:0,
from ../Generated_Code/MCUC1.h:65,
from ../Generated_Code/FreeRTOSConfig.h:73,
from ../Generated_Code/FreeRTOS.h:97,
from ../SDK/platform/osa/inc/fsl_os_abstraction_free_rtos.h:78,
from ../SDK/platform/osa/inc/fsl_os_abstraction.h:80,
from ..\lwip\port/lwipopts.h:39,
from ..\lwip\src\include/lwip/opt.h:45,
from ../lwip/src/netif/ppp/chap.c:69:
../SDK/platform/drivers/inc/fsl_enet_driver.h:378:5: error: unknown type name ‘mutex_t’
mutex_t enetContextSync; /*!< Sync signal*/
So, task_param_t and mutex_t are well defined in fsl_os_abstraction_free_rtos.h.
It seems to be a bad mistake difficult to solve.
If you have an idea.
I think, I have to forget PE now if I want to use FreeRTOS9 with Lwip and KDS320.
LikeLike
Hi Bernhard,
have you configured the McuLibConfig for SDK V1.3? If yes, could you share your project so I can have a look? There seems to be an issue with header file includes.
LikeLike
Hi Erich,
You are the best! McuLibConfig was for PE, I changed it for SDK V1.3, now it works
Have a great day!
LikeLike
🙂
LikeLike
Hi Erich,
I plan to use Percepio Trace V3.1 with USB CDC without Segger J-link.
Do you plan to improve this component Percepio Trace V3.1?
LikeLike
Yes, I’m maintaining it, and improve it, and I’m using it in my projects. I’m not sure what you mean with ‘improving’? I’m using it mostly with the streaming/RTT mode as this is the most value in my projects, but you can use it with any other probe in stop or post mortem mode too.
LikeLike
Erich,
I tried to add Percepio Trace, but after compile, I got error with SEGGER_RTT_Config.h not found.
So I add Segger_RTT component, now, the project compile but I lose Semihosting. (Segger_RTT modified printf)
I suppose that use of Percepio Trace implies use of Segger_RTT
Is it possible to use Percepio Trace with semihosting and stream to USB CDC ?
Another thing, I tried to use FreeRTOS_task component, I declarate 3 task, but I got files .C and .H with nothing usefull. it seems to be a dummy component? Maybe I forget something.
LikeLike
Have you configured Percepio for Snapshot mode? Segger RTT is not needed in that mode.
Maybe contact me offline with the place where it complains about the missing header file.
It is possible to use any kind of communication way with Percepio, even storing data say on a file system.
I would recommend not to use semihosting as it semihosting is very intrusive and very slow. And yes, you could stream to USB CDC, but I have not done this myself (yet).
LikeLike
Hi Erich,
Good, Percepio is well working with Snapshot mode.
To stop compiler complain, I added Segger RTT component.
I tried again to stream with USB CDC without success. I got problems with instantiation USB Stack and other components USB.
Snapshot works fine, I will wait for your try with Streaming and USB CDC.
Bye
LikeLike
Hi Erich,
Do you know if it’s possible with PEx KSDK130 to migrate Lwip141 to Lwip200?
I tried without success.
LikeLike
I would think that this should be possible, but I have not tried it. Your report does indicate it is at least not easy 😦
LikeLike
Hi Erich,
Your website and work is awesome!
I’m working on KDS 3.2.0 using PE, MCUOnEclipse Components 2017-03-12 and updated PE with GenericSWI2C_16.03.2017.PEupd.
I have a project using FreeRTOS with no heap, only static allocation. This is a project that was compiling fine with a previous version of MCUOnEclipse, so I’m just trying to update to use the latest version.
I’m getting a redefine error in generated code:
In file included from ../Generated_Code/FreeRTOS.h:97:0,
from ../Generated_Code/WatchDogLdd1.c:86:
../Generated_Code/FreeRTOSConfig.h:134:0: warning: “configFRTOS_MEMORY_SCHEME” redefined [enabled by default]
#define configFRTOS_MEMORY_SCHEME configUSE_HEAP_SCHEME /* for backwards compatible only with legacy name */
^
../Generated_Code/FreeRTOSConfig.h:133:0: note: this is the location of the previous definition
#define configFRTOS_MEMORY_SCHEME 1 /* either 1 (only alloc), 2 (alloc/free), 3 (malloc), 4 (coalesc blocks), 5 (multiple blocks) */
^
And then eventually the build fails with:
In file included from ../Generated_Code/heap_2.c:2:0:
../Generated_Code/FreeRTOSConfig.h:134:0: warning: “configFRTOS_MEMORY_SCHEME” redefined [enabled by default]
#define configFRTOS_MEMORY_SCHEME configUSE_HEAP_SCHEME /* for backwards compatible only with legacy name */
^
../Generated_Code/FreeRTOSConfig.h:133:0: note: this is the location of the previous definition
#define configFRTOS_MEMORY_SCHEME 1 /* either 1 (only alloc), 2 (alloc/free), 3 (malloc), 4 (coalesc blocks), 5 (multiple blocks) */
^
../Generated_Code/heap_2.c:96:3: error: #error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0
#error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0
^
Generated_Code/subdir.mk:105: recipe for target ‘Generated_Code/heap_2.o’ failed
make: *** [Generated_Code/heap_2.o] Error 1
In file included from ../Generated_Code/heap_3.c:2:0:
../Generated_Code/FreeRTOSConfig.h:134:0: warning: “configFRTOS_MEMORY_SCHEME” redefined [enabled by default]
#define configFRTOS_MEMORY_SCHEME configUSE_HEAP_SCHEME /* for backwards compatible only with legacy name */
^
../Generated_Code/FreeRTOSConfig.h:133:0: note: this is the location of the previous definition
#define configFRTOS_MEMORY_SCHEME 1 /* either 1 (only alloc), 2 (alloc/free), 3 (malloc), 4 (coalesc blocks), 5 (multiple blocks) */
^
../Generated_Code/heap_3.c:99:3: error: #error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0
#error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0
^
Generated_Code/subdir.mk:105: recipe for target ‘Generated_Code/heap_3.o’ failed
Any thoughts on how to resolve?
Thanks!!
LikeLike
Hi Ken,
sorry about that one, it was my fault. I have fixed that some days ago (https://github.com/ErichStyger/McuOnEclipse_PEx/commit/eb9cfb99e99377888ebefc204b330546b4263507), but had no time to release the new components. I see what I can do this week end.
But you might apply the fix on your side, just change that one line as in above commit.
You woud need to locate the file on your machine (depends where you have installed the components, no my machine it is in C:\ProgramData\Processor Expert\PEXDRV_PE5_3\Drivers\freeRTOS\Source\include\FreeRTOSConfig.h, for you it might be inside your Eclipse installation, e.g. \KDS_3.2.0\eclipse\ProcessorExpert\Repositories
Let me know if this works for you,
Erich
LikeLike
Hi Ken,
I have published a new release: https://mcuoneclipse.com/2017/05/06/mcuoneclipse-components-06-may-2017-release/
Can you give it a try?
Thanks,
Erich
LikeLike
Erich,
That fixed it!
Thanks Erich.
Regards,
Ken
LikeLike