This is a cache of https://www.96boards.org/documentation/iot/carbon/build/linux/build-disco.md.html. It is a snapshot of the page at 2024-12-21T02:42:05.875+0000.
How to build the disco <strong>zephyr</strong> application from source - Linux Host - 96Boards

How to build the disco zephyr application from source - Linux Host

These instructions can be used to build a simple ‘disco’ demo using a Linux host machine as a development environment. The demo assumes that 2 LEDs are connected to GPIO outputs of the MCU/board. The sample code is configured to work on Carbon, with LEDs connected to PA15 and PB5 pins.

After startup, the program looks up a predefined GPIO devices, and configures the GPIO pins in output mode (LEDs). During each iteration of the main loop, the state of GPIO lines will be changed so that one of the lines is in high state, while the other is in low, thus switching the LEDs on and off in an alternating pattern.

Once running, you should see the USR1 (green) and BT (blue) LEDs blinking, like a disco :-)


  • Step 0: Download and setup zephyr
  • Step 1: Build a sample application in zephyr
  • Step 2: Proceed to Installation page for flashing instructions

####Step 0: Download and setup zephyr

  • Download and setup the zephyr development environment from https://www.zephyrproject.org. You can find more information about installing the zephyr SDK at https://www.zephyrproject.org/doc/getting_started/getting_started.html
$ git clone https://gerrit.zephyrproject.org/r/zephyr

####Step 1: Build the zephyr disco application

Build the sample shell application as follows:

$ cd zephyr
$ source zephyr-env.sh
$ cd samples/basic/disco
$ mkdir outdir; cd outdir
$ cmake -DBOARD=96b_carbon ..
$ make

Step 2: Flashing

  • Connect the micro-USB cable to the OTG port
  • Press the BOOT0 switch and hold
  • While holding BOOT0 switch, also press the RST switch (At this point you should be pressing two switches)
  • Release the RST switch, then release the BOOT0 switch.
$ sudo make flash

Proceed to Installation page for legacy flashing instructions

The application will be available at samples/basic/disco/outdir/96b_carbon/zephyr.bin.

Proceed to flash the zephyr application binary over USB-UART or USB-DFU. Host machine specific flashing instructions can be found on the “Installation” page, link found below.