Menu

Getting Started

Aloysius Indrayanto

Getting Started


AVR and/or NodeMCU build toolkit and SDK are needed to build eCxx. The easiest method is to install an Arduino IDE. For NodeMCU, you will need to install an additional package (please refer to Getting Started with NodeMCU ESP8266 on Arduino IDE for more details).

To start building eCxx library and its test applications and firmwares, simply edit the Makefile.config[.*] files to reflect your build environment. After that, simply type make to see the available targets.

Please refer to MAKEFILE_CONFIGURATION_VARIABLES for some explanation about configuration variables within the makefiles.

Major Namespace Names

  • eCxx - the primary namespace of eCxx
  • eCxx::Ext - classes and functions that use dynamic memory allocation as well as other auxiliary features (such as color constants, etc.)

  • eCxx::placeholders - placeholders for eCxx::bind<>()

  • eCxx::argument_selectors - argument selectors for eCxx::OutputFormatter's format dispatchers (specifiers)

  • eCxx::TZ - timezone name constants

  • eCxx::AVR - platform specific namespace for AVR and AVRX platforms
  • eCxx::NodeMCU - platform specific namespace for NodeMCU platforms

Namespace Names for Literal Operators

The literal operators are defined within their own namespaces. Therefore, the C++ using-directives will be needed to bring them to the active scope before using:

using namespace eCxx::program_string_literals;

using namespace eCxx::string_view_ram_string_literals;
using namespace eCxx::string_view_program_string_literals;

using namespace eCxx::string_ip_literals;
using namespace eCxx::string_uuid_literals;

using namespace eCxx::unsigned_string_literals;
using namespace eCxx::output_formatter_string_literals;

using namespace eCxx::fixed_point_literals;
using namespace eCxx::decimal_floating_point_literals;

using namespace eCxx::binary_constant_literals;
using namespace eCxx::hexadecimal_constant_literals;

Some of the string literal operators will only be available if the corresponding macros are defined. Please refer to
FEATURE_MACROS for more details.

Troubleshooting Errors Like "make: *** No rule to make target '<???>.cpp', needed by 'build/<???>.cpp.d'. Stop."

Try if executing this command twice fixes the problem:

make fdepend -k

Using AVR Device Pack (AVR DFP) for Newer AVR MCUs

Please download the latest ATmega series device pack from Microchip Packs Repository and extract (unzip) it to a base directory named Atmel.ATmega_DFP.x.x.xxx.

The base directory should then be placed inside one of this locations:

/usr
/usr/share
/etc
/usr/local
/usr/local/share
/usr/local/etc
/opt
/home/<user_name>
/home/<user_name>/Arduino
/home/<user_name>/arduino
/home/<user_name>/.arduino
/home/<user_name>/.arduino/packages

Troubleshooting Errors Like "/dev/ttyACM0: Device or resource busy"

Due to eCxx uses free shared USB VID/PID pair for CDC devices (VID=0x16C0 ; PID=0x05E1) from USB IDs for free, on Linux machines with ModemManager installed, the device may show up as busy for ~15 seconds while modem manager tries to decide if its a modem. To disable this, you can add a custom UDEV rule:

echo 'ATTRS{idVendor}=="16c0" ATTRS{idProduct}=="05e1", ENV{ID_MM_DEVICE_IGNORE}="1"' >> \
/etc/udev/rules.d/99-ttyacms.rules

udevadm control --reload-rules

Troubleshooting Baudrate Mismatch between the Target MCU and the Arduino Micro in the JTAG2UPDI_Serial_Bridge_Micro_ProMini Board

