Tag Archives: firmware

ESP32 – IDF Sdk with Eclipse

After configuring the IDF development environment in the previous article

ESP32 – IDF Sdk

let’s see now how to use Eclipse as IDE for code development. Instructions are available at the link

Eclipse Setup

Download the  C/C++ Eclipse  for Linux

Eclipse Download

Unpack the file and move it to /opt/

Run ecplise

Set the workspace for eclipse

eclipse-workspaceOnce the IDE is open, select File -> Import -> C / C ++ – -> Existing Code as Makefile Project

eclipse-importPress Next; on the next screen select the folder containing the Makefile of a sample project in the “Existing Code Location” field and choose CrossGcc as “Toolchain for indexer settings” as shown below

eclipse-import2Once the project is loaded, using the mouse right button on the project name, select the properties option

eclipse-project-propertiesUnder C / C ++ Build -> Envinronment add the variable

eclipse-batchAdd the IDF_PATH variable pointing to the downloaded IDF SDK in the same section

eclipse-idf-pathEdit the PATH variable and add the path to the bin folder of the cross compiler /home/sviluppo/Esp32/espressif/esp/xtensa-esp32-elf/bin

eclipse-pathAccess “C / C ++ General” -> “Preprocessor Include Paths”; choose the Providers tab and click on “CDT Cross GCC Built-in Compiler Settings”

eclipse-cross-cdtReplace $ {COMMAND}

eclipse-cross-cdt1with xtensa-esp32-elf-gcc

eclipse-cross-cdt2Choose now, always in the providers section,  “CDT GCC Build Output Parser”

eclipse-cross-cdt3and insert at the beginning of the “Compiler command pattern” xtensa-esp32-elf-

eclipse-cross-cdt4Save the configurations.

The project settings should always be made by make menuconfig in the unix shell. Access the shell and set the LED to be switched on/off  the value 2 as GPIO; this is because in our case the card is a doit whose design is illustrated in this document


Access to Example configuration

blink-configurationand set the gpio value to 2

blink-gpioSave the configuration. Go back to Eclipse and proceed with cleaning with

eclipse-clean-blinkand subsequent compilation with Project -> Build

eclipse-build-blinkTo run firmware flash from eclipse;, select the project and with the right button choose Build Targets -> Create …

eclipse-create-targetEnter flash as value in the target name field, leaving everything else as default

eclipse-create-target-flashAt this point we proceed to upload the image by double-clicking on the new flash item within the project targets

eclipse-run-flashThe settings to run the flash must be set with make menuconfig, as seen in the previous article

 

ESP32 – IDF Sdk

This article describes how to set the Espressif development environment for the ESP32.

From the link to the resources for the soc

https://www.espressif.com/en/products/hardware/esp32/resources

we access the guide for compiling the firmware on the Windows, OSX and Linux platforms

http://esp-idf.readthedocs.io/en/latest/get-started/index.html

In this article we use Linux Debian 9 as operating system, configured as described previously  here

MicroPython – Python ib embedded devices

We  use the IDF github. On Debian 9, with the user used to connect to the system, we create  the Esp32 folder under the user’s Home and  the espressif folder inside it

Install the prerequisites

Download the cross compiler

Create the esp folder and unpack the toolchain

Add the bin folder of the cross compiler to the PATH

Add the user used for the operations to the dialout group

Clone the IDF repository from  $HOME/Esp32/espressif

Add the IDF_PATH environment variable

Create the project folder under $HOME/Esp32/espressif and copy an example from di IDF examples

Run the configuration

Access Serial flasher config -> and set the connection parameters; in our case we leave the default

idf-serial_flasher-engSave the configuration and build the firmware

To upload the firmware on the device run

To upload only the application run

while to build only the application run

To run the program monitor run

hello_world-engHere are the other examples available with sdk

https://github.com/espressif/esp-idf/tree/f586f5e/examples

The following link contains the references of the IDF API

http://esp-idf.readthedocs.io/en/latest/api-reference/index.html

You can also generate documentation from the github source. Go into  ~/Esp32/espressif/esp-idf/docs/en

Install the prerequisites

Generate documentantion in html format

make-html-eng

The documentation is available under  _build / html.

In the next article we will configure Eclipse as IDE  to build our applications

ESP32 -IDF Sdk with Eclipse

 

ESP32 – Nodemcu firmware compiling

After  the compilation of the MicroPython firmware for ESP32

ESP32 – MicroPython compiling for ESP32

this article shows how to generate the Nodemcu firmware for the ESP32 MCU.

The firmware is not yet complete as the one existing for ESP8266.

The instructions can be found on the github at the link

https://github.com/nodemcu/nodemcu-firmware/tree/dev-esp32

The compilation documentation is available at the link

