Technical topic: TASTE on MSP430 with FreeRTOS

From TASTE
Revision as of 16:49, 13 December 2019 by Rbabski (talk | contribs)
Jump to: navigation, search

This page describes how FreeRTOS support was added to TASTE.

Hardware Description

This article describes steps of adding support for MSP43FR5969 processor [1]. The MSP430FR5969 LaunchPad Development Kit [2] was used for testing purposes.

Features of this microcontroller:

  • 16-bit RISC architecture;
  • 16‑MHz Clock;
  • 64KB FRAM / 2KB SRAM.

On this very limited platform using PolyORB-HI-Ada or PolyORB-HI-C is impossible, due to memory requirements. In the next sections the different approach of code generation is described.

New execution platform

Add new platform Platform_MSP430_FreeRTOS to TASTE. Follow instructions from Technical topic: Add a new target platform to TASTE.

TBC

Source code generation for Concurrency View

The Concurrency View code is responsible for initialization of devices, drivers, threads and other structures. The created structures are responsible for passing information between functions and thread synchronization. Generally this code is generated by Ocarina. The generated code uses PolyORB-HI-Ada or PolyORB-HI-C as a middleware.

Kazoo templates for Concurrency View has parameters, which describes threads, mutexes, functions, etc. and relations between them. These parameters may be used to generate code without PolyORB-HI-Ada or PolyORB-HI-C. This section described this approach.

TBC

Mapping of TASTE structures

The threads will be mapped to FreeRTOS tasks [3].

The communication and synchronization between tasks will be realised using queues and semaphores or mutexes [4].

Cyclic provided interfaces of functions will be implemented using software timers [5].

TBC

main.c

To generate this file, the new concurrency_view subdirectory should be created. This file is a entry point for partition on MSP430. This file should be responsible for intialization of FreeRTOS primitives like tasks, queues or drivers. The main.c should also contain all necessary functions and other structures, which are required by FreeRTOS.

TBC

FreeRTOSConfig.h

To generate this file, the new concurrency_view subdirectory should be created.

The file FreeRTOSConfig.h contains configuration for FreeRTOS. This file defines a set of macros. Example macros are presented in table below:

Macro name Description
configTICK_RATE_HZ Used to configure tick frequency for scheduler
configMAX_PRIORITIES Used to configure max priority of the task
configGENERATE_RUN_TIME_STATS Used to enable or disable run time statistics
configTOTAL_HEAP_SIZE Used to configure total heap size
configMINIMAL_STACK_SIZE Uset to configure minimal stack size

Some macros, like configTICK_RATE_HZ, will be generated based on kazoo template parameters. FreeRTOSConfig.h will be used for tailoring FreeRTOS for TASTE purposes. For an example to disable coroutines following line will be added:

#define configUSE_CO_ROUTINES ( 0 )

Or to do not include FreeRTOS function to compilation to reduce memory usage:

#define INCLUDE_vTaskDelete ( 1 )

TBC

Modification in Makefiles and GNAT Project Manager files

The source code files generated by kazoo, should be compiled. For this purpose the kazoo template should be created based on existing template for other platform, e.g. c_pohi_gpr.

$ cd ~/tool-src/kazoo/templates/concurrency_view
$ cp -r c_pohi_gpr freertos_msp430_gpr

Within new subdirectory, the file partition.tmplt is the main file responsible for generation of .gpr file. Also, other files like trigger.tmplt should be changed. The main modification in partition.tmplt is exclusion of PolyORB files from compilation and inclusion of source files generated for target platform. This file should also include FreeRTOS source files and source code for device drivers.

Another modification in this file is introduction of C compiler for MPS430 platform: msp430-elf-gcc.

TBC

Adding device drivers

The device drivers are described in file ocarina_components.aadl. This file describes subprograms required by device drivers. These subprograms should be implemented in source code files, which should be included to the compilation process.

TBC