Over a million developers have joined DZone.

McuOnEclipse Components: 07-Dec-2014 Release

· Java Zone

Easily build powerful user management, authentication, and authorization into your web and mobile applications. Download this Forrester report on the new landscape of Customer Identity and Access Management, brought to you in partnership with Stormpath.

Over the last weeks, several contributions, extensions and fixes have been added to the McuOnEclipse components, so a new release is available on SourceForge.

  • Bug fix for RingBuffer.
  • Better FreeRTOS task debugging with gdb.
  • Better watchdog support with Shell component.
  • Additional properties for PercepipTrace.
  • New Utility function ScanDoubleQuotedString() to scan a double quoted string.
  • LCDHTA with additional cursor functions.
  • New devices supported in FSL_USB_Stack: K22FN1M (FRDM-K22F), KL24Z48M, USB host support for K22F120/K22FX512).
  • RNet with nRF24L01+ to deal better with overflow situations.
  • A new component FreeRTOS_Tasks to create FreeRTOS tasks.
FreeRTOS Tasks Component

FreeRTOS Tasks Component

Ring Buffer Bug Fix

With a RingBuffer buffer size of 256 it was possible that the internal index variable overflows. This has now been fixed and it works properly with a buffer size of 256 bytes.

RingBuffer with 256 Elements

RingBuffer with 256 Elements

FreeRTOS Task Stack Frame with GDB

With FreeRTOS v8.0.0 on, there is an issue with gcc+gdb that it does not properly show the stack frame:

Incomplete Stack Frame

Incomplete Stack Frame

This is caused by the addition of an error handler in case the task returns, see this question in the FreeRTOS forum. There is now a setting in the FreeRTOS properties where you can disable the error handler:

Task Exit Error Handler setting for FreeRTOS

Task Exit Error Handler setting for FreeRTOS

With this, the stack task frames are shown properly with GDB too:

FreeRTOS Task Stack Frame properly shown

FreeRTOS Task Stack Frame properly shown

Shell with Command Parsing Hooks

If using a watchdog and if command line Shell commands take long for printing text, this can be an issue to properly refresh a watchdog. To deal with this situation, two optional hooks have been added to the shell:

Shell Iteration Hooks

Shell Iteration Hooks

If enabled, the hooks are called before and after parsing a command:

uint8_t CLS1_IterateTable(constuint8_t *cmd, bool*handled, CLS1_ConstStdIOType *io, CLS1_ConstParseCommandCallback *parserTable)
{
	uint8_t res = ERR_OK;

	if(parserTable==NULL) { /* no table??? */
	returnERR_FAILED;
	}
	/* iterate through all parser functions in table */
	while(*parserTable!=NULL) {
		CLS1_OnBeforeIterateCmd(cmd);
		if((*parserTable)(cmd, handled, io)!=ERR_OK) {
			res = ERR_FAILED;
		}
		CLS1_OnAfterIterateCmd(cmd);
		parserTable++;
	}
	returnres;
}

That way I can measure and offset the time needed to handle a command and use this in my application to keep my watchdog counters up-to-date:

staticTickType_t ticksBeforeCmd;

voidSHELL_OnBeforeIterateCmd(constuint8_t *cmd) {
	(void)cmd; /* not used */
	ticksBeforeCmd = FRTOS1_xTaskGetTickCount();
}

voidSHELL_OnAfterIterateCmd(constuint8_t *cmd) {
	(void)cmd; /* not used */
	WDT_IncTaskCntr(WDT_TASK_ID_SHELL, (FRTOS1_xTaskGetTickCount()-ticksBeforeCmd)/portTICK_RATE_MS); /* count for output to console */
}

FreeRTOS PercepioTrace

Additional properties in Percepio FreeRTOS trace gives now more control what to trace:

  • Ability to limit only to trace scheduling events
  • Setting if ready events shall be traced
  • Configuration if 16bit or 32bit handles shall be used
  • Started to build up settings to enable/disable events to better use the trace buffer. For now vTaskDelay() and vTaskDelayUntil() can be turned on or off individually.
  • Setting to tell trace that the heap is always below 16 MByte to reduce the trace size
New Perceipio FreeRTOS Trace Settings

New Perceipio FreeRTOS Trace Settings

Utility String Scanning

A new function has been added to the Utility to scan a string in double quotes. This is useful for example to read strings like

"hello", "my world"
ScanDoubleQuotedString

ScanDoubleQuotedString

Character LCD Cursor Functions

The LCDHTA character LCD component has now a public interface to WriteLCDCommand() so the application can directly write LCD commands. And there are two new functions to shift the cursor either left or right:

LCDHTA Cursor Functions

LCDHTA Cursor Functions

New Device Support for FSL_USB_Stack

The following devices have been added to the USB stack component:

  • KL24Z48M
  • K22FN1M (FRDM-K22F)
  • USB host support for K22FX devices
New Device Support in USB Stack

New Device Support in USB Stack

RNet and nRF24L01+

The RNet component has been extended with a shell interface for the RMSG part, so it can report the size and status of the message queues. Additionally error handling for queue full cases in the nRF24L01+ transceiver has been improved.

Component to Create FreeRTOS Tasks

This component is a contribution of Omar Isaí Pinales Ayala from Mexico (thanks!). Omar already contributed a OneWire component which is experimental for the moment.

FreeRTOS Tasks Component

FreeRTOS Tasks Component

With the FreeRTOS_Tasks component new tasks can be created with a graphical user interface:

Tasks Created

Tasks Created

It then creates the source to create the tasks:

void TSK1_CreateTasks(void)
{
	if (FRTOS1_xTaskCreate(
		BlinkTask,  /* pointer to the task */
		"Blink", /* task name for kernel awareness debugging */
		configMINIMAL_STACK_SIZE + 0, /* task stack size */
		(void*)NULL, /* optional task startup argument */
		tskIDLE_PRIORITY + 0,  /* initial priority */
		(xTaskHandle*)NULL /* optional task handle to create */
	) != pdPASS) {
		/*lint -e527 */
		for(;;){}; /* error! probably out of memory */
		/*lint +e527 */
	}
	if (FRTOS1_xTaskCreate(
		CalcTask,  /* pointer to the task */
		"Calc", /* task name for kernel awareness debugging */
		configMINIMAL_STACK_SIZE + 100, /* task stack size */
		(void*)NULL, /* optional task startup argument */
		tskIDLE_PRIORITY + 2,  /* initial priority */
		(xTaskHandle*)NULL /* optional task handle to create */
	) != pdPASS) {
		/*lint -e527 */
		for(;;){}; /* error! probably out of memory */
	/*lint +e527 */
	}
}

Summary

I’m happy to publish multiple extensions, improvements and as well bug fixes. I hope the release is useful. The full release notes are available on SourceForge here.

Happy Upgrading :-)

The Java Zone is brought to you by Stormpath—a complete, pre-built User Management API. Want to learn how to use JWTs to protect microservices from CSRF and more? Check out this on-demand webinar with our Java Developer Evangelist, Micah Silverman.

Topics:

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}