GithubHelp home page GithubHelp logo

mcd500 / riscv-badge-application Goto Github PK

View Code? Open in Web Editor NEW

This project forked from antmicro/riscv-badge-application

0.0 1.0 0.0 13 KB

RISC-V Electronic Badge open source software Zephyr RTOS application

Home Page: http://badge.antmicro.com

CMake 0.87% C 99.13%

riscv-badge-application's Introduction

RISC-V Electronic Badge application

Cloning the repository

The application is based on the Zephyr RTOS. The code of the Zephyr RTOS is referenced as a submodule. In order to clone the repository and its sudmodules run the following command:

$ git clone --recursive https://github.com/antmicro/riscv-badge-application.git

Building the application

Prerequisites

In order to build the application and link it against the Zephyr RTOS, the Zephyr SDK has to be installed in the system. To install the Zephyr SDK, do the following:

$ wget https://github.com/zephyrproject-rtos/meta-zephyr-sdk/releases/download/0.9.2/zephyr-sdk-0.9.2-setup.run
$ chmod +x zephyr-sdk-0.9.2-setup.run
$ ./zephyr-sdk-0.9.2-setup.run

Zephyr itself requires some additional tools to be installed in the system. Follow the Zephyr documentation for requirements.

Building

To build the application you need to setup a build environment. To do this, source the zephyr-env.sh file from the zephyr directory.

$ source zephyr/zephyr-env.sh

Additionally, three environment variables have to be set before building the app:

$ export ZEPHYR_GCC_VARIANT="zephyr"
$ export ZEPHYR_SDK_INSTALL_DIR="/opt/zephyr-sdk" #assuming default sdk install directory
$ export BOARD="hifive1"

The next step is to create a make environment:

$ cd badge_fe310/
$ mkdir -p build && cd build
$ cmake ../

To build the application, simply run make:

$ make -j`nproc`

The resulting binary is located in the build/zephyr directory under zephyr.elf.

Binary deployment

The device can be programmed using the JTAG interface via an FTDI based adapter. The FTDI adapter is a part of the module, so no additional hardware is required.

Installing the freedom-e-sdk

In order to upload the application to the Badge device, SiFive's Freedom-E-SDK is required. Download and installation instructions can be found in the SDK's GitHub repository.

Uploading

With the SDK installed, you can connect to the board using OpenOCD with the configuration file from the utils directory. To establish an OpenOCD connection, switch to the utils directory and run:

# assuming that the openocd executable's location is in PATH
$ sudo openocd -f openocd_quad.cfg

Leave it running, and in a different terminal, use GDB to upload the binary to the board. Use the RISC-V GDB from SiFive's Freedom-E-SDK toolchain.

Before loading, the device's flash protection has to be disabled. In order to load the binary to the device, run the following commands in the GDB terminal:

$ gdb
(gdb) set remotetimeout 240
(gdb) target extended-remote localhost:3333
(gdb) monitor reset halt
(gdb) monitor flash protect 0 64 last off
(gdb) load {path to repository}/build/zephyr/zephyr.elf
(gdb) monitor resume

Connecting to the board

The board uses a quad USB chip, so it will show up in the system as four tty devices. Zephyr standard output will launch on the third interface. Use your favorite com terminal (e.g. picocom) to connect with the board. The default baud rate is 115200.

riscv-badge-application's People

Contributors

kgugala avatar mcd500 avatar pkatarzynski avatar

Watchers

 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.