Konubinix' opinionated web of thoughts

Microcontroller Board Programming

Fleeting

How to build and upload programs to microcontrollers

The tooling with depend on:

the microcontroller
the compiler needs to know how to build for it,
the board
the tool needs to be able to discuss with its components,

In general, there is one specific microcontroller for a specific board, so we can focus of the later.

tooling

espressif/esptool: Espressif SoC serial bootloader utility

Arduino IDE 2

flashing

This is the process of uploading the program that will run in the microcontroller. It contains the whole code, the bootloader and the code you built.1

bootloader

The part for the code that does the lowlevel stuff (initializing the clock, upgrade the firmware, etc) before running the higher level program.

languages

You can either build the source code to target the microcontroller directly or upload an interpreter built for it and run a program written in a higher level language directly on the controller2.

that can target directly the microcontroller

C++ arduino library

firmware based: higher level languages that are interpreted by a firmware that needs to be installed

Note that you cannot install several of them.3

micropython

  • External reference: https://micropython.org/ MicroPython - Python for microcontrollers

    MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments.

    https://micropython.org/

nodemcu/nodemcu-firmware: Lua based interactive firmware for ESP8266, ESP8285 and ESP32

Notes linking here


  1. #+BEGIN_QUOTE Bootloaders can have many functionalities, but it’s mainly used to manage the application. They can also utilize different protocols such as UART, CAN, I2C, I2S, Ethernet, or USB to establish communication and initial a firmware upgrade ↩︎

  2. Technically speaking NodeMCU is a firmware for ESP8266 developed using C Programming Language, Espressif NON-OS SDK and Lua scripting language.

    Traditionally, we write code for our Microcontrollers like Arduino, STM32, 8051 etc., either in C or C++ and compile it with a set of tools and generate a binary file. This binary file is then uploaded into the flash memory of the microcontroller and it gets executed.

    Things are quite different with NodeMCU. You can consider the NodeMCU firmware as an interpreter for Lua Scripts. So, if your ESP8266 is loaded with NodeMCU Firmware, you can simply write your application in Lua and send it to the ESP8266.

    https://www.electronicshub.org/getting-started-with-nodemcu/

     ↩︎
  3. IMPORTANT NOTE: Only one firmware can exist on the ESP8266. It can be either AT Commands Firmware, NodeMCU Firmware or Arduino based code. Once you upload an Arduino sketch, the NodeMCU firmware gets erased. If you want to work with Lua Scripts and NodeMCU, then you have to flash the NodeMCU Firmware.

    https://www.electronicshub.org/getting-started-with-nodemcu/

     ↩︎