Table of Contents

Note: you don't have to build TNeo to use it. If you want to just use pre-built library (with default configuration), refer to the section Using TNeo in your application.

Configuration file

TNeo is intended to be built as a library, separately from main project (although nothing prevents you from bundling things together, if you want to).

There are various options available which affects API and behavior of the kernel. But these options are specific for particular project, and aren't related to the kernel itself, so we need to keep them separately.

To this end, file tn.h (the main kernel header file) includes tn_cfg.h, which isn't included in the repository (even more, it is added to .hgignore list actually). Instead, default configuration file tn_cfg_default.h is provided, and when you just cloned the repository, you might want to copy it as tn_cfg.h. Or even better, if your filesystem supports symbolic links, copy it somewhere to your main project's directory (so that you can add it to your VCS there), and create symlink to it named tn_cfg.h in the TNeo source directory, like this:

Default configuration file contains detailed comments, so you can read them and configure behavior as you like.

Makefile or library projects

If you need to build TNeo with some non-default configuration, the easiest way is to use ready-made Makefile or library project.

Makefile

It is tested only in Unix-like environment, so that you can't use makefile to build the kernel with Keil Realview or IAR. For Keil Realview or IAR, use library project (see the section below).

There are two makefiles available: Makefile-all-arch and Makefile.

The first one is used to build all possible targets at once, so it is more for the kernel developer than for kernel user. The second one is used to build the kernel for some particular architecture, and it takes two params: TN_ARCH and TN_COMPILER.

As a result, there will be archive library file bin/cortex_m3/arm-none-eabi-gcc/tneo_cortex_m3_arm-none-eabi-gcc.a

Library project

In the root of TNeo repository, there is a directory lib_project which contains ready-made projects for various platforms. You may use it for building library, and then use resulting library file in your project.

For MPLABX projects, there are library projects, so that you even don't need to build a library: just add this library project to your main project, and MPLABX will do all the work for you. You can change tn_cfg.h file "on-the-fly" then. Other IDEs don't offer such a luxuries, so you need to build library file as a separate step.

Building manually

If you want to create library project yourself (say, in some different IDE, or anything), or if you want to build TNeo as a direct part of your project, there are some generic requirements (there might be additional architecture-dependent requirements, see links below):

Core sources: add all .c files from src/core directory to the project.

C99: TNeo uses some features of C99, such as static inline functions and variable declarations not at the start of a compound statement. So, C99 is a requirement.

C Include directories (relative to the root of the repository) :

src

src/core

src/core/internal

src/arch

Assembler preprocessor Include directories (relative to the root of the repository) :

src

src/core

.S files preprocessed by C preprocessor: This is probably more arch-dependent requirement than a generic one, but actually .S files for all supported architectures need to be preprocessed, so it is specified here. On most platforms, it works "out-of-the-box", on some others, you need to perform additional steps for it: in these cases, necessary steps explained in the "building" section for the appropriate architecture, see links below.

Isolate each function in a section Not a requirement, but recommendation: for embedded designs, it is usually a good idea to isolate each function in a section, so that in your application you can set linker option like "remove unused sections", and save notable amount of flash memory.

For arch-dependent information on building TNeo, please refer to the appropriate section: