Skip to content

Compiling and development environment setup

Asif Sardar edited this page Mar 9, 2015 · 27 revisions

It is often very confusing with multiple compilers when working with embedded systems. Hence, it would be very good to write few words on the compilation environment, creating very clear instructions how to compile the board-native binaries with arm-gcc cross compiler and how to compile the emulator with i386-gcc native compiler.

The desktop and embedded software development setup environment for Linux (32 & 64 bit) is discussed in the sections below.

  • Pre-requisites and software dependencies
  • Path setup
  • Git cloning
  • Desktop software compiling and development
  • Embedded software compiling and development

Pre-requisites and software dependencies

Compiling the emulator binaries with the i386-gcc native compiler may need 32-bit Linux Dependencies.

Compiling the board-native binaries with the arm-gcc cross compiler may need the following packages:

  • gcc-arm-4.8.x
  • stm32flash

The already compiled and binaries for these can be downloaded from gcc-arm-4.8.x and stm32flash.

Path setup

When you install packages either with Synaptic Package Manager or CLI, the path is added to the PATH environment variable by default. However, for manual installations or already built and downloaded packages, the path should be added to the PATH environment variable explicitly using export PATH= as follows:

export PATH=${PATH}:/absolute/path/to/gcc-arm-4.8.x/bin/
export PATH=${PATH}:/absolute/path/to/stm32flash/

To add these to the PATH environment variable persistently on each login session in terminal/bash login session, please add the above lines to ~/.bashrc file and save it.

Git cloning

For more information on git please refer to Git Tutorial. This section describes cloning the above repository structure into your local machine:

cd ~
mkdir Ell-i
cd Ell-i
git clone [email protected]:Ell-i/Runtime.git

Target boards

Currently, Ell-i runtime has support for the following hardware boards:

  • ellduino
  • stm32f4discovery
  • stm32f334nucleo

Desktop software compiling and Emulator

To build and compile emulator, open the terminal/bash login session and go to the build folder in Runtime

cd Runtime/stm32/build

Then execute:

make sketch.cpp
make PLATFORM=emulator VARIANT=<board-name>

where board-name is one of the above mentioned supported boards.

To build test cases, go to folder:

cd Runtime/stm32/tests/robot_library/
make PLATFORM=emulator VARIANT=<board-name>

where board-name is one of the above mentioned supported boards.

Now, the emulator is built and the librobot_library.so dynamic shared library can be used in Robot Framework Test Scripts using 32-bit Python ctypes module.

Embedded software compiling and Hardware Board

To build and compile sketch.cpp which may contain code for supported-board i.e. header file stm32f0xx.h for stm32f0xx , arduino header files for Arduino API and C code for accessing the peripherals and registers, open the terminal/bash login session and go to the build folder in Runtime

cd Runtime/stm32/build

Then execute:

make sketch.cpp
make PLATFORM=hardware VARIANT=<board-name>

where board-name is one of the above mentioned supported boards.

This will create binaries for the board in the Runtime/build/hardware/ folder. The .hex file can be uploaded to the supported-board using the stm32flash software. For uploading the .hex file to the supported-board, please connect the supported-board to Linux machine via USB and open the terminal/bash login session. Then execute:

sudo chmod 666 /dev/ttyUSB0
stm32flash -w <path-to-binaries-folder>/sketch.hex -v -g 0 /dev/ttyUSB0

This will upload the .hex file to the supported-board.