<<< | >>>

ColdFire RTOS Implementation

Phase 1: Compilation

The first step in building the FreeRTOS� was to establish an appropriate file structure. We chose to retain the standard structure used by other ports of FreeRTOS�. Although this increases the complexity of the compilation, as files must be selectively gathered from several directories, it should make our code more suitable to being contributed back to the FreeRTOS� project.

The resulting directory structure involved adding a folder labelled MCF5272 to the Demo and Source/portable/GCC directories.

Based on this source organisation we produced a makefile to compile the files required for our port from the various directories. Because the FreeRTOS� does not have a program loader this makefile compiles the application to be run with the real time operating system and must be modified if a different application is to be compiled.

The problem of selecting files from the directory hierarchy was solved using make's VPATH variable which allows the makefile to specify a series of paths to search for required dependencies. Using this approach we can specify the source files independent of their location in the directory structure and let make find them.

It was decided to output all object files to a separate 'objs' directory. This simplifies the process of cleaning object files and reduces the risk of the output of one port interfering with another (as might be the case if object files for common parts of the real time operating system were left in the same directories as their source files). Likewise it was decided to use a separate output directory to keep these files separate from the source files.

The 'all' target produces both an ELF image and an S-Record. The S-Record is used when loading the real time operating system onto the board via a serial port. The ELF image on the other hand can be used for other transfer modes, in particular this is the format used when debugging with gdb via BDM.

In order to compile the FreeRTOS� several changes were made to the source files. Firstly, as the source files were taken from the AVR port several references to external AVR libraries were removed. Secondly, the inline assembly instructions in the code (which were of course AVR-specific) were replaced with "nop" (no-operation) instructions. These instructions will be replaced in turn as we address these parts of the system.

After succeeding in compiling and linking the real time operating system we defined an additional target which may be used to compile but not assemble or link an individual source file. This is simply a convenience target used during development to quickly examine the output of the compiler in order to understand how the compiler implements features such as function calls.

NEXT >>> ColdFire RTOS Port - Phase 2 - Running a Simple Task

� 2017, Amazon Web Services, Inc. or its affiliates. All rights reserved