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.
Liu Zhi Fu [Sat, 19 Nov 2016 14:25:30 +0000 (22:25 +0800)]
lwip: optimize low_level_output
When the parameter pbuf for low_level_output is a list, malloc a new pbuf of
which the length equals to the total length of pbuf and send the new pbuf to L2