Ivan Grokhotkov [Sun, 25 Sep 2016 19:05:25 +0000 (03:05 +0800)]
components/lwip,esp32: fixes for C++
- put contents of a few headers into c++ guard blocks
- fix off-by-one error in do_global_ctors
- remove system_init from startup code (should be called from main)
Ivan Grokhotkov [Sun, 25 Sep 2016 17:17:32 +0000 (01:17 +0800)]
Event handling refactoring
This change separates definitions in esp_event.h and functions in event.c into several parts:
- event structure definitions (esp_event.h)
- default implementations of event handlers (event_default_handlers.c)
- default implementation of event loop (event_loop.c, esp_event_loop.h)
Purpose of this change is to allow applications choose their own poison:
- full control of event loop at the expense of more bootstrap code
- pre-defined event task firing event callbacks, but less code in app_main.c
Ivan Grokhotkov [Fri, 23 Sep 2016 06:46:39 +0000 (14:46 +0800)]
clean up warnings
For third party components (lwip and expat), compilation flags are adjusted to silence existing warnings (i have manually checked that all warnings are benign).
In components/esp32, replaced use of WIFI_DEBUG with ESP_LOG functions.
Only remaining warning is in FreeRTOS queue.c, and it may be a useful one.
Ivan Grokhotkov [Sun, 25 Sep 2016 16:50:57 +0000 (00:50 +0800)]
Startup flow refactoring
This change removes implicit WiFi/BT initialization from startup code.
"main" task is started once essential part of startup code is complete.
This task calls application-provided "int main(void)" function, which can call WiFi/BT init functions if necessary.
Merge branch 'feature/btdm_controller' into 'master'
BT support
Initial version of BT support.
BT and WiFi are mutually exclusive at this point, so we have a new option to select which stack is used.
Precompiled BT libraries are added as a submodule.
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).