8000 ubirch-meta/INDEX.md at master · ubirch/ubirch-meta · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
226 lines (169 loc) · 8.54 KB

INDEX.md

File metadata and controls

226 lines (169 loc) · 8.54 KB

ubirch board firmware

The ubirch board firmware is a hardware abstraction layer 9201 for different boards based on the NXP Kinetis SDK v2. Our main goal is to support the development of IoT applications for the ubirch platform while still providing enough abstraction to make coding easy.

Contents

  1. Installation
    1. Cross Compilation Environment
      1. Linux Ubuntu/Debian
      2. macOS
      3. Windows
    2. Installing the Toolchain
  2. Getting Started
    1. Install Template Project
    2. Compiling
    3. Flashing
  3. Additional Information
    1. BOARDS
    2. Development (CMake, Firmware, Crypto)
    3. Example Code
  4. License

Installation

The toolchain consists of a number of code packages that are cross-compiled on your development platform for the target devices. In order to make it as simple as possible to get the toolchain up and running we provide a meta project (sometimes called a super-build) that will fetch all necessary repositories and compile the toolchain for any known MCU and board type.

Install cross compilation environment

A number of tools are necessary if you didn't setup a cross compilation environment before:

Linux (Ubuntu/Debian)

apt-get install git
apt-get install cmake
apt-get install gcc-arm-none-eabi
# optional CGDB for debugging
apt-get install cgdb
# optional Doxygen for generating the documentation locally
apt-get install doxygen

macOS

Install homebrew first, it will help greatly! You will also need the Xcode command line tools, however, homebrew usually complains and helps you install and setup it.

brew install git
brew install cmake
brew tap armmbed/formulae
brew install arm-none-eabi-gcc
# optional CGDB for debugging
brew install cgdb
# optional Doxygen for generating the documentation locally
brew install doxygen

Windows

Get Git for Windows and install either MingW or another GNU toolchain. With cmake it may even work with the Windows developer tools. However, you will need the Launchpad GCC ARM Embedded installer as well as the CMake windows installer.

Installing the toolchain

After you've prepared the cross-compilation environment we can start downloading and compiling the actual ubirch toolchain which contains the libraries, linking helpers and some flashing support.

Currently the build script is only available for Linux and macOS. Feel free to adapt the build.sh to a Windows batch script.

git clone https://github.com/ubirch/ubirch-meta.git
cd ubirch-meta
./build.sh -a

The compilation will take a little while because the toolchain fetches the git repositories and compile the libraries required for each of the supported targets.

DO NOT DELETE THE SOURCES!
They are required for finding header files and additional support files. In contrast to a normal library on your host system, the cross compilation can't install libraries and headers the normal way. We decided to just leave them where they are and point the search paths to the original sources.

If you would like to know more about the structure of the toolchain, take a look at the ubirch-meta README.

That's it, now you're ready to start with your first project.

Getting started

Now you're ready to start your first project. The choice of your development environment possibly includes an IDE. Leo's choice is currently CLion but you can use any C/C++ IDE of your choice as long as it is supported by CMake. One option is Eclipse CDT.

Install the Template Project

First download our template project (zip) and extract it at the location of your choice.

Compiling

CMake promotes out-of-source builds, which means your compiled files will go in a different location than your sources! Thus we create a ubirch-project-template-build directory right next to the source directory:

We assume the ubirch-meta directory also be a sibling of the template project.

mkdir ubirch-project-template-build
cd ubirch-project-template-build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../ubirch-arm-toolchain/cmake/ubirch-arm-gcc-toolchain.cmake
make

If that worked, you compiled the project template successfully for the ubirch1r02 board. In case your target is a different board, just run the cmake command again as follows:

# generate the makefiles for the FRDM-K82F board
cmake .. -DBOARD=FRDM-K82F -DCMAKE_TOOLCHAIN_FILE=../ubirch-arm-toolchain/cmake/ubirch-arm-gcc-toolchain.cmake

Currently available boards are: ubirch1r02, FRDM-K82F, FRDM-KL82Z

Attention
Unless you want to change the target board, you should not need to run cmake again. Just run make as it takes care of changed settings.

Flashing

Flashing the resulting code is also supported by make:

make ubirch-template-flash

Depending on your selected board the toolchain will try to use the default flashing method:

  • ubirch1r02 - Flashing via USB using the blhost
  • FRDM-K82F/FRDM-KL82Z - Flashing via CMSIS-DAP (mounted directoy)

Debugging

Debugging requires an external Debug Probe. We use a SEGGER JLink and its GDB server together with GDB. Debugging requires to attach the debug probe to the corresponding JTAG (SWD) pins on board and starting the GDB server:

For more convenient debugging, install CGDB (available via brew install and apt-get).

In this example we start the GDB server attached to our ubirch1r02 or the FRDM-K82F board.

JLinkGDBServer -if SWD -speed 4000 -device MK82FN256xxx15

The toolchain provides a make target which outputs the debugger commandline which you can then just cut and paste into the terminal to start debugging:

make ubirch-template-gdb

Happy debugging!

Additional Information

The toolchain libraries and board specific information is available in the individual sub projects:

License

Copyright © 2016 ubirch GmbH, Author: Matthias L. Jugel

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
0