Atom evironment for developing C FreeRTOS ESP8266

Atom is a powerfull texteditor for software develop. Has been create and maintained from github.It support many programming language, but not support autocomplete native for C language. We have to install some plugin to make easy develop fotware under Atom.I has try many and many plugin for make easy develop under C language, and i found i good configuration for Atom.

I use this Plugins for Atom.

Cscope

Cscope is a powerfull tool for analizze C source code, it allow programmer to search C simbols, and make very easy navigation of source code, it can handle very big project, like linux kernel without any problem.It create a binary database, where save all C simbols that find into source. Take look of animated GIF, that is more clear of one thousand words. We must also install cscope as system pakages.

Atom packages:https://atom.io/packages/atom-cscope

Installing Cscope:

For install Atom pakages, we must go into atom's pakages manager.
It can be open pressing (CTRL+MAIUS+P).
Dropdon menu will be open, into this, we must digit, 'Install' and then choose:'Setting View:Install Pakages And Themes'.

Then we search cscope.

# Ubuntu:
aptitude install cscope
# if aptitude is not installed
apt-get install cscope

#Fedora
dnf install cscope

I use this shortcut, for cscope

# keymap atom
'atom-workspace':
    'ctrl-shift-c o': 'atom-cscope:toggle'
    'ctrl-shift-c ctrl-f f': 'atom-cscope:find-symbol'
    'ctrl-shift-c ctrl-f b': 'atom-cscope:find-functions-called-by'
    'ctrl-shift-c ctrl-f g': 'atom-cscope:find-global-definition'
    'ctrl-shift-c ctrl-f c': 'atom-cscope:find-functions-calling'
    # 'ctrl-shift-z-alt-m': 'atom-cscope:find-text-string'
    'ctrl-shift-c f-s': 'atom-cscope:find-egrep-pattern'
    'ctrl-shift-c f': 'atom-cscope:find-file'
    'ctrl-shift-c f-i': 'atom-cscope:find-files-including'

First of all, we must generate database of simbols.
atom-cscope:toggle from Atom command line(CTRL+ALT+P), and then lightning icon.

AutoComplete-clang

This plugin use clang compiler for analize source code and it create a list of possible autocomplete for simbol.
If all is correct configured it return a perfect autocomplete, like visualstudio.
Take look of animated GIT, it will be more clear of one thousand words.

Atom's plugin installation is the same.

Atom packages:https://atom.io/packages/autocomplete-clang

Installing the system package

# Install clang compiler

# Ubuntu
sudo apt-get install clang

# Fedora
dnf install clang

Configuration file of autocomplete-clang

Clang need a configuration file that setup .h files paths, used by compiler. I use this configuration file, for my ESP8266 project. This file must be checked, and adapted for your configuration.

