Ivan Grokhotkov [Fri, 16 Dec 2016 08:17:37 +0000 (16:17 +0800)]
Merge branch 'feature/extend_deep_sleep_apis' into 'master'
extend deep sleep APIs
This adds the following APIs to enable various wakeup sources:
- esp_deep_sleep_enable_timer_wakeup
- esp_deep_sleep_enable_ulp_wakeup
- esp_deep_sleep_enable_ext0_wakeup
- esp_deep_sleep_enable_ext1_wakeup
And an API to start deep sleep:
- esp_deep_sleep_start
Add an API to control which peripherals are kept enabled in deep sleep mode:
- esp_err_t esp_deep_sleep_pd_config
Also rolled an update of rtc_io header comments into this MR, as I had to add `slpie`, `slpsel`, and `hold` fields into `rtc_gpio_desc_t` struct.
Deep sleep unit tests don’t do anything useful in CI context because we don’t have a way to check reset behavior (time till reset, reason for reset) in CI environment, yet. Also for external wakeup we would need to control some ESP32 pins from the test environment.
Currently there is one known issue:
- RTC Fast memory may be isolated from the bus after deep sleep reset. We work around this by setting FORCE_NONISO flag in RTC power control register. This is non-optimal and we will keep looking for the reason why isolation gets enabled.
Ivan Grokhotkov [Fri, 16 Dec 2016 06:26:05 +0000 (14:26 +0800)]
deep sleep: set pin configuration right before entering deep sleep
This change allows setting pin configuration for EXT1 wakeup depending on the state of RTC_PERIPH power domain:
- if peripherals are enabled (due to another wakeup mode, or due to esp_deep_sleep_pd_config call), we can keep internal pullups/pulldowns enabled
- if peripherals are disabled, pullups and pulldowns need to be disabled as well
Also add comments about the purpose of registers being configured.
Ivan Grokhotkov [Wed, 14 Dec 2016 06:23:40 +0000 (14:23 +0800)]
deep sleep: RTC fast memory may be disconnected after deep sleep wakeup
This adds a workaround for a bug that following deep sleep wakeup, ISO (bus isolation) signal may be set for RTC fast memory.
We set FORCE_NOISO bit in RTC_CNTL_PWC_REG until we find out what is causing ISO signal to be set.
Ivan Grokhotkov [Mon, 12 Dec 2016 15:20:15 +0000 (23:20 +0800)]
deep sleep: add option to delay CPU startup
When ESP32 wakes up from deep sleep, flash is accessed an approximately 900us after power on.
Some flash chips need more time to become ready. This change adds a menuconfig option to add
some delay to the default deep sleep wake stub.
Ivan Grokhotkov [Thu, 8 Dec 2016 14:22:10 +0000 (22:22 +0800)]
deep sleep: implement wake up using ULP, EXT0, EXT1 sources
This adds the following APIs to enable various wakeup sources:
- esp_deep_sleep_enable_timer_wakeup
- esp_deep_sleep_enable_ulp_wakeup
- esp_deep_sleep_enable_ext0_wakeup
- esp_deep_sleep_enable_ext1_wakeup
And an API to start deep sleep:
- esp_deep_sleep_start
Liu Zhi Fu [Mon, 12 Dec 2016 02:00:24 +0000 (10:00 +0800)]
esp32: refactor to sniffer
1. TW8657, WIFI send the whole packet to smartconfig;
2. modify API annotation of smartconfig and sniffer;
3. export smartconfig APIs to programming guide;
Ivan Grokhotkov [Thu, 15 Dec 2016 08:28:29 +0000 (16:28 +0800)]
Merge branch 'bugfix/heap_alloc_no_iram' into 'master'
Restore ability to alloc IRAM, and more.
- Fix mem regions so allocating IRAM works again
- Optimize allocator slightly, uses 4 less bytes per malloc now
- Allow querying free heap memory space per memory type
Merge branch 'bugfix/btdm_bluedroid' into 'master'
Bugfix/btdm bluedroid
Cleanup all the warnings。
Fix GATT CLIENT cannot receive notfiy/indicate from GATT SERVER bug.
Originally, bluetooth have its own master branch(feature/btdm_bluedroid), all the bluetooth sub branch will merge to feature/btdm_bluedroid firstly. If feature/btdm_bluedroid is ready, it will request merge to master. But as Ivan/JG/Jack's requires, all the bluetooth bugfix or feature will request merge to master ASAP.
This MR contains "cleanup warning " and "some bug fix", after, every merge request only contain one thing.
Jeroen Domburg [Thu, 15 Dec 2016 07:15:32 +0000 (15:15 +0800)]
Merge branch 'bugfix/uart_examples_intr' into 'master'
Update uart examples in uart.h to new interrupt allocation scheme
Some of the examples in the UART header haven't been adjusted to the new interrupt scheme; this fixes that. Also runs dos2unix on the drivers tree; a fair few drivers used DOS-style line ends.
Jeroen Domburg [Fri, 9 Dec 2016 09:13:45 +0000 (17:13 +0800)]
Add xPortGetFreeHeapSizeCaps and xPortGetMinimumEverFreeHeapSizeCaps plus everything it entails. Allows querying the available memory for various capabilities. Also: xPortGetFreeHeapSize and xPortGetMinimumEverFreeHeapSize now return the expected value. Bonus: the linked list used in the allocator is now 4 bytes smaller, which should save some memory.
Tian Hao [Thu, 15 Dec 2016 05:35:30 +0000 (13:35 +0800)]
component/bt : change the resolving list cleanup position
1. enable will malloc, but disable don't free resolving list, so fix it
2. In disable procedure, it will alloc alarm to hash_map, and all the alarm hash_map will be free in deinit. So this need not be fixed currently.
Tian Hao [Mon, 12 Dec 2016 20:10:44 +0000 (04:10 +0800)]
component/bt : fix the bug of deinit/disable
1. fix the exception of deinit/disable
2. debug mem leak of deinit, fix some memleak, but still something wrong.
3. debug men leak of disable.
4. add bluedroid memory debug
Ivan Grokhotkov [Tue, 13 Dec 2016 06:16:57 +0000 (14:16 +0800)]
Merge branch 'bugfix/rom_int_functions' into 'master'
Fix broken WiFi due to intr allocation code.
TL;DR: The dynamic interrupt allocation code fixed something up to the point it broke. This code breaks off the broken code, fixing everything.
The dynamic allocated interrupt patch also fixed a bug in FreeRTOSs interrupt handling for two cores, which caused the two cores to (most of the time) have exactly the same interrupts enabled. This made WiFi fail: it would wait on a semaphore but never figure out the other core had set the semaphore, so it would keep waiting in the idle task for ever. This was caused by both the cross-core interrupt as well as the tick interrupt being disabled.
The culplrit for this appeared to be the WiFi driver, which enabled a FRC2 interrupt. The code enabling this, through a respectable amount of defines, called a rom function which called a HAL function... which was configured in such a way that it worked okay if both CPUs happened to have the same interrupts set, but broke as soon as that was not the case, possibly setting only the interrupt that was enabled and clearing all others.
The fix for this is to not use the ROM functions, but provide our own instead. Fortunately, this can be done without changes in the WiFi libs.
This MR also addresses a potentially dangerous ESP_LOG as well as some, according to the ISA document, needed rsyncs in the interrupt enable/disable code. It also marks int 9 and 10 as reserved, the WiFi code seems to use this.
Ivan Grokhotkov [Fri, 9 Dec 2016 11:44:27 +0000 (19:44 +0800)]
freertos: fix TLS delete callback test
“Full” printf uses more stack space than “nano” printf, and more space than available in the idle task.
This caused stack overflow in TLS delete test. Replacing printf with ets_printf.
Ivan Grokhotkov [Mon, 12 Dec 2016 08:20:13 +0000 (16:20 +0800)]
Merge branch 'test/integrate_stress_test_to_CI' into 'master'
add supported stress test to CI
add supported stress test to CI:
stress test requires long time to execute. They will only be executed when variable NIGHT_BUILD=YES. Therefore we'll use gitlab-API trigger to execute stress test cases.
Angus Gratton [Sun, 11 Dec 2016 22:50:46 +0000 (06:50 +0800)]
Merge branch 'feature/esptool_flash_encryption' into 'master'
Flash encryption support
Flash encryption support in build system, tooling
To come in future MR:
* On-device key generation on first boot (for production devices), need to finalise testing of bootloader entropy seeding.
* spi_flash_encrypted_write to support non-32-byte block writes (at least optionally.)
* I think a lot of the bootloader_support component can possibly be rolled into "spiflash" and other components, to use a common API.
Jeroen Domburg [Fri, 9 Dec 2016 06:00:39 +0000 (14:00 +0800)]
Merge branch 'feature/intr_alloc' into 'master'
Add dynamic interrupt allocation mechanism
This adds:
- Dynamic allocation of interrupts. Pass it the features of the interrupt you want, it'll set you up with an int.
- Shared interrupts. Enables multiple peripheral drivers to use the same interrupt.
- Marking what interrupts are fully executable from IRAM; if an int isn't marked like that it will get disabled once flash cache gets disabled.
Also:
- Modifies driver to be in line with these changes
Ivan Grokhotkov [Fri, 9 Dec 2016 04:04:29 +0000 (12:04 +0800)]
Merge branch 'feature/newlib_full_format' into 'master'
newlib: add "full" formatting support
This change adds support for 64-bit formats and C99 features to newlib printf/scanf functions. This support is enabled by default in menuconfig, but can be switched off to reduce code size.
Also adds missing functions such as fmod and fmodf.
Jeroen Domburg [Fri, 25 Nov 2016 09:33:51 +0000 (17:33 +0800)]
Add interrupt allocation scheme / interrupt sharing. Also modifies drivers and examples. Also allows interrupts
to be marked specifically as having a handler that's all in IRAM.
- add two versions of libc: libc.a and libc_nano.a. First one has full C99 formatting support, second one uses “nano” formatting functions available in ROM.
- fix linker error for fmod, fmodf, atof, atoff
- update tests
Ivan Grokhotkov [Thu, 8 Dec 2016 02:58:44 +0000 (10:58 +0800)]
Merge branch 'feature/select_default_uart' into 'master'
UART console selection
This change adds a set of menuconfig options to set custom UART#, baud rate, and pins, for console output.
Ref. TW8146
Also includes the following changes:
- `uart_tx_wait_idle`: fix issue with last character not transmitted. ROM function `uart_tx_wait_idle` may have a bug which causes the function to return before the final character is fully transmitted. This replaces `uart_tx_wait_idle` declaration with a static inline definition which fixes the issue. Also replaces the use of `uart_tx_flush` with `uart_tx_wait_idle` in `esp_restart`, to remove garbage in console output on restart.
- `rtc_printf` is temporary replaced with a no-op, pending a new release of librtc.a. Current release assumes that UART0 is used for output,
and switches UART0 baud rate while doing frequency changes and printing some log output. This doesn’t work if a different UART is used for output.
- disable boot watchdog only after starting the main task. Boot watchdogs were disabled very early in startup code. It was possible to introduce an infinite loop anywhere in the many functions called from startup code, and this would not be detected by interrupt watchdog and task watchdog. This change postpones disabling of boot watchdogs to the point when the scheduler is running. Also replaces register expressed using integer address with a name. This change is not directly related to the previous ones, but was found while debugging UART selection features.
Ivan Grokhotkov [Thu, 8 Dec 2016 02:02:15 +0000 (10:02 +0800)]
Merge branch 'bugfix/netif_zero_init' into 'master'
Zero-fill netif on alloc
LwIP's `struct netif` was not zero-initialized after allocation, so `ipv6_addr_cb ` function pointer contained garbage. This caused a crash if the device was on an IPv6 capable network.