From a8b75ed974c0c2b4d8bd5b61bb3dcb4ba15e5642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lourens=20Naud=C3=A9?= Date: Sat, 31 Dec 2016 17:54:40 +0000 Subject: [PATCH 01/10] log: fix esp_log_level_set function name in docs Fix documentation and comments to reflect the new esp_log_level_set API (and not deprecated esp_log_set_level) --- components/log/README.rst | 12 ++++++------ components/log/log.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/log/README.rst b/components/log/README.rst index d378179c8..002dadf81 100644 --- a/components/log/README.rst +++ b/components/log/README.rst @@ -4,11 +4,11 @@ Logging library Overview -------- -Log library has two ways of managing log verbosity: compile time, set via menuconfig; and runtime, using ``esp_log_set_level`` function. +Log library has two ways of managing log verbosity: compile time, set via menuconfig; and runtime, using ``esp_log_level_set`` function. At compile time, filtering is done using ``CONFIG_LOG_DEFAULT_LEVEL`` macro, set via menuconfig. All logging statments for levels higher than ``CONFIG_LOG_DEFAULT_LEVEL`` will be removed by the preprocessor. -At run time, all logs below ``CONFIG_LOG_DEFAULT_LEVEL`` are enabled by default. ``esp_log_set_level`` function may be used to set logging level per module. Modules are identified by their tags, which are human-readable ASCII zero-terminated strings. +At run time, all logs below ``CONFIG_LOG_DEFAULT_LEVEL`` are enabled by default. ``esp_log_level_set`` function may be used to set logging level per module. Modules are identified by their tags, which are human-readable ASCII zero-terminated strings. How to use this library ----------------------- @@ -51,11 +51,11 @@ At component scope, define it in component makefile: CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG -To configure logging output per module at runtime, add calls to ``esp_log_set_level`` function: +To configure logging output per module at runtime, add calls to ``esp_log_level_set`` function: .. code-block:: c - esp_log_set_level("*", ESP_LOG_ERROR); // set all components to ERROR level - esp_log_set_level("wifi", ESP_LOG_WARN); // enable WARN logs from WiFi stack - esp_log_set_level("dhcpc", ESP_LOG_INFO); // enable INFO logs from DHCP client + esp_log_level_set("*", ESP_LOG_ERROR); // set all components to ERROR level + esp_log_level_set("wifi", ESP_LOG_WARN); // enable WARN logs from WiFi stack + esp_log_level_set("dhcpc", ESP_LOG_INFO); // enable INFO logs from DHCP client diff --git a/components/log/log.c b/components/log/log.c index 9670b82df..3826e173b 100644 --- a/components/log/log.c +++ b/components/log/log.c @@ -15,7 +15,7 @@ /* * Log library — implementation notes. * - * Log library stores all tags provided to esp_log_set_level as a linked + * Log library stores all tags provided to esp_log_level_set as a linked * list. See uncached_tag_entry_t structure. * * To avoid looking up log level for given tag each time message is From d8fb30c930ba10ed7054d5f8669a230d95053245 Mon Sep 17 00:00:00 2001 From: devsaurus Date: Sat, 7 Jan 2017 13:14:40 +0100 Subject: [PATCH 02/10] i2c: fix i2c_get_period name rename i2s_get_period to i2c_get_period --- components/driver/i2c.c | 2 +- components/driver/include/driver/i2c.h | 2 +- docs/api/i2c.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/driver/i2c.c b/components/driver/i2c.c index 311f01516..39eb87734 100644 --- a/components/driver/i2c.c +++ b/components/driver/i2c.c @@ -494,7 +494,7 @@ esp_err_t i2c_set_period(i2c_port_t i2c_num, int high_period, int low_period) return ESP_OK; } -esp_err_t i2s_get_period(i2c_port_t i2c_num, int* high_period, int* low_period) +esp_err_t i2c_get_period(i2c_port_t i2c_num, int* high_period, int* low_period) { I2C_CHECK(i2c_num < I2C_NUM_MAX, I2C_NUM_ERROR_STR, ESP_ERR_INVALID_ARG); I2C_ENTER_CRITICAL(&i2c_spinlock[i2c_num]); diff --git a/components/driver/include/driver/i2c.h b/components/driver/include/driver/i2c.h index 69b80b1e6..960ec61d2 100644 --- a/components/driver/include/driver/i2c.h +++ b/components/driver/include/driver/i2c.h @@ -401,7 +401,7 @@ esp_err_t i2c_set_period(i2c_port_t i2c_num, int high_period, int low_period); * - ESP_OK Success * - ESP_ERR_INVALID_ARG Parameter error */ -esp_err_t i2s_get_period(i2c_port_t i2c_num, int* high_period, int* low_period); +esp_err_t i2c_get_period(i2c_port_t i2c_num, int* high_period, int* low_period); /** * @brief set I2C master start signal timing diff --git a/docs/api/i2c.rst b/docs/api/i2c.rst index 1186e0583..2f89681f1 100644 --- a/docs/api/i2c.rst +++ b/docs/api/i2c.rst @@ -68,7 +68,7 @@ Functions .. doxygenfunction:: i2c_slave_write_buffer .. doxygenfunction:: i2c_slave_read .. doxygenfunction:: i2c_set_period -.. doxygenfunction:: i2s_get_period +.. doxygenfunction:: i2c_get_period .. doxygenfunction:: i2c_set_start_timing .. doxygenfunction:: i2c_get_start_timing .. doxygenfunction:: i2c_set_stop_timing From e5feeb195f1588ffc26a5235f21cfaaa14863385 Mon Sep 17 00:00:00 2001 From: "rudi ;-)" Date: Wed, 11 Jan 2017 21:47:38 +0100 Subject: [PATCH 03/10] sdmmc: change idx num of example --- docs/api/sdmmc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/sdmmc.rst b/docs/api/sdmmc.rst index 126be8657..e751852f9 100644 --- a/docs/api/sdmmc.rst +++ b/docs/api/sdmmc.rst @@ -15,7 +15,7 @@ Protocol layer works with the host via ``sdmmc_host_t`` structure. This structur Application Example ------------------- -An example which combines SDMMC driver with FATFS library is provided in ``examples/24_sd_card`` directory. This example initializes the card, writes and reads data from it using POSIX and C library APIs. See README.md file in the example directory for more information. +An example which combines SDMMC driver with FATFS library is provided in ``examples/27_sd_card`` directory. This example initializes the card, writes and reads data from it using POSIX and C library APIs. See README.md file in the example directory for more information. Protocol layer APIs From a2ace698edc44271d8cdcb26e9aee8d957ecda4d Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 16 Jan 2017 01:19:14 +0800 Subject: [PATCH 04/10] sdmmc: fix explanation of flash voltage regulator configuration efuses - low level on GPIO12 corresponds to 3.3V output, not 1.8V - add espefuse.py commands to burn efuses - add XPD_SDIO_REG to the list of efuses which must be set Reported on the forum: http://esp32.com/viewtopic.php?f=2&t=849&start=10#p4170 --- examples/27_sd_card/README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/examples/27_sd_card/README.md b/examples/27_sd_card/README.md index 4053ad260..bfc6a39fe 100644 --- a/examples/27_sd_card/README.md +++ b/examples/27_sd_card/README.md @@ -40,9 +40,20 @@ GPIO12 is used as a bootstrapping pin to select output voltage of an internal re - For boards which don't use the internal regulator, GPIO12 can be pulled high. - On boards which use the internal regulator and a 3.3V flash chip, GPIO12 should be pulled up high, which is compatible with SD card operation. -- For boards which use 1.8V flash chip, GPIO12 needs to be low at reset. +- For boards which use 3.3V flash chip, GPIO12 needs to be low at reset. * In this case, internal pullup can be enabled using a `gpio_pullup_en(GPIO_NUM_12);` call. Most SD cards work fine when an internal pullup on GPIO12 line is enabled. Note that if ESP32 experiences a power-on reset while the SD card is sending data, high level on GPIO12 can be latched into the bootstrapping register, and ESP32 will enter a boot loop until external reset with correct GPIO12 level is applied. - * Another option is to program flash voltage selection efuses: set `SDIO_TIEH=0` and `SDIO_FORCE=1`. This will permanently select 1.8v output voltage for the internal regulator, and GPIO12 will not be used as a bootstrapping pin anymore. Then it is safe to connect a pullup resistor to GPIO12. This option is suggested for production use. + * Another option is to program flash voltage selection efuses: set `XPD_SDIO_TIEH=1`, `XPD_SDIO_FORCE=1`, and `XPD_SDIO_REG = 1`. This will permanently select 3.3V output voltage for the internal regulator, and GPIO12 will not be used as a bootstrapping pin anymore. Then it is safe to connect a pullup resistor to GPIO12. This option is suggested for production use. + +The following commands can be used to program flash voltage selection efuses **to 3.3V**: + +```sh + # Override flash regulator configuration using efuses + components/esptool_py/esptool/espefuse.py burn_efuse XPD_SDIO_FORCE + # Select 3.3V output voltage + components/esptool_py/esptool/espefuse.py burn_efuse XPD_SDIO_TIEH + # Enable internal voltage regulator + components/esptool_py/esptool/espefuse.py burn_efuse XPD_SDIO_REG +``` ## 4-line and 1-line modes From 3efbbab2cfd4a6766c1d9ffe182d447ec58f247a Mon Sep 17 00:00:00 2001 From: Neil Kolban Date: Sun, 1 Jan 2017 23:51:48 -0600 Subject: [PATCH 05/10] wifi: fix typos, rename ESP_ERR_WIFI_NOT_START to ESP_ERR_WIFI_NOT_STARTED --- components/esp32/include/esp_wifi.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index c835c071c..197a04fd3 100755 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -76,8 +76,8 @@ extern "C" { #define ESP_ERR_WIFI_ARG ESP_ERR_INVALID_ARG /*!< Invalid argument */ #define ESP_ERR_WIFI_NOT_SUPPORT ESP_ERR_NOT_SUPPORTED /*!< Indicates that API is not supported yet */ -#define ESP_ERR_WIFI_NOT_INIT (ESP_ERR_WIFI_BASE + 1) /*!< WiFi driver is not installed by esp_wifi_init */ -#define ESP_ERR_WIFI_NOT_START (ESP_ERR_WIFI_BASE + 2) /*!< WiFi driver is not started by esp_wifi_start */ +#define ESP_ERR_WIFI_NOT_INIT (ESP_ERR_WIFI_BASE + 1) /*!< WiFi driver was not installed by esp_wifi_init */ +#define ESP_ERR_WIFI_NOT_STARTED (ESP_ERR_WIFI_BASE + 2) /*!< WiFi driver was not started by esp_wifi_start */ #define ESP_ERR_WIFI_IF (ESP_ERR_WIFI_BASE + 3) /*!< WiFi interface error */ #define ESP_ERR_WIFI_MODE (ESP_ERR_WIFI_BASE + 4) /*!< WiFi mode error */ #define ESP_ERR_WIFI_STATE (ESP_ERR_WIFI_BASE + 5) /*!< WiFi internal state error */ @@ -85,7 +85,7 @@ extern "C" { #define ESP_ERR_WIFI_NVS (ESP_ERR_WIFI_BASE + 7) /*!< WiFi internal NVS module error */ #define ESP_ERR_WIFI_MAC (ESP_ERR_WIFI_BASE + 8) /*!< MAC address is invalid */ #define ESP_ERR_WIFI_SSID (ESP_ERR_WIFI_BASE + 9) /*!< SSID is invalid */ -#define ESP_ERR_WIFI_PASSWORD (ESP_ERR_WIFI_BASE + 10) /*!< Passord is invalid */ +#define ESP_ERR_WIFI_PASSWORD (ESP_ERR_WIFI_BASE + 10) /*!< Password is invalid */ #define ESP_ERR_WIFI_TIMEOUT (ESP_ERR_WIFI_BASE + 11) /*!< Timeout error */ #define ESP_ERR_WIFI_WAKE_FAIL (ESP_ERR_WIFI_BASE + 12) /*!< WiFi is in sleep state(RF closed) and wakeup fail */ @@ -222,8 +222,8 @@ esp_err_t esp_wifi_connect(void); * * @return * - ESP_OK: succeed - * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init - * - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start + * - ESP_ERR_WIFI_NOT_INIT: WiFi was not initialized by eps_wifi_init + * - ESP_ERR_WIFI_NOT_STARTED: WiFi was not started by esp_wifi_start * - ESP_ERR_WIFI_FAIL: other WiFi internal errors */ esp_err_t esp_wifi_disconnect(void); @@ -246,7 +246,7 @@ esp_err_t esp_wifi_clear_fast_connect(void); * @return * - ESP_OK: succeed * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init - * - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start + * - ESP_ERR_WIFI_NOT_STARTED: WiFi was not started by esp_wifi_start * - ESP_ERR_WIFI_ARG: invalid argument * - ESP_ERR_WIFI_MODE: WiFi mode is wrong */ @@ -266,7 +266,7 @@ esp_err_t esp_wifi_deauth_sta(uint16_t aid); * @return * - ESP_OK: succeed * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init - * - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start + * - ESP_ERR_WIFI_NOT_STARTED: WiFi was not started by esp_wifi_start * - ESP_ERR_WIFI_TIMEOUT: blocking scan is timeout * - others: refer to error code in esp_err.h */ @@ -278,7 +278,7 @@ esp_err_t esp_wifi_scan_start(wifi_scan_config_t *config, bool block); * @return * - ESP_OK: succeed * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init - * - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start + * - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start */ esp_err_t esp_wifi_scan_stop(void); @@ -292,7 +292,7 @@ esp_err_t esp_wifi_scan_stop(void); * @return * - ESP_OK: succeed * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init - * - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start + * - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start * - ESP_ERR_WIFI_ARG: invalid argument */ esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number); @@ -307,7 +307,7 @@ esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number); * @return * - ESP_OK: succeed * - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by eps_wifi_init - * - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start + * - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start * - ESP_ERR_WIFI_ARG: invalid argument * - ESP_ERR_WIFI_NO_MEM: out of memory */ From 4b71d9cb351666ae6405f85b48da1c5b0197b934 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 16 Jan 2017 01:48:47 +0800 Subject: [PATCH 06/10] docs: update index, improve structure of the readme --- README.md | 44 ++++++++++++++++++++++++-------------------- docs/index.rst | 10 +++------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 5290aa798..64fe3ed36 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,36 @@ -# Using Espressif IoT Development Framework with the ESP32 +# Espressif IoT Development Framework [![alt text](https://readthedocs.org/projects/docs/badge/?version=latest "Documentation Status")](http://esp-idf.readthedocs.io/en/latest/?badge=latest) -# Setting Up ESP-IDF +ESP-IDF is the official development framework for the `ESP32 `_ chip. -In the [docs](docs) directory you will find per-platform setup guides: +# Developing With the ESP-IDF -* [Windows Setup Guide](docs/windows-setup.rst) -* [Mac OS Setup Guide](docs/macos-setup.rst) -* [Linux Setup Guide](docs/linux-setup.rst) +## Setting Up ESP-IDF -# Finding A Project +See setup guides for detailed instructions to set up the ESP-IDF: -As well as the [esp-idf-template](https://github.com/espressif/esp-idf-template) project mentioned in the setup guide, esp-idf comes with some example projects in the [examples](examples) directory. +* [Windows Setup Guide](http://esp-idf.readthedocs.io/en/latest/windows-setup.html) +* [Mac OS Setup Guide](http://esp-idf.readthedocs.io/en/latest/macos-setup.html) +* [Linux Setup Guide](http://esp-idf.readthedocs.io/en/latest/linux-setup.html) -Once you've found the project you want to work with, change to its directory and you can configure and build it: +## Finding a Project -# Configuring your project +As well as the [esp-idf-template](https://github.com/espressif/esp-idf-template) project mentioned in the setup guide, ESP-IDF comes with some example projects in the [examples](examples) directory. + +Once you've found the project you want to work with, change to its directory and you can configure and build it. + +## Configuring the Project `make menuconfig` -# Compiling your project +## Compiling the Project `make all` ... will compile app, bootloader and generate a partition table based on the config. -# Flashing your project +## Flashing the Project When `make all` finishes, it will print a command line to use esptool.py to flash the chip. However you can also do this from make by running: @@ -36,7 +40,7 @@ This will flash the entire project (app, bootloader and partition table) to a ne You don't need to run `make all` before running `make flash`, `make flash` will automatically rebuild anything which needs it. -# Viewing Serial Output +## Viewing Serial Output The `make monitor` target will use the already-installed [miniterm](http://pyserial.readthedocs.io/en/latest/tools.html#module-serial.tools.miniterm) (a part of pyserial) to display serial output from the ESP32 on the terminal console. @@ -46,7 +50,7 @@ To flash and monitor output in one pass, you can run: `make flash monitor` -# Compiling & Flashing Just the App +## Compiling & Flashing Just the App After the initial flash, you may just want to build and flash just your app, not the bootloader and partition table: @@ -57,9 +61,9 @@ After the initial flash, you may just want to build and flash just your app, not (There's no downside to reflashing the bootloader and partition table each time, if they haven't changed.) -# Parallel Builds +## Parallel Builds -esp-idf supports compiling multiple files in parallel, so all of the above commands can be run as `make -jN` where `N` is the number of parallel make processes to run (generally N should be equal to or one more than the number of CPU cores in your system.) +ESP-IDF supports compiling multiple files in parallel, so all of the above commands can be run as `make -jN` where `N` is the number of parallel make processes to run (generally N should be equal to or one more than the number of CPU cores in your system.) Multiple make functions can be combined into one. For example: to build the app & bootloader using 5 jobs in parallel, then flash everything, and then display serial output from the ESP32 run: @@ -67,7 +71,7 @@ Multiple make functions can be combined into one. For example: to build the app make -j5 flash monitor ``` -# The Partition Table +## The Partition Table Once you've compiled your project, the "build" directory will contain a binary file with a name like "my_app.bin". This is an ESP32 image binary that can be loaded by the bootloader. @@ -84,7 +88,7 @@ In both cases the factory app is flashed at offset 0x10000. If you `make partiti For more details about partition tables and how to create custom variations, view the `docs/partition-tables.rst` file. -# Erasing Flash +## Erasing Flash The `make flash` target does not erase the entire flash contents. However it is sometimes useful to set the device back to a totally erased state, particularly when making partition table changes or OTA app updates. To erase the entire flash, run `make erase_flash`. @@ -92,11 +96,11 @@ This can be combined with other targets, ie `make erase_flash flash` will erase # Resources -* The [docs directory of the esp-idf repository](docs) contains source of [esp-idf](http://esp-idf.readthedocs.io/) documentation. +* Documentation for the latest version: http://esp-idf.readthedocs.io/. This documentation is built from the [docs directory](docs) of this repository. * The [esp32.com forum](http://esp32.com/) is a place to ask questions and find community resources. * [Check the Issues section on github](https://github.com/espressif/esp-idf/issues) if you find a bug or have a feature request. Please check existing Issues before opening a new one. -* If you're interested in contributing to esp-idf, please check the [Contributions Guide](http://esp-idf.readthedocs.io/en/latest/contributing.html>). +* If you're interested in contributing to ESP-IDF, please check the [Contributions Guide](http://esp-idf.readthedocs.io/en/latest/contributing.html>). diff --git a/docs/index.rst b/docs/index.rst index bcc3c923a..eafe10244 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,11 +1,7 @@ -ESP32 Programming Guide -======================= +ESP-IDF Programming Guide +========================= -.. caution:: - - Until ESP-IDF release 1.0, this documentation is a draft. It is incomplete and may have mistakes. Please mind your step! - -Documentation adressed to developers of applications for `ESP32 `_ by `Espressif `_ using `esp-idf `_. +This is the documentation for Espressif IoT Developement Framework (`esp-idf `_). ESP-IDF is the official development framework for the `ESP32 `_ chip. Contents: From 4c0f90bfaeeae4696bfac0cadd1380a90b873345 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 16 Jan 2017 02:07:46 +0800 Subject: [PATCH 07/10] docs: fix some of the Sphinx warnings --- docs/api/ledc.rst | 9 --------- docs/api/sigmadelta.rst | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/docs/api/ledc.rst b/docs/api/ledc.rst index 40855ddb4..12d7cd16d 100644 --- a/docs/api/ledc.rst +++ b/docs/api/ledc.rst @@ -22,15 +22,6 @@ Header Files * `driver/include/driver/ledc.h `_ -Data Structures -^^^^^^^^^^^^^^^ - -.. doxygenstruct:: ledc_channel_config_t - :members: - -.. doxygenstruct:: ledc_timer_config_t - :members: - Macros ^^^^^^ diff --git a/docs/api/sigmadelta.rst b/docs/api/sigmadelta.rst index acfdaaa27..b03f04942 100644 --- a/docs/api/sigmadelta.rst +++ b/docs/api/sigmadelta.rst @@ -1,5 +1,5 @@ Sigma-delta Modulation -======== +====================== Overview -------- From 786573fb2d9b4d0beac8b12d792b65ba656ee648 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 16 Jan 2017 02:18:42 +0800 Subject: [PATCH 08/10] docs: fix macOS setup instructions Most of the packages mentioned are only needed for building the toolchain using crosstool-NG, not for the normal ESP-IDF environment. Mention that pyserial needs to be installed (fixes https://github.com/espressif/esp-idf/issues/229). --- docs/macos-setup.rst | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/docs/macos-setup.rst b/docs/macos-setup.rst index ac772c529..eeed9e4e2 100644 --- a/docs/macos-setup.rst +++ b/docs/macos-setup.rst @@ -4,19 +4,13 @@ Set up of Toolchain for Mac OS Step 0: Prerequisites ===================== -Getting MacPorts or homebrew ----------------------------- +- install pip:: -Whether you compile the toolchain from source or download binary toolchain, there are some dependencies which need to be installed on macOS first. These dependencies are installed with one of the package managers: homebrew or MacPorts. If you have these already, you can skip the following instructions. + sudo easy_install pip -- Install XCode from Mac App Store -- Open Terminal.app and run ``xcode-select --install`` -- Run ``sudo xcodebuild -license`` and agree to XCode license -- Install MacPorts_ or homebrew_ - -.. _homebrew: http://brew.sh/ -.. _MacPorts: https://www.macports.org/install.php +- install pyserial + sudo pip install pyserial Step 1: Download binary toolchain for the ESP32 ================================================== @@ -64,13 +58,18 @@ In any case, here are the steps to compile the toolchain yourself. - Install dependencies: + - Install either MacPorts_ or homebrew_ package manager. MacPorts needs a full XCode installation, while homebrew only needs XCode command line tools. + + .. _homebrew: http://brew.sh/ + .. _MacPorts: https://www.macports.org/install.php + - with MacPorts:: - sudo port install gsed gawk binutils gperf grep gettext ncurses + sudo port install gsed gawk binutils gperf grep gettext wget libtool autoconf automake - - with homebrew + - with homebrew:: - brew install gnu-sed gawk binutils gperf grep gettext ncurses + brew install gnu-sed gawk binutils gperftools gettext wget help2man libtool autoconf automake Create a case-sensitive filesystem image:: From f20135af5400f78ea09a69f178d72e66020cceac Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 16 Jan 2017 02:33:16 +0800 Subject: [PATCH 09/10] esp32: compile PHY-related code only when WiFi is enabled Fixes https://github.com/espressif/esp-idf/issues/230, https://github.com/espressif/esp-idf/issues/237 --- components/esp32/cpu_start.c | 7 ++++++- components/esp32/phy_init.c | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index 5ae68fc64..b5e896e57 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -71,9 +71,11 @@ static bool app_cpu_started = false; #endif //!CONFIG_FREERTOS_UNICORE static void do_global_ctors(void); -static void do_phy_init(); static void main_task(void* args); extern void app_main(void); +#if CONFIG_ESP32_PHY_AUTO_INIT +static void do_phy_init(); +#endif extern int _bss_start; extern int _bss_end; @@ -264,6 +266,7 @@ static void main_task(void* args) vTaskDelete(NULL); } +#if CONFIG_ESP32_PHY_AUTO_INIT static void do_phy_init() { esp_phy_calibration_mode_t calibration_mode = PHY_RF_CAL_PARTIAL; @@ -297,3 +300,5 @@ static void do_phy_init() esp_phy_release_init_data(init_data); free(cal_data); // PHY maintains a copy of calibration data, so we can free this } +#endif //CONFIG_ESP32_PHY_AUTO_INIT + diff --git a/components/esp32/phy_init.c b/components/esp32/phy_init.c index bfc5a15f5..07a455d50 100644 --- a/components/esp32/phy_init.c +++ b/components/esp32/phy_init.c @@ -23,10 +23,12 @@ #include "esp_err.h" #include "esp_phy_init.h" #include "esp_system.h" -#include "phy.h" #include "esp_log.h" #include "nvs.h" #include "sdkconfig.h" + +#ifdef CONFIG_WIFI_ENABLED +#include "phy.h" #include "phy_init_data.h" static const char* TAG = "phy_init"; @@ -219,6 +221,4 @@ static esp_err_t store_cal_data_to_nvs_handle(nvs_handle handle, return err; } -void register_chipv7_phy_stub() -{ -} +#endif // CONFIG_WIFI_ENABLED From ea19838d3a9e4dc100a90209fa4e4084577521d0 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 16 Jan 2017 11:52:15 +1100 Subject: [PATCH 10/10] Build: Handle WiFi & BT enabled/disabled combos gracefully as possible If using WIFI_INIT_CONFIG_DEFAULT, error message will point out lack of WiFi. Otherwise linker errors on WiFi symbols should help give a clue as to what is broken. Piggy-backs on changes in !420, ref github #230 #237 --- components/esp32/component.mk | 9 ++++++++- components/esp32/include/esp_wifi.h | 6 +++++- components/esp32/system_api.c | 3 +++ examples/02_blink/sdkconfig.defaults | 2 ++ examples/14_gatt_server/sdkconfig.defaults | 7 ++----- examples/15_gatt_client/sdkconfig.defaults | 7 ++----- 6 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 examples/02_blink/sdkconfig.defaults diff --git a/components/esp32/component.mk b/components/esp32/component.mk index 4ceb13e83..e1cd2c652 100644 --- a/components/esp32/component.mk +++ b/components/esp32/component.mk @@ -3,8 +3,15 @@ # COMPONENT_SRCDIRS := . hwcrypto +LIBS := core rtc phy +ifdef CONFIG_BT_ENABLED +LIBS += coexist +endif +ifdef CONFIG_WIFI_ENABLED +LIBS += net80211 pp wpa smartconfig coexist wps wpa2 +endif -LIBS := core net80211 phy rtc pp wpa smartconfig coexist wps wpa2 +LIBS := $(sort $(LIBS)) # de-duplicate, we can handle different orders here LINKER_SCRIPTS += esp32.common.ld esp32.rom.ld esp32.peripherals.ld diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index 197a04fd3..8d4fa17bb 100755 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -62,6 +62,7 @@ #include "freertos/FreeRTOS.h" #include "freertos/queue.h" #include "rom/queue.h" +#include "sdkconfig.h" #include "esp_err.h" #include "esp_wifi_types.h" #include "esp_event.h" @@ -97,11 +98,14 @@ typedef struct { uint32_t rx_buf_num; /**< WiFi RX buffer number */ } wifi_init_config_t; - +#ifdef CONFIG_WIFI_ENABLED #define WIFI_INIT_CONFIG_DEFAULT() { \ .event_handler = &esp_event_send, \ .rx_buf_num = CONFIG_ESP32_WIFI_RX_BUFFER_NUM, \ }; +#else +#define WIFI_INIT_CONFIG_DEFAULT #error Wifi is disabled in config, WIFI_INIT_CONFIG_DEFAULT will not work +#endif /** * @brief Init WiFi diff --git a/components/esp32/system_api.c b/components/esp32/system_api.c index 60fa1796c..bfc0f0752 100644 --- a/components/esp32/system_api.c +++ b/components/esp32/system_api.c @@ -17,6 +17,7 @@ #include "esp_wifi.h" #include "esp_wifi_internal.h" #include "esp_log.h" +#include "sdkconfig.h" #include "rom/efuse.h" #include "rom/cache.h" #include "rom/uart.h" @@ -74,7 +75,9 @@ esp_err_t system_efuse_read_mac(uint8_t mac[6]) __attribute__((alias("esp_efuse_ void IRAM_ATTR esp_restart(void) { +#ifdef CONFIG_WIFI_ENABLED esp_wifi_stop(); +#endif // Disable scheduler on this core. vTaskSuspendAll(); diff --git a/examples/02_blink/sdkconfig.defaults b/examples/02_blink/sdkconfig.defaults new file mode 100644 index 000000000..8c618fb9b --- /dev/null +++ b/examples/02_blink/sdkconfig.defaults @@ -0,0 +1,2 @@ +# Disable WiFi stack by default +CONFIG_WIFI_ENABLED=n diff --git a/examples/14_gatt_server/sdkconfig.defaults b/examples/14_gatt_server/sdkconfig.defaults index dcf4ad2c2..9d51df5ee 100644 --- a/examples/14_gatt_server/sdkconfig.defaults +++ b/examples/14_gatt_server/sdkconfig.defaults @@ -1,7 +1,4 @@ # Override some defaults so BT stack is enabled -# in this example - -# -# BT config -# +# and WiFi disabled by default in this example CONFIG_BT_ENABLED=y +CONFIG_WIFI_ENABLED=n diff --git a/examples/15_gatt_client/sdkconfig.defaults b/examples/15_gatt_client/sdkconfig.defaults index dcf4ad2c2..9d51df5ee 100644 --- a/examples/15_gatt_client/sdkconfig.defaults +++ b/examples/15_gatt_client/sdkconfig.defaults @@ -1,7 +1,4 @@ # Override some defaults so BT stack is enabled -# in this example - -# -# BT config -# +# and WiFi disabled by default in this example CONFIG_BT_ENABLED=y +CONFIG_WIFI_ENABLED=n