546cc47121
* bmp180: comment typo * ds3231: minor code style fixes. Comment, on the week day start. * Reverse engineered ets_timers.o Switch from FreeRTOS queue to task notification. Removed unknown/unused code. Rename sdk_ets_handler_isr to process_pending_timers. Add function for microseconds Simplify time to ticks conversion * ets_timer: code for using the FreeRTOS timers, and remove from libs. * libc: update to a recent newlib version. * LwIP v2 support * spi_write: use uint32_t for the page iteration counter. The page counter was using an uint8_t which seems unnecessary and might wrap. * sysparam_get_bool: memcpy the binary values out. * FreeRTOS 9.0.1 * Add an argument to ISRs. Disable interrupts while masking them. * sysparam: reserve one more flash sector before placing the sysparams. This is to help work with recent SDKs that add a RF cal sector by default in the fifth last sector - just so the sysparam sectors do not jump around when using different SDK versions. * upnp example: strip down the lwipopts.h file * sysparam editor: accept newline to end a line of input. * Add Wificfg. Uses the sysparam store to save the wifi configuration. Adds a basic http server for configuration. * lwip: disable the tcpip_core_locking_input option. With this option enabled some lwip input processing occurs in the pp task which works well for some uses but some code uses a lot of stack (e.g. mdns) and will overflow the pp task stask, or might unnecessarily slow the critical pp task, so disable this by default and if not already defined. * sdk_cnx_add_rc: fix overflow of the table, when no match is found. Also adds source code for sdk_cnx_rc_search, adding a null pointer dereference. Check (that is not expected to be seen), and source code for sdk_cnx_remove_rc. * http_get example: fix compilation with ipv6 disabled. * lwip: update to master branch. * wificfg: allow the AP channel to be 1. * lwip: rework the tcp ooseq handling. It now accounts for the number of rx pool buffers used and the available memory when deciding the number of ooseq buffers to retain. Enable the TCP Selective ACK support which appears to help a lot on lossy wifi when using the OOSEQ option. * Update lwip, fixes losses of pcbs and associated problems. * lwip: revise the tcp ooseq limit calulations. Was making a mess of the calculation sign. Also added a COPY_PP_RX_PBUFS define to include appropriate limits for this option. * lwip: ooseq_max_bytes() - set a practical target memory size. * lwip: revise ooseq handling. Modified for lwip backwards compatibility based on upstream feedback. * lwip: update to the 2.0.3 release * lwip: merge upstream master. * libc: update to upstream master. * lwip: fix building without TCP_QUEUE_OOSEQ |
||
---|---|---|
bootloader | ||
core | ||
examples | ||
extras | ||
FreeRTOS | ||
include | ||
ld | ||
lib | ||
libc | ||
lwip | ||
open_esplibs | ||
tests | ||
utils | ||
.dir-locals.el | ||
.gitignore | ||
.gitmodules | ||
.travis.yml | ||
code_of_conduct.md | ||
common.mk | ||
LICENSE | ||
parameters.mk | ||
README.md |
esp-open-rtos
A community developed open source FreeRTOS-based framework for ESP8266 WiFi-enabled microcontrollers. Intended for use in both commercial and open source projects.
Originally based on, but substantially different from, the Espressif IOT RTOS SDK.
Resources
Email discussion list: https://groups.google.com/d/forum/esp-open-rtos
IRC channel: #esp-open-rtos on Freenode (Web Chat Link).
Github issues list/bugtracker: https://github.com/superhouse/esp-open-rtos/issues
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Quick Start
-
Install esp-open-sdk, build it with
make toolchain esptool libhal STANDALONE=n
, then edit your PATH and add the generated toolchainbin
directory. The path will be something like/path/to/esp-open-sdk/xtensa-lx106-elf/bin
. (Despite the similar name esp-open-sdk has different maintainers - but we think it's fantastic!)(Other toolchains may also work, as long as a gcc cross-compiler is available on the PATH and libhal (and libhal headers) are compiled and available to gcc. The proprietary Tensilica "xcc" compiler will probably not work.)
-
Install esptool.py and make it available on your PATH. If you used esp-open-sdk then this is done already.
-
The esp-open-rtos build process uses
GNU Make
, and the utilitiessed
andgrep
. If you built esp-open-sdk then you have these already. -
Use git to clone the esp-open-rtos project (note the
--recursive
):
git clone --recursive https://github.com/Superhouse/esp-open-rtos.git
cd esp-open-rtos
- To build any examples that use WiFi, create
include/private_ssid_config.h
defining the two macro defines:
#define WIFI_SSID "mywifissid"
#define WIFI_PASS "my secret password"
- Build an example project (found in the 'examples' directory) and flash it to a serial port:
make flash -j4 -C examples/http_get ESPPORT=/dev/ttyUSB0
Run make help -C examples/http_get
for a summary of other Make targets.
(Note: the -C
option to make is the same as changing to that directory, then running make.)
The Build Process wiki page has in-depth details of the build process.
Goals
- Provide professional-quality framework for WiFi-enabled RTOS projects on ESP8266.
- Open source code for all layers above the MAC layer, ideally lower layers if possible (this is a work in progress, see Issues list.
- Leave upstream source clean, for easy interaction with upstream projects.
- Flexible build and compilation settings.
Current status is alpha quality, actively developed. AP STATION mode (ie wifi client mode) and UDP/TCP client modes are tested. Other functionality should work. Contributors and testers are welcome!
Code Structure
examples
contains a range of example projects (one per subdirectory). Check them out!include
contains header files from Espressif RTOS SDK, relating to the binary libraries & Xtensa core.core
contains source & headers for low-level ESP8266 functions & peripherals.core/include/esp
contains useful headers for peripheral access, etc. Minimal to no FreeRTOS dependencies.extras
is a directory that contains optional components that can be added to your project. Most 'extras' components will have a corresponding example in theexamples
directory. Extras include:- mbedtls - mbedTLS is a TLS/SSL library providing up to date secure connectivity and encryption support.
- i2c - software i2c driver (upstream project)
- rboot-ota - OTA support (over-the-air updates) including a TFTP server for receiving updates (for rboot by @raburton)
- bmp180 driver for digital pressure sensor (upstream project)
FreeRTOS
contains FreeRTOS implementation, subdirectory structure is the standard FreeRTOS structure.FreeRTOS/source/portable/esp8266/
contains the ESP8266 port.lwip
contains the lwIP TCP/IP library. See Third Party Libraries wiki page for details.libc
contains the newlib libc. Libc details here.
Open Source Components
- FreeRTOS V9.0.0
- lwIP v2.0.3, with some modifications.
- newlib v2.5.0, with patches for xtensa support and locking stubs for thread-safe operation on FreeRTOS.
For details of how third party libraries are integrated, see the wiki page.
Binary Components
Binary libraries (inside the lib
dir) are all supplied by Espressif as part of their RTOS SDK. These parts were MIT Licensed.
As part of the esp-open-rtos build process, all binary SDK symbols are prefixed with sdk_
. This makes it easier to differentiate binary & open source code, and also prevents namespace conflicts.
Espressif's RTOS SDK provided a "libssl" based on axTLS. This has been replaced with the more up to date mbedTLS library (see below).
Some binary libraries appear to contain unattributed open source code:
- libnet80211.a & libwpa.a appear to be based on FreeBSD net80211/wpa, or forks of them. (See this issue).
- libudhcp has been removed from esp-open-rtos. It was released with the Espressif RTOS SDK but udhcp is GPL licensed.
Licensing
-
BSD license (as described in LICENSE) applies to original source files, lwIP. lwIP is Copyright (C) Swedish Institute of Computer Science.
-
FreeRTOS is provided under the GPL with the FreeRTOS linking exception, allowing non-GPL firmwares to be produced using FreeRTOS as the RTOS core. License details in files under FreeRTOS dir. FreeRTOS is Copyright (C) Real Time Engineers Ltd.
-
Source & binary components from the Espressif IOT RTOS SDK were released under the MIT license. Source code components are relicensed here under the BSD license. The original parts are Copyright (C) Espressif Systems.
-
Newlib is covered by several copyrights and licenses, as per the files in the
libc
directory. -
mbedTLS is provided under the Apache 2.0 license as described in the file extras/mbedtls/mbedtls/apache-2.0.txt. mbedTLS is Copyright (C) ARM Limited.
Components under extras/
may contain different licenses, please see those directories for details.
Contributions
Contributions are very welcome!
-
If you find a bug, please raise an issue to report it.
-
If you have feature additions or bug fixes then please send a pull request.
-
There is a list of outstanding 'enhancements' in the issues list. Contributions to these, as well as other improvements, are very welcome.
If you are contributing code, please ensure that it can be licensed under the BSD open source license. Specifically:
-
Code from Espressif IoT SDK cannot be merged, as it is provided under either the "Espressif General Public License" or the "Espressif MIT License", which are not compatible with the BSD license.
-
Recent releases of the Espressif IoT RTOS SDK cannot be merged, as they changed from MIT License to the "Espressif MIT License" which is not BSD compatible. The Espressif binaries used in esp-open-rtos were taken from revision ec75c85, as this was the last MIT Licensed revision.
For code submissions based on reverse engineered binary functionality, please either reverse engineer functionality from MIT Licensed Espressif releases or make sure that the reverse engineered code does not directly copy the code structure of the binaries - it cannot be a "derivative work" of an incompatible binary.
The best way to write suitable code is to first add documentation somewhere like the esp8266 reverse engineering wiki describing factual information gained from reverse engineering - such as register addresses, bit masks, orders of register writes, etc. Then write new functions referring to that documentation as reference material.
Coding Style
For new contributions in C, please use BSD style and indent using 4 spaces.
For assembly, please use the following:
- Instructions indented using 8 spaces.
- Inline comments use
#
as a comment delimiter. - Comments on their own line(s) use
/*
..*/
. - First operand of each instruction should be vertically aligned where possible.
- For xtensa special registers, prefer
wsr aX, SR
overwsr.SR aX
If you're an emacs user then there is a .dir-locals.el file in the root which configures cc-mode and asm-mode (you will need to approve some variable values as safe). See also the additional comments in .dir-locals.el, if you're editing assembly code.
Upstream code is left with the indentation and style of the upstream project.
Sponsors
Work on parts of esp-open-rtos has been sponsored by SuperHouse Automation.