µTasker Embedded Real Time Kernel
µTasker is used by ELZET80 to support its embedded control modules wih Kinetis K60 ARM Cortex M4 processors: kBed, ethernode K60 and more to come. And also for custom hardware done on the K60 and the LPC1768 Cortex M3.
With a low one time payment - NO ROYALTIES - uTasker offers you a toolbox for your commercial embedded projects that comprises
- ETHERNET TCP/IP stack with HTTP web server, FTP file transfer, SMTP E-Mail, Telnet, and DHCP
- Cooperative multitasking with message queues and events
- System tick, programmable delays, high resolution timeouts
- File system in internal Flash, SPI-Flash and (micro-) SD-Card (FAT compatible)
- USB device working as bulk storage (USB-stick) or for communication (CDC, virtual com port)
- Asynchronous serial, SPI, I2C and CAN drivers
- Access functions for process-i/o (GPIO, analog, timers)
- µParameter system stores your configuration settings
- Comprehensive boot loader allows update over Ethernet
- Test/Buy
- Basics
- Boot loader
- Ethernet
- USB/Serial
- Demo
- C-Programming
- Downloads
µTasker delivers
It packs about everything you could wish in application support: Ethernet and USB, µFAT files, UART, I²C and small graphical LCD support. There's also a sophisticated simulator to try everything out on your PC! And ELZET80 complements µTasker with an inexpensive breadboarding hardware and an Ethernet update loader.
µTasker is free for eductional and uncommercial use!
For commercial users, there's a 30 day FREE trial period. And even thereafter it doesn't cost an arm and a leg: A single project license starts at US$485 and a full license for use on multiple products costs US$765 for one target processor, for instance K60 (Indicatory prices only, please contact M.J.Butcher Consulting in Switzerland to verify).
µTasker comes with source code
Most of the code comes in source so you can modify it as needed and trace through the system functions when chasing a bug in your application.
You need a C-Compiler
Which is a kind of bad news as the free ones are limited in code size (128K in CodeWarrior® Special edition) or have no JTAG debugger support (GNU-C). 128K will take you, however, through smaller projects (inclusive of Ethernet and USB) and for big projects at least to a point where you can decide about the general fitness of the hardware and µTasker for your project. See the "Get Started" tab for more.
Inexpensive test hardware
The minimum hardware is our kBed with its kBedM cradle. It supports Ethernet, USB and serial, has a micro-SD-card holder and lots of standard header connectors to get your hardware extensions glued to the 100MHz K60 processor. Memory is 128K RAM with 512K on-board flash and 1MByte SPI-Flash (used as update fallback and web pages storage)
Basics
µTasker real time operating system
Cooperative multitasking with message queues and events
System tick, programmable delays, high resolution timeouts
ETHERNET TCP/IP stack
with webserver, file transfer, e-mail, DHCP - see separate tab
µFAT file system
File system in internal Flash, SPI-Flash and (micro-) SD-Card (FAT compatible)
USB and serial lines
USB device working as bulk storage (USB-stick) or for communication (CDC, virtual com port), asynchronous serial, SPI, I2C and CAN drivers - - see separate tab
Process i/o
Access functions for process-i/o (GPIO, analog, timers)
µParameter-system
Stores your configuration settings in a separte area with secure update functions. Like IP address, serial port settings, time zone, language etc. Parameter system is immediately available, for instance while starting up an application update. Protected against accidental access via FTP, USB, HTTP etc.
Swap-block gets used in ELZET80's full demo.
Boot loader
Comprehensive boot loader allows update over Ethernet and serial line
Details to be filled soon
Boot loader
Ethernet Remote Update
Loading your code into a development board on your table is painless using the JTAG debugger. It can turn into a nightmare, however, to update 150 ceiling suspended devices spread over some buildings. ELZET80's Ethernet loader is a custom extension to µTasker that allows the download of your application program into remote controllers. There are several requirements to make this a failsafe process that are described in detail in the Bootloader document.
Bare Minimum Loader
On reset, the processor starts a "bare minimum loader" located together with a secondary loader in the first 48K of program Flash. It checks a number of Flash and SPI locations for update code (which needs a CRC header to be valid). If the loader veryfies an update, it loads it into the main program area and deletes the temporary update file. After this - or if no update is present - the secondary loader gets started.
Secondary (Serial and Ethernet) Loader
The secondary loader now has to decide between boot mode or application start by checking:
- Boot jumper - a hardware contact to force into boot mode after next reset
- Found a valid (start code and CRC) application and not
- Found a code in RAM set from a previous special Ethernet message ("set to boot mode"), having forced the reset that now gets handled.
before starting a valid application found. If instead forced to boot mode, UART and Ethernet (DHCP and web server) get acitvated. Ethernet is in DHCP mode to react to an "info-request" broadcast as sent by our Network Utility tool. The secondary loader returns to the Network Utility the IP-address hat has been assigned to the unit in boot mode (see the Network Utility manual for details). The IP address is necessary to access the boot loader's web page for update options.
Getting beyond a crashing application
If not forced to boot mode, the valid application gets started. But there may be a perfectly valid application that still crashes. To facilitate replacing such an application, the secondary loader introduces a 3s delay to allow the Network Utility to intercept application start and write the "set to boot mode" code to a specific RAM location (mailbox), then forcing a reset - after which the board comes up with the boot mode web page as described above.
How to reset a device?
Pretty easy if the device works on PoE - just tell the network switch to cycle PoE power for that port. If this is no option for your setup, you could "update-enable" your application by making it react to our Network Utility. It's just a DEFINE setting when using our FullDemo as your application template.
Sending Magic Packets With the Network Utility
Our network utility allows to find all our hardware in a network - as long as the devices are accessible from a broadcast message (which usually does not cross a router barrier).
First select the file to be uploaded to the microcontroller, then the temporary destination. Then upload the software and run it. Running the software means another reset, after which the bare minimum loader will collect the uploaded file - provided header and check sum are valid.
You may also integrate the update feature into your application and set a code in RAM to start the boot loader programmatically.
Manual Validation
To be on the safe side, there's the option to require validation of the newly uplodaded code within 30s of the update. This allows to check whether the new software responds over the Ethernet or maybe gets halted. Validate your update from within the application with a function call (after you know everything is working) or wait until the timeout takes you back into the boot loader, refresh the browser, then validate from the boot loader's web page.
The validation feature is an option marked in the application's header, the validation function sets a flag in the application's header area in flash.
The boot loader might get another IP-address from DHCP than the fixed IP address set for the application (it usually is no good idea to assign the application its IP by DHCP if you need to know which unit is in the cellar and which in the hall).
Serial Update (UART/RS232)
In case you are close to the machine or Ethernet is not available, µTasker provides a traditional serial line dialog to perform settings and query the state of the controller. Please note some boards might only have a TTL level UART, then please use the IF232 RS232-converter to connect with a PC's RS232 port or USB-to-RS232-adapter.
After connection with 115.2 kBit/s at 8N1, power cycle the unit to bring up the greeting message. You have the chance to erase the whole flash or just the application memory and to start download.
Ethernet
Web Server
µTasker's web server is the central hub to connect to your device: Conventionally through static web pages or by serving XML data structures to PC programs or handheld devices. But even a static web page isn't usually static: The web server replaces place holders in the static page with calls into the program to serve dynamic data.
USB / Serial
Demo
Hands on!
After you got hardware on the table for the first time or after you have deleted your application your device will start up in boot loader (see details there). Usually, you will apply power (or USB to power) and then find a red LED flashing - indicating boot mode (if the red LED is off and a green flashing, there's an application running already).
Connect to Ethernet. After a while, a green LED lights continuously to indicate it has got an IP address from the DHCP server.
To find out the IP address, start the ELZET80 Network Utility: First (1) select the network board your PC uses, then (2) click "Discover.. in same subnet" and check (3) which IP the unit got - based on the MAC address marked on the device. Devices that are in boot monitor mode are marked "BM" in the device list. If you have not selected the "Open boot loader web page automatically", you might use the "Open Webpage" button to show the page in an internal window or direct your browser to the discovered IP.
Pick a binary application file, for instance the supplied Full_Demo.bin and click "Upload". The web page refreshes with a message that the upload was successful. To run the application, click the RESET button.
What happens now depends on whether your application uses a fixed IP or is set to DHCP. With DHCP, you will most likely get the same IP as from the boot loader. If not, use the Network Utility again. In the browser, you should now see a page that says that there are no web pages stored (except somebody else uploaded them before).
You may now use FTP to store your web pages. As we have seen FTP tools not to work smoothly with uTasker, simply use the Windows command level to do the transfer. Start | Execute: cmd. In the "DOS" box, navigate to the demo's web pages directory and start the copy-all batch file with the IP-address of your device (like "copy-all 192.168.47.11").
After this, refreshing the browser window will present the Full Demo application's home page.
Full Demo is one of the programs provided in source and also pre-installed on our K60 hardware. The installed programm gives you immediate access to the hardware while the source code (modified from the µTasker original to match our hardware) is intended as a starting point for your own coding of projects that make use of the more advanced µTasker functionality.
The Full Demo home page will lead you to 10+ web pages with access to live data as taken from kBed's i/o:
- Ethernet parameters and access statistics, serial numbers etc.
- LAN configuration with IP-address, gateway, DHCP etc. and demonstration of the parameter validation mechanism
- I/O-configuration and port access (read and set ports)
- Analog i/o: Read ADCs and set DACs
- Serial interface parameter setting
- Graphic LCD screen: Capture embedded LCD content, upload bitmap
- Upload of an alternative picture for the web site (HTTP-Post), sending an e-mail (SMTP) and more
The Full Demo code shows how these web pages are generated by µTasker functions:
- Exemplary use of uTasker's parameter system for LAN settings (with validation mechanism)
- HTTP-Post functionality to upload data to kBed, for instance a new application
- Dynamic content generation of arbitrary size, conditioned as a virtual file such that the browser downloads it as an attachment.
In addition to the web server support, Full Demo deals with:
- FTP to support file transfers (Web pages, config, ...) to internal data-flash or SD
- FTP client to show files on another FTP server
- Telnet and serial line access to debug console (monitor)
- USB MSD (Mass storage dev.) - accessing the board's µSD-Card (FAT32) like a USB stick
- RTC and timer use (LCD backlight brightness PWM)
- Demonstration of µTasker LCD graphic library on 128x64 monochrome display (via SPI or FlexBus).
After you have tried out the various settings you might want to modify the program or write your own. The C-programming section will guide you through this.
C-Programming
After you have seen one of the demo programs working, you might want to set up a C-Compiler to create your own application.
ELZET80 has experience with these 2 ways to program:
- Using uTasker with our boot-loader and the "official" KEIL MDK-ARM
- Using uTasker with our boot-loader and the free Code-Warrior Special Edition (128K limit), plus the USBDM
The KEIL MDK-ARM suite is our suggested environment for commercial applications. It is well supported by the manufacturer and generates a very compact code. To start your own, use our ELZET80 FullDemo as a starting point for your projects. Use the instructions in J. Valvanos's PDF to copy it for your modifications.
For those that cannot afford a good 2000€ for the programming environment, Freescale offers their free CodeWarrior Suite with a limited compiler that supports programs up to 128K. Which seems a lot - though it is not if you switch off compiler optimisation, which again is useful to easily debug: Variables and jumps are like you would expect. While our Full Demo, for instance, is less than 80K with full optimisation, it is just a bit over 128K with optimisation switched off.
Now "Full Demo" is what the name suggests - about all you can do with the K60, so you might remove parts like USB, file system etc to shrink your code. And it is not that you can't work with the free edition but we thought to warn you that you might not get the full convenience. A very good way to circumvent the limitation is uTasker's simulator - anyway a very handy and convenient way to program and debug, using Microsoft®s fast Visual Studio 2010 compiler.
Downloads
FullDemo Tutorial
Explore µTasker and kBed with our free FullDemo sample program (installed as firmware on standard devices). This document gives some hints and details. To obtain the source code, you have to agree to µTasker's license conditions,
Installing the CodeWarrior IDE for µTasker
Setting up the CodeWarrior Eclipse IDE to program for µTasker is easier with some guidance. Follow this tour to get it done in a few minutes.
Boot loader
Two-step boot loader that allows local and remote (Ethernet) updates of the application program. Flowchart.
Debugging with CodeWarrior
This document describes how to debug your application with bootloaders in place.
More Documentation
For more documentation, see the official µTasker website.