TNeo
BETA v1.08-11-g97e5a6d
|
Some notes on building the project.
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.
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:
$ cd /path/to/tneo/src $ cp ./tn_cfg_default.h /path/to/main/project/lib_cfg/tn_cfg.h $ ln -s /path/to/main/project/lib_cfg/tn_cfg.h ./tn_cfg.h
Default configuration file contains detailed comments, so you can read them and configure behavior as you like.
If you need to build TNeo with some non-default configuration, the easiest way is to use ready-made Makefile or library project.
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
.
Valid values for TN_ARCH
are:
cortex_m0
- for Cortex-M0 architecture,cortex_m0plus
- for Cortex-M0+ architecture,cortex_m1
- for Cortex-M1 architecture,cortex_m3
- for Cortex-M3 architecture,cortex_m4
- for Cortex-M4 architecture,cortex_m4f
- for Cortex-M4F architecture,pic32mx
- for PIC32MX architecture,pic24_dspic_noeds
- for PIC24/dsPIC architecture without EDS (Extended Data Space),pic24_dspic_eds
- for PIC24/dsPIC architecture with EDS.Valid values for TN_COMPILER
depend on architecture. For Cortex-M series, they are:
arm-none-eabi-gcc
(you need GNU ARM Embedded toolchain)clang
(you need LLVM clang)For PIC32, just one value is valid:
xc32
(you need Microchip XC32 compiler)For PIC24/dsPIC, just one value is valid:
xc16
(you need Microchip XC16 compiler)Example invocation (from the TNeo's root directory) :
$ make TN_ARCH=cortex_m3 TN_COMPILER=arm-none-eabi-gcc
As a result, there will be archive library file bin/cortex_m3/arm-none-eabi-gcc/tneo_cortex_m3_arm-none-eabi-gcc.a
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.
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):
.c
files from src/core
directory to the project.static inline
functions and variable declarations not at the start of a compound statement. So, C99 is a requirement.src
src/core
src/core/internal
src/arch
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.For arch-dependent information on building TNeo, please refer to the appropriate section: