This project is a lua
rtos
sdk, based on ESP32-RTOS-SDK/ESP8266_RTOS_SDK, for esp8266/esp32.
The hardware is provided by www.doit.am.
Our Kickstarter campaign is alive: https://www.kickstarter.com/projects/857552561/luanode-for-esp8266-and-esp32 . If you back for it, we will be very appreciated!
LuaNode-master
-->LuaNode_Esp32
-->bin
-->components
-->apps
-->luaapp
-->task
-->wifikiller
-->driver
-->include
-->libc
-->lua
-->modules
-->platform
-->extra_include
-->include
-->ld
-->lib
-->third_party
-->tools
-->LuaNode_Esp8266
-->The structure is almost the same as that of esp32
-
bin
contains blank.bin, boot.bin. -
components
contains all components the project needed, including driver, modules, and lua source, etc. -
extra_include
contains the extra head files for this project. -
include
is a directory that contains head files for this project. -
third_party
contains head files for the libraries used, such as freertos, in this project. -
ld
contains the link files. -
lib
contains some libraries to be linked when bin file generated. -
tools
contains some useful tools.
Note that the wifikiller app only support ESP8266.
The following tools are required, use apt-get
to install them.
- GNU autoconf, libtool, libtool-bin
- GNU flex, bison, gawk,
- libexpat1-dev
We utilize VirtualBox (VB) with Ubuntu installed as build environment. If your OS is Linux, you can also setup the build environment according the following steps:
-
- Download and install VirtualBox-5.0.16-105871-Win (You'd better install the latest version, since I found that the older version such as 4.x cannot install the VB Guest Additions)
-
- Download ubuntu-15.10-desktop-amd64.iso and install it on VB. Make sure that asign more than 1G RAM and 12G Hard Disk for this virtual machine. The tool chain build process require much memory!
-
- Setup share file folder: Settings->Share Folders->Add new shared folder, input your share folder path and the select
Make Permanent
, Note thatdo not
select Auto Mount. Launch Ubuntu and then create a folder to mount the share folder, I create a folder, namedshare
, in the path /mnt. Type the commond in the terminal to mount share folder:
- Setup share file folder: Settings->Share Folders->Add new shared folder, input your share folder path and the select
sudo mount -t vboxsf share /mnt/share
Note: if you mount failed, check whether the module vboxsf
is exist by executing commond lsmod | grep vboxsf
. If nothing found, maybe the Guest Additions
are not installed correctly. Try to install that again or upgrade your VirtualBox to the latest version.
-
- Download toolchain: Before downloading, make sure that the
git
has been installed, if not, install it bysudo apt-get install git
. I create path/opt/Espressif
and then install to sdk to it, then make the current user the owner:sudo chown $USER /opt/Espressif/
; Execute the following commond to download toolchain:
- Download toolchain: Before downloading, make sure that the
cd /opt/Espressif/
git clone -b esp108-1.21.0 git://github.com/jcmvbkbc/crosstool-NG.git
-
- Install toolchain: Before installing, make sure that all the required tools list in
Requirements
are installed on your virtual machine. Type the following commands to build the toolchain.
- Install toolchain: Before installing, make sure that all the required tools list in
cd crosstool-NG
./bootstrap && ./configure --prefix=`pwd` && make && make install
./ct-ng xtensa-esp108-elf
./ct-ng build
Note: if your machine is not enough memory, the error such as Build failed in step: 'installing pass-2 core C compiler'
may occur. The following screenshot shows the error:
-
- After installing the toolchain, export the bin path by the following commond, then you can build your source on your machine!
export PATH=/opt/Espressif/crosstool-NG/builds/xtensa-esp108-elf/bin:$PATH
Now that you can place your source in the share folder, build it with your virtual machine.
Build App
:
- Create a directory, say LuaNode, and then clone the LuaNode project to it:
git clone --recursive https://github.com/Nicholas3388/LuaNode.git
- Create a Bin folder for LuaNode, say LuaNode_Bin, you should place LuaNode_Bin and LuaNode_Esp32 at the same directory.
- Modify the gen_misc.sh, setup the following three variables: SDK_PATH, BIN_PATH, and APP_NAME. SDK_PATH is the path of LuaNode_Esp32; BIN_PATH is the path of LuaNode_Bin; APP is the path of the application that you want to build. The apps you can build is in the apps folder.
- Start to build by input
./gen_misc.sh
in your shell.
- System requiement: RAM>1G; Hard Disk>10G
- Setup the build environment as that on Windows:)
- Download and install VirtualBox for Mac
- Assign memory > 1G and hard disk > 12G for the virtual machine
- Setup the build environment as that on Windows:)
Requirements:
The required tools are the same as those list in the section How To Build for ESP8266
. But the firmware for ESP32 utilize different toolchain.
-
Follow the Step 1~3 list in
How To Build for ESP32
. -
Create a new directory for toolchain by executing the commond:
sudo mkdir /opt/esp-open-sdk
. Download the latest toolchain:
git clone --recursive https://github.com/pfalcon/esp-open-sdk.git /opt/esp-open-sdk
-
Install the toolchain (If you are not in the toolchain directory now, change directory first
cd /opt/Espressif/
): 'make STANDALONE=y' -
Setup PATH variable:
export PATH=/opt/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
Note: You have to export PATH again if you restart the shell. If you don't want to reqeat this step, you
can place the toolchain directory to the .bashrc file.
If you prefer IDE, such as Eclipse
, you can also build the firmware with Eclipse. To setup Eclipse, follow the steps list below:
-
- Download and install the Unofficial Development Kit for Espressif ESP8266
-
- Download and install the Java Runtime x86 (jre-7uXX-windows-i586.exe)
-
- Download and install Eclipse Mars x86 to develop in C++ (eclipse-cpp-mars-R-win32.zip). Unpack the archive to the root of drive C.
Note: You should place the Eclipse under the path C:, since the install-mingw-package.bat
run in step 5 will search the path. If install-mingw-package.bat run failed, it may
probably you didn't place Eclipse in C:
-
- Download and install MinGW. Run the downloader mingw-get-setup.exe,
the installation process to select without GUI, ie uncheck "... also install support for the graphical user interface"
.
- Download and install MinGW. Run the downloader mingw-get-setup.exe,
-
- Run from the file
install-mingw-package.bat
. He will establish the basic modules for MinGW, installation should proceed without error.
- Run from the file
-
- Start the Eclipse Luna from the directory c:\eclipse\eclipse.exe
-
- In Eclipse, select File -> Import -> General -> Existing Project into Workspace, in the line Select root directory, select the directory C:\Espressif\examples and import work projects. Further, the right to select the Make Target project, such as hello-world and run the target All the assembly, while in the console window should display the progress of the build. To select the target firmware flash.
Now that you can build firmware using Eclipse, if you have any questions, go to ESP8266 Community Forum
, read this post for details.
- Setup as that in Windows VirtualBox
- Setup as in Windows
You can download the windows flash tool HERE. This tool is official Espressif flash tool.
You can also use esptool
to flash the bin files on Linux, instead of Espressif flash tool.
I use SecureCRT to monitor the output from UART0. When you try to utilize this tool, you should setup serial as bellow:
Note: In the Session Options, you must uncheck XON/XOFF, otherwise, you won't be able to input anything via serial!
To set break points and debug code, maybe you can use GDBSTUB.
task
: This is a sample to show how to create an os task. Build the example by executing the gen_misc.sh.
How to create a task:
void task1(void *pvParameters) {
// do something
}
void user_init(void) {
xTaskCreate(task1, (signed char *)"tsk1", 256, &mainqueue, 2, NULL);
}
-
luaapp
: A lua sample. -
wifikiller
: An wifi sample. Set baud rate to 115200pbs, using UART0. It will disconnect WiFi connection.
A funny application is to utilize Luanode and Esp32/Esp8266 to create a Wifi tank. You can control the tank via app installed on your phone. The Luanode run on Esp32/Esp8266 and wait for the commands sent from phone, and then drives the motor on tank to move it on.
The hardware contains: T300 Tank Chassis, Esp8266 Development Kit, 720p HD Camera, WR703N Wireless Router.
A video on Youtube to illustrate how to control the tank via phone.
Another video on Youku, a Chinese video website, to illustrate the features of the tank.
When you are trying to compile esp-open-sdk or build your firmware, you may face some errors as below.
- configure: error: missing required tool: makeinfo
Install texinfo
by running the following commond to fix it:
sudo apt-get install texinfo
- cannot create autom4te.cache
This is a permission problem, change the permission of directory esp-open-sdk/ to 777. Input the following commond on terminal:
sudo chmod 777 -R /opt/esp-open-sdk
- configure: error: could not find GNU awk
sudo apt-get install gawk
- configure: error: could not find GNU libtool >= 1.5.26
sudo apt-get install libtool
If it dosen't work, install libtool-bin:
sudo apt-get install libtool-bin
- configure: error: could not find curses header, required for the kconfig frontends
sudo apt-get install libncurses5-dev
- configure: error: expat is missing or unusable
sudo apt-get install libexpat1-dev
- configure: error: could not find GNU automake >= 1.10
sudo apt-get install automake
- When you compile the esp-open-sdk, occurs some errors like the following screenshot:
Just ignore it, execute make STANDALONE=y
again, it will be ok then.
Wei Wang
: He got his master's degree from Guilin University of Electronic Technology in 2012. He has more than 4 years work experience on Embedded System.
DOIT
(www.doit.am): DOIT is a high-tech company, who focus on IoT technology and open source hardware. He supports this project and provides hardware for this project. Its successful products include WifiMCU, Doit Video Car, and Wifi sniffer, etc.
If you have any question, you can contact me via Email/QQ list below, Thanks:)
Email
: nicholas3388@gmail.comQQ
: 535873968Homepage
: www.apparduino.com
2016.4.7 Modified lbaselib.c
2016.4.19 Modified code structure
-
esp-open-sdk: https://github.com/pfalcon/esp-open-sdk
-
esp-open-rtos: https://github.com/SuperHouse/esp-open-rtos
-
ESP8266_RTOS_SDK: https://github.com/espressif/ESP8266_RTOS_SDK
-
ESP32_RTOS_SDK https://github.com/espressif/ESP32_RTOS_SDK
-
FreeRTOS: http://www.freertos.org/
-
Unofficial Development Kit for Espressif ESP8266: http://programs74.ru/udkew-en.html
-
lua: www.lua.org
-
elua: www.eluaproject.net
-
DOIT: www.doit.am