-I/opt/esp-open-sdk/sdk/include
-I/opt/esp-open-rtos/open_esplibs/include
-I/opt/esp-open-rtos/FreeRTOS/Source/include
-I/opt/esp-open-rtos/extras/cpp_support/include
-I/opt/esp-open-rtos/extras/dhcpserver/include
-I/opt/esp-open-rtos/extras/mbedtls/include
-I/opt/esp-open-rtos/extras/mbedtls/mbedtls/include
-I/opt/esp-open-rtos/lwip/lwip/src/include
-I/opt/esp-open-rtos/lwip/lwip/espressif/include
-I/opt/esp-open-rtos/lwip/include
-I/opt/esp-open-rtos/examples/http_get_mbedtls/include
-I/opt/esp-open-rtos/libc/xtensa-lx106-elf/include
-I/opt/esp-open-rtos/core/include
-I/opt/esp-open-rtos/open_esplibs/include
-I/opt/esp-open-rtos/FreeRTOS/Source/include
-I/opt/esp-open-rtos/include
-I/opt/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-cc-gcc-core-pass-2/gcc/include
-I/opt/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-cloog-host-x86_64-build_pc-linux-gnu/include
-I/opt/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-isl-host-x86_64-build_pc-linux-gnu/include
-I/opt/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-cc-gcc-final/xtensa-lx106-elf/libstdc++-v3/include
-I/opt/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-cc-gcc-final/gcc/include
-I/opt/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/build/build-ncurses-build-x86_64-build_pc-linux-gnu/include
-I/opt/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/lib/gcc/xtensa-lx106-elf/4.8.5/plugin/include
-I/opt/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/lib/gcc/xtensa-lx106-elf/4.8.5/install-tools/include
-I/opt/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/lib/gcc/xtensa-lx106-elf/4.8.5/include
-I/opt/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/include
-I/opt/esp-open-sdk/crosstool-NG/.build/xtensa-lx106-elf/buildtools/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/gcc-4.8.5/libffi/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/gcc-4.8.5/libsanitizer/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/gcc-4.8.5/libcpp/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/gcc-4.8.5/boehm-gc/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/gcc-4.8.5/libjava/classpath/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/gcc-4.8.5/libjava/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/gcc-4.8.5/libstdc++-v3/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/gcc-4.8.5/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/gcc-4.8.5/gcc/testsuite/gcc.dg/pch/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/gcc-4.8.5/gcc/testsuite/gcc.dg/cpp/usr/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/gcc-4.8.5/gcc/doc/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/Ada95/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/ncurses-6.0/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/libc/sys/xtensa/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/libgloss/bfin/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/machine/cris/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/machine/spu/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/sys/linux/machine/i386/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/sys/linux/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/sys/xtensa/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/sys/rtems/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/testsuite/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/cloog-0.18.4/isl/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/cloog-0.18.4/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/cloog-0.18.4/osl/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/gdb-7.10/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/expat-2.1.0/amiga/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/isl-0.14/include
-I/opt/esp-open-sdk/crosstool-NG/.build/src/binutils-2.25.1/include
-I/opt/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/plugin/include
-I/opt/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/install-tools/include
-I/opt/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/include
-I/opt/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include
-I/opt/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/include
-I/opt/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/include/include
-I/opt/esp-open-sdk/xtensa-lx106-elf/include
-I/opt/esp-open-sdk/esp-open-lwip/include
-I/opt/esp-open-sdk/esp-open-sdk/esp-open-lwip/include
-I/opt/esp-open-sdk/esp-open-sdk/lx106-hal/include
-I/opt/esp-open-sdk/ESP8266_NONOS_SDK_V1.5.4_16_05_20/examples/at_espconn/include
-I/opt/esp-open-sdk/ESP8266_NONOS_SDK_V1.5.4_16_05_20/examples/wps/include
-I/opt/esp-open-sdk/ESP8266_NONOS_SDK_V1.5.4_16_05_20/examples/IoT_Demo/include
-I/opt/esp-open-sdk/ESP8266_NONOS_SDK_V1.5.4_16_05_20/examples/lwip_open_src_template_proj/include
-I/opt/esp-open-sdk/ESP8266_NONOS_SDK_V1.5.4_16_05_20/examples/at/include
-I/opt/esp-open-sdk/ESP8266_NONOS_SDK_V1.5.4_16_05_20/examples/smart_config/include
-I/opt/esp-open-sdk/ESP8266_NONOS_SDK_V1.5.4_16_05_20/examples/peripheral_test/include
-I/opt/esp-open-sdk/ESP8266_NONOS_SDK_V1.5.4_16_05_20/driver_lib/include
-I/opt/esp-open-sdk/ESP8266_NONOS_SDK_V1.5.4_16_05_20/include
-I/opt/esp-open-sdk/lx106-hal/include

Build

This plugin allow programmer to launch compiling process directly from Atom. It trouth Linter plugin, it underline error line.

Atom packages:https://atom.io/packages/build

Do not need any configuration

Build-make

Build-Make allow programmer to launch make through Atom and shortcut F9

Atom packages:https://atom.io/packages/build-make

By default it do not need any configuration, but we must open atom from a shell, because it pass all environment variable to atom.
Else plugin allow configuration file, but i found it uncomfortable.

# Project in /home/user/project/TestPrj
cd /home/user/project/TestPrj
atom .

Linter

Base plugin for underline error, and all IDE feature.

Atom packages:https://github.com/steelbrain/linter