Upon power-on (plugged to a host PC's USB port), the hardware UART of the Arduino Micro will be set to the default baudrate of 57600 bps.

If the serial device has been opened using a different baudrate by the host PC, and then the board is unplugged and plugged back to the host PC, the OS may not know that the baudrate has been reset to 57600 bps. In this case, the serial console may connect with a mismatched baudrate. To fix this, simply start the serial console with a different baudrate, close it, and start it again using the intended baudrate.


ESP8266 GPIO Behavior at Boot

When ESP8266 is booting, some of its GPIOs will output pulses. It may even fail to boot if some of the GPIOs are pulled low or high during the booting phase. For more information, please refer to:

This behavior may cause problems to and from the attached peripherals. This is why eCxx's NodeMCU development board has 74LVC541 buffers for those GPIOs. The buffers must be activated manually from within the user code (as shown in some of the test applications).

Because the buffers' outputs will be in high impedance when they are inactive, noise may affect the attached peripherals. This problem can be solved by adding pull-up or pull-down resistors for those outputs. However, the eCxx's NodeMCU development board does not have this resistors onboard because it cannot possibly know if the attached peripherals will need to be pulled high or low during the booting phase.

Using Custom Xtensa LX106 GCC

Please download the GCC package matching your host PC's architecture from ESP8266 Quick Toolchain.

Extract the package and put its main directory to one of this locations:

/opt
/usr/local
/usr/share

If using custom Xtensa LX106 GCC with newlib 4.0.0, please set the USE_NEWLIB variable in the file Makefile.config.nodemcu (or Makefile.shadow.config to auto or 1); otherwise, it will fail to build.

Please note that newlib 4.0.0 is binary incompatible with the previous releases because of time_t size change. Therefore, do not mix code compiled using the new library with code compiled using the previous releases.

Troubleshooting Errors Like "/lib64/libstdc++.so.6: version 'GLIBCXX_3.4.21' not found" when Executing "mklittlefs"

The "mklittlefs" utility requires at least GLIBCXX version 3.4.21 which is included with GCC version
5.1.0 and later.

In case your system has multiple GCC installations, setting the LD_LIBRARY_PATH environment variable
would solve the problem; for example:

export LD_LIBRARY_PATH=/opt/gcc-5.3.0/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/gcc-7.5.0/lib64:$LD_LIBRARY_PATH

In case of 32-bit system, replace "lib64" with "lib".

Espressif AT Firmware for WiFi Modules

The original firmware of ESP-01 (or other compatible modules) with 1 MB of flash can backed up using this command (please adjust the parameter for ESP8266 module with different flash size):

esptool.py --port /dev/ttyUSB0 --baud 460800 read_flash 0x000000 0x100000 orig_fw.bin

The firmware can later be restored using this command (please adjust the parameter for ESP8266 module with different flash size):

esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash -fs 1MB -ff 40m 0x000000 orig_fw.bin

The latest Non-OS firmware (version 1.7.4, at the time this document was written) for ESP-01 (or other compatible modules) with 1 MB of flash can be downloaded from:

The Non-OS firmware can then be uploaded using this command:

esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash -fs 1MB -ff 40m \
    0x000000 bin/boot_v1.7.bin                   \
    0x001000 bin/at/512+512/user1.1024.new.2.bin \
    0x07E000 bin/blank.bin                       \
    0x081000 bin/at/512+512/user2.1024.new.2.bin \
    0x0FB000 bin/blank.bin                       \
    0x0FC000 bin/esp_init_data_default_v08.bin   \
    0x0FE000 bin/blank.bin

The latest RTOS firmware (version 2.2.0, at the time this document was written) for ESP-01 (or other compatible modules) with 1 MB of flash can be downloaded from:

The RTOS firmware can then be uploaded using this command:

esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash -fs 1MB -ff 40m \
    0x000000 bootloader/bootloader.bin                           \
    0x008000 partition_table/partition-table.bin                 \
    0x009000 ota_data_initial.bin                                \
    0x020000 esp-at.bin                                          \
    0x018000 at_customize.bin                                    \
    0x019000 customized_partitions/factory_param_ESP8266_1MB.bin \
    0x01A000 customized_partitions/client_cert.bin               \
    0x01B000 customized_partitions/client_key.bin                \
    0x01C000 customized_partitions/client_ca.bin                 \
    0x01D000 customized_partitions/mqtt_cert.bin                 \
    0x01E000 customized_partitions/mqtt_key.bin                  \
    0x01F000 customized_partitions/mqtt_ca.bin

On the other hand, the latest RTOS firmware (version 2.2.0, at the time this document was written) for ESP8266 (or other compatible modules) with 2 MB of flash can be downloaded from:

The RTOS firmware can then be uploaded using this command:

esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash -fs 2MB -ff 40m \
    0x000000 bootloader/bootloader.bin                                   \
    0x008000 partition_table/partition-table.bin                         \
    0x009000 ota_data_initial.bin                                        \
    0x010000 esp-at.bin                                                  \
    0x0F0000 at_customize.bin                                            \
    0x0F1000 customized_partitions/AT2_esp8266_factory_param_tx1rx3.bin  \
    0x0F8000 customized_partitions/client_cert.bin                       \
    0x0FA000 customized_partitions/client_key.bin                        \
    0x0FC000 customized_partitions/client_ca.bin                         \
    0x104000 customized_partitions/mqtt_cert.bin                         \
    0x106000 customized_partitions/mqtt_key.bin                          \
    0x108000 customized_partitions/mqtt_ca.bin

After uploading the default UART baudrate should have been set to 115200 bps.


[Home]


Related

Wiki: Home