https://nodemcu.readthedocs.io/en/dev-esp32/en/build/

The operating system used is Debian 9 previously encountered for the esptool and Adafruit-ampy utilities

MicroPython – Python on embedded devices

Log on  with the operating system user on Debian 9, sviluppo in our case; under the home folder  create the Esp32 folder and inside this folder the  nodemcu  folder

Clone the repository

To update the cloned repository follow the description on the compilation link, i.e.

Go into  nodemcu-firmware-esp32 folder and run

nodemcu-settingsEnable the bluetooth  in Component config–>Bluetooth

nodemcu-bluetoothEnable various modules in Component config–>Nodemcu modules

nodemcu-modulesIn the flash settings we set the default values for our ESP32,  Serial flasher config->

nodemcu-flashSave the configuration and exit. To build the firmware run

At the end of the compilation the command to upload the firmware  is shown; the same operation is executed  by simply running

For informations about the partitions of the various ESP32 versions, refer to the documentation

http://api-guides/partition-tables.html

In the next article we’ll  show how to make an application using the Espressif SDK

ESP32 – IDF Sdk

ESP32 – MicroPython compiling for ESP32

We begin now a series of articles about the Espressif ESP32 MCU

ESP32 Wifi-Bluetooth Module

After having analyzed in the previous articles  MicroPython  for ESP8266, in this we start to treat MicroPython on ESP32.

The following shows how to generate the MicroPython image from the source code for the ESP32 board.

The operating system is Debian 9, previously encountered for the esptool and Adafruit-ampy utilities

MicroPython – Python on embedded devices

Log on  with the operating system user on Debian 9, sviluppo in our case; under the home folder  create the Micropython folder and inside this folder the  esp32 folder

The MicroPython source code is available at the following link

Github Micropython

Instructions to build the firmware for the ESP32 are available at the link

MicroPython esp32

Clone the repository

Go into  micropython/ports/esp32 folder

Run

The command releases the git hash for the supported espidf

At the time of our compilation the result is as follows

Go into  /home/sviluppo/Micropython/esp32 folder and clone ESPIDF

Checkout with the hash obtained above

Run

We follow the instructions at the link

Cross compiler

to install the cross compiler; install the prerequisites for building

Download the cross compiler

Create the  esp folder under /home/sviluppo/Micropython/esp32

Unpack the cross compiler in esp

Add the binary folder of the cross compiler to the PATH envinronment variable

Go into the following folder

and create the makefile file with the following code inside

Go into the micropython folder available in /home/sviluppo/Micropython/esp32

Run

to add external dependencies.

Next step is the MicroPython cross compiler build

Finally we can build the ESP32  firmware with the following commands

The firmware is generated under ports/esp32/build with the name firmware.bin.

Proceed to load the firmware with the commands

In our case, the firmware upload was successful with the command

It is also possible to load the firmware.bin image with the commands

where  /dev/ttyXXX is replaced with the actual serial port to which we connect the ESP32 board.

In the next article we’ll compile the nodemcu firmware for ESP32

ESP32 – Nodemcu firmware compiling

MicroPython – MicroPython compiling for ESP8266 with additional modules

After the firmware build of the MicroPython firmware for esp8266 in the previous article

MicroPython – MicroPython compiling for ESP8266

we now show how build a module inside the firmware; this option optimizes the module execution and minimizes the size of the same on the device; the module is frozen into the firmware.

With the firmware compiled with the defaults, the following modules are available, listed in the REPL console with the command

standardmodulesNow let’s try to compile the firmware with the mqtt modules already inside. For this purpose, the module sources are copied to the umqtt folder under modules

umqttfolderWe proceed to recompile the firmware. From micropython/ports/esp8266 we run the following commands

We can see from the compilation log, that these modules are placed in the frozen state

frozenmodulesAfter uploading this firmware we obtain the following list of modules inside the firmware

firmwarewithmodulesIt is also possible to create the firmware with the modules not compiled and optimized, by copying the sources in the scripts folder under esp8266; in the specific case the sources must be placed as shown below

The modules are always visible in the firmware, but not optimized, so if you need some module it is convenient to copy it on the device during the coding  and in the last phase of the project compile the firmware with the frozen modules.

 

 

MicroPython – MicroPython compiling for ESP8266

After using in some examples the MicroPython firmware on the ESP8266 board

MicroPython – Nodes examples with DHT11, Relay and MQTT

this article shows how to generate the MicroPython firmware for the ESP8266 board.

The operating system used for this task is Debian 9, already encountered when we analyzed  the esptool utility

MicroPython – Python on embedded devices

Log on  with the operating system user on Debian 9, sviluppo in our case; under the home folder  create the Micropython folder and inside this folder the  esp8266 folder

The MicroPython source code is available at the following link

