In the root of the project folder, we find this Makefile. It contains a number of settings that we may want to set to suit our purposes:
Name |
Description |
COM_PORT |
If we always connect the board to the same serial port, we can hardcode it here to save ourselves some typing. |
SPI_MODE |
This sets the SPI mode used while flashing the firmware images to the SPI ROM. With dio only two data lines (SD_D0, D1) or four (SD_D0-3). Not all SPI ROMs have all four data lines connected. The qio mode is faster, but dio should always work. |
RBOOT_ENABLED |
When set to 1, this enables rBoot bootloader support. We want this enabled. |
RBOOT_BIG_FLASH |
With 4 MB of ROM available, we wish to use all of this. Enable this as well. |
RBOOT_TWO_ROMS |
This option can be used if we wish to place two firmware images in a single 1 MB ROM chip instead. This applies to some ESP8266 modules and derivatives. |
SPI_SIZE |
Here, we set the size of the SPI ROM chip, which should be 4M for this project. |
SPIFF_FILES |
The location of the folder containing the files that will be put on the SPIFFS ROM image that will be written to the MCU. |
SPIFFS_SIZE |
The size of the SPIFFS ROM image to create. Here, 64 KB is standard, but we could use up to 1 MB if we needed to when using a 4 MB ROM with the RBOOT_BIG_FLASH option enabled. |
WIFI_SSID |
The SSID of the Wi-Fi network that we wish to connect to. |
WIFI_PWD |
The password for the Wi-Fi network. |
MQTT_HOST |
The URL or IP address of the MQTT server (broker) to use. |
ENABLE_SSL |
Enable this with SSL support compiled into Sming to make the firmware use TLS-encrypted connections with the MQTT broker. |
MQTT_PORT |
The port of the MQTT broker. This depends on whether SSL is enabled. |
USE_MQTT_PASSWORD |
Set to true if you wish to connect to the MQTT broker with a username and password. |
MQTT_USERNAME |
The MQTT broker username, if required. |
MQTT_PWD |
The MQTT broker password, if required. |
MQTT_PREFIX |
A prefix you can optionally add in front of each MQTT topic used by the firmware, if necessary. It has to end with a slash if not left empty. |
OTA_URL |
The hardcoded URL that will be used by the firmware whenever an OTA update is requested. |
Of these, the Wi-Fi, MQTT, and OTA settings are essential, as they will allow the application to connect to the network and MQTT broker, as well as receive firmware updates without having to flash the MCU over its serial interface.