# Getting Started

<hr>

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](https://create.arduino.cc/projecthub/electropeak/getting-started-w-nodemcu-esp8266-on-arduino-ide-28184f) 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 [README.CONFIG](https://sourceforge.net/p/ecxx/code/HEAD/tree/trunk/README.CONFIG) for some explanation about configuration variables within the makefiles.

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:

~~~c++
using namespace eCxx::fixed_point_literals;
using namespace eCxx::program_string_literals;
~~~

The program string literals will only be available if the **ECXX_HAVE_PROGRAM_STRING_LITERALS** macro is defined.

Troubleshooting Errors Like "make: \*\*\* No rule to make target '&lt;???&gt;.cpp', needed by 'build/&lt;???&gt;.cpp.d'. Stop."
---

Try if executing this command twice fixes the problem:

~~~bash
make fdepend -k
~~~

<hr>

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

Please download the latest ATmega series device pack from [Microchip Packs Repository](http://packs.download.atmel.com) 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:

~~~bash
/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](https://github.com/obdev/v-usb/blob/master/usbdrv/USB-IDs-for-free.txt), 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:

~~~bash
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.

<hr>

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:

+ [ESP8266 GPIO Behaviour at Boot](https://rabbithole.wwwdotorg.org/2017/03/28/esp8266-gpio.html)
+ [ESP8266 Pinout Reference](https://randomnerdtutorials.com/esp8266-pinout-reference-gpios)

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 can not 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](https://github.com/earlephilhower/esp-quick-toolchain/releases).

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

~~~bash
/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 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:

~~~bash
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".

<hr>

## [Home]