Github Micropython

Instructions to build the firmware for the ESP8266 are available at the link

MicroPython esp8266

Clone the repository

Download the cross compiler, as described here

Cross compiler

As indicated in the link above, download the source of the cross compiler always from the folder esp8266

Install the prerequisites for building

Proceed to the build of the cross compiler with the following commands

At the end of the build add the binary folder of the cross compiler to the PATH envinronment variable

Go into the micropython folder available under ~/Micropython/esp8266

Run

to add external dependencies.

Next step is the MicroPython cross compiler build

Finally we can build the ESP8266 firmware with the following commands

The firmware is generated under ports/esp8266/build folder with the name firmware_combined.bin.

Proceed to load the firmware with the command

where  /dev/ttyXXX is repalced with the actual serial port to which we connect the ESP8266 board.

In our case, the firmware upload was successful with the command

It is also possible to load the firmware_combined.bin image with the command

In the next article we’ll  analyze how to build the MicroPython firmware adding into the image additional MicroPython modules

MicroPython – MicroPython compiling for ESP8266 with additional modules

OctoPrint installation on Orange PI PC – Python package installation

This article describes how to enable the Orange PI PC board to work as 3d printers network server.

A  software that provides this functionality is OctoPrint

OctoPrint

From the OctoPrint site we can download an image for Raspberry PI with the system already ready; in the case of the Orange PI PC we have  to install and configure OctoPrint on a Linux image.

You can also use a Linux image available for Orange PI PC and run the steps related to OctoPrint package installation, but you have to check the prerequisites for Octoprint python package installation.

We instead built for this article an image using the Armban scripts.

As a first step, prepare the micro sd card with an Armbian image. In the specific case, we’ll use a Debian Jessie image created using the Armbian script, as indicated on the link

Armbian building

and described also in a previous article

Building Armbian image for Orange PI PC

We followed these steps to build the Armbian image on Ubuntu Xenial 16.04; from  a Linux command shell

In the building options choose

armbianopipcfosWe selected the default kernel configuration

armbianopipckernelChoose an Orange PI PC board

armbianopipcboardWe used the mainline kernel

armbianopipcmlkerneland Debian Jessie as distribution

armbianopipcjessieWe built an image with desktop envinronment

armbianopipcjessiedeAfter this option, the script proceeds to the compilation. The generated image is Armbian_5.34_Orangepipc_Debian_jessie_next_4.13.12_desktop.img. This image can be downloaded from the link

Armbian image for Orange Pi PC

Start Armbian and create the user for the Jessie image; in this case we choose octoprint/password as user.

If necessary, reconfigure the keyboard with the command

and proceed to upgrade the system

If the system needs to be configured via a wireless connection, the connection must be active at startup. For this purpose in our case we used the Wicd daemon

Wicd Debian

Remove the network-manager package

This command uninstalls network-manager and network-manager-gnome.

Check that the wireless interface is not present in

/etc/network/interfaces

Proceed to Wicd installation

Check that the octoprint user is present in the netdev group

In our case it is already present, giving as a result

netdev-group

If not present, add it with the command

Start  wicd

Logon to the armbian graphic desktop and start the wireless configuration with the command

wicd-client

Configure and save the network connection from the graphical interface.

If you want the remote desktop follow the steps listed in the article

Remote desktop setup for Armbian on Orange PI PC

We can now install Octoprint. Follow the steps available at the link

OctoPrint installation on Linux

Install the prerequisites

Create under /opt the octoprint folder and assign the ownership  to octoprint

In a Linux shell command go to /opt/octoprint  folder and download the software

Run

Create the  .octoprint folder

Add  octoprint to the following groups  to manage the 3d printer using the USB port

Check  the correct installation by running the command

The OctoPrint server can be reached on port 5000 at the IP address of Orange PI PC

http://ipaddress:5000

octoprinttest

Install the Cura Engine at this point; place yourself in the octoprint user’s home and download the source package

Unpack the package

Go into  the unpacked folder

Run  the compilation with the command

The compiled software is located under the build folder

curaengineCreate the /opt /octoprint/cura folder and copy the CuraEngine file to this folder

The executable is now in the /opt/octoprint/cura folder and will be used later by OctoPrint.

In the next article we’ll treat how to configure OctoPrint’s automatic startup

OctoPrint Autostart

Enigma 2 – How to read the contents of an image

In the previous article

OpenaATV Enigma2 image compilation

we built an Enigma2 image.

This shows how to view the content  of an Enigma2 image.

As an example we will always use the image for Zgemma H2H.

In a Linux environment, Debian 8 in our case, download the image to a folder, for example enigma2

enigma2 imageIn a terminal unzip it with the command

In the unpacked folder we have several files

rootfsWhat we are interested in is rootfs.bin.

