McuOnEclipse Components: 30-Oct-2016 Release

A new McuOnEclipse components release was long overdue, so I’m pleased to announce that a new drop is available with the following major changes:

  • Segger SystemView library with kernel time reporting
  • GenericTimeDate supports different hardware RTC devices
  • Utility with little endian packet handling functions
  • Shell Standard I/O handlers for USB CDC, Segger RTT and Bluetooth
  • FreeRTOS and stack size reporting
  • printf() support in Shell component
  • Various small bug fixes and improvements
SourceForge

SourceForge

Segger SystemView

The Segger SystemView library has been updated to the new V2.x version. I have added kernel time reporting which was reported with the port to FreeRTOS 9.0.0. Now SystemView reports properly the time spent in the kernel with black bars:

Scheduler time spent in Segger SystemView

Scheduler time spent in Segger SystemView

FreeRTOS and SVCall on Cortex-M0+

The Cortex-M0+ port does not need the SVCall interrupt handler, see ARM Cortex-M Interrupts and FreeRTOS: Part 3. It is still provided, but it is not added to the vector table on Cortex-M0+ any more.

USB CDC Device Subclass

The FSL_USB_CDC component has now a setting to specify the USB device subclass:

USB Device Subclass Setting

USB Device Subclass Setting

This allows to load the USB driver on Windows 10 automatically without a .inf, see https://msdn.microsoft.com/en-us/library/windows/hardware/dn707976(v=vs.85):

“If you want to load Usbser.sys automatically, set the class code to 02 and subclass code to 02 in the Device Descriptor.”

Thanks to Barry for that tip and wish to add that setting!

GenericTimeDate with Hardware RTC Support

The generic RTC module so far supported only a software RTC. Now both an internal and an external hardware RTC can be used. It supports both LDD, non-LDD and external (e.g. I2C) RTC devices. Two optional init parameters allow selective initialization of the software RTC from the hardware RTC. That way both the software and hardware RTC can be kept easily in sync at system startup time:

GenericTimeDate with hardware RTC

GenericTimeDate with hardware RTC

If using it with an internal RTC LDD component, make sure that the component initialize the handle and does a ‘soft’ init (that way the hardware RTC time is kept):

Internal RTC Hardware Settings

Internal RTC Hardware Settings

The API has been extended with several new functions:

Extended GenericDateTime API

Extended GenericDateTime API

The command line supports bot the software and hardware RTC functions and reports the time and date:

generictimedate-command-line-shell

GenericTimeDate Command Line Shell

The above extensions now make it easy to use an RTC e.g. for a data logger application.

Utility

The Utility module implements more functions to pack/unpack little endian data:

Utility Little Endian Functions

Utility Little Endian Functions

Shell Standard I/O Handlers

To make it easier to have multiple Shell connections, the Segger RTT, USB CDC and Bluetooth components implement a standard I/O handler structure plus a local buffer for input handling. That structure can be used for command line and Shell redirection. Below is the implementation for the Segger RTT:

/* default standard I/O struct */
CLS1_ConstStdIOType RTT1_stdio = {
    (CLS1_StdIO_In_FctType)RTT1_StdIOReadChar, /* stdin */
    (CLS1_StdIO_OutErr_FctType)RTT1_StdIOSendChar, /* stdout */
    (CLS1_StdIO_OutErr_FctType)RTT1_StdIOSendChar, /* stderr */
    RTT1_StdIOKeyPressed /* if input is not empty */
  };
uint8_t RTT1_DefaultShellBuffer[CLS1_DEFAULT_SHELL_BUFFER_SIZE]; /* default buffer which can be used by the application */

FreeRTOS and Kernel Awareness

The FreeRTOS V9.0.0 source base has been extended to support an optional stack end marker which is turned on by default:

configRECORD_STACK_HIGH_ADDRESS

configRECORD_STACK_HIGH_ADDRESS

This configures the configRECORD_STACK_HIGH_ADDRESS macro in FreeRTOS.h. With this turned on, the Eclipse FreeRTOS Kernel Awareness V1.0.1 (see “FreeRTOS Kernel Awareness for Eclipse from NXP“) is able to properly report the stack size:

Stack Usage in FreeRTOS Eclipse Kernel Awareness

Stack Usage in FreeRTOS Eclipse Kernel Awareness

Using the command line Shell in FreeRTOS, a more accurate report can be produced with the ‘tasklist’ command:

CMD> FRTOS1 tasklist
TCB Static Handle     Name       State    Prio    Stack Beg  Stack End  Size    Stack Top            Unused  Runtime          
1   no (0) 0x20000A18 Shell      Running  (1,1)   0x20000A08 0x200004C0  1360 B 0x20000968 (  164 B)   776 B 0x00000001 ( <1%)
4   no (0) 0x200019B8 IDLE       Ready    (0,0)   0x200019A8 0x20001780   560 B 0x20001950 (   92 B)   476 B 0x00001AD1 (100%)
3   no (0) 0x200015E8 LedFrame   Blocked  (1,1)   0x200015D8 0x200013B0   560 B 0x20001550 (  140 B)   164 B 0x0000000F ( <1%)
5   no (0) 0x20001C80 Tmr Svc    Blocked  (2,2)   0x20001C70 0x20001A20   600 B 0x20001BF8 (  124 B)   308 B 0x00000000 ( <1%)
2   no (0) 0x20001348 RNet       Blocked  (0,0)   0x20001338 0x20001110   560 B 0x200012C0 (  124 B)   228 B 0x00000001 ( <1%)

Printf() in Shell

Hm, yes, I’m not a fan of printf() (see “Why I don’t like printf()“). But there are good alternatives (see “XFormat, a Lightweight printf() and sprintf() Alternative“). Because that version is handy, I have added support for it to the Shell component:

tiny printf() support Shell

tiny printf() support Shell

As a result, the Shell component references the XFormat component, so existing projects have to be updated with a simple one-click.

Summary

I hope this updates and features are useful for you. 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. For more details see the commit logs on GitHub and the release notes on SourceForge.

Happy Updating:-)

Advertisements

One thought on “McuOnEclipse Components: 30-Oct-2016 Release

  1. Hi Erich,
    great component update, especially support of internal hardware RTC is very usefull for me. If the FRDM boards would have a battery holder for buffering the RTC it would be perfect.
    Thanks Michael

    Like

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s