Code Monkey home page Code Monkey logo

libtock-c's Introduction

Build Status irc

Tock Userland

This directory contains libraries and example applications for developing Tock apps that sit above the kernel.

Prerequisites

  1. If you have not yet done so, it might be a good idea to start with the TockOS getting started guide, which will lead you through the installation of some tools that will be useful for developing and deploying applications on TockOS. In particular, it will give you a rust environment (required to install elf2tab) and tockloader, which you need to deploy applications on most boards.

    And it will of course give you a board with TockOS installed which you can use to run the applications found in this repository.

    So, if you haven't been there before, just head over there until it sends you back here.

  2. Clone this repository.

    $ git clone https://github.com/tock/libtock-c
    $ cd libtock-c
    
  3. The main requirement to build the C applications in this repository is a cross compiler for embedded targets. Currently, the only supportetd target is ARM Cortex M, so you will need an arm-none-eabi toolchain.

    MacOS:

    $ brew tap ARMmbed/homebrew-formulae && brew update && brew install arm-none-eabi-gcc
    

    Ubuntu (18.04LTS or later):

    $ sudo apt install gcc-arm-none-eabi
    

    Ubuntu (before 18.04):

    $ sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa && sudo apt update && sudo apt install gcc-arm-embedded
    
  4. You will also need an up-to-date version of elf2tab. The build system will install and update this automatically for you, but you'll need Rust's cargo installed. If you have followed the getting started guide, everything should be in place.

  5. You will also likely need Tockloader, a tool for programming apps onto boards. If you haven't installed it during the TockOS getting started guide:

    MacOS:

    $ pip3 install tockloader
    

    Ubuntu:

    $ pip3 install tockloader --user
    

Compiling and Running Applications

To compile all the examples, switch to the examples directory and execute the build script:

$ cd examples
$ ./build_all.sh

This will install elf2tab if it is not yet installed and compile all the examples for cortex-m0, cortex-m3, and cortex-m4. It does this because the compiler emits slightly different instructions for each variant. When installing the application, tockloader will select the correct version for the architecture of the board being programmed.

The build process will ultimately create a tab file (a "Tock Application Bundle") for each example application. The tab contains the executable code for the supported architectures and can be deployed to a board using tockloader. For example to one of the Nordic development boards:

$ tockloader install --board nrf52dk --jlink blink/build/blink.tab
Installing apps on the board...
Using known arch and jtag-device for known board nrf52dk
Finished in 2.567 seconds

You can remove an application with

$ tockloader uninstall --board nrf52dk --jlink blink

or remove all installed applications with

$ tockloader uninstall --board nrf52dk --jlink

Tock applications are designed to be generic and run on any Tock-compatible board. However, compiled applications typically depend on specific drivers, which not all boards provide. For example, some applications expect an IEEE 802.15.4 radio interface which not all boards support. If you load an application onto a board that does not support every driver/system call it uses, some system calls will return error codes (ENODEVICE or ENOSUPPORT).

Next Steps

The next step is to read the overview that describes how applications in TockOS are structured and then look at some of the examples in detail. The description of the compilation environment may also be of interest.

License

Licensed under either of

at your option.

Contributions

We welcome contributions from all. We use the bors-ng bot to manage, approve, and merge PRs. In short, when someone replies bors r+, your PR has been approved and will be automatically merged. If a maintainer replies bors delegate+, then you have been granted the authority to mark your own PR for approval (usually this will happen if there are some trivial changes required). For a full list of bors commands, see the bors documentation.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

libtock-c's People

Contributors

alevy avatar ppannuto avatar bradjc avatar niklasad1 avatar hudson-ayers avatar phil-levis avatar brghena avatar bors[bot] avatar adkinsjd avatar bbbert avatar daniel-scs avatar cmcavity avatar fhars avatar alexandruradovici avatar amilich avatar alistair23 avatar tobiasschaffner avatar nealjack avatar jaykickliter avatar cpluss avatar dverhaert avatar ahl avatar vagabond avatar dieracdelta avatar jrvanwhy avatar joshtriplett avatar jiashuoz avatar mwilbur avatar torfmaster avatar haoyifan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.