The command

provides informations about the file type. In the case of rootfs.bin

ubithe command indicates that this is an image with ubi filesystem.

Now install the memory technology device utilities as the first step. In a terminal run

To view the contents run

The file  content is now visible under /mnt/ ubifs

ubimountTo unmount the filesystem run

Finally to  detach the UBI from the mtd device use the command

Below the links to find more informations about mtd and ubi filesystem

UBIFS

Linux MTD UBIFS

Libreelec8 addon building for Orange PI PC

In the article about the Libreelec8 build for Orange PI PC

Libreelec8 in OrangePI PC

we created the environment and compiled the Libreelec8 image for our development board. We integrate what it has been said in the previous article showing how to build  the Libreelec 8 addons for our Orange PI PC board.

Now we proceed to build some addons. The packages that you can build are available in the kodi-binary-addons folder as shown below

libreelec8 addonsand in the packages/addons folder

addons packages

We build the  pvr.iptvsimple addon running the following command from the /home/sviluppo/orangepi/libreelec/libreelec-8.0 folder

addon command

We build the proftpd addon, among those avaliable in the packages/addons  folder

The compiled addons are available in the following folder

addons

Here are the links to download some compiled addons

PVR addons

Service Addons

Libreelec8 in OrangePI PC

This article describes the steps that I ran to prepare a first version of Libreelec 8 in Orange PI PC cards and other H3 socs.

Starting from the Debian development envinronment, with its installed packages, already used for the compilation of OpenELEC 7

 Openelec compilation for Orange PI PC

we proceed to build an Libreelec 8 image.

We started as basis from the work done for Openelec 7 and Libreelec 7 available on the two github repositories

H3 Openelec 7 Github

H3 Libreelec 7 Github

Log in a unix command shell as user sviluppo; create a folder, libreelec , under orangepi folder and move into it

Clone the Libreelec8 github

The patches have been created for a specific version of the commit, so we align our github clone to that version

Download from the following link the patches, the H3 project and other stuff

H3 Libreelec 8

Unzip this file in /home/sviluppo/orangepi/libreelec

Run the following steps

1)Copy  to /home/sviluppo/orangepi/libreelec/libreelec-8.0/projects the folder

H3

2) Copy to /home/sviluppo/orangepi/libreelec/libreelec-8.0/packages/multimedia  the folders

cedarx
libmpeg2

3) Copy to /home/sviluppo/orangepi/libreelec/libreelec-8.0/packages/tools the folder

sunxi-tools

4) Copy to /home/sviluppo/orangepi/libreelec/libreelec-8.0/packages/sysutils  the folder

  sunxi-sys-utils

5) Copy to /home/sviluppo/orangepi/libreelec/libreelec-8.0/packages/graphics  the folder

sunxi-mali

6) Copy to /home/sviluppo/orangepi/libreelec/libreelec-8.0/packages/linux-drivers  the folder

mt7601u

7)  The following patches are available in /home/sviluppo/orangepi/libreelec/H3LE8/patches folder

linux.patch

image.patch

mkimage.patch

kodi.patch

libcec.patch

u-boot.patch

u-boot-release.patch

u-boot-update.patch

Patch the code from the /home/sviluppo/orangepi/libreelec folder running the following commands

Proceed to the image build for Orange PI PC from the folder /home/sviluppo/orangepi/libreelec/libreelec-8.0  running

At the end of the compilation in the /home/sviluppo/orangepi/libreelec/libreelec-8.0/target folder we find the files to install or update Libreelec 8

 At the link

Openelec 7 H3 FAQ

we find the boards we can build changing the SYSTEM parameter in the building command

SYSTEM=opi2
SYSTEM=opione
SYSTEM=opipc
SYSTEM=opiplus
SYSTEM=opilite
SYSTEM=opipcplus
SYSTEM=opiplus2e
SYSTEM=bpim2p
SYSTEM=bx2

This image is a first attempt to build Libreelec 8 for  H3  socs. The image was installed on Orange PI PC and the system worked well, but still bugs and malfunctions may occur.

Here is the built Libreelec 8 image for Orange PI PC

Orange PI PC Libreelec 8 Image

We tested this image on an Orange PI PC board.

Here are other images we did’t test on the devices

Orange Pi2 Libreelec 8 Image

Orange Pi Lite Libreelec 8 Image

Orange Pi One Libreelec 8 Image

Orange Pi PC Plus Libreelec 8 Image

Orange Pi Plus Libreelec 8 Image

Orange Pi Plus 2e Libreelec 8 Image

WARNING: The image installation on the device is at your own risk. We accept no responsibility if the installation leads to  malfunction or block of the device.

The following article shows how to build the addons

Libreelec 8 addon building for Orange PI PC