Wu Jian Gang [Wed, 30 Nov 2016 10:01:31 +0000 (18:01 +0800)]
Merge branch 'bugfix/tw8868_fix_packet_length_erro_in_ap_bridge_mode' into 'master'
esp32: update wifi lib to fix tw8868
In AP bridge mode, the length of the forwarded data is wrong, it's 26Btyes longer, thus cuase
AP can't forward the data of which length is 1460. This modification is to make the
data length right.
Liu Zhi Fu [Wed, 30 Nov 2016 06:20:05 +0000 (14:20 +0800)]
esp32: update wifi lib to fix tw8868
In AP bridge mode, the length of the forwarded data is wrong, it's 26Btyes longer, thus cuase
AP can't forward the data of which length is more than 1460. This modification is to make the
data length right.
Wu Jian Gang [Tue, 29 Nov 2016 12:15:30 +0000 (20:15 +0800)]
Merge branch 'bugfix/tw8851_some_phy_cause_wifi_connect_fail' into 'master'
esp32: fix tw8851 some phy version cause wifi connect fail
Update phy version to 258 to fix tw8851
When upgrade the phy version, the RF calibration version is not change, but the calibration data format is changed and the wrong calibration data causes wifi connection failure. The solution is to make RF calibration data and phy version the same version.
Liu Zhi Fu [Tue, 29 Nov 2016 07:30:31 +0000 (15:30 +0800)]
esp32: update wifi lib
1. update phy to version 258 to fix wifi upgrade cause wifi connect fail issue
2. update fix_printf.sh
3. fb5a2b07 - default set ps type to WIFI_PS_NONE
Wu Jian Gang [Tue, 29 Nov 2016 05:45:44 +0000 (13:45 +0800)]
Merge branch 'feature/fota_ops_api' into 'master'
Add fota ops api
add ota core function implement
1. esp_ota_begin: init ota partition need to be update, output ota handle,every partition need ota should be init firstly
2. esp_ota_write: write image data to update partition, will record wrote size automatically
3. esp_ota_end: verify image after ota ended
4. esp_ota_set_boot_partition: set next boot partition
5. esp_ota_get_boot_partition: get current running partition
Wu Jian Gang [Fri, 25 Nov 2016 05:44:02 +0000 (13:44 +0800)]
Merge branch 'bugfix/tw8770_fix_socket_memory_leak' into 'master'
lwip: fix socket memory leak issue
1. Add socket memory leak debug counter
2. Fix TCP PCB leak issue
Currently ESP32 support maximum 16 TCP PCBs and all TCP PCB are allocated from heap memory. In some scenario, we may
have memory leak issue, for example, the application already created 16 TCP PCB, then it close 5 of them, because the TCP
state machine, the LWIP core may not free all the 5 TCP PCB immediately, maybe some is in TIME_WAIT status, some is in
FIN_WAIT_1 etc. Then the application try to malloc 17th TCP PCB (the application think they just create 12 because they already
close 5), memp_malloc() will return true because the heap is not out of memory, but actually we got 17 TCP PCB. When the
scenario repeat again and again (in our Audio application, it repeat more than 10000 times), more and more TCP PCB will be
created in the system, each TCP PCB require 200B, then memory leak happen (In Audio application, I saw more than 26 TCP PCB
are created, and 10*200=2K memory are leaked).
Angus Gratton [Fri, 25 Nov 2016 02:11:33 +0000 (10:11 +0800)]
Merge branch 'bugfix/ledc_divider' into 'master'
ledc: fix reported error when div_param == 256
Whenever bit_num and freq_hz are such that div_param == 256, the code would flag that as an error.
In fact, value 256 of div_param was a valid one (HW requires that div_param >= 1.0, when interpreted as a Q10.8 fixed point value).
Changed the if statements a bit to make the logic clearer, and added more descriptive error messages.
Also added missing error for the unimplemented case of low speed mode.
Reported in https://github.com/igrr/esp32-cam-demo/issues/2
Ivan Grokhotkov [Thu, 24 Nov 2016 10:22:50 +0000 (18:22 +0800)]
Merge branch 'feature/system_apis' into 'master'
system_* APIs cleanup
This changeset is mostly about cleaning up `system_*` APIs and moving them from libcore. It has dragged a few more changes along, however.
- `system_deep_sleep` deprecated, new name is `esp_deep_sleep`
- `system_efuse_read_mac` deprecated, new name is `esp_efuse_read_mac`
- `system_read/write_rtc_mem` removed (reason: we use linker to place code/data into RTC memory now)
- `system_get_sdk_version` deprecated. Returns "master" for now. Support for compile-time and runtime version detection will be done in a separate MR.
- `system_get_time` and variations have been deprecated. `gettimeofday` should be used instead.
- `system_restart` deprecated, new name is `esp_restart`. Rewritten code to work correctly from any of the cores.
- `system_restore` deprecated, `esp_wifi_restore` should be used instead.
- `system_get_rst_info` removed (it wasn't in a header file)
- RTC library has been updated to latest version
- Logging output from `libfoo.a` goes through `foo_printf` function now, where `foo ` is any of the library names. For libraries other than rtc and phy, this is a temporary measure, until we finish switching to esp_log library and clean up all uses of printf/ets_printf.
- ESP-IDF build will fail if any of the libraries have printf/ets_printf reference.
- Added `esp_random` function which gets values from HW RNG. I have added code which makes sure the value is not polled too often (allows at least 16 APB cycles). Also added a header file for HW RNG (just one register).
- Moved random number generation functions used by wpa library into wpa_supplicant component.
Ivan Grokhotkov [Thu, 24 Nov 2016 04:27:32 +0000 (12:27 +0800)]
ledc: fix reported error when div_param == 256
Whenever bit_num and freq_hz are such that div_param == 256, the code would flag that as an error.
In fact, value 256 of div_param was a valid one (HW requires that div_param >= 1.0, when interpreted as a Q10.8 fixed point value).
Changed the if statements a bit to make the logic clearer, and added more descriptive error messages.
Also added missing error for the unimplemented case of low speed mode.
This is a really subtle bug, gcc noticed the UART array elements are read-only so
implicitly moved the elements to .rodata as if it was const. However
this array is accessed from the UART ISR, so has to be in IRAM or DRAM.
rmt.c should include stdlib.h for malloc, esp_bignum,c & https_request_main.c should include it for abort().
FreeRTOSConfig.h is only including stdlib if CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION is set. However, it is included for abort() so needs to be included whenever CONFIG_FREERTOS_ASSERT_FAIL_ABORT is set.
This change includes it unconditionally in FreeRTOSConfig.h. This is to avoid this kind of bug where compiler errors are dependent on config. I suggest we don't change this to be more selective until we have 'make randomconfig' style tests in CI.
rmt.c should include stdlib.h for malloc, esp_bignum,c &
https_request_main.c for abort().
FreeRTOSConfig.h is only including stdlib if
CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION is set. However, it is
included for abort() so needs to be included whenever
CONFIG_FREERTOS_ASSERT_FAIL_ABORT is set.
This change includes unconditionally in FreeRTOSConfig.h. This is to
avoid this kind of bug where compiler errors are dependent on config. I
suggest we don't change this to be more selective until we have 'make
randomconfig' style tests in CI.
Ivan Grokhotkov [Wed, 23 Nov 2016 04:13:39 +0000 (12:13 +0800)]
Merge branch 'feature/integrate_unit_tests' into 'master'
Integrate unit tests into build system
This MR moves unit tests from esp-idf-tests repository into 'test' subdirectories of respective components.
Tests are run using a runner app in tools/unit-test-app.
This needs a bit of cleanup:
1. remove extra newlines added to makefiles,
2. re-format unit tests code which has tabs
3. write a document on using this test app
4. maybe some refactoring in project.mk
I think 1&2&4 need to be done in this MR, while 3 may be done in a follow-up one.
Ivan Grokhotkov [Wed, 23 Nov 2016 04:04:53 +0000 (12:04 +0800)]
Merge branch 'bugfix/freertos_staticqueue_size' into 'master'
StaticQueue_t needs to have the same size as xQUEUE.
https://github.com/espressif/esp-idf/pull/98
Without this change, building FreeRTOS with static allocation enabled succeeds, but trying to create a queue from a static buffer causes an assert because the size of static and dynamic queues differ.
This is a really subtle bug, gcc noticed the UART array elements are read-only so
implicitly moved the elements to .rodata as if it was const. However
this array is accessed from the UART ISR, so has to be in IRAM or DRAM.
Angus Gratton [Tue, 22 Nov 2016 22:42:35 +0000 (09:42 +1100)]
FreeRTOS: Use C11 _Static_assert to verify static "dummy" structs at compile time
Includes a tweak to make Static_task_t equal size to TCB_t when using
MPU_WRAPPERS . Matches tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE macro
in tasks.c. This isn't actually a bug (if static task allocation is off,
there is no use for Static_task_t), but it allows us to make consistent
compile-time checks that Static_task_t == TCB_t.
Daniel Campora [Mon, 14 Nov 2016 23:46:53 +0000 (00:46 +0100)]
StaticQueue_t needs to have the same size as xQUEUE.
Without this change, building FreeRTOS with static allocation enabled succeeds, but trying to create a queue from a static buffer causes an assert because the size of static and dynamic queues differ.
Wu Jian Gang [Tue, 22 Nov 2016 11:19:10 +0000 (19:19 +0800)]
Merge branch 'bugfix/tw8727_pc_send_random_pkt_cause_esp32_watchdog' into 'master'
esp32: fix random pkt cause esp32 watchdog
This change fixes the ESP32 watchdog issue. When the MPDU of AMPDU is longer than 1600B,
esp32 will check whether the last 4B is DEADBEEF, if it's not DEADBEEF, it will assert
and the assert will cause esp32 watchdog. The solution is to init the last 4B to DEADBEEF
when malloc new ebuf for the packet longer than 1600B.
Liu Zhi Fu [Tue, 22 Nov 2016 03:46:10 +0000 (11:46 +0800)]
esp32: fix random pkt cause esp32 watchdog
This change fixes the ESP32 watchdog issue. When the MPDU of AMPDU is longer than 1600B,
esp32 will check whether the last 4B is DEADBEEF, if it's not DEADBEEF, it will assert
and the assert will cause esp32 watchdog. The solution is to init the last 4B to DEADBEEF
when malloc new ebuf for the packet longer than 1600B.
tianzhongxing [Mon, 21 Nov 2016 06:09:52 +0000 (14:09 +0800)]
components/lwip/arp: change the arp dropping packet function
LWIP will drop the oldest package at the arp packet cache queue and return "ERR_OK"
We change it that ARP level will drop the current packet and return "ERR_MEM" to tell user that you should send the packet again latter.