FreeRTOS for MSP430F148

From DIDEAS Wiki
Revision as of 23:12, 20 February 2006 by Ceb (talk | contribs) (dIDEAS example1)
Jump to: navigation, search

Getting started with FreeRTOS on the MSP430F148

I started with version 3.2.4 that contains a port to a MSP430F449 evaluation board using GCC. The ZIP file unpacks into a tree with a "demo" and "source" branches. The source branch contains the FreeRTOS microkernel for various architectures - and demo branch the example programs for each of the architectures.


dIDEAS example1

Although the demo programs are interesting, I find them to be too complex for someone new to the FreeRTOS distribution. So I've created a simple generic MSP430 demo program that one can quickly customize to their own platform.

Download Demo1 - V1.00 in ZIP format. FreeRTOS v3.2.4 for MSP430F148 only

The demo spawns 4 tasks. Three of them toggle LEDs and output chars to the serial port. The 4th task operates at the idle priority and (when calibrated) outputs a number showing the percentage of the CPU that is free.

To keep things simple in my first demo - shared resources are NOT locked. For example, the LED ports are not modified with an atomic operation. The serial port output - due to being in an ISR - is effectively atomic, however a the ISR reads from a single queue filled from threads that don't lock it. Thus a printf output from one thread could be mixed with output from another thread.

The best way to understand the demo program is make good use of the FreeRTOS API. You can also access the API by going to FreeRTOS.org and expanding the "Information" node on the top-right frame. Then select "FreeRTOS API".

dIDEAS example 2

The 2nd demo adds resource locking.

In progress.


MODs to the demo branch

Changing the target MSP430 from a F449 to the F148 required no changes to the source tree! However the example programs are both processor and evaluation board dependant.

First the file demo/msp430_gcc/FreeRTOSConfig.h should be changed to be portable across all MSP430 devices:

Replace the line:

#include <msp430x44x.h>

with

#include <io.h>


"io.h" contains macros that include the correct MSP430 portmap based on the processor type.


Also needed - modify the makefile (demo/msp430_gcc/makefile) and replace the line:

CFLAGS=-mmcu=msp430x449 $(OPT) ...

with

CFLAGS=-mmcu=msp430x148 $(OPT) ...

or that which is appropriate for your processor type.