Introduction to ESP8266 Native Development
1.Introduction to the ESP8266
The ESP8266EX from Espressif Systems is a highly integrated Wi-Fi capable microcontroller that integrates a low power, high performance 32-bit core. The ESP8266 features a lot of the common peripherals that are found in commonly used microcontrollers. To summarize everything that the ESP8266 contains, here is a simple block diagram:
2.Features of the ESP8266
The chip integrates the following hardware peripherals:
- 2 x UART
- 1 x I2C
- 1 x I2S
- 1 x SDIO SLAVE
- 1 x 10-bit ADC
- 2 x SPI
- n x GPIO
Apart from these, the ESP8266 also contains precision timer modules, power management circuitry, and RAM and cache for program execution and storage.
Do note that there is no code flash memory or EEPROM embedded in the ESP8266 itself. It must use an external SPI flash memory chip to run programs from and to read/write non-volatile data as required.
3.ESP8266 vs Generic 32-bit MCUs
4.About ESP8266 Peripherals
5.Introduction to Espressif Development Tools
Espressif Systems provides development tools for every stage of the product development cycle. You may develop your native ESP8266 programs based on one of Espressif’s two SDKs: RTOS SDK and nonOS SDK. The sources based on these SDKs are compiled using the xtensa GCC compiler as the ESP8266 is built around an Xtensa LX106 core.
After compiling the code, .BIN files and .S files are generated. The BIN files need to be downloaded into ESP8266 flash memory so that the code can be executed. The S file helps in tracing causes of fatal exceptions.
6.Introduction to ESP8266 Development Boards
7.Introduction to ESP8266 nonOS SDK
For the fans of bare-metal programming, without an operating system, Espressif provides a nonOS SDK. As the name suggests, the SDK does not have an underlying operating system to manage tasks and resources. The user is responsible for intended sequential execution of the program.
However, as a network connected device must attend to real-time network events, the program execution cannot always be sequential and defined. In the ESP8266 nonOS SDK interrupts are handled internally in the SDK core functions and the SDK just calls the registered callback functions when an event needs to be addressed. Thus, real time response is achieved by registering callback functions during runtime.
Unlike the RTOS SDK, there are no limitations as to what amount of stack or heap space you can use in a function.
8.Introduction to ESP8266 RTOS SDK
The ESP8266 RTOS SDK is based on FreeRTOS. A networking chip must deal with a lot of real time events and tasks. The main reason for having an RTOS based SDK is that it provides developers with the ability to model the application as a bunch of real time, simultanously active threads that execute when there is data to process or just run in parallel.
There are certain limitations to using ESP8266 RTOS SDK for programming your applications, especially related to stack usage depth of your RTOS tasks. This may limit the functionality of your code in some cases.