Ivan Grokhotkov [Tue, 20 Sep 2016 09:22:18 +0000 (17:22 +0800)]
Merge branch 'master' into feature/menuconfig_cpu_frequency_option
* master: (57 commits)
components/lwip: fix grammar
components/lwip: make SO_REUSE configurable via menuconfig
bootloader: remove trailing newlines from log messages
components/freertos: override per-task __cleanup handler to close stdin, stdout, stderr
components/esp32: move peripheral symbols to separate ld script
components/log: regroup macros for better readability
gitlab-ci: allow running tests for branches, triggered via API
components/log: fix timestamp calculation
components/log: set default runtime log level to ESP_LOG_VERBOSE
components/log: fix error when using ESP_LOGx from C++ code
components/log: fix bugs, add options to override log level for files, components, and bootloader
fix ledc and spi typo
remove prefix and postfix
Enable SO_REUSEADDR in LWIP
freertos: fix memory debug macro issue Define configENABLE_MEMORY_DEBUG according to CONFIG_ENABLE_MEMORY_DEBUG
peripheral structure headers: move volatile keyword from members to typedef
Adding -fstrict-volatile-bitfields to the CFLAGS/CXXFLAGS. Without this, gcc tries to access bitfields using the smallest possible methods (eg l8i to grab an 8-bit field from a 32-bit). Our hardware does not like that. This flag tells gcc that if a bitfield is volatile, it should always use the type the field is defined at (uint32_t in our case) to size its access to the field. This fixes accessing the hardware through the xxx_struct.h headers.
add peripheral module struct headers
build system docs: Add note about no spaces in component names
Docs: Add note about unusual submodule messages when cloning on Windows
...
Ivan Grokhotkov [Tue, 20 Sep 2016 09:16:41 +0000 (17:16 +0800)]
Merge branch 'feature/logging' into 'master'
Add logging library
Logging library, intended to be used across other components.
Uses design similar to Android NDK logging APIs and allows for both compile time and run time filters, similar to logcat.
Also includes cleanup of cpu_startup.c — i was changing some logging output in this file so decided to re-format it and reduce code duplication.
Ivan Grokhotkov [Tue, 20 Sep 2016 08:24:21 +0000 (16:24 +0800)]
Merge branch 'master' into bugfix/lwip_so_reuse
* branch 'master':
components/freertos: override per-task __cleanup handler to close stdin, stdout, stderr
gitlab-ci: allow running tests for branches, triggered via API
Ivan Grokhotkov [Tue, 20 Sep 2016 04:12:06 +0000 (12:12 +0800)]
Merge branch 'bugfix/newlib_fd_memory_leak' into 'master'
override per-task __cleanup handler to close stdin, stdout, stderr
Default _cleanup_r function (called from _reclaim_reent) calls _fclose_r for all file descriptors related to a particular instance of struct _reent.
It does that by calling _fwalk_reent, which iterates over __sglue list in struct _reent and calls _fclose_r for each member. But _stdin, _stdout, and _stderr are not in this list, so _fclose_r is not called for them. Which leads to a memory leak.
The easy way to fix this is to reset __cleanup member of struct _reent to our new “patched” version, which first calls the original version (_cleanup_r) and then does _fclose_r for each of the stdin, stdout, and stderr.
Merge branch 'features/lwip-SO_REUSEADDR' into 'master'
Enable SO_REUSEADDR in LWIP
Daniel initially asked me why this wasn't enabled, and I don't think I got any reasons against enabling this. If any, it makes porting existing software easier. Tuan needs it for UDP multicast as well.
Code changes are by Tuan: basically the enable for SO_REUSEADDR in LWIP as well as a bugfix in a bit of mbedTLS that gets enabled.
Adding -fstrict-volatile-bitfields to the CFLAGS/CXXFLAGS. Without this, gcc tries to access bitfields using the smallest possible methods (eg l8i to
grab an 8-bit field from a 32-bit). Our hardware does not like that. This flag tells gcc that if a bitfield is volatile, it should always use the type
the field is defined at (uint32_t in our case) to size its access to the field. This fixes accessing the hardware through the xxx_struct.h headers.
Ivan Grokhotkov [Thu, 15 Sep 2016 06:08:35 +0000 (14:08 +0800)]
Merge branch 'bugfix/github_deploy' into 'master'
fix deploy to GitHub
Previous change to gitlab-ci.yml moved setting of Gitlab ssh key to global before_script.
This together with the fact that we used `echo >>` instead of `echo >` to write to `id_rsa_base64` file caused wrong key to be used while pushing to GitHub.
Therefore:
- don't run default before_script before push_master_to_github job
- replace echo >> with echo > to avoid mistakes in the future
Ivan Grokhotkov [Wed, 14 Sep 2016 17:59:42 +0000 (01:59 +0800)]
components/esp32: clean up cpu_start
Move CPU region protection setup into soc/cpu.h
change tabs to spaces
remove unused extern declarations
use RTC_WDTCONFIG0 instead of numeric address (still need to fix BB reg)
Ivan Grokhotkov [Wed, 14 Sep 2016 16:53:33 +0000 (00:53 +0800)]
components/log: add implementation, update a few components to use it
This also removes logging implementation from bootloader and replaces it
with the one provided by the log component. Some occurrences of printf
and ets_printf have been changed to ESP_LOGx APIs.
Ivan Grokhotkov [Tue, 13 Sep 2016 10:10:58 +0000 (18:10 +0800)]
components/esp32: add CPU frequency selection in menuconfig
Note that with WiFi stack enabled, system_init will reset frequency to 240MHz.
To make this setting useful, esp32-wifi-libs submodule needs to be updated.
Only modify headers in soc/ .
Pass compiling under esp-idf-tests/merge_soc_tmp/merge_for_soc_headers branch.(only change some names of register and INUM).
Ivan Grokhotkov [Wed, 14 Sep 2016 04:19:43 +0000 (12:19 +0800)]
Merge branch master into feature/logging
* branch master: (51 commits)
fix typos
callback: add a void* pointer with each callback
header: callbacks use "void *" as arguments
header: format and fix typos
add wifi api comments
add wifi api comments
components/spi_flash: call SPIUnlock only once
components/spi_flash: improve comments and readability
esp32 cpu_start: Include rom/uart.h, remove inline ROM function declarations
bootloader: Add bootloader Kconfig
Fix bug where nesting vTaskEnterCritical calls would not re-enable interrupts after vTaskExitCritical sections.
installed gitlab key in global before_script, don't need to overwrite in template before_script
ci: Use github repo for wifi libraries on master branch, gitlab repo otherwise
components/esp32,spi_flash: update some comments
components/esp32: remove dependency of WIFI_ENABLED on FREERTOS_UNICORE
esp32/lib: Bump WiFi revision
update ci: build ssc with idf submodule wifi lib
components/esp32: add inter-processor call API and implement spi_flash through it
add MACRO to get flash pad number from efuse value
add comments to register read/write operations
...
Merge branch 'bugfix/add_tx_flowcontrol' into 'master'
lwip: add socket tx flow control
This fix is used to solve wifi q full issue:
1. When wifi tx q is full, set tx_enable to false
2. When wifi tx q decrease 1/2 max length, set tx_enable to true again
3. esp_wifi_tx_enable return whether tx_enable is true
4. If esp_wifi_tx_enable return false, socket will be blocked
Ivan Grokhotkov [Tue, 13 Sep 2016 10:14:22 +0000 (18:14 +0800)]
Merge branch 'bugfix/spi_flash_unlock_once' into 'master'
components/spi_flash: call SPIUnlock once
This fixes the performance impact for spi_flash_write and spi_flash_erase.
With this change, NVS init in single core mode takes about 50ms (compared to >2seconds before that).
For dual core mode, we still spend on average 2ms for each spi_flash_ operation due to synchronization between CPUs, so NVS startup time is about 2 seconds in dual core mode.
Ivan Grokhotkov [Tue, 13 Sep 2016 07:16:36 +0000 (15:16 +0800)]
components/spi_flash: call SPIUnlock only once
This fixes the performance impact for spi_flash_write and spi_flash_erase.
With this change, NVS init in single core mode takes about 50ms (compared to >2seconds before that).
Ivan Grokhotkov [Tue, 13 Sep 2016 05:58:54 +0000 (13:58 +0800)]
Merge branch 'feature/dualcore_spi_flash_api' into 'master'
Dual core compatible spi flash APIs
Implementation of spi flash APIs which work in dual core mode.
This also includes other changes:
- fixes to FreeRTOS tasks.c made by Jeroen and me — these were originally made to fix issues with high priority tasks seen in WiFi stack, but were required to get stuff in ipc.c working as well
- initial base idea with two high-priority tasks was separated into a separate API — esp_ipc.h. That API allows one to run a function on the other CPU from a high-priority task. Because we don't have preemption across CPUs, this is currently not very fast: it requires on average half a tick until the second CPU switches to the high priority task. Currently that API can be either blocking, or non-blocking with queue length of 1. I haven't yet found a use case for arbitrary sized queue of IPC requests. Anyone who needs that can trivially add that later by replacing a binary semaphore with a generic queue.
With these changes i can run application with WiFi stack and NVS on both cores.