Compare commits

...

1439 Commits

Author SHA1 Message Date
310beae373 Merge branch 'bugfix/revert_optimize_wifi_rx_v4.0' into 'release/v4.0'
esp_wifi: revert WiFi RX optimization

See merge request espressif/esp-idf!5941
2019-08-30 10:59:20 +08:00
cf0caaec11 esp_wifi: revert WiFi RX optimization
Revert following commit since it has compatibility issue:
commit 45dd6175cd
esp32: optimize wifi rx
2019-08-29 21:26:42 +08:00
ea1037742d Merge branch 'bugfix/confgen_msys_path_v4.0' into 'release/v4.0'
Fix sdkconfig.rename paths for confgen.py in MSYS (v4.0)

See merge request espressif/esp-idf!5904
2019-08-29 10:15:21 +08:00
465d46e9dd Merge branch 'bugfix/cmake_src_exclude_issue_v4.0' into 'release/v4.0'
cmake: fix issue with handling of EXCLUDE_SRCS (v4.0)

See merge request espressif/esp-idf!5900
2019-08-28 14:42:20 +08:00
ebcb3a22b8 Merge branch 'bugfix/btdm_fix_ble_data_loss_and_send_same_pkt_twice_v4.0' into 'release/v4.0'
Component/bt: fix some BLE bugs (backport v4.0)

See merge request espressif/esp-idf!5909
2019-08-27 18:49:55 +08:00
61ba1c3026 components/bt: backport 2 BT bugfix about controller
1.Bugfix btdm sleep twice after wakeup request
2.Set the minimum encryption key size to be 7 octects for BR/EDR link for preventing KNOB attack
    This patch is to address the CVE-2019-9506 vulnerability.
2019-08-27 10:42:40 +08:00
90bbea65c1 Component/bt: fix some BLE bugs
- fix data loss and send same pkt twice sometimes
- fix adv data error in air sometimes
- fix adv start/stop crash sometimes
2019-08-26 20:29:01 +08:00
cb3d458050 Fix sdkconfig.rename paths for confgen.py in MSYS
Closes https://github.com/espressif/esp-idf/issues/3950
2019-08-26 11:12:44 +02:00
b72ff61899 cmake: fix issue with handling of EXCLUDE_SRCS 2019-08-26 11:49:30 +05:30
7bb8b5ba9e Merge branch 'Bugfix/nonblocking_udp_is_zero_for_4.0' into 'release/v4.0'
fix bug for nonblocking udp is zero for v4.0

See merge request espressif/esp-idf!5855
2019-08-23 10:50:45 +08:00
1f5f6adcb6 fix bug for nonblocking udp is zero for v4.0 2019-08-21 17:07:45 +08:00
16ee476a77 Merge branch 'bugfix/config_panic_gdbstub_build_issue_v4.0' into 'release/v4.0'
esp32_gdbstub: fix build error with esp32-2019r1 toolchain (v4.0)

See merge request espressif/esp-idf!5764
2019-08-20 13:11:24 +08:00
674ecc3b56 Merge branch 'bugfix/vfs_concurrent_select_v4.0' into 'release/v4.0'
VFS: Support concurrent VFS select calls & improve the documentation (backport v4.0)

See merge request espressif/esp-idf!5797
2019-08-20 12:49:03 +08:00
43efee5232 Merge branch 'bugfix/fix_mbedtls_net_sockets_error_handling_v4.0' into 'release/v4.0'
mbedtls: use `errno` instead of `SO_ERROR` for getting socket errors (v4.0)

See merge request espressif/esp-idf!5768
2019-08-20 12:28:56 +08:00
5dab23ea98 Merge branch 'bugfix/confserver_temporaryfile_windows_v4.0' into 'release/v4.0'
confserver: Fix NamedTemporaryFile use on Windows (v4.0)

See merge request espressif/esp-idf!5818
2019-08-20 12:28:16 +08:00
79afd2d580 confserver: Fix NamedTemporaryFile use on Windows
Can't have the file open twice, so need to close and delete after reopening.
2019-08-19 17:44:18 +10:00
a8e8919bbf tools: Support sdkconfig.rename files from outside IDF in confgen.py 2019-08-19 17:44:18 +10:00
ba0f4f17ed Merge branch 'bugfix/doc_pip_requirements_v4.0' into 'release/v4.0'
Add -r flag to pip install command from file (backport v4.0)

See merge request espressif/esp-idf!5798
2019-08-16 13:16:04 +08:00
a63b3c4fe6 Merge branch 'feature/dport_eco_revision2_v4.0' into 'release/v4.0'
make dport workaround depend on chip revision (v4.0)

See merge request espressif/esp-idf!5765
2019-08-16 13:15:18 +08:00
6b8c75d87c Merge branch 'bugfix/hwcrypt_fault_inj_v4.0' into 'release/v4.0'
AES & SHA fault injection checks (backport v4.0)

See merge request espressif/esp-idf!5748
2019-08-16 05:29:54 +08:00
68d82abe52 Added -r flag to pip install command from file
Closes https://github.com/espressif/esp-idf/pull/3874
Closes https://github.com/espressif/esp-idf/issues/3915
2019-08-15 14:23:49 +02:00
ec31f235e9 docs: Correct and extend the documentation about VFS select() 2019-08-15 14:11:51 +02:00
7e9d90b180 VFS: Support concurrent VFS select calls
Closes https://github.com/espressif/esp-idf/issues/3392
2019-08-15 14:11:37 +02:00
d4fcbe37f3 Merge branch 'bugfix/idf_tool_default_encoding_v4.0' into 'release/v4.0'
idf_tool: fix UnicodeDecodeError (v4.0)

See merge request espressif/esp-idf!5720
2019-08-15 16:35:58 +08:00
b9a5f764ba Merge branch 'bugfix/fix_flash_read_error_in_dio_mode_v4.0' into 'release/v4.0'
bugfix(flash): add spi dio address bitlen configure in psram init (backprot v4.0)

See merge request espressif/esp-idf!5790
2019-08-15 12:08:56 +08:00
764b70d7e6 bugfix(flash): add spi dio address bitlen configure in psram init 2019-08-15 10:52:56 +08:00
a1496b90e5 Merge branch 'bugfix/fix_ledc_clock_select_bug_v4.0' into 'release/v4.0'
driver(ledc): fixed ledc clock selection bug for v4.0

See merge request espressif/esp-idf!5757
2019-08-14 10:44:39 +08:00
622d6d5504 mbedtls: use errno instead of SO_ERROR for getting socket errors
As per upgrade notes of lwIP v2.1.0:
socket API: according to the standard, SO_ERROR now only returns asynchronous errors.
All other/normal/synchronous errors are (and always were) available via 'errno'.
LWIP_SOCKET_SET_ERRNO has been removed - 'errno' is always set - and required!

Refer: https://www.nongnu.org/lwip/2_1_x/upgrading.html

Fixes https://github.com/espressif/esp-azure/issues/51
2019-08-13 13:11:24 +05:30
1b903111b6 efuse: update the scheme of getting chip revision 2019-08-13 14:37:17 +08:00
69ef694178 esp32_gdbstub: fix build error with esp32-2019r1 toolchain
Fixes https://github.com/espressif/esp-idf/issues/3866
Closes https://github.com/espressif/esp-idf/issues/3834
2019-08-13 11:38:28 +05:30
81651b47a4 Merge branch 'ci/disable_nimble_tests_v4.0' into 'release/v4.0'
ci: Temporarily disable NimBLE tests in CI (v4.0)

See merge request espressif/esp-idf!5754
2019-08-13 10:42:38 +08:00
30dc86179c Merge branch 'bugfix/fix_wifi_bugs_for_authmode_and_multi_ssid_v4.0' into 'release/v4.0'
fix wifi bugs for authmode and multi ssid (backport v4.0)

See merge request espressif/esp-idf!5725
2019-08-12 23:34:43 +08:00
eff3ac05b3 driver(ledc): fixed ledc clock selection bug for release/v4.0 2019-08-12 17:16:52 +08:00
e5349d47a8 ci: Temporarily disable NimBLE tests in CI 2019-08-12 17:14:54 +10:00
4253adf42b modify WIFI_CONN_0101 case for wrong authmode of AP 2019-08-12 02:38:44 +00:00
088ed65194 wifi: fix wifi bugs for authmode and multi ssid 2019-08-12 02:38:44 +00:00
0ce94950b7 sha: Add fault injection checks reading hash digest state
Vulnerability reported by LimitedResults under Espressif Bug Bounty Program.
2019-08-11 15:58:48 +10:00
ae8b2684d7 aes: Add fault injection checks when writing key to hardware
Vulnerability reported by LimitedResults under Espressif Bug Bounty Program.
2019-08-11 15:58:48 +10:00
9c51f679a7 Merge branch 'bugfix/update_example_docs_build_instructions_to_cmake_v4.0' into 'release/v4.0'
examples: change default build instructions in docs to CMake (v4.0)

See merge request espressif/esp-idf!5704
2019-08-09 13:20:25 +08:00
5c07acad46 idf_tool: fix unicode decode error
Closes https://github.com/espressif/esp-idf/issues/3841
2019-08-07 21:27:29 +08:00
70af759dd2 examples: change default build instructions in docs to CMake 2019-08-06 17:25:25 +05:30
76191a0f55 Merge branch 'move/ble_example_v4.0' into 'release/v4.0'
examples/bluetooth: Move the demos to the appropriate locations (v4.0)

See merge request espressif/esp-idf!5687
2019-08-06 00:32:26 +08:00
f0c3114f2f examples/bluetooth: Move the demos to the appropriate locations (v4.0) 2019-08-06 00:32:25 +08:00
16b300bd7a Merge branch 'bugfix/fix_the_bug_in_wifi_doc' into 'master'
docs: fix the bug in wifi doc

Closes IDFGH-1590

See merge request espressif/esp-idf!5647
2019-07-30 09:42:23 +08:00
b071fbdd81 Merge branch 'test/rtc_noinit_wdt_test' into 'master'
esp32: verify that RTC_NOINIT_ATTR vars are preserved after WDT reset

See merge request espressif/esp-idf!4936
2019-07-30 09:42:15 +08:00
8dbe1f024e Merge branch 'bugfix/pthread_fixes' into 'master'
pthread fixes

Closes IDFGH-1437

See merge request espressif/esp-idf!5646
2019-07-30 09:41:31 +08:00
b803c7328a Merge branch 'bugfix/btdm_some_unallocated_memory' into 'master'
Bugfix/btdm some unallocated memory

See merge request espressif/esp-idf!5629
2019-07-30 09:41:09 +08:00
d005d95119 Merge branch 'bugfix/gpio_intr_enable_bug' into 'master'
bugfix(GPIO):  Fixed the  GPIO  interrupt  enable  bug

Closes IDFGH-495

See merge request espressif/esp-idf!5571
2019-07-30 09:35:42 +08:00
6fe853a2c7 Merge branch 'bugfix/ws_client_fix_static_analysis_warnings' into 'master'
ws_client: fix double delete issue in ws client initialization

See merge request espressif/esp-idf!5309
2019-07-29 19:25:30 +08:00
e9b77d3a69 Merge branch 'feature/move_gettimeofday_in_clock_gettime' into 'master'
newlib: Move _gettimeofday_r call in clock_gettime

Closes IDFGH-1525

See merge request espressif/esp-idf!5562
2019-07-29 19:25:11 +08:00
f0442e744d Merge branch 'fix/esp_flash_compatible_with_rom' into 'master'
esp_flash: fix a compatibility issue working with the ROM

See merge request espressif/esp-idf!5462
2019-07-29 19:18:20 +08:00
477c7bb789 Merge branch 'feature/idf_tools_installer_ci' into 'master'
Build Windows tools installer in CI

Closes IDF-201

See merge request espressif/esp-idf!5583
2019-07-29 19:16:18 +08:00
64f81aefae bugfix(GPIO): Fixed the bug that GPIO enables interrupts on one core,
but registers interrupt service routines on another core

closes https://github.com/espressif/esp-idf/issues/2808
closes https://github.com/espressif/esp-idf/issues/2845
2019-07-29 11:09:07 +00:00
022223f570 Merge branch 'feat/sdmmc_io_cis_parse' into 'master'
sdmmc_io: support to print CIS information

See merge request espressif/esp-idf!5515
2019-07-29 19:05:30 +08:00
82af11813f Merge branch 'bugfix/export_macos' into 'master'
tools: export.sh: fix ESP-IDF path detection on macos

See merge request espressif/esp-idf!5644
2019-07-29 19:01:50 +08:00
b4e850a4b1 Merge branch 'bugfix/make_link_libc_psram' into 'master'
esp32: also add -mfix-esp32-psram-cache-issue to LDFLAGS

See merge request espressif/esp-idf!5643
2019-07-29 19:01:12 +08:00
b1bb90a596 Merge branch 'bugfix/partition_tables_update_note' into 'master'
global: update note in the partition tables

See merge request espressif/esp-idf!5636
2019-07-29 19:00:44 +08:00
f6857f634f Merge branch 'nimble/submodule_update_fix' into 'master'
NimBLE: Update submodule to fix bug in delete bond procedure

See merge request espressif/esp-idf!5605
2019-07-29 19:00:21 +08:00
1f0d682406 NimBLE: Update submodule to fix bug in delete bond procedure
- Fixes bug in `get_nvs_db_attribute` related to getting correct index while
  deleting bond in NVS.
- MR raised on esp-nimble branch: https://gitlab.espressif.cn:6688/espressif/esp-nimble/merge_requests/12
2019-07-29 19:00:21 +08:00
b7125303a2 Merge branch 'bugfix/examples_stale_options' into 'master'
examples: remove non-existent options from sdkconfig.defaults

See merge request espressif/esp-idf!5633
2019-07-29 19:00:04 +08:00
62bb107b31 docs: fix the bug in wifi doc 2019-07-29 14:55:17 +08:00
6cff19adb6 ci: add jobs to build idf_exe, cmdlinerunner, tools installer 2019-07-29 06:13:52 +02:00
fa555e3109 esp_flash: fix a compatibility issue working with the ROM
The esp_flash API has a side effects: it modifies the clock control
registers, and this makes the clock inconsistent with the ROM variable
`g_rom_spiflash_dummy_len_plus`.

This commit helps the ROM to get the correct dummy cycles required by
the latest clock settings. Every device on the SPI1 bus will update the
ROM variable when it modifies the clock registers.
2019-07-29 03:00:09 +00:00
14c7f8e150 Merge branch 'bugfix/ws_transport_revert_masked_after_sending' into 'master'
tcp_transport: websocket layer modifies in-buffer data (for masked transports)....

See merge request espressif/esp-idf!5546
2019-07-29 11:00:05 +08:00
3c63f49591 examples: remove non-existent options from sdkconfig.defaults 2019-07-29 04:57:38 +02:00
bfb0f83b32 Merge branch 'bugfix/dis_interrupts_up_to_6_level_for_dport_wa' into 'master'
esp32: Dis interrupts up to 5 lvl for DPORT

Closes IDF-728

See merge request espressif/esp-idf!5344
2019-07-29 10:57:20 +08:00
62780234a3 Merge branch 'bugfix/get-started-legacy-links' into 'master'
docs: getting-started: fix broken links

See merge request espressif/esp-idf!5549
2019-07-29 10:56:01 +08:00
e9de7b1df3 pthread: remove ESP32_ prefix from Kconfig options
pthread implementation is not chip-specific, so this prefix is not
needed.
2019-07-29 04:43:49 +02:00
661769527c pthread: force linking pthread implementation from IDF
Force linking pthread implementation from IDF, instead of the weak
functions provided by gthread library. Previously this would either
work or not depending on the linking order.

Thanks @bpietsch for suggesting the fix.

Closes https://github.com/espressif/esp-idf/issues/3709
2019-07-29 04:43:49 +02:00
434dd2d7a1 Merge branch 'bugfix/add_flash_config_in_app_startup' into 'master'
bugfix(flash): add flash config in app startup

See merge request espressif/esp-idf!5459
2019-07-29 10:42:27 +08:00
b98b4c3886 sdmmc_io: support to print CIS information
Currently only ESP slaves can be parsed correctly.
2019-07-29 10:41:17 +08:00
53d1d211e7 Merge branch 'feature/gcc_reorder_blocks' into 'master'
build system: add -freorder-blocks option for release config

See merge request espressif/esp-idf!3990
2019-07-29 10:16:49 +08:00
3f9fc97de7 tools: export.sh: fix ESP-IDF path detection on macos
The argument passed to the function is in $1; $0 contains `-bash`.
Before this fix, IDF_PATH would be set to $PWD instead of the correct
path.
2019-07-28 10:04:36 +02:00
98c179ed47 esp32: also add -mfix-esp32-psram-cache-issue to LDFLAGS
xtensa-esp32-elf-gcc selects among the multilib configurations based
on the presence of -mfix-esp32-psram-cache-issue flag. Pass this flag
in LDFLAGS so that the correct libraries are linked.

Reported in https://github.com/espressif/esp-idf/issues/3624
2019-07-28 08:05:56 +02:00
3e17c69e4f tools: idf_tools.py: allow downloading for a different platform 2019-07-28 07:27:00 +02:00
7cb3a57b9c build_system: add -freorder-blocks option for release config 2019-07-27 09:28:19 +00:00
c4e5c62cda Merge branch 'bugfix/malloc_warnings_rtc' into 'master'
rtc: fix minor malloc issues found by static analyzer

See merge request espressif/esp-idf!5144
2019-07-27 17:27:24 +08:00
1b6010bedf Merge branch 'bugfix/mdns_fix_discard_packet_on_invalid_name' into 'master'
mdns: fix ignoring mdns packet if contained an invalid name entries in question field

See merge request espressif/esp-idf!5307
2019-07-27 17:25:25 +08:00
26800ed71e global: update note in the partition tables
The build system automatically determines offsets of partitions from
the partition table, so no manual changes are needed. Instead, add a
note that partition offsets may need to be updated when increasing
the bootloader size.
2019-07-27 10:28:16 +02:00
75f64a01cd Merge branch 'bugfix/esp_event_add_missing_include' into 'master'
esp_event: add missing header include

See merge request espressif/esp-idf!5630
2019-07-26 18:30:34 +08:00
84982ae2ee Merge branch 'feature/ext_flash_example' into 'master'
examples: add FATFS in external Flash example

See merge request espressif/esp-idf!5579
2019-07-26 16:30:37 +08:00
a8535767e4 esp_event: add missing header include
Required header was indirectly getting resolved through lwip includes,
apparently does not work if application is not using lwip networking stack.
2019-07-26 13:58:26 +05:30
f77a5851bb component/bt: Fix BLE SMP free without init 2019-07-26 14:40:03 +08:00
2d1d747cbb component/bt: Avoid A2DP demo to use unallocated memory 2019-07-26 14:40:02 +08:00
d1f774bc0a component/bt: Avoid PLC to use unallocated memory
Closes https://github.com/espressif/esp-idf/pull/3799
2019-07-26 14:39:50 +08:00
89ee7b5dfb examples: add FATFS in external Flash example
Demonstrates the usage of the new spi_bus_add_flash_device,
esp_flash_init, esp_partition_register_external functions.
2019-07-26 08:19:42 +02:00
b0456cc926 Merge branch 'bugfix/mesh_scan_done_crash' into 'master'
Bugfix: mesh scan done crash caused by uint8_t overflow

See merge request espressif/esp-idf!5590
2019-07-25 18:01:47 +08:00
842432fb65 Merge branch 'bugfix/dont_rerun_reconfig_on_tests' into 'master'
Don't re-run reconfig on tests executed with same parameters

Closes IDF-732

See merge request espressif/esp-idf!5335
2019-07-25 12:24:03 +08:00
c19106876c Merge branch 'bugfix/tools_installer_fixes' into 'master'
tools: fixes for idf_tools.py and Windows tools installer

Closes IDFGH-1545 and IDFGH-1544

See merge request espressif/esp-idf!5595
2019-07-25 12:20:28 +08:00
308d03456d Merge branch 'bugfix/fix_WiFi_stack_can_freeze' into 'master'
esp_wifi: ESP32_WIFI_RX_BA_WIN should be less than ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM

Closes IDFGH-1383

See merge request espressif/esp-idf!5576
2019-07-25 10:42:54 +08:00
dd26caf779 esp_wifi: ESP32_WIFI_RX_BA_WIN should be less than ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM 2019-07-24 18:03:33 +08:00
a7ddb03274 mesh: fix scan done crash caused by uint8_t overflow 2019-07-24 15:54:50 +08:00
80ad09f230 tools: installer: allow changing installation path
Installation path can now be changed in a subsequent install,
without uninstalling and logging out.
The default value of the installation path is set to
IDF_TOOLS_PATH environment variable, if it was already set by the
previous installation, or by the user.

Closes https://github.com/espressif/esp-idf/issues/3806
2019-07-24 06:44:30 +02:00
3450d9e531 Merge branch 'bugfix/ethernet_apll_clock_config' into 'master'
fix ethernet apll clock config and other optimization

Closes IDFGH-1432, IDFGH-1503, and IDFGH-1504

See merge request espressif/esp-idf!5499
2019-07-24 11:28:10 +08:00
e36a76d940 idf_ext.py: don't rerun reconfig for tests when possible 2019-07-23 16:15:33 +02:00
09fe556faa Merge branch 'doc/resolve-pdf-building-issues' into 'master'
Doc/resolve pdf building issues

See merge request espressif/esp-idf!5566
2019-07-23 17:45:42 +08:00
639687f92b Replace gif images on EN and zh_CN index pages with identical png images for successful building of PDFs on ReadTheDocs. 2019-07-23 17:45:41 +08:00
1271008dd8 tools: tools.json: don't require ulp-binutils and openocd on x86 Linux
Fixes https://esp32.com/viewtopic.php?f=13&t=11540
2019-07-23 06:57:36 +02:00
b70ac4deb7 tools: idf_tools.py: improve error message when no downloads found
...for the given platform.
Previously would raise AssertionError.
2019-07-23 06:55:30 +02:00
f38c1c18a8 tools: install.bat: bail out if idf_tools.py call fails
Makes installation errors easier to spot.
2019-07-23 06:20:52 +02:00
78aef41ef6 Merge branch 'test/check_lib_reversion' into 'master'
test: move wifi library check to esp32-wifi-lib ci

See merge request espressif/esp-idf!5483
2019-07-23 12:02:37 +08:00
018de8101f ethernet: can build without enable esp32 emac
Closes https://github.com/espressif/esp-idf/issues/3770
2019-07-22 21:07:02 +08:00
97ad2bcb86 ethernet: support giving 50mhz rmii clock with both 40mhz and 26 mhz rtc xtal
Merges https://github.com/espressif/esp-idf/pull/3769
Closes https://github.com/espressif/esp-idf/pull/3704
2019-07-22 21:07:02 +08:00
cfbf8c5d07 ethernet: task yield at the end of isr handler 2019-07-22 21:07:02 +08:00
af78311975 ethernet: malloc hal together with driver context 2019-07-22 21:07:02 +08:00
9c5284e7b5 tools: installer: verify that IDF_PATH doesn't contain spaces 2019-07-22 09:29:49 +02:00
aaf3dcbda0 tools: installer: fix quoting of IDF_TOOLS_PATH
IDF_TOOLS_PATH may contain spaces, so needs to be properly quoted.

Closes https://github.com/espressif/esp-idf/issues/3807
2019-07-22 09:29:49 +02:00
606c6c867c Merge branch 'bugfix/mqtt_minor_fixes' into 'master'
mqtt: bugfixes: crash on disconnect if not connected, fixed static analysis warning

See merge request espressif/esp-idf!5223
2019-07-22 15:21:39 +08:00
4dc247f5ec Merge branch 'bugfix/IDF-790' into 'master'
tools: added realpath_int() for MacOS script path resolution

Closes IDF-790

See merge request espressif/esp-idf!5548
2019-07-22 11:56:28 +08:00
fcb668ec9c Merge branch 'bugfix/btdm_AVRC_command_fail_while_playing' into 'master'
components/bt: Fix AVRCP command will not be executed while playing music

See merge request espressif/esp-idf!5458
2019-07-22 11:45:19 +08:00
7436535fbe Merge branch 'doc/add_Chinese_translation_to_api-reference_network_esp_smartconfig' into 'master'
Add Chinese translation to api-reference/network/esp_smartconfig.rst

See merge request espressif/esp-idf!5302
2019-07-19 19:04:44 +08:00
d767e0edc7 Add Chinese translation to api-reference/network/esp_smartconfig.rst 2019-07-19 19:04:44 +08:00
75f5e443c6 Merge branch 'doc/review_api-ref_periph-timer' into 'master'
Review the file api-reference/peripherals/timer.rst

See merge request espressif/esp-idf!5291
2019-07-19 15:06:52 +08:00
75d7ca4b60 Review the file api-reference/peripherals/timer.rst 2019-07-19 15:06:52 +08:00
ad966d9375 Merge branch 'config/nimble_params' into 'master'
NimBLE: Give an option to configuration no of bonds and CCCD's to save through menuconfig

See merge request espressif/esp-idf!5563
2019-07-19 14:34:57 +08:00
c75240a939 NimBLE: Give an option to configuration no of bonds and CCCD's to save through menuconfig 2019-07-19 14:34:57 +08:00
18df3dd5ed test: move wifi library check to esp32-wifi-lib ci 2019-07-19 13:12:57 +08:00
ceea278501 Merge branch 'bugfix/fix_some_supplicant_bugs' into 'master'
esp_wifi/supplicant: fix some supplicant bugs

Closes IDFGH-1455 and IDF-774

See merge request espressif/esp-idf!5511
2019-07-19 10:46:39 +08:00
4be0fdb24c Merge branch 'doc/review_api-ref_periph-ledc' into 'master'
Doc/review api ref periph ledc

See merge request espressif/esp-idf!5342
2019-07-18 20:33:27 +08:00
0a11604686 Merge branch 'feature/dockerfile' into 'master'
tools: add Dockerfile

Closes IDFGH-1304 and IDF-590

See merge request espressif/esp-idf!5432
2019-07-18 19:52:38 +08:00
54b16b7f5a tools: added realpath_int() for MacOS script path resolution
JIRA IDF-790
2019-07-18 13:36:11 +02:00
f3f08fa713 esp_wifi/supplicant: fix some supplicant bugs
Closes IDFGH-1455
Closes IDF-774
2019-07-18 17:36:19 +08:00
f27527dd78 Merge branch 'bugfix/phy_change_for_WiFi_scan_BLE_scan_watchdog' into 'master'
phy change for WiFi scan BLE scan watchdog

Closes WIFI-681

See merge request espressif/esp-idf!5539
2019-07-18 17:31:00 +08:00
d8b3676797 Review the file api-reference/peripherals/ledc.rst 2019-07-18 16:38:59 +08:00
6289a26596 mqtt: referenced esp-mqtt master to close disconnection issues and fix static analysis warnings
closes https://github.com/espressif/esp-idf/issues/3619 including mqtt commit 7223302deb
closes https://github.com/espressif/esp-idf/issues/3215 including mqtt commit caf5007b99
2019-07-18 10:34:10 +02:00
ffca1825e6 lwip fuzzer: supplied dummy dns server entry to work with internal packet processing functionwhich is exercised in fuzzer tests, disable CTYPE as recent newlib is not compatible with AFL 2019-07-18 10:34:03 +02:00
d77c74770a bugfix(flash): add flash config in app startup
We fixed some flash bugs in bootloader, but for the users used the old
vrsion bootloader, they can not fix these bugs via OTA, the solution is
add these updates in app startup.

These updates include:
1. SPI flash gpio matrix and drive strength configuration
2. SPI flash clock configuration
3. SPI flash read dummy configuration
4. SPI flash cs timing configuration
5. Update flash id of g_rom_flashchip
2019-07-18 14:40:59 +08:00
83277fe0f2 docs: add tools section and IDF docker image page 2019-07-18 06:18:04 +00:00
024176c509 ci: build IDF docker image in CI 2019-07-18 06:18:04 +00:00
dd443f61e8 tools: add Dockerfile 2019-07-18 06:18:04 +00:00
69504bd9c5 phy change for WiFi scan BLE scan watchdog 2019-07-18 11:00:18 +08:00
c6c6cd7179 rtc: fix minor malloc issues found by static analyzer 2019-07-17 14:45:17 +00:00
785e711561 Merge branch 'bugfix/mesh_stop_block' into 'master'
mesh: fix esp_mesh_stop blocking issue

Closes WIFI-313

See merge request espressif/esp-idf!5475
2019-07-17 20:36:51 +08:00
7982ed9a7d newlib: Move _gettimeofday_r call in clock_gettime
Signed-off-by: KonstantinKondrashov <konstantin@espressif.com>
Merges: https://github.com/espressif/esp-idf/pull/3789
2019-07-17 16:52:40 +08:00
c29e353142 Merge branch 'bugfix/app_update_tests' into 'master'
app_update: Add [timeout=90] for UTs

See merge request espressif/esp-idf!5553
2019-07-17 16:41:06 +08:00
e431bfd6c2 docs: getting-started: correct style of "macOS" name 2019-07-17 08:31:35 +02:00
7feea26404 docs: getting-started: fix broken links 2019-07-17 08:30:53 +02:00
a544c0e4da Merge branch 'bugfix/optimize_wifi_rx' into 'master'
esp_wifi: optimize wifi rx

See merge request espressif/esp-idf!5501
2019-07-17 12:40:09 +08:00
4dd75184e4 mesh: fix esp_mesh_stop not return 2019-07-17 11:02:21 +08:00
17791d5384 app_update: Add [timeout=90] 2019-07-17 10:28:50 +08:00
eab3edf3d4 Merge branch 'fix_bug_for_ipv6_example' into 'master'
Modify IPv6 functionality compatible with lwip2.1.2

See merge request espressif/esp-idf!5495
2019-07-17 00:09:17 +08:00
45dd6175cd esp_wifi: optimize wifi rx 2019-07-16 17:59:04 +08:00
d7e659df27 Merge branch 'bugfix/fix_wifi_stop_bug' into 'master'
esp_wifi: fix wifi stop

See merge request espressif/esp-idf!5479
2019-07-16 17:55:19 +08:00
f048be924c components/bt: Fix AVRCP command will not be executed while playing music 2019-07-16 08:50:36 +00:00
f29ff2c552 Modify IPv6 functionality compatible with lwip2.1.2 2019-07-16 16:22:11 +08:00
8fc02e860a tcp_tansport: websocket layer modifies in-buffer data (for masked transports). This fix reverts the data back to original rather then making a copy.
Closes https://github.com/espressif/esp-idf/issues/3774
2019-07-16 09:47:18 +02:00
596209de69 Merge branch 'feature/update_mbedtls_config_approach' into 'master'
Modify esp_config include approach

See merge request espressif/esp-idf!5382
2019-07-16 15:32:03 +08:00
4732e22e64 Merge branch 'bugfix/fix_mcpwm_example_memory_bug' into 'master'
Bugfix(example) : Fixed the bug that the malloc memory size is smaller than the actual required.

Closes IDFGH-1490

See merge request espressif/esp-idf!5509
2019-07-16 14:51:35 +08:00
b7d6aa74dd esp_wifi: fix WiFi stop bug
Fix the bug that WiFi stop causes esp_wifi_internal_reg_rxcb() fails.
2019-07-16 14:09:47 +08:00
69a313b6ae esp32: Add UTs for DPORT and Hi-interrupt 2019-07-16 05:54:45 +00:00
632b016028 esp32: Dis interrupts up to 5 lvl for DPORT
Disable interrupts for both DPORT workarounds up to 5 lvl.

Closes: https://esp32.com/viewtopic.php?f=2&t=10981&sid=d125cec233070ed4d2c5410bf5d3d74a
Closes: IDF-728
2019-07-16 05:54:45 +00:00
a6b39f0c64 Merge branch 'bugfix/wifi_prov_mgr_event_end_missing' into 'master'
Bugfix wifi_prov_mgr : Added missing esp_event_post() for WIFI_PROV_END events

See merge request espressif/esp-idf!5522
2019-07-16 13:53:08 +08:00
56afdedf7c Merge branch 'bugfix/do_not_require_new_target_link_library_signature' into 'master'
CMake: Do not force use of new target_link_libraries signature

See merge request espressif/esp-idf!5471
2019-07-16 13:36:35 +08:00
caf3a43c07 Merge branch 'bugfix/fix_smartconfig_crash_when_no_ap_is_found' into 'master'
esp_wifi: smartconfig crash when no ap is found

Closes IDFGH-1292

See merge request espressif/esp-idf!5505
2019-07-15 21:21:09 +08:00
9b507c45c8 ws_client: fix double delete issue in ws client initialization 2019-07-15 13:15:07 +02:00
034440b85d esp_wifi: fix smartconfig crash when no AP is found
Fix the bug that smartconfig crashes when no AP is found during smartconfig scan.
2019-07-15 12:44:03 +08:00
fdab15dc76 Merge branch 'bugfix/modify_wifi_country_struct' into 'master'
esp32: make wifi_country_t in idf consistent with VNC

See merge request espressif/esp-idf!5463
2019-07-15 12:41:59 +08:00
6ae352c3a0 Merge branch 'bugfix/fix_regression_with_setting_component_dir_in_early_expansion' into 'master'
cmake: set COMPONENT_DIR in early expansion

Closes IDFGH-1506

See merge request espressif/esp-idf!5518
2019-07-15 11:05:21 +08:00
17e637afa3 Merge branch 'bugfix/docs_update_openssl_command' into 'master'
mqtt: update example documentation on generating a certificate for ssl authentication to hosts

See merge request espressif/esp-idf!5220
2019-07-15 10:53:37 +08:00
bd0a5d4c8b Merge branch 'feature/esptool_py_use_component_properties' into 'master'
esptool_py: use component property to simplify arg file generation

See merge request espressif/esp-idf!5312
2019-07-15 10:52:15 +08:00
3eda52f6cd mqtt: update example documentation on generating a certificate for ssl authentication to hosts
Closes https://github.com/espressif/esp-idf/issues/3593
2019-07-14 16:05:50 +02:00
5588b22796 Merge branch 'bugfix/fix_wps_memory_leak' into 'master'
WPS: fix wps memory leak

Closes WIFI-630 and WIFI-644

See merge request espressif/esp-idf!5314
2019-07-14 17:19:16 +08:00
8f2d13d9db WiFi: Modify the wifi_country struct in VNC to keep it consistent with IDF.
1, Modfy wifi_country struct
    2, Add md5 check esp_wifi_types.h
    3, Add md5 check esp_wifi.h
2019-07-14 15:10:11 +08:00
3d95b63686 Merge branch 'doc/heap_thread_safety' into 'master'
docs: Add notes about thread safety and using heap from ISRs

Closes IDFGH-1502

See merge request espressif/esp-idf!5516
2019-07-14 14:48:14 +08:00
fdece759d8 Merge branch 'bugfix/fix_the_watchdog_during_WiFi_scan_BLE_scan' into 'master'
fix the watchdog bug during WiFi scan and BLE scan

See merge request espressif/esp-idf!5521
2019-07-14 14:40:33 +08:00
0e07b85d2f wifi_prov_mgr : Added missing esp_event_post() for WIFI_PROV_END events 2019-07-13 15:48:23 +05:30
d1bf08d4ad coexist: fix the watchdog bug during WiFi scan and BLE scan 2019-07-12 20:23:59 +08:00
d3e814fe19 cmake: set COMPONENT_DIR in early expansion
Gives same treatment to COMPONENT_DIR as COMPONENT_PATH in
https://gitlab.espressif.cn:6688/espressif/esp-idf/merge_requests/4557

Closes https://github.com/espressif/esp-idf/issues/3771
2019-07-12 16:22:18 +08:00
1dec976fba Update esp_config and add new feature
Closes https://github.com/espressif/esp-idf/issues/3372
2019-07-12 11:42:48 +05:30
8795f1ac86 Fixed the bug that the malloc memory size is smaller than the actual required.
Merges https://github.com/espressif/esp-idf/pull/3757
2019-07-12 09:51:41 +08:00
0f27c38855 docs: Add notes about thread safety and using heap from ISRs
Closes https://github.com/espressif/esp-idf/issues/3768
2019-07-12 11:09:00 +10:00
0114af25da Merge branch 'feature/vfs_pread' into 'master'
VFS: Implement pread() and pwrite()

Closes IDFGH-1211

See merge request espressif/esp-idf!5422
2019-07-11 19:33:33 +08:00
6c865a84ff 1, Fix wps memory leak.
2, Add a queue to save wps rx eapol frame.
  3, Add data lock protect wpa2_sig_cnt.
  4, Add a queue to save wpa2 rx rapol frame.
2019-07-11 08:57:31 +00:00
577d2c5e2b Merge branch 'bugfix/parttool_baud' into 'master'
partition_table: Add baud option to parttool and otatool

Closes IDFGH-1483

See merge request espressif/esp-idf!5494
2019-07-11 14:53:54 +08:00
41062bea99 VFS: Implement pread() and pwrite()
Closes https://github.com/espressif/esp-idf/issues/3515
2019-07-11 06:20:21 +00:00
1ea68e6093 Merge branch 'feature/build_example_make_on_trigger' into 'master'
ci: don't build examples with Make in regular jobs

See merge request espressif/esp-idf!5498
2019-07-11 13:59:15 +08:00
65582291ad Merge branch 'bugfix/unit_test_app_size' into 'master'
unit-test-app: split default, release, single_core configs

See merge request espressif/esp-idf!5497
2019-07-11 13:27:30 +08:00
9b5a3ca9fc Merge branch 'feature/cleanup_fast_crypto_files' into 'master'
wpa_supplicant: Cleanup fast_xxx modules that use duplicate code

See merge request espressif/esp-idf!5190
2019-07-11 10:26:45 +08:00
663ed11509 unit-test-app: use stripped config name in test case ID:
We could split cases of same config into multiple binaries as we have limited rom space. So we should regard those configs like `default` and `default_2` as the same config.
2019-07-11 10:01:05 +08:00
edd7f90b77 ci: don't build examples with Make on pushes
Still build the examples with make on:
- triggered pipelines
- master, release branches, tags
- scheduled and manual (web) pipelines
2019-07-10 17:16:53 +02:00
56e3f2780d ci: add unit test job 2019-07-10 22:44:11 +08:00
41b6811f45 unit-test-app: split default, release, single_core configs 2019-07-10 22:44:11 +08:00
3552ca4d6a app_update: Add the baud option into otatool 2019-07-10 15:09:46 +02:00
3f47269211 app_update: Fix argument of ParttoolTarget 2019-07-10 15:09:46 +02:00
aa0c5f03be Add --baud option to parttool
Closes https://github.com/espressif/esp-idf/pull/3753
2019-07-10 15:09:46 +02:00
900df44546 wpa_supplicant: Cleanup fast_xxx modules that use duplicate code
wpa_supplicant is using MbedTLS API's for crypto algorithms. For
calling them a duplicate set of modules is maintained prepended
with 'fast_'. Remove these and use flag USE_MBEDTLS_CRYPTO
instead to separate modules calling MbedTLS API's from native
implementation.
2019-07-10 14:53:20 +05:30
847e00d17b Merge branch 'bugfix/idf_exe_crash' into 'master'
tools: fix idf.py.exe crash on Windows 7

Closes IDFGH-1471

See merge request espressif/esp-idf!5484
2019-07-10 16:20:13 +08:00
fbc8e35577 Merge branch 'bugfix/btdm_compile_error_with_new_toolchain' into 'master'
components/bt: Fix compile error with new toolchain

See merge request espressif/esp-idf!5444
2019-07-10 15:28:49 +08:00
6a3c5905ed Merge branch 'bugfix/docs_recover_some_build_time' into 'master'
docs: Remove building of zipped HTML docs from build process and consequently...

See merge request espressif/esp-idf!5467
2019-07-10 10:06:32 +08:00
058ef98c33 Merge branch 'feature/cmake_default_build_system' into 'master'
cmake: Make CMake the default build system

Closes IDF-198 and IDF-325

See merge request espressif/esp-idf!5328
2019-07-10 08:16:39 +08:00
409181361f Merge branch 'bugfix/fix_flash_read_error_in_dio_26MHz_mode' into 'master'
bugfix(flash): fix flash read error in DIO/26MHz mode

See merge request espressif/esp-idf!5381
2019-07-10 08:13:35 +08:00
e6e1792946 tools: update idf_exe to 1.0.1 2019-07-09 14:15:09 +02:00
15bcb79712 idf_exe: bump version to 1.0.1 2019-07-09 14:15:09 +02:00
76dc87e9ad idf_exe: fix NULL pointer passed to WriteFile
For an unknown reason, passing NULL pointer instead of &written worked
on Windows 10 and on Windows 7 when stdout is not redirected.

Closes https://github.com/espressif/esp-idf/issues/3740
2019-07-09 14:15:09 +02:00
896d675248 idf_tools.py: add another platform string to handle Windows x86 2019-07-09 14:11:19 +02:00
c8f5f47d5d Merge branch 'bugfix/fix_uart_wait_done_bug' into 'master'
Driver(UART):  Fixed two UART issues

Closes IDFGH-1348

See merge request espressif/esp-idf!5340
2019-07-09 18:39:02 +08:00
80e9faaf1c docs: Move Legacy Get Started guide to the Related Documents section 2019-07-09 20:35:34 +10:00
f8c107fbe3 components/bt: Fix compile error with new toolchain
Closes https://github.com/espressif/esp-idf/issues/3331
Closes https://github.com/espressif/esp-idf/issues/3734
2019-07-09 17:50:43 +08:00
9583c8d037 docs: Rephrase the warning about not requiring MSYS2 on Windows 2019-07-09 14:32:26 +10:00
05ac8cfb6d docs: Update description for Eclipse+Cmake support not ready yet 2019-07-09 14:32:26 +10:00
222146845c docs: Make CMake build system default, mark GNU Make as legacy option
All `-cmake` suffixes are removed
Where a GNU Make option is renamed, the `-legacy` suffix is used
2019-07-09 14:32:26 +10:00
27a6f84e7f Merge branch 'bugfix/eth2ap_example' into 'master'
temporarily work around for fixing eth2ap

Closes IDFGH-1458 and IDFGH-1456

See merge request espressif/esp-idf!5441
2019-07-09 12:20:44 +08:00
ce9600ec81 Merge branch 'docs/rename_partition_addr_param_pr3750' into 'master'
esp_partition_erase_range(): rename parameter "start_addr" to "offset"

See merge request espressif/esp-idf!5469
2019-07-09 12:18:38 +08:00
2a5b02097b cmake: do not force use of new signature for target_link_libraries 2019-07-08 19:43:57 +08:00
74140b0cfb Merge branch 'feature/cmake_proto_build' into 'master'
cmake : Add CMakeLists.txt and update READMEs for re-compilation of proto files

Closes IDF-725

See merge request espressif/esp-idf!5442
2019-07-08 19:13:32 +08:00
62ed221daf docs: Functional renaming commit for CMake-as-default
Rename all the files which will be edited substantially in the next commit, without changing their
contents

Docs will not build for this ocmmit.

This is done so that git doesn't decide we renamed xxx-cmake -> xxx-legacy in the next commit, which
is what it will infer otherwise (and makes rebasing more of a pain than it should be)
2019-07-08 17:31:27 +10:00
86dbe9299a docs: Load page redirects from a file instead of inline in config 2019-07-08 17:31:27 +10:00
47bbb107a8 build system: Use CMake-based build system as default when describing commands 2019-07-08 17:31:27 +10:00
d6c2dad101 esp_partition_erase_range(): rename parameter "start_addr" to "offset"
The name "start_addr" (which goes straight into the docs) implies
it's an absolute address while in fact it's an offset into the
partition like what's used in all the other esp_partition_*
functions.

So in order to avoid confusion make the name consistent with the
parameter names used for the other partition functions and call it
"offset".

Merges https://github.com/espressif/esp-idf/pull/3750
2019-07-08 17:29:05 +10:00
f6ad7f564d Merge branch 'bugfix/otadata_operations_do_not_use_esptool_configs' into 'master'
Fix Make otadata operations do not use esptool configs

Closes IDFGH-686

See merge request espressif/esp-idf!4636
2019-07-08 15:19:30 +08:00
c25fe765a9 Merge branch 'feature/esp_http_client_tx_buf_size' into 'master'
esp_http_client: separate buffer_size config option for transmit

See merge request espressif/esp-idf!5337
2019-07-08 15:15:14 +08:00
e0360bf156 temporarily work around for fixing eth2ap
Closes https://github.com/espressif/esp-idf/issues/3726
Closes https://github.com/espressif/esp-idf/issues/3728
2019-07-08 15:05:09 +08:00
363f3e8311 docs: Remove building of zipped HTML docs from build process and consequently from Downloads as many users don't use that. We are still providing PDF documentation for people who prefer viewing docs off-line. Removal of this build step is expected to save almost 10 minutes of build time and resolve issue of build failures because of hitting 40 min build time limit on Read The Docs. 2019-07-08 13:19:56 +08:00
c3cc096af0 Merge branch 'ci/cmake_examples_multichip_support' into 'master'
ci: multichip build support for examples

See merge request espressif/esp-idf!5384
2019-07-08 12:29:25 +08:00
09a63cca51 bugfix(UART): fixed two UART issues:
1. uart_wait_tx_done works incorrect when sending a byte of data.
2. uart_set_rx_timeout sets an incorrect rx timeout value when ref_tick is enabled

closes https://github.com/espressif/esp-idf/issues/3631
2019-07-08 12:27:14 +08:00
0f50af0a12 Merge branch 'bugfix/supplicant_security_fixes' into 'master'
wpa_supplicant: Fix sprintf security bugs.

Closes WIFI-624

See merge request espressif/esp-idf!5295
2019-07-08 11:13:20 +08:00
1587770cbb Merge branch 'bugfix/improve_spi_timing_for_flash' into 'master'
bugfix(flash): improve spi cs timing settings for flash

See merge request espressif/esp-idf!4964
2019-07-08 11:11:03 +08:00
266baa8839 bugfix(flash): fix flash read error in DIO/26MHz mode 2019-07-08 01:50:07 +00:00
1935a5a93c Merge branch 'bugfix/gcov_example_report_cmake_target' into 'master'
gcov_example: Adds cmake target to generate report

Closes IDF-727

See merge request espressif/esp-idf!5403
2019-07-08 09:30:11 +08:00
ee1743af70 Merge branch 'bugfix/confgen_break' into 'master'
tools: Fix indentation in confgen.py

See merge request espressif/esp-idf!5460
2019-07-08 09:29:09 +08:00
d67b9403e8 Merge branch 'feature/tcp_transport_pass_errors_stage1' into 'master'
esp-tls: capturing specific errors to be available in tcp_transport and then in application code

See merge request espressif/esp-idf!4782
2019-07-08 08:51:29 +08:00
0a65cf73fa Merge branch 'feature/prov_mgr_event_loop' into 'master'
Wi-Fi Provisioning : Add support for esp_event

See merge request espressif/esp-idf!4857
2019-07-07 13:40:18 +08:00
274d7fe12a Merge branch 'feature/lwip_2.1.2_idf' into 'master'
lwip_2.1.2 for idf_4.0

See merge request espressif/esp-idf!5374
2019-07-07 13:33:41 +08:00
fa02598b5c lwip_2.1.2 for idf_4.0 2019-07-07 01:51:45 +00:00
138c941fad Merge branch 'mesh/use_event_library' into 'master'
Mesh/use event library

See merge request espressif/esp-idf!4800
2019-07-06 21:55:21 +08:00
f3d6219c46 tools: Fix indentation in confgen.py 2019-07-06 09:17:31 +02:00
ae46f04997 wpa_supplicant: Fix sprintf security bugs.
Revert back to using os_snprintf instead of sprintf.

Closes WIFI-624
2019-07-06 04:22:53 +00:00
d6c40c7c1d bugfix(flash): improve spi cs timing settings for flash
cs setup time is recomemded to be 1.5T, and cs hold time is recommended to be 2.5T.
(cs_setup = 1, cs_setup_time = 0; cs_hold = 1, cs_hold_time = 1)
2019-07-05 21:21:17 +08:00
068a2dcb32 mesh: update mesh events demonstration 2019-07-05 21:14:33 +08:00
a272e7204d mesh: use new event library 2019-07-05 21:14:30 +08:00
783ddd1e05 Merge branch 'cleanup/remove_redundant_tags_file' into 'master'
wpa_supplicant: Remove tags file which was added by mistake

See merge request espressif/esp-idf!5457
2019-07-05 21:11:41 +08:00
bd4591b053 esp_http_client: separate buffer_size config option for transmit
Merges https://github.com/espressif/esp-idf/pull/3528

Signed-off-by: Jitin George <jitin@espressif.com>
2019-07-05 13:04:35 +00:00
f16f4297cd Merge branch 'doc/power_management_update_with_bt_changes' into 'master'
doc/power_management_update_with_bt_changes

See merge request espressif/esp-idf!5170
2019-07-05 21:03:52 +08:00
27628ef133 Merge branch 'doc/add_ble_mesh_doxyfile' into 'master'
ble_mesh: add Doxyfile for core apis & model apis

See merge request espressif/esp-idf!5401
2019-07-05 20:55:39 +08:00
98cf38ca9c cmake : Add CMakeLists.txt and update READMEs for re-compilation of proto files 2019-07-05 18:20:15 +05:30
c849f7bfb6 Merge branch 'mesh/bugfix_0628_master' into 'master'
mesh: bugfix

Closes WIFI-628, WIFI-638, WIFI-635, WIFI-582, WIFI-130, WIFI-622, WIFI-579, WIFI-428, and WIFI-451

See merge request espressif/esp-idf!5437
2019-07-05 20:48:03 +08:00
2926cd09a2 gcov_example: Adds cmake target to generate report
Closes IDF-727
2019-07-05 12:44:35 +00:00
534062dd3b Merge branch 'bugfix/btdm_fix_rxwinsz_assert_in_wifi_ble_coex' into 'master'
component/bt: fix rxwinsz assert in ble and wifi coex

See merge request espressif/esp-idf!5434
2019-07-05 20:27:33 +08:00
46c8497f01 Merge branch 'bugfix/prov_tool_desc_readme' into 'master'
esp_prov : Minor refactoring in argument dependent logic and other changes

See merge request espressif/esp-idf!5430
2019-07-05 17:18:32 +08:00
181fd70a9a ci: multichip build support for examples 2019-07-05 17:06:25 +08:00
773ddcf0ff wpa_supplicant: Remove tags file which was added by mistake
Merge request idf/esp-idf!5219 added a ctags 'tags' file to
the repository by mistake. Remove it.
2019-07-05 14:23:21 +05:30
703e98eb98 wifi_prov_mgr : Updated the set of WIFI_REASON_ codes used for setting WIFI_PROV_STA_AUTH_ERROR 2019-07-05 08:41:27 +00:00
9f1033862d wifi_prov_mgr : Free memory allocated by cJSON_Print 2019-07-05 08:41:27 +00:00
a13cc7da7a Provisioning : Manager example updated to use esp_event_loop feature 2019-07-05 08:41:27 +00:00
0e8bd1699d Wi-Fi Provisioning : Manager docs updated with information about esp_event_loop support 2019-07-05 08:41:27 +00:00
69ade757e2 Wi-Fi Provisioning : Manager now uses esp_event to catch system events and emit provisioning events to the default event loop
List of changes:
* Deprecated public API wifi_prov_mgr_event_handler() and added private function wifi_prov_mgr_event_handler_internal(), registered with the default event loop for catching WIFI and IP system events
2019-07-05 08:41:27 +00:00
f79813ff86 Merge branch 'feature/tools_script_to_switch_submodules' into 'master'
tools: Fix up relative submodule URLs for forks

See merge request espressif/esp-idf!5421
2019-07-05 16:16:58 +08:00
d64d97743f Merge branch 'bugfix/efuse_secure_version_emulate' into 'master'
efuse: Fix mode EFUSE_SECURE_VERSION_EMULATE

See merge request espressif/esp-idf!5446
2019-07-05 16:05:26 +08:00
c24c5cf164 Merge branch 'feature/gdbstub_multi_target' into 'master'
gdbstub multi-target support

Closes IDF-466

See merge request espressif/esp-idf!5246
2019-07-05 14:33:54 +08:00
c516819ba6 mesh: bugfix
1. resend eb which are pending in g_ic.tx_buf due to channel switch.
2. add lock for mgmg/xon/bcast to protect send from user flush.
3. softap: add check if secondary offset is correct when start softap.
4. softap: in inactive timer handler, add check if child bss is removed to avoid removing it again.
5. disable A-MPDU for non-root.
6. fix reusing a freed eb.
7. fix when node becomes root, it does not record assoc value to nvs.
8. discard unnecessary forwarded group packets.
9. fix toDS state is not updated in time.
10. fix s_sta_cnx_times is not cleared when deinit causes root sends ADD annoucement.
11. root: increase beacon timeout time from 6 seconds to 15 seconds to delay initiation of reconnection.
12. add esp_mesh_get_tsf_time to return TSF time.
13. send the whole routing table multi-times.
14. clear candidate settings if not receive candidate beacon within 8 seconds.
2019-07-05 13:17:43 +08:00
c9cf0afb6e tools: Add a script for switching to real submodules in forks 2019-07-05 11:12:06 +07:00
b54762597a Avoid 'redirecting to' warnings when cloning 2019-07-05 11:12:06 +07:00
nif
e72a09ee27 Make submodules work in forks
Merges https://github.com/espressif/esp-idf/pull/3721
2019-07-05 11:12:06 +07:00
7ef42f2596 Merge branch 'fix/nvs_util_key_len' into 'master'
nvs_util: Add check for key len in input csv file

See merge request espressif/esp-idf!5392
2019-07-05 10:34:55 +08:00
94e0569c2b make, cmake: pass config esptool args for otatool invocation
Closes https://github.com/espressif/esp-idf/issues/3135
2019-07-05 02:26:00 +00:00
2360d882d9 parttool, otatool: accept esptool args 2019-07-05 02:26:00 +00:00
8be982f60c Merge branch 'feature/mfg_util_optimise' into 'master'
mfg_util: Optimise by adding subparser changes w.r.t similar changes in nvs util changes

See merge request espressif/esp-idf!5336
2019-07-05 10:08:10 +08:00
cc75721f9c mfg_util: Optimise by adding subparser changes w.r.t similar changes in nvs util changes 2019-07-05 01:13:27 +00:00
84b2fa4c1c nvs_util: Add check for key len in input csv file
Closes https://github.com/espressif/esp-idf/issues/3113
2019-07-05 01:12:41 +00:00
30819a8151 Merge branch 'bugfix/tcp_transport_use_without_list' into 'master'
tcp transport: fix minor memory leak when ssl transport used separately

See merge request espressif/esp-idf!5206
2019-07-05 09:11:10 +08:00
fda1887260 Merge branch 'feature/nimble_example_tests' into 'master'
Add NimBLE bleprph,blecent,blehr example tests

See merge request espressif/esp-idf!4420
2019-07-05 08:14:05 +08:00
bfd1eeefa2 Add NimBLE bleprph,blecent,blehr example tests 2019-07-05 08:14:04 +08:00
d1433564ec ws_client: removed dependency on internal tcp_transport header 2019-07-04 20:55:10 +02:00
dc16b8243f esp_http_client: added example test case to verify error code received when connecting to non-existent url 2019-07-04 20:55:10 +02:00
a001eb39bf http_client: disconnect event to read last occurred error in esp-tls 2019-07-04 20:55:10 +02:00
587739391c esp-tls: extending error handle to contain error descriptors with last mbedtls failure and latest certificate verification result flags, reworked tcp_transport to use this error handle 2019-07-04 20:55:10 +02:00
2972f96982 esp-tls: capturing specific errors to be available in tcp_transport and then in application code 2019-07-04 20:55:10 +02:00
cd89182458 Merge branch 'bugfix/confgen_avoid_write_to_conf' into 'master'
tools: avoid using directly _write_to_conf from Kconfiglib

Closes IDFGH-1246

See merge request espressif/esp-idf!5423
2019-07-04 22:36:23 +08:00
564dbabf49 Merge branch 'bugfix/confgen_hex_value' into 'master'
tools: Fix hex parsing in confgen.py

Closes IDFGH-1273

See merge request espressif/esp-idf!5439
2019-07-04 22:35:54 +08:00
87c35c71b9 Merge branch 'bugfix/fix_tools_idf_tools_exception_with_python3' into 'master'
CI: fix CI tools exception with python3

Closes IDF-769

See merge request espressif/esp-idf!5443
2019-07-04 22:35:31 +08:00
09ee721932 efuse: Fix mode EFUSE_SECURE_VERSION_EMULATE 2019-07-04 13:34:35 +00:00
8bed3a3dd2 Merge branch 'feature/support_spi_ethernet' into 'master'
ethernet: support dm9051

Closes IDFGH-1443 and IDFGH-1439

See merge request espressif/esp-idf!5345
2019-07-04 21:30:52 +08:00
f4f59964a3 Merge branch 'feature/wifi_refactor_smartconfig_to_esp_event' into 'master'
esp_wifi: refactor smartconfig callback to use esp event

Closes IDF-268

See merge request espressif/esp-idf!4806
2019-07-04 21:16:57 +08:00
6029ef1b58 component/bt: fix rxwinsz assert in ble and wifi coex 2019-07-04 19:44:59 +08:00
cb42c29252 ethernet: support dm9051
1. move resource allocation from xxx_init to xxx_new
2. fix enabling tx checksum insertion by mistake
3. iperf example: enlarge max arguments
4. add examples for spi-ethernet

Closes https://github.com/espressif/esp-idf/issues/3715
Closes https://github.com/espressif/esp-idf/issues/3711
2019-07-04 19:38:13 +08:00
a831fe596b Merge branch 'bugfix/btdm_conn_fail_with_some_speaker' into 'master'
components/bt: Fix connect fail with some speakers

See merge request espressif/esp-idf!5358
2019-07-04 19:23:19 +08:00
29d1d2bd38 esp_wifi: refactor smartconfig callback to use esp event 2019-07-04 18:00:04 +08:00
61923d37b6 esp_prov : Minor refactoring in argument dependent logic
Other changes:
* Command line argument name and descriptions updated and formatted
* Some exception messages updated for clarity
* READMEs updated for tool and all provisioning examples
* Minor update in example test scripts due to change in esp_prov.get_transport() API
* Transport_HTTP now forces connect on initialization
2019-07-04 15:02:07 +05:30
edbcb5b295 esp_transport_destroy: Fix memory leak
if tcp_transport component was used separately (e.g. using tranpsort_ssl.h directly without building list of transport) then it leaks memory on unitialization

Merges https://github.com/espressif/esp-idf/pull/3541
Closes https://github.com/espressif/esp-idf/issues/3531

Signed-off-by: David Cermak <cermak@espressif.com>
2019-07-04 11:07:41 +02:00
412dc95168 tcp_transport: added basic unit tests for init/destroy transports in lists or when used separately 2019-07-04 11:07:41 +02:00
510042160d tools: avoid using directly _write_to_conf from kconfiglib
Closes https://github.com/espressif/esp-idf/issues/3543
2019-07-04 10:35:34 +02:00
3bd4003e98 tools: Fix hex parsing in confgen.py
Closes https://github.com/espressif/esp-idf/issues/3568
2019-07-04 10:35:03 +02:00
a626061f3c tools: fix exception in checkout ref script:
decode bytes before searching with RegEx
2019-07-04 16:31:35 +08:00
50af558df9 update pm document with changes in bluetooth that supports automatic light sleep in case that external 32.768KHz crystal is used as the sleep clock
If bluetooth modem sleep is enabled and "External 32kHz crystal" is used as bluetooth sleep clock, the power management lock "ESP_PM_NO_LIGHT_SLEEP" in bluetooth is released for the periods of time when Bluetooth enters modem sleep. In this case automatic light sleep is allowed.
2019-07-04 07:14:02 +00:00
9ecd0436f5 tools: fix idf_tools.py exception with python3
use `subprocess.Popen` when catch TypeError:

```
Traceback (most recent call last):
  File "tools/idf_tools.py", line 1249, in <module>
    main(sys.argv[1:])
  File "tools/idf_tools.py", line 1245, in main
    action_func(args)
  File "tools/idf_tools.py", line 1038, in action_install
    tool_obj.find_installed_versions()
  File "tools/idf_tools.py", line 468, in find_installed_versions
    ver_str = self.check_version()
  File "tools/idf_tools.py", line 426, in check_version
    version_cmd_result = run_cmd_check_output(cmd, None, extra_paths)
  File "tools/idf_tools.py", line 176, in run_cmd_check_output
    result = subprocess.run(cmd, capture_output=True, check=True, input=input_text)
  File "/opt/pyenv/pyenv-1.2.6/versions/3.5.5/lib/python3.5/subprocess.py", line 383, in run
    with Popen(*popenargs, **kwargs) as process:
TypeError: __init__() got an unexpected keyword argument 'capture_output'
```
2019-07-04 15:06:00 +08:00
c94339c559 Merge branch 'doc/fatal_errors_zh_CN' into 'master'
zh_CN translation of fatal-errors

See merge request espressif/esp-idf!4418
2019-07-04 15:00:16 +08:00
471f4b2f0e zh_CN translation of fatal_error 2019-07-04 14:01:53 +08:00
533c080bc1 Merge branch 'bugfix/cmake_mconf_build' into 'master'
cmake: Fix some bugs building mconf-idf from scratch

See merge request espressif/esp-idf!5413
2019-07-04 13:38:20 +08:00
0794a26f7b Merge branch 'doc/merge_make-related_documents' into 'master'
Merge make-related documents:

See merge request espressif/esp-idf!5304
2019-07-04 13:16:18 +08:00
b24341a664 Merge make-related documents:
1. Moved get-started files, 7 documents in total, from get-started-cmake folder to hw-reference folder;
2. Deleted get-started files, 7 documents in total, in get-started folder;
3. Updated links in get-started-cmake/index.rst and in get-started/index.rst;
4. Modified descriptions for build system in these files.
2019-07-04 13:16:18 +08:00
b293518ec7 Merge branch 'feature/optimize_ci_config_file' into 'master'
CI: use features from latest Gitlab in CI config file

See merge request idf/esp-idf!4896
2019-07-04 10:56:45 +08:00
28f1cdf5ed Merge branch 'feature/local_ctrl_no_sec' into 'master'
ESP Local Ctrl Feature Added

See merge request idf/esp-idf!5348
2019-07-04 00:45:29 +08:00
b75f8b1b20 ESP Local Control Feature Added
List of changes:
* New component esp_local_ctrl added
* Example added under examples/protocols/esp_local_ctrl
* Documentation added under protocols/esp_local_ctrl
* Demo client side app esp_local_ctrl.py added under examples/protocols/esp_local_ctrl/scripts
* protocomm_ble : protocomm_ble_config_t given struct name for allowing forward declaration
* esp_prov/transport_softap renamed to transport_http
* transport_http module supports verification of server certificate
* transport_http module performs name resolution before connection
2019-07-03 21:31:04 +05:30
lly
ff40911a51 ble_mesh: add Doxyfile for core apis & model apis 2019-07-03 17:58:09 +08:00
c5c853a8ca Merge branch 'bugfix/vfs_kconfig' into 'master'
VFS: Fix Kconfig prefix

See merge request idf/esp-idf!5431
2019-07-03 17:21:33 +08:00
a1ae89f8e2 Merge branch 'bugfix/bt_config_option_test' into 'master'
Fix the irrelevant characters added to test the config options

See merge request idf/esp-idf!5436
2019-07-03 17:17:15 +08:00
daa71d5e18 Fix the irrelevant characters added to test the config options 2019-07-03 17:17:14 +08:00
e390dd3eab CI: use include to split large CI config file 2019-07-03 16:59:50 +08:00
6eca80a989 CI: try to use the correct branch of other projects used in CI:
1. revision defined in bot message
2. branch name (or tag name) of current IDF
3. CI_MERGE_REQUEST_TARGET_BRANCH_NAME
4. branch name parsed from `git describe`
5. default branch
2019-07-03 16:53:34 +08:00
81dd9d4e27 CI: use parallel attribute in CI config file 2019-07-03 16:53:34 +08:00
47da3d3334 Merge branch 'bugfix/idf_py_reconfigure_for_ccache_flag' into 'master'
idf.py: Run reconfigure on ccache option change.make --no-ccache default

See merge request idf/esp-idf!5429
2019-07-03 16:51:12 +08:00
1e7ffbf943 Merge branch 'bugfix/uuid_value' into 'master'
Correct UUID value for ESP_GATT_UUID_ENVIRONMENTAL_SENSING_SVC

See merge request idf/esp-idf!5409
2019-07-03 16:49:30 +08:00
46a268dc78 Correct UUID value for ESP_GATT_UUID_ENVIRONMENTAL_SENSING_SVC 2019-07-03 16:49:30 +08:00
2639d5b6c3 cmake: Fix some bugs building mconf-idf from scratch
- Makefile didn't quite work with out-of-tree build unless there was already an in-tree build done.
- CMake needs to delete some of the in-tree build artifacts or they're used instead of the correct
 files.
2019-07-03 18:40:55 +10:00
916df0df14 Merge branch 'bugfix/from_github' into 'master'
docs: PRs from GitHub containing documentation bug fixes and corrections

See merge request idf/esp-idf!5367
2019-07-03 16:26:55 +08:00
4e7a6d4762 Merge branch 'bugfix/btdm_wrong_bt_lib' into 'master'
components/bt: Fix Wrong bt lib from commit "Bluetooth component refactoring"

See merge request idf/esp-idf!5420
2019-07-03 15:33:55 +08:00
60a3f3e09d components/bt: Fix Wrong bt lib from commit "Bluetooth component refactoring" 2019-07-03 04:44:04 +00:00
3ff01d60a4 Merge branch 'fix/sdio_slave_reset_infloop_leak' into 'master'
sdio_slave: fix the send_flush infinite loop issue

See merge request idf/esp-idf!5365
2019-07-03 08:36:26 +08:00
43eb58da99 VFS: Fix Kconfig prefix 2019-07-02 17:17:18 +02:00
6895ea1624 Merge branch 'feature/ext_flash_partition' into 'master'
Support for partitions in external flash

See merge request idf/esp-idf!5277
2019-07-02 22:18:14 +08:00
56a624e305 ci: add unit test job 2019-07-02 15:21:34 +02:00
5aa019fce6 Replace hardcoded links with link roles 2019-07-02 21:01:52 +08:00
82b3779b2b Fix broken link to components/wifi_provisioning/proto
Merges https://github.com/espressif/esp-idf/pull/3668
2019-07-02 21:00:38 +08:00
b7ca18edcd idf.py Run reconfigure on ccache option change.make --no-ccache default 2019-07-02 13:37:55 +02:00
660eb84da7 Correct links
Closes https://github.com/espressif/esp-idf/issues/3723
2019-07-02 18:22:33 +08:00
8d251d7369 Implement review comments 2019-07-02 18:22:33 +08:00
82ba58db22 Fix reference in jtag debugging section
Merges https://github.com/espressif/esp-idf/pull/3617

Signed-off-by: Stefan Venz <stefan.venz@protonmail.com>
2019-07-02 17:49:49 +08:00
d1ceaf81ae example/wifi/scan: fix README grammar
Merges https://github.com/espressif/esp-idf/pull/3678
2019-07-02 17:49:49 +08:00
b0168310db Typo correction
Merges https://github.com/espressif/esp-idf/pull/3604
2019-07-02 17:49:49 +08:00
66e0b2f9df gdbstub: move to a separate component, support multiple targets 2019-07-02 11:06:25 +02:00
c730c9e397 nvs: minor host test fixes
Fixes the tests to pass when some files already exist.
Fixes clean target.
Moves CONFIG_NVS_ENCRYPTION definition into sdkconfig.h.
2019-07-02 10:26:06 +02:00
1c17558e6e spi_flash: use same argument types in .h and .c files
Fixes compilations on targets where size_t != uint32_t
2019-07-02 10:26:06 +02:00
ec427a5b43 spi_flash: support for partitions in external flash 2019-07-02 10:26:06 +02:00
ebcb08ec89 host tests: correct definition of CONFIG_SPI_FLASH_USE_LEGACY_IMPL 2019-07-02 10:10:49 +02:00
240192f9fa Merge branch 'bugfix/sec_boot_ota_fail' into 'master'
Bugfix: ota fails with secure boot on for image size greater than 3.2MB

See merge request idf/esp-idf!5263
2019-07-02 14:44:36 +08:00
be5e7e1c6d Merge branch 'feature/nimble-provisioning' into 'master'
NimBLE-Provisioning: Add NimBLE support to existing BLE variant of unified provisioning

See merge request idf/esp-idf!5319
2019-07-02 14:20:11 +08:00
388b350f0d NimBLE-provisioning: Add NimBLE support to unified provisioning framework
- Adds NimBLE stack support to existing BLE variant of unified provisioning.
- Uses scan response to send device name, 128 bit custom UUIDs based on service
  UUID.
- Minimal changes to `app_prov.c`, component.mk, CMakeLists.txt and
  `protocomm_ble.h` to accomodate NimBLE stack for provisioning.
2019-07-02 14:20:10 +08:00
e6623c4a7b Merge branch 'bugfix/esp_timer_delete_from_cb' into 'master'
esp_timer: handle esp_timer_delete in timer task

Closes IDFGH-1143

See merge request idf/esp-idf!5037
2019-07-02 14:16:26 +08:00
4d4fef6da7 Merge branch 'nimble/update_submodule' into 'master'
NimBLE: Update nimble submodule

See merge request idf/esp-idf!5419
2019-07-02 11:26:24 +08:00
396258380a NimBLE: update nimble submodule
- Update submodule to fix https://jira.espressif.com:8443/browse/BT-192.
- Upstream PR: https://github.com/apache/mynewt-nimble/pull/427
2019-07-02 11:26:24 +08:00
55b823cd13 Merge branch 'feature/ringbuffer_support_allocate_memory' into 'master'
ringbuffer: support allocate memory in the ringbuffer before actually send

See merge request idf/esp-idf!5252
2019-07-02 08:41:26 +08:00
18bea96bf5 esp32: verify that RTC_NOINIT_ATTR vars are preserved after WDT reset
Related to https://github.com/espressif/esp-idf/issues/2973
2019-07-01 20:55:10 +00:00
16014079f9 Merge branch 'bugfix/add_extern_c_for_sntp' into 'master'
lwip/sntp: Added extern "C"

See merge request idf/esp-idf!5398
2019-07-02 04:45:30 +08:00
4b42f535ed Add mmu pages available check in non-secure image hash check path.
Made MMU pages available check in `esp_image_format.c`
This now makes it possible to map and process bootoader image as well in chunks when image doesn't fit completely into available free pages.

Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2019-07-01 20:04:15 +00:00
da77dcb0be Changed log level for spi_master
There are lot of prints of `Allocate TX buffer for DMA`
Changed these from `ESP_LOGI` to `ESP_LOGD`

Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2019-07-01 20:04:15 +00:00
eb99b27f2e Bugfix: ota fails with secure boot on for image size greater than 3.2MB
When an OTA image size is larger than 50 MMU pages (approx. 3.2 MB), secure_boot_generate fails while trying to map it into memory:
https://gitlab.espressif.cn:6688/idf/esp-idf/blob/master/components/bootloader_support/src/esp32/secure_boot.c#L72
Instead of trying to map the whole image, secure boot code should split the image into chunks and map them one by one, like it is done in esp_image_format.c:
https://gitlab.espressif.cn:6688/idf/esp-idf/blob/master/components/bootloader_support/src/esp_image_format.c#L372

Closes https://jira.espressif.com:8443/browse/IDF-709

Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2019-07-01 20:04:15 +00:00
bca4afb466 Merge branch 'feature/idf_tools_dir_user_facing' into 'master'
IDF Tools directory: user facing changes

Closes IDF-61

See merge request idf/esp-idf!4808
2019-07-02 01:47:16 +08:00
22dfac7405 mconf-idf: update to v4.6.0.0-idf-20190603 2019-07-01 18:08:02 +02:00
4f5f30d37d tools: add fallback tools.json for IDF v3.x 2019-07-01 18:08:02 +02:00
6f5c7a21ac docs: update CMake getting started guide to use install.bat and export.bat 2019-07-01 18:08:02 +02:00
04d24c750a tools: new installer for Windows 2019-07-01 18:08:02 +02:00
12b6da0388 tools: {install,export}.{bat,sh} tools 2019-07-01 14:51:44 +02:00
3d866694c9 tools.json: add idf.py.exe 2019-07-01 14:51:44 +02:00
916c0c5754 idf.py.exe wrapper program for Windows 2019-07-01 14:51:43 +02:00
1a2bf4d8ff idf_tools: print additional info when download verification fails 2019-07-01 14:51:43 +02:00
a831db7ec0 Merge branch 'bugfix/fix_nimble_flake_issue' into 'master'
Fix failure in flake8 due to incorrect NimBLE path

See merge request idf/esp-idf!5415
2019-07-01 19:22:55 +08:00
a32534497c Fix failure in flake8 due to incorrect NimBLE path 2019-07-01 19:22:55 +08:00
d4276f2242 Merge branch 'enhancement/move_bt_examples' into 'master'
Bluetooth examples restructuring

See merge request idf/esp-idf!4025
2019-07-01 19:21:57 +08:00
cba69dd088 Bluetooth examples restructuring
The existing Bluetooth examples are split as:

1. examples/bluetooth/bluedroid - Bluedroid Host (BT + BLE) examples
   a. examples/bluetooth/bluedroid/classic_bt - Classic BT examples
   b. examples/bluetooth/bluedroid/ble - BLE examples
   c. examples/bluetooth/bluedroid/coex - Classic BT and BLE coex examples
   d. examples/bluetooth/bluedroid/hci - VHCI and HCI UART examples
      i. Rename ble_adv to controller_vhci_ble_adv and move it in hci folder
2. examples/bluetooth/nimble - NimBLE BLE Host + NimBLE Mesh examples
3. examples/bluetooth/esp_ble_mesh - ESP BLE Mesh examples
4. Update documentation references
2019-07-01 19:21:57 +08:00
f8d2188e93 Merge branch 'bugfix/win_flash_app_cmd' into 'master'
tools: Accept CTRL-T + A for app-flash in idf_monitor

Closes IDF-736

See merge request idf/esp-idf!5376
2019-07-01 15:51:44 +08:00
9ef37270f6 Merge branch 'bugfix/make_ccache_opt_in' into 'master'
cmake: make use of ccache opt-in

See merge request idf/esp-idf!5368
2019-07-01 15:48:31 +08:00
e7064df8e7 Merge branch 'bugfix/confgen_windows_command_line' into 'master'
cmake kconfig: Pass environment variables to confgen.py via a file

Closes IDF-711

See merge request idf/esp-idf!5356
2019-07-01 15:26:11 +08:00
f1e07663c4 cmake: Use environment variables file for all config binaries 2019-07-01 15:54:27 +10:00
26db058339 cmake kconfig: Pass environment variables to confgen.py via a file
Works around "command line too long" errors when using Windows
and CMake < 3.11

Closes IDF-711
2019-07-01 15:54:10 +10:00
687908b1e9 ringbuffer: support to allocate memory on the ringbuffer before send 2019-07-01 11:41:50 +08:00
c5150d16b2 ringbuffer: seperate acquire from send 2019-07-01 11:40:45 +08:00
0c8192f3be Merge branch 'feature/mconf_simple_expand' into 'master'
mconf-idf: Use same 'simple expand' logic, same as kconfig-frontends

See merge request idf/esp-idf!5390
2019-07-01 10:33:35 +08:00
bd69998516 mconf-idf: Use same 'simple expand' logic, same as kconfig-frontends
Previously, wordexp() was used. However for providing Windows builds
of mconf-idf we can't use wordexp() so we use this simplified
environment variable expansion code instead.

The reasoning here is to make the behaviour consistent across Windows
(CMake vs GNU Make), Linux & macOS mconf.
2019-07-01 00:38:55 +00:00
70474ae844 Merge branch 'feature/btdm_avrcp_volume' into 'master'
components/bt: Add AVRCP feature about volume

See merge request idf/esp-idf!5209
2019-06-30 16:40:10 +08:00
f1b8723996 Merge branch 'refactor/new_bt_component' into 'master'
Bluetooth component refactoring

See merge request idf/esp-idf!5366
2019-06-30 16:39:01 +08:00
21165edf41 Bluetooth component refactoring 2019-06-30 16:39:00 +08:00
66e333e352 Merge branch 'feature/move_supplicant_to_idf_new' into 'master'
supplicant/wifi: move supplicant to idf

Closes IDFGH-1233 and WIFI-392

See merge request idf/esp-idf!5219
2019-06-30 14:02:22 +08:00
30d7002731 components/bt: Add AVRCP feature about volume 2019-06-30 03:46:15 +00:00
c139683024 supplicant/esp_wifi: move supplicant to idf
Move supplicant to idf and do following refactoring:
1. Make the folder structure consitent with supplicant upstream
2. Remove duplicated header files and minimize the public header files
3. Refactor for WiFi/supplicant interfaces
2019-06-29 22:46:52 +08:00
72a5762525 cmake: make use of ccache opt-in 2019-06-29 00:22:57 +00:00
39a5fbdfee Merge branch 'bugfix/idf_py_fix_subcommand_options' into 'master'
idf.py: Fix subcommand options

Closes IDF-740

See merge request idf/esp-idf!5386
2019-06-29 00:15:13 +08:00
dcd5e9cf08 Merge branch 'bugfix/ci_fix_mirror-submodule-update' into 'master'
tools: Keep script behaviour

See merge request idf/esp-idf!5362
2019-06-28 23:57:14 +08:00
4848dfa710 esptool_py: use component property to simplify arg file generation
esptool_py used to create its own custom target to attach properties to.
This commit uses component properties instead, and the APIs used to set
and retrieve those properties in order to simplify generation of
argument files to esptool.py.
2019-06-28 18:14:25 +08:00
c165335554 Merge branch 'bugfix/make_V_flag' into 'master'
gnu make: Make V= behaviour consistent with V=0

Closes IDFGH-1175

See merge request idf/esp-idf!5334
2019-06-28 16:39:44 +08:00
56db269fb5 idf.py: Fix subcommand options 2019-06-28 10:07:38 +02:00
265d7dc4e5 Merge branch 'bugfix/fix_secure_boot_support' into 'master'
Fixes to secure boot support in CMake

See merge request idf/esp-idf!4977
2019-06-28 15:38:59 +08:00
d9ca915fa4 Merge branch 'bugfix/cmake_project_vars_not_set_by_redefinition' into 'master'
cmake: set variables set by project call

See merge request idf/esp-idf!5187
2019-06-28 15:31:10 +08:00
28d79e242f lwip/sntp: Added extern "C"
so that sntp_set_time_sync_notification_cb can be used from c++

Signed-off-by: Konstantin Kondrashov <konstantin@espressif.com>

Merges: https://github.com/espressif/esp-idf/pull/3700
2019-06-28 14:51:28 +08:00
d96379ba0f Merge branch 'feature/nvs_util_decryption' into 'master'
nvs_util: Add NVS decryption feature + Optimisations

See merge request idf/esp-idf!5003
2019-06-28 13:07:24 +08:00
936720d3ef Merge branch 'feature/add_limitation_for_max_tx_power' into 'master'
esp_wifi: add limitation for setting maximum WiFi TX power

See merge request idf/esp-idf!5331
2019-06-28 11:18:11 +08:00
e5de1991d4 tools: Keep script behaviour 2019-06-28 10:05:31 +07:00
67909fe2a0 ci: test fail on build time works 2019-06-28 10:54:21 +08:00
e4a4063e4c cmake: fix issue with fail at build time
Fix issue that next build retry does not succeed once the requirement is
satisfied.
2019-06-28 10:54:21 +08:00
60a77bea7d docs: remove secure boot and flash encryption from CMake pending features 2019-06-28 10:54:21 +08:00
3ae69484fe esptool_py: do not generate flasher arg files on bootloader build 2019-06-28 10:54:21 +08:00
9edc867c62 bootloader: fix secure boot issues
Do not include bootloader in flash target when secure boot is enabled.
Emit signing warning on all cases where signed apps are enabled (secure
boot and signed images)
Follow convention of capital letters for SECURE_BOOT_SIGNING_KEY variable, since it is
relevant to other components, not just bootloader.
Pass signing key and verification key via config, not requiring
bootloader to know parent app dir.
Misc. variables name corrections
2019-06-28 10:54:21 +08:00
179259f195 components: restore dependency of extra bins on flash target 2019-06-28 10:50:52 +08:00
f332e0c1d6 partition_table: move establishing dependencies to respective components
partition_table: move establishing dependencies to respective components
2019-06-28 10:50:52 +08:00
6a18eaeaf5 esptool_py: fix issue with variable for esptool args
elf2image-only arguments are being added to esptool args meant for
flashing
2019-06-28 10:50:52 +08:00
2adf313838 bootloader_support: move embedding key after component registration
Bootloader build requires verification key to be embedded in the binary.
Under specific configs, this key is generated during build time from the
signing key. Move the key generation to after the component
registration, since non scriptable commands are used in the process
(during early expansion)
2019-06-28 10:50:52 +08:00
13d9c483b3 Merge branch 'bugfix/i2s_apll_clock_fix' into 'master'
driver/i2s: fix apll_clock_rate for different sample rates

See merge request idf/esp-idf!5159
2019-06-28 03:49:11 +08:00
d7d91225d3 Merge branch 'feature/refactor_etherent_driver' into 'master'
add esp_eth component

Closes IDF-324, IDF-637, and IDFGH-1139

See merge request idf/esp-idf!5111
2019-06-28 03:44:44 +08:00
131978d707 Merge branch 'feature/esp_flash_init_functions' into 'master'
esp_flash: add initialization interface for SPI devices

See merge request idf/esp-idf!5306
2019-06-27 20:59:44 +08:00
1352ada4e0 Merge branch 'bugfix/bootloader_header_cxx_guards' into 'master'
bootloader_support: Add C++ header guards

See merge request idf/esp-idf!5349
2019-06-27 19:31:56 +08:00
f56b7d4a1d tools: Accept CTRL-T + A for app-flash in idf_monitor
"CTRL-A" cannot be captured in Windows command line, so "A" can be used
instead.
2019-06-27 12:21:09 +02:00
5d855fcdef esp_wifi: add limitation for setting maximum WiFi TX power
Limit the WiFi TX power range to 10dBm ~ 20.5 dBm
2019-06-27 17:28:59 +08:00
5a12be5162 Merge branch 'bugfix/pc_ble_prep_buf_memcpy' into 'master'
protocomm_ble : Bugfix for unbound memcpy on prepare write buffer

Closes IDFGH-1350

See merge request idf/esp-idf!5284
2019-06-27 16:48:11 +08:00
45364fe54e Merge branch 'bugfix/btdm_fail_to_config_url_in_eir' into 'master'
components/bt: Fix fail to config URL in EIR

See merge request idf/esp-idf!5352
2019-06-27 14:27:35 +08:00
3636e75792 nvs_util: Add NVS decryption feature 2019-06-27 11:51:58 +05:30
d6bd24ca67 esp_flash: add initialization interface for SPI devices 2019-06-27 13:27:27 +08:00
65c0d354e4 spi_common: add interface to get whether the bus is on IOMUX 2019-06-27 13:27:27 +08:00
b76ab9142d spi_common: deprecate some public APIs 2019-06-27 13:27:26 +08:00
28b2e113ca spi_master: move the spi_bus_init function into common header 2019-06-27 13:27:26 +08:00
9805902482 sdio_slave: fix the send_flush infinite loop issue
Also add some helper functions.
2019-06-27 13:24:22 +08:00
e6d229d301 Merge branch 'feature/ringbuffer_static_allocation' into 'master'
Ringbuffers: Add static allocation, refactor, and update API reference

Closes IDFGH-639 and IDFGH-902

See merge request idf/esp-idf!4426
2019-06-27 13:20:01 +08:00
80abb531b5 Merge branch 'feature/remove_mbedtls_cmake_workarounds' into 'master'
mbedtls: remove component CMake file workarounds

Closes #78

See merge request idf/esp-idf!5341
2019-06-27 13:19:42 +08:00
8726676a82 Merge branch 'feature/idf_py_add_positional_args_to_subcommands' into 'master'
idf.py: Make subcommand arguments more flexible

See merge request idf/esp-idf!5198
2019-06-27 13:18:59 +08:00
5d0eb95130 Merge branch 'bugfix/cmake_esptool_args_path' into 'master'
esptool+cmake: Fix path generation for args.in2 file

Closes IDFGH-1409

See merge request idf/esp-idf!5353
2019-06-27 13:12:26 +08:00
83ba2e082c esptool+cmake: Fix path generation for args.in2 file
Path was accidentally generated as build/<absolute path to input file> which creates unexpected path structure on Linux/macOS and breaks Windows (as can't have a directory named "C:".

Regression in e8582e9aa4

Closes https://github.com/espressif/esp-idf/issues/3687
Closes IDFGH-1409
2019-06-27 14:19:03 +10:00
bbafd50662 Merge branch 'bugfix/bt_typo' into 'master'
Fix typo from the commit "Reduce the size of DRAM"

See merge request idf/esp-idf!5347
2019-06-27 10:48:47 +08:00
917589e784 Fix typo from the commit "Reduce the size of DRAM" 2019-06-27 10:48:47 +08:00
6ad2a948cc Merge branch 'doc/add_Chinese_translation_for_power_management_in_api_references' into 'master'
Add Chinese translation to api-reference/system/power-management.rst

See merge request idf/esp-idf!5265
2019-06-26 20:42:57 +08:00
32954e5f90 Add Chinese translation to api-reference/system/power-management.rst
1. Add translation to docs/zh_CN/api-reference/system/power_management.rst
2. Add a link to docs/en/api-reference/system/power_management.rst
2019-06-26 20:42:56 +08:00
74e4554a74 Merge branch 'doc/add_Chinese_translation_for_external-ram_in_api-guides' into 'master'
Add Chinese translation for exteral-ram.rst in api-guides:

See merge request idf/esp-idf!5078
2019-06-26 19:59:21 +08:00
9fbb27b194 Add Chinese translation for exteral-ram.rst in api-guides:
- The draft should be first reviewed by Technical Reviewers;
- Then by Language Reviewer.
2019-06-26 19:59:21 +08:00
4fc411e744 Merge branch 'bugfix/btdm_fix_hci_enhance_conn_complete_evt_unpack_error' into 'master'
component/bt: fix hci enhance connection complete event unpack error

See merge request idf/esp-idf!4889
2019-06-26 16:45:39 +08:00
0872efa4ef mbedtls: remove component CMake file workarounds 2019-06-26 08:41:02 +00:00
8a597b865f esp_ringbuf: Add static allocation, refactor, and update API reference
This commit updates does the following:
    - xRingbufferCreateStatic() added to allow ringbuffers via to be statically
      allocated. Docs and unit tests update accordingly. Closes #3064

    - Fix doc typos, closes #3248. Updated API reference regarding to mention
      item size limits of no-split buffers when calling
      xRingbufferGetCurFreeSize() or xRingbufferGetMaxItemSize(), closes #3117.

    - Remove the following deprecated types/functions for v4.0
        - xRingbufferIsNextItemWrapped()
        - xRingbufferAddToQueueSetWrite()
        - xRingbufferRemoveFromQueueSetWrite()
2019-06-26 16:04:38 +08:00
291e25baa6 Merge branch 'bugfix/btdm_add_readme_for_BLE_demos' into 'master'
Component/bt: add readme doc for BLE demos

See merge request idf/esp-idf!4890
2019-06-26 16:04:28 +08:00
aecd0f9ae4 Add subcomand options that become global 2019-06-26 10:00:21 +02:00
afc30b09bc idf.py: Add positional arguments to subcommands 2019-06-26 10:00:21 +02:00
8dc8dd5689 Merge branch 'feature/sntp_update_delay' into 'master'
sntp/l_ip: Add SNTP_UPDATE_DELAY option in Kconfig

Closes IDFGH-337

See merge request idf/esp-idf!5271
2019-06-26 15:54:25 +08:00
bd89b69daa Merge branch 'feature/btdm_add_ble_ancs_demo' into 'master'
Component/bt: add ble ancs demo

See merge request idf/esp-idf!4688
2019-06-26 15:50:06 +08:00
22ed1ec43a Merge branch 'feature/fatfs_r013cp4' into 'master'
FatFS: update to R0.13c patch 4

Closes IDF-698, IDFGH-1012, and IDFGH-1017

See merge request idf/esp-idf!5297
2019-06-26 15:15:41 +08:00
ad62b2b8c0 Merge branch 'feature/prov_wifi_scan_list' into 'master'
Wi-Fi Provisioning  : Feature Wi-Fi Scan List

See merge request idf/esp-idf!4855
2019-06-26 14:53:04 +08:00
84e9e243d0 components/bt: Fix connect fail with some speakers 2019-06-26 14:50:13 +08:00
1a34d65e4c Merge branch 'bugfix/btdm_intr_wdt_after_controller_disable_then_enable' into 'master'
bugfix/btdm_intr_wdt_after_controller_disable_then_enable

See merge request idf/esp-idf!5301
2019-06-26 14:05:48 +08:00
9c0ee28670 wifi_provisioning : Added Wi-Fi Scan list feature to Provisioning Manager
List of changes in components/wifi_provisioning:
* Manager version is now v1.1
* .proto files and protocomm handler added for sending Wi-Fi scan command and receiving scan results
* Implemented handlers for wifi_scan protocomm endpoint
* Update manager context data structure to hold scan state and results
* scheme_softap now runs Wi-Fi in APSTA mode
* Wi-Fi is started in AP mode when provisioning is started. This is necessary for scan list to work
* Docs updates with information about new wifi_scan endpoint

List of changes in tools/esp_prov:
* Added functions for sending and receiving protobuf messages compatible with wifi_scan protocomm endpoint
* Added feature to display/refresh scan results and accept user selection at runtime
* New functions:
  * get_version() : only returns the protocol version string
  * has_capability() : check is a capability is present according to proto-ver response
* wifi_scan feature is provided only if the `wifi_scan` capability is present

Other changes:
* Replace recursive mutex with plain mutex
* assert on return value of mutex give / take calls
* replace all calls with macros ACQUIRE_LOCK and RELEASE_LOCK
* some checks added in scanning related private APIs
* free and nullify scanning context and state if service is stopped while ongoing scan
2019-06-26 05:24:20 +00:00
79ba509384 components/bt: Fix fail to config URL in EIR 2019-06-26 11:58:41 +08:00
90c4827bd2 add esp_eth component 2019-06-26 10:19:23 +08:00
12f4541f19 Merge branch 'bugfix/stdoutflush' into 'master'
Stdoutflush: Flushing stdout to avoid issues with 64k char limits

See merge request idf/esp-idf!4698
2019-06-26 10:07:41 +08:00
c8570ffa6d bootloader_support: Add C++ header guards
As reported on forum https://esp32.com/viewtopic.php?f=13&t=11173&p=45470
2019-06-26 11:26:56 +10:00
2c26eb2213 Merge branch 'feature/flash_encryption' into 'master'
Change flash encryption workflow to development / release

See merge request idf/esp-idf!4125
2019-06-26 09:04:03 +08:00
ba94bbf1f8 Merge branch 'bugfix/esp_https_ota_heap_failure' into 'master'
HTTPS OTA: Removed unnecessary free()

See merge request idf/esp-idf!5048
2019-06-26 09:03:16 +08:00
af430adb34 Merge branch 'feature/esp_tls_server' into 'master'
esp_tls: Add support for server side SSL/TLS connection

See merge request idf/esp-idf!5091
2019-06-26 09:03:08 +08:00
9550176f83 Addressing PR comments 2019-06-26 00:42:13 +00:00
bc48a9c92f Stdoutflush: Flushing stdout to avoid issues with 64k char limits 2019-06-26 00:42:13 +00:00
c404f8b6e9 Merge branch 'feature/upgrade_mbedtls_to_v2.16.1' into 'master'
mbedtls: upgrade to v2.16.2 release

Closes IDF-664

See merge request idf/esp-idf!5130
2019-06-26 08:40:43 +08:00
2b521bba1c Merge branch 'feature/ci_relative_submodules' into 'master'
ci: Use relative submodules and a new cleaning working tree feature

See merge request idf/esp-idf!4877
2019-06-26 08:34:42 +08:00
cdecb67d66 example/https_server: Add default sdkconfig 2019-06-25 23:43:35 +00:00
a8ebde227f esp_https_server: Add support for esp-tls server APIs 2019-06-25 23:43:35 +00:00
8950f94ec7 esp_tls: Add support for server side SSL/TLS connection
Currently, esp-tls supports creation of SSL/TLS connection on the client side.

This commit includes support for creating SSL/TLS connection on the server side.
2019-06-25 23:43:35 +00:00
a2b5a93881 example/simple_ota_example: Fix python formatting and KConfig 2019-06-25 23:41:33 +00:00
83a4e4656f example/simple_ota_example: Add support for skipping OTA server certificate CN field 2019-06-25 23:41:33 +00:00
ab6dd36243 esp_http_client: Add support to disable validation of certificate's CN field 2019-06-25 23:41:33 +00:00
c536c8fa5f tcp_transport: Add API to allow skipping of certificate CN validation 2019-06-25 23:41:33 +00:00
9fa23bc599 example/simple_ota_example: Add example test 2019-06-25 23:41:33 +00:00
7fbedb1ba3 esp_https_ota: Removed unnecessary free()
Closes https://github.com/espressif/esp-idf/issues/3504

Merges https://github.com/espressif/esp-idf/pull/3513

Signed-off-by: Jitin George <jitin@espressif.com>
2019-06-25 23:41:33 +00:00
a68c7c21e1 Improve flash encryption documentation and add Development & Release modes
This MR improves existing flash encryption document to provide simplified steps
Adds two new modes for user: Development & Release
Adds a simple example
Supports encrypted write through make command
2019-06-25 23:41:18 +00:00
eb5cc203f9 protocomm_ble : Bugfix for unbound memcpy on prepare write buffer
Closes https://github.com/espressif/esp-idf/issues/3633
2019-06-25 19:58:19 +00:00
008ad9af47 ci: Use relative submodule URLs over IDF. Correct CI accordindly
Clean up `before_script`s

    Update `check_submodule_sync`

    Remove tools/ci/mirror* stuff
2019-06-25 22:24:45 +07:00
3b3b891282 ci: Remove unused IS_PRIVATE and IS_PUBLIC environment 2019-06-25 22:24:45 +07:00
beaefd3359 Merge branch 'feature/add_nimble_ssc' into 'master'
test: modify test cases for bluedroid

See merge request idf/esp-idf!5208
2019-06-25 23:14:32 +08:00
f14563a47d test: modify test cases for bluedroid 2019-06-25 23:14:32 +08:00
dbe3221969 fatfs: reduce rawflash tests run time
Don't flash fatfs.img on every test run. Comparing the content is
faster than flashing.
2019-06-25 23:07:07 +08:00
8f6606141a fatfs: create separate ffsystem.c for host side testing 2019-06-25 23:07:07 +08:00
66bdeca603 fatfs: update diskio and vfs for FatFS changes
- do to not rely on integer.h types
- ffsystem.c does not define ff_memcalloc, replace with ff_memalloc +
  memset.
2019-06-25 23:05:16 +08:00
7724df407a fatfs: update to R0.13c patch 4
Breaking change: integer.h does not exist in FatFS anymore
2019-06-25 23:05:16 +08:00
e181a40c9f fatfs: separate IDF-specific files from the original FatFS code
This is a breaking change: applications which used diskio.h to
call ff_diskio_register, will now need to include diskio_impl.h.
Including diskio.h will include the original diskio.h header from
FatFS library.
2019-06-25 23:05:16 +08:00
4ea12d432e Merge branch 'bugfix/fix_ble_examples_build' into 'master'
Fix build issues

See merge request idf/esp-idf!5343
2019-06-25 23:04:34 +08:00
82858050b6 ci: sort list of flake8 submodule excludes 2019-06-25 20:18:36 +08:00
94b88654a3 ci: exclude nimble submodule from python style check 2019-06-25 20:12:35 +08:00
31ec634730 bt: fix build issue
Source files and include directories were appended to variables
used by the previous component registration command.
2019-06-25 16:53:37 +08:00
f55ace596b Merge branch 'fix/update_curr_page_state' into 'master'
nvs_util: Set previous page state to full before creating new page

See merge request idf/esp-idf!5325
2019-06-25 14:21:25 +08:00
9bca2f878a Merge branch 'feature/gcc_8_msys_update_simple' into 'master'
update MSYS package for esp32-2019r1 toolchain

See merge request idf/esp-idf!5199
2019-06-25 14:14:08 +08:00
a54a3fc92e Merge branch 'bugfix/idfpy_print_filter' into 'master'
tools: Port the filtering option of IDF Monitor to the idf.py toolchain

Closes IDF-543

See merge request idf/esp-idf!4416
2019-06-25 13:36:03 +08:00
9a412d3a08 Merge branch 'feature/use_new_component_registration_apis' into 'master'
Use new component registration API

See merge request idf/esp-idf!4898
2019-06-25 10:24:11 +08:00
9d573c65dc Merge branch 'bugfix/legacy_header_bootloader_build' into 'master'
bootloader: pass legacy header config variable to subproject

See merge request idf/esp-idf!4966
2019-06-25 10:23:33 +08:00
391eba07e4 Merge branch 'bugfix/kconfig_source_comment' into 'master'
tools: Fix Kconfig checker for comments and source after help

See merge request idf/esp-idf!5275
2019-06-25 10:22:12 +08:00
9845a41315 Merge branch 'feature/nimble' into 'master'
Port NimBLE Host Stack on ESP-IDF

See merge request idf/esp-idf!5182
2019-06-25 09:03:58 +08:00
342f6a7829 Port NimBLE Host Stack on ESP-IDF 2019-06-25 09:03:58 +08:00
1f9f39fe46 nvs_util: Set previous page state to full before creating new page 2019-06-24 13:53:51 +00:00
dff5254085 Merge branch 'doc/review_api-ref_periph-sdmmc-host' into 'master'
Review the file api-reference/peripherals/sdmmc_host.rst

See merge request idf/esp-idf!5261
2019-06-24 21:46:12 +08:00
4db4402bed Review the file api-reference/peripherals/sdmmc_host.rst 2019-06-24 21:46:11 +08:00
396131433a Merge branch 'feature/idf_size_json' into 'master'
idf_size: Support JSON output

Closes IDF-264

See merge request idf/esp-idf!4987
2019-06-24 19:06:12 +08:00
a60b1428d5 gnu make: Make V= behaviour consistent with V=0
Previously, V=0 would print some verbose lines but not most of them.

This meant that it was impossible to disable all verbose output
when BATCH_BUILD=1

Closes https://github.com/espressif/esp-idf/issues/3488
2019-06-24 21:01:12 +10:00
5cb71b5213 Merge branch 'feature/add_doc_about_app_desc_t' into 'master'
docs: Add description about the app image

Closes IDF-597

See merge request idf/esp-idf!4912
2019-06-24 18:40:02 +08:00
6559f935ce component/bt: fix unpack hci enhance connection complete event error 2019-06-24 07:05:01 +00:00
f4eb3ddfee Merge branch 'feature/ble_mesh_feature' into 'master'
component/ble_mesh: Add BLE Mesh Stack onto ESP-IDF

See merge request idf/esp-idf!4079
2019-06-24 14:31:23 +08:00
adfe16d928 mbedtls: upgrade to v2.16.2 release
For detailed release notes please refer to:
https://github.com/ARMmbed/mbedtls/releases/tag/mbedtls-2.16.2
2019-06-24 06:02:59 +00:00
12a7d39ed6 docs: Add description 2019-06-24 12:33:33 +08:00
fc3253163e component/ble_mesh: ESP BLE Mesh release
1. BLE Mesh Core

* Provisioning: Node Role
    * Advertising and GATT bearer
    * Authentication OOB

* Provisioning: Provisioner Role
    * Advertising and GATT bearer
    * Authentication OOB

* Networking
    * Relay
    * Segmentation and Reassembly
    * Key Refresh
    * IV Update

* Proxy Support

* Multiple Client Models Run Simultaneously
    * Support multiple client models send packets to different nodes simultaneously
    * No blocking between client model and server

* NVS Storage
    * Store Provisioning Data of BLE Mesh Nodes in Flash

2. BLE Mesh Applications

* BLE Mesh Node & Provisioner
    * Node Example
    * Provisioner Example
    * Node + Generic OnOff Client Example

* Fast Provisioning
    * Vendor Fast Prov Server Model
    * Vendor Fast Prov Client Model
    * Examples

* Wi-Fi & BLE Mesh Coexistence
    * Example

* BLE Mesh Console Commands
    * Example

3. BLE Mesh Models

* Foundation Models
    * Configuration Server Model
    * Configuration Client Model
    * Health Server Model
    * Health Client Model

* Generic Client Models
    * Generic OnOff Client
    * Generic Level Client
    * Generic Location Client
    * Generic Default Transition Timer Client
    * Generic Power OnOff Client
    * Generic Power Level Client
    * Generic Battery Client
    * Generic Property Client

* Generic Server Models
    * Generic OnOff Server (Example)

* Lighting Client Models
    * Light Lightness Client
    * Light CTL Client
    * Light HSL Client
    * Light xyL Client
    * Light LC Client

* Sensor Client Model
    * Sensor Client

* Time and Scenes Client Models
    * Time Client
    * Scene Client
    * Scheduler Client
2019-06-24 11:31:24 +08:00
2b808fc19a Merge branch 'feature/btdm_add_gattc_gatts_coex_example' into 'master'
Component/bt: add gattc and gatts coex example

See merge request idf/esp-idf!5087
2019-06-24 11:23:30 +08:00
1b12e6e97d Merge branch 'refactor/bluedroid' into 'master'
Refactor/bluedroid

See merge request idf/esp-idf!4027
2019-06-24 11:07:53 +08:00
61ccb538fd Merge branch 'doc/review_ext_ram' into 'master'
Review the file api-guides/external-ram.rst

See merge request idf/esp-idf!5156
2019-06-24 08:24:45 +08:00
32c3730c33 Review the file api-guides/external-ram.rst 2019-06-24 08:24:44 +08:00
19e89d0e2f Merge branch 'doc/review_modules-and-boards' into 'master'
Review the file hw-reference/modules-and-boards.rst

See merge request idf/esp-idf!5157
2019-06-24 08:22:43 +08:00
752c7c32d4 Review the file hw-reference/modules-and-boards.rst 2019-06-24 08:22:43 +08:00
b31ab65fa5 Merge branch 'doc/review_api-ref_periph-touchpad' into 'master'
Review the file api-reference/peripherals/touch_pad.rst

See merge request idf/esp-idf!5259
2019-06-21 20:43:18 +08:00
1096ee4b57 Review the file api-reference/peripherals/touch_pad.rst 2019-06-21 20:43:17 +08:00
9b350f9ecc cmake: some formatting fixes
Do not include bootloader in flash target when secure boot is enabled.
Emit signing warning on all cases where signed apps are enabled (secure
boot and signed images)
Follow convention of capital letters for SECURE_BOOT_SIGNING_KEY
variable, since it is
relevant to other components, not just bootloader.
Pass signing key and verification key via config, not requiring
bootloader to know parent app dir.
Misc. variables name corrections
2019-06-21 19:53:29 +08:00
047cf71c01 tools: update make converter to use new component registration api 2019-06-21 19:53:29 +08:00
e9bc46db71 tools: use new component registration api for unit test app 2019-06-21 19:53:29 +08:00
6771eead80 examples: use new component registration api 2019-06-21 19:53:29 +08:00
9eccd7c082 components: use new component registration api 2019-06-21 19:53:29 +08:00
e8582e9aa4 esptool_py: use passed offset and image when template is given
esptool_py defines command `esptool_py_flash_project_args` that
generates arg file for esptool.py. Two of the arguments are the offset
and image, which are not being used when a template file is given.
This commit makes variables OFFSET and IMAGE available to the template
file, which will holds the value of the offset and image arguments to
`esptool_py_flash_project_args`.
2019-06-21 19:48:41 +08:00
0ed590640e bootloader: Move some structs to separated file
Moved structures which describe the app image to separated file.

Closes: IDF-597
2019-06-21 18:43:27 +08:00
d1da76e369 Merge branch 'bugfix/misc_cmake_changes' into 'master'
Follow up CMake changes/fixes

See merge request idf/esp-idf!5267
2019-06-21 13:27:55 +08:00
934a1a3223 Merge branch 'feature/add_ability_to_specify_spiffsgen_dependencies' into 'master'
Add ability to specify dependencies for spiffsgen

See merge request idf/esp-idf!4933
2019-06-21 13:27:35 +08:00
bd9590502c Merge branch 'bugfix/spi_flash_remove_include_chain_in_host_drv' into 'master'
esp_flash: support C++ and improve the document

See merge request idf/esp-idf!5287
2019-06-21 13:12:09 +08:00
8aa6fb241d Merge branch 'bugfix/malloc_warnings_mdns' into 'master'
mdns: fix static analysis warnings

See merge request idf/esp-idf!5143
2019-06-21 13:10:06 +08:00
149e07911d components/bt: Optimization and bugfix of previous commits 2019-06-21 11:55:45 +08:00
e2b8f4c6ae Merge branch 'feature/docs_for_updated_idf_argparsing' into 'master'
docs: Update order of arguments for idf.py and add click linux package

Closes IDF-501

See merge request idf/esp-idf!5166
2019-06-21 11:42:59 +08:00
c65038fd74 spiffs,make: change spiffsgen build API 2019-06-21 10:58:40 +08:00
e0a652f164 spiffs: add ability to specify dependencies when dirs themselves are generated 2019-06-21 10:48:34 +08:00
c2a9785fa9 Merge branch 'feature/netif_custom_name' into 'master'
Allow setting netif hostname via lw/ip component config menu item (IDFGH-1342)

See merge request idf/esp-idf!5262
2019-06-21 08:41:59 +08:00
e56d4eff9a Merge branch 'feature/example_ethernet2wifi_ap' into 'master'
add ethernet to wifi-ap example

See merge request idf/esp-idf!5053
2019-06-21 08:31:44 +08:00
070b86eee5 i2s: test case for variation in apll clock rate 2019-06-20 16:40:58 +00:00
430d9c6fba i2s: fix a bug when calculating i2s apll parameters
Closes https://github.com/espressif/esp-idf/issues/2634
Closes https://github.com/espressif/esp-idf/issues/3380
Fixes https://github.com/espressif/esp-idf/issues/3407
2019-06-20 16:40:58 +00:00
813c9dcf22 ethernet: add eth2ap example
This example illustrates how to do Layer2 packet forwarding bussiness between Wi-Fi and Ethernet.
2019-06-20 22:12:56 +08:00
53fd406f53 Merge branch 'test/fix_some_error_wifi_cases' into 'master'
test: fix some wifi case issues

See merge request idf/esp-idf!5226
2019-06-20 22:05:16 +08:00
4bd4c7caf3 mdns: fix ignoring mdns packet with some invalid name entries in question field
In case of invalid name entry, only this entry is invalidated and parsing continues as other query entries could contain questions to be responded to
2019-06-20 14:25:12 +02:00
126b687c75 Merge branch 'refactor/vfs_uart_multichip_support' into 'master'
vfs_uart & uart: add multichip support

See merge request idf/esp-idf!5298
2019-06-20 18:31:24 +08:00
f2e6ba8701 component/bt: clear BT/BLE interrupts after controller_disable to overwrite the default non-zero value of intcntl registers 2019-06-20 17:40:55 +08:00
8024fcb296 components/bt: Add more functions for memory debug. 2019-06-20 17:12:04 +08:00
2ad65bb434 Support timeout of fixed_queue and osi_thread
1. remove fixed_queue_try_dequeue and fixed_queue_try_enqueue,
2. add timeout parameter for fixed_queue_enqueue and fixed_queue_dequeue
3. replace where call fixed_queue_try_dequeue/enqueue to fixed_queue_dequeue/enqueue(..., timeout = 0)
4. replace where call fixed queue_enqueue/dequeue to fixed_queue_enqueue/dequeue( ..., timeout = FIXED_QUEUE_MAX_TIMEOUT)
5. modify the blocking_type of osi_thread_post to timeout.
2019-06-20 17:12:04 +08:00
9863565a6f components/bt: Optimization and bugfix of previous commit 2019-06-20 17:06:23 +08:00
07fef85a23 components/bt: Separation of BT and BLE 2019-06-20 17:06:23 +08:00
90008e3fd6 Merge branch 'feature/spi_driver_support_multi_chip' into 'master'
spi: multichip support

See merge request idf/esp-idf!5234
2019-06-20 16:45:06 +08:00
a9157aaba9 Merge branch 'bugfix/ut_ci_test_fail_because_failed_to_reset' into 'master'
ci: fix random unit test CI failure

See merge request idf/esp-idf!5264
2019-06-20 16:08:51 +08:00
11924d76cb cmake: clarify build trimming docs
How idf_build_component and the COMPONENTS argument to idf_build_process
interact is not clear/misleading. Clarify their interaction in the docs.

Closes: https://github.com/espressif/esp-idf/issues/3630
2019-06-20 16:02:22 +08:00
7a19894aec esptool_py: better display logs when generating binary
Since OUTPUT argument of custom command does not currently support
generator expressions, the project image is only generated as a side
effect. The primary generated file is a timestamp file. Unfortunately as a consequence
the output logs when the
binary is about to be generated is not as helpful anymore.

Set a custom comment that is more descriptive of what is happening,
and provide more feedback as to what has been generated.
2019-06-20 16:02:22 +08:00
64d37f5cb9 cmake: fix issues with build process
Fix issue when COMPONENTS are is not specified for idf_build_process,
no component is included in the build.
2019-06-20 16:02:22 +08:00
2fff500a1c cmake: export IDF_TARGET to menuconfig
Pass value of IDF_TARGET to menuconfig invocation.
2019-06-20 16:02:22 +08:00
8424822150 cmake: set CONFIG_DIR build property
Add CONFIG_DIR as a build property, so that components don't have to
derive it from one of the generated config files.
2019-06-20 16:02:22 +08:00
485c896740 components/bt: Combine A2DP sink task and A2DP source task into btc task 2019-06-20 16:00:55 +08:00
930c304a57 components/bt: Combine two hci task into one 2019-06-20 16:00:55 +08:00
5fd4cbb9d2 component/bt: Add functions for heap memory debug 2019-06-20 16:00:55 +08:00
bd9fed4400 component/bt: reduce the size of DRAM
DRAM.data:   506B -->  196B
DRAM.bss : 26857B --> 2170B
2019-06-20 16:00:55 +08:00
0150982ae3 tools: Fix Kconfig checker for comments and source after help 2019-06-20 09:48:04 +02:00
4397627b5b Merge branch 'feature/ws_client' into 'master'
esp_websocket_client

See merge request idf/esp-idf!3420
2019-06-20 15:37:40 +08:00
2a2d932cfe esp_websocket_client: Add websocket client component
Closes https://github.com/espressif/esp-idf/issues/2829
2019-06-20 15:37:40 +08:00
092179207e Merge branch 'bugfix/spi_concurrency' into 'master'
spi: fix a possible concurrency issue (port to master)

See merge request idf/esp-idf!5191
2019-06-20 15:32:02 +08:00
37cb673cd7 esp_flash: update the document to the latest API 2019-06-20 11:50:23 +08:00
21cce564ba component/bt: Macor from sdkconfig.h is used only in bt_user_config.h 2019-06-20 11:41:17 +08:00
b5c3ac0ec2 vfs_uart: refactor to have static context structure 2019-06-20 11:32:24 +08:00
cf2ba210ef uart: multichip support 2019-06-20 11:32:22 +08:00
026533cd72 esp_flash: fix C++ compilation and some typos 2019-06-20 10:55:13 +08:00
caf121e4b6 esp_flash: break the inappropriate include chain in spi_flash_host_drv.h 2019-06-20 10:55:12 +08:00
2eff8f7742 spi_slave: fix a example issue caused by word alignment 2019-06-20 10:38:52 +08:00
5c9dc44c49 spi: multichip support
move hardcoded numbers, etc. into soc files.
create headers for shared types which needs to be documented.

(MINOR CHANGE)
2019-06-20 10:38:52 +08:00
b2ae2601fd Merge branch 'feat/backtrace_in_ut' into 'master'
esp32: Refactor backtraces to be iterative, add printing backtrace at runtime and when UT fails

Closes IDF-93

See merge request idf/esp-idf!3825
2019-06-20 09:28:34 +08:00
58986992e8 Merge branch 'bugfix/ci_confserver_timeout_again' into 'master'
ci: Adjust spawn settings in test_confserver

See merge request idf/esp-idf!5225
2019-06-19 22:56:45 +08:00
442b57b3ee ci: Adjust more 'spawn' settings in test_confserver 2019-06-19 20:50:53 +07:00
faf23df19a component/bt : modify OSI thread of bluedroid
abstract of OSI thread to make bluedroid more compatible with different OS.
2019-06-19 21:20:04 +08:00
71eece07a0 Component/bt: add ble ancs demo 2019-06-19 19:36:55 +08:00
037c079e9a esp32: Refactor backtrace and add esp_backtrace_print()
This commit refactors backtracing within the panic handler so that a common
function esp_backtrace_get_next_frame() is used iteratively to traverse a
callstack.

A esp_backtrace_print() function has also be added that allows the printing
of a backtrace at runtime. The esp_backtrace_print() function allows unity to
print the backtrace of failed test cases and jump back to the main test menu
without the need reset the chip. esp_backtrace_print() can also be used as a
debugging function by users.

- esp_stack_ptr_is_sane() moved to soc_memory_layout.h
- removed uncessary includes of "esp_debug_helpers.h"
2019-06-19 18:30:18 +08:00
f78eea97fe Component/bt: add gattc and gatts coex example 2019-06-19 17:30:06 +08:00
28e0a17e0a Merge branch 'bugfix/btdm_make_failed_due_to_macro' into 'master'
components/bt: Fix make errors due to macro usage error

See merge request idf/esp-idf!5105
2019-06-19 14:44:02 +08:00
484eb7cd07 Merge branch 'feature/mdns_unit_tests' into 'master'
mdns: add initial unit tests

See merge request idf/esp-idf!5088
2019-06-19 14:43:51 +08:00
dfae8ce26e Merge branch 'bugfix/ci_remove_dup_UT' into 'master'
ci: fix a duplicate job the CI.

See merge request idf/esp-idf!5276
2019-06-19 10:59:43 +08:00
aebcbd98bf ci: fix a duplicate job the CI. 2019-06-19 00:22:23 +07:00
920cabb382 Merge branch 'feature/spi_ext_flash' into 'master'
spi_flash: support working on differnt buses and frequency

See merge request idf/esp-idf!4096
2019-06-19 00:14:39 +08:00
ce5653c257 Merge branch 'doc/openocd_build2win_update' into 'master'
Updated building-openocd-windows.rst instruction

See merge request idf/esp-idf!5049
2019-06-19 00:14:22 +08:00
ceb00f7a41 Merge branch 'bugfix/btdm_add_svc_inst_id_param_for_create_tab_event' into 'master'
Component/bt: add svc_inst_id param for create service table event

See merge request idf/esp-idf!4958
2019-06-18 21:19:41 +08:00
979dc1b0b8 Merge branch 'feature/btdm_add_new_api_get_conn_params' into 'master'
Component/bt: add new api to get connection parameters

See merge request idf/esp-idf!5057
2019-06-18 21:10:53 +08:00
bcb662c3cd Merge branch 'bugfix/log_free_level_entry' into 'master'
log: fix minor memory leak when cleaning list of log levels

Closes IDF-710

See merge request idf/esp-idf!5260
2019-06-18 15:34:39 +08:00
1036a091fe spi_flash: support working on differnt buses and frequency 2019-06-18 06:32:52 +00:00
ce4de867d6 spi_flash: New low-level flash API 2019-06-18 06:32:52 +00:00
21b04e7798 Merge branch 'bugfix/phy_init_data_mistake' into 'master'
esp_wifi: fix wrong path of phy_init_data

Closes IDFGH-1168

See merge request idf/esp-idf!5201
2019-06-18 14:13:01 +08:00
304e7119ce ci: fix random unit test CI failure:
we use `-` command to check if DUT reset pass. If we input `-` command
during DUT bootup, DUT could only receive `\n` and print test cases.
Print test cases could take long time and lead to reset check timeout.
Now we will add delay after reset, and enlarge reset check timeout to
solve this problem.
2019-06-18 12:22:00 +08:00
c5c716e9d7 esp_wifi: fix wrong path of phy_init_data
Closes https://github.com/espressif/esp-idf/issues/3482
2019-06-18 11:29:09 +08:00
e031719178 Merge branch 'bugfix/mbedtls_mpi_exp_mod' into 'master'
mbedtls: Fix mbedtls_mpi_exp_mod() set n and s values

Closes IDFGH-1313

See merge request idf/esp-idf!5222
2019-06-18 11:17:37 +08:00
6b7c5dc37e Merge branch 'feature/clang_static_analysis' into 'master'
add clang static analysis jobs

Closes IDF-91

See merge request idf/esp-idf!3752
2019-06-18 08:42:00 +08:00
b107b832ca sntp/lwip: Add SNTP_UPDATE_DELAY option in Kconfig
Closes: https://github.com/espressif/esp-idf/issues/2277
Closes: IDFGH-337
2019-06-17 18:04:10 +08:00
7ec9f9ee74 Merge branch 'bugfix/strncpy_issue_in_wifi_example' into 'master'
replace strncpy with strlcpy in wifi examples for safety's sake

Closes IDF-695

See merge request idf/esp-idf!5192
2019-06-17 15:38:23 +08:00
bc8c8c68dd mbedtls: Add UTs for modexp 2019-06-17 07:19:54 +00:00
0a040345cc mbedtls: Fix Z->s in mbedtls_mpi_exp_mod()
Z->s should never be zero, only 1 or -1.
Added additional checks for X, Y and M args to correctly set Z->s.

Closes: https://github.com/espressif/esp-idf/issues/1681
Closes: https://github.com/espressif/esp-idf/issues/3603
Closes: IDFGH-1313
2019-06-17 07:19:54 +00:00
4d8a46b376 component/bt: add readme doc for BLE demos
- Closes:https://github.com/espressif/esp-idf/issues/3341
2019-06-17 07:05:41 +00:00
483e82caf8 Component/bt: modify some logs level 2019-06-17 07:05:41 +00:00
8f2490cc6f Component/bt: add svc_inst_id param for create service table event
- add svc_inst_id param for create service table event
  - Closes https://github.com/espressif/esp-idf/issues/3256
2019-06-17 07:05:31 +00:00
76b3a64b76 Component/bt: add new api to get connection parameters 2019-06-17 07:04:34 +00:00
0521296264 Merge branch 'doc/review_api-ref_storage' into 'master'
Doc/review api ref storage

See merge request idf/esp-idf!5074
2019-06-17 14:23:52 +08:00
4faf2de035 Doc/review api ref storage 2019-06-17 14:23:52 +08:00
d156f0fc0f replace strncpy with strlcpy in wifi examples for safety's sake 2019-06-17 11:25:50 +08:00
e20b37aff9 Merge branch 'bugfix/prov_examples_strlcpy' into 'master'
Wi-Fi Provisioning : Bugfix in copying Wi-Fi SSID and Passphrase

Closes IDF-693

See merge request idf/esp-idf!5180
2019-06-17 10:29:05 +08:00
1138133a78 spi: fix a possible concurrency issue 2019-06-17 00:16:01 +00:00
8a3cf8ca77 Allow configuration of local netif hostname via new LWIP component configuration menu item
Signed-off-by: Sagar Bijwe <sagar@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/3627
2019-06-15 16:09:51 +05:30
c4f3afd4b5 ci: add clang static analysis jobs
Clang tidy 9.0.0 is to perform static analysis of IDF sources. All component sources are analysed with default sdkconfig configuration, based on examples/get-started/hello_world project (compilation commands are extracted from default build commands for this project). Configuration of static analysis is defined in tools/ci/static-analysis-rules.yml

Closes https://github.com/espressif/esp-idf/issues/145
2019-06-14 20:24:36 +02:00
8e43cd4d69 Add click package to linux setup instructions 2019-06-14 19:51:39 +02:00
a77f01ec9d Update order of arguments for idf.py in docs 2019-06-14 19:51:39 +02:00
da978bc5a1 tools: Port the filtering option of IDF Monitor to the idf.py toolchain 2019-06-14 17:45:20 +02:00
353de1487f log: fix minor memory leak when cleaning list of log levels 2019-06-14 13:55:46 +02:00
d4d162640f Merge branch 'bugfix/dns_bug' into 'master'
LDNS: fix the crash  under static IP address

Closes WIFI-487

See merge request idf/esp-idf!5069
2019-06-14 15:06:05 +08:00
df0b8db400 Merge branch 'feature/allow_multiple_fragment_definitions_for_library_v4.0' into 'master'
Allow multiple mapping fragments to map same library

See merge request idf/esp-idf!4713
2019-06-14 14:07:59 +08:00
e2d1c6234f Merge branch 'bugfix/improve_flash_dio_read_timing' into 'master'
bugfix(flash): fix flash dio read mode configuration error on SPI0

See merge request idf/esp-idf!5086
2019-06-14 12:10:46 +08:00
d18ed01b81 lwip:fix bugfix/dns_bug 2019-06-14 03:52:31 +00:00
c5e89897ef Merge branch 'bugfix/malloc_warnings_can' into 'master'
can: suppress clang tidy warning about nullptr dereference

See merge request idf/esp-idf!5145
2019-06-14 09:58:14 +08:00
d127849d80 can: suppress clang tidy warning about nullptr dereference 2019-06-13 16:23:20 +02:00
58df1d93bc Merge branch 'bugfix/ci_sort_executable_list' into 'master'
ci: keep executables list sorted to pass tests

See merge request idf/esp-idf!5231
2019-06-13 21:39:06 +08:00
08557be5df Merge branch 'fix/bootloader_region_overlap_update' into 'master'
bootloader: remove duplicate region overlap logic

See merge request idf/esp-idf!5128
2019-06-13 16:07:05 +08:00
7871983370 Merge branch 'optimize/igmp_mld6_timer' into 'master'
optimize: IGMP and MLD6 timer optimization config added

See merge request idf/esp-idf!4776
2019-06-13 15:31:26 +08:00
4e09eaf8e2 Merge branch 'feature/btdm_config_eir' into 'master'
components/bt: Add API to config EIR data

See merge request idf/esp-idf!5038
2019-06-13 14:55:23 +08:00
b1bf41be22 Merge branch 'bugfix/btdm_coex_assert_in_lc_lmppdu' into 'master'
components/bt: Fix assert due to alloc LMP TX buffer failed

See merge request idf/esp-idf!5134
2019-06-13 13:58:43 +08:00
a98141cc0a ci: keep executables list sorted to pass tests 2019-06-13 12:42:53 +07:00
2deb267be5 test: fix some wifi case issues:
* remove heap size check cases as we have bg tasks allocate memory
* fix wifi connect to open ap issue
2019-06-13 11:14:39 +08:00
78b7b137ad Merge branch 'feature/otatool_parttool_python_api' into 'master'
otatool, parttool Python API

See merge request idf/esp-idf!5077
2019-06-13 10:31:29 +08:00
60d28bb72f Merge branch 'bugfix/spiflash_kconfig' into 'master'
spi_flash: Fix Kconfig indentation

Closes IDFGH-1307

See merge request idf/esp-idf!5195
2019-06-13 10:18:14 +08:00
2dcf33d7b5 Merge branch 'doc/partition_table_app_test' into 'master'
partition table: Update documentation about "test" partition type

See merge request idf/esp-idf!5125
2019-06-13 10:16:51 +08:00
3cc384fbe9 Merge branch 'bugfix/malloc_warnings_transport' into 'master'
tcp_transport: fix minor memory leak found by static analyzer

Closes IDF-681

See merge request idf/esp-idf!5141
2019-06-13 10:11:36 +08:00
9909206b16 Merge branch 'bugfix/malloc_warnings_event_loop' into 'master'
esp_event: fix possible malloc free issues found by static analyzer

See merge request idf/esp-idf!5142
2019-06-13 10:10:26 +08:00
1094b83bcb Merge branch 'bugfix/rest_server_strlcpy' into 'master'
Example restful_server : Minor fix in copying file system base path

Closes IDF-691

See merge request idf/esp-idf!5181
2019-06-13 09:47:32 +08:00
eac356ef4a Merge branch 'feature/idf_version_header' into 'master'
esp_common: add esp_idf_version.h header to define IDF version

Closes IDF-253

See merge request idf/esp-idf!4596
2019-06-13 09:41:35 +08:00
1be207adb4 Merge branch 'bugfix/idfpy_msys_powershell' into 'master'
idf.py: Don't expect "_" env. variable to be available from PowerShell

Closes #79

See merge request idf/esp-idf!5119
2019-06-13 09:23:43 +08:00
26215bc1ad Merge branch 'doc/translate_idf_about' into 'master'
Doc/translate idf about

See merge request idf/esp-idf!5168
2019-06-12 19:17:04 +08:00
2dec7787c1 Doc/translate idf about 2019-06-12 19:17:04 +08:00
70b2c86fff Merge branch 'bugfix/gcc8_toolchain_links' into 'master'
docs: fix generation of toolchain links

Closes IDFGH-1319

See merge request idf/esp-idf!5194
2019-06-12 18:40:02 +08:00
5ae151308b Merge branch 'bugfix/fix_some_wps_bugs' into 'master'
wps: add  overlap event

Closes WIFI-517

See merge request idf/esp-idf!5022
2019-06-12 14:35:52 +08:00
e6801912c5 mdns: added initial suite of api unit tests 2019-06-12 08:18:25 +02:00
7971845fd4 idf.py: Don't expect "_" env. variable to be available from PowerShell 2019-06-12 08:04:28 +02:00
22d070e0af spi_flash: Rename long Kconfig options 2019-06-12 08:03:07 +02:00
842384a0d3 spi_flash: Fix Kconfig indentation
Closes https://github.com/espressif/esp-idf/issues/3598
2019-06-12 08:03:07 +02:00
8cfa574ad6 Merge branch 'bugfix/ci_test_confserver_timeout' into 'master'
ci: Adjust the test_confserver timeout to 2 seconds

See merge request idf/esp-idf!5184
2019-06-12 13:48:19 +08:00
a012025deb Example restful_server : Minor fix in copying file system base path 2019-06-12 05:43:17 +00:00
a8d19e6638 Provisioning Examples : Bugfix in copying Wi-Fi SSID and Passphrase 2019-06-12 05:42:46 +00:00
a75be3413e Wi-Fi Provisioning : Bugfix in copying SSID and Passphrase
These changes guarantee that the SSID and Passphrase received via protocomm are NULL terminated and size limited to their standard lengths.

List of changes:
* Corrected length of passphrase field in wifi_prov_config_set_data_t structure
* Performing length checks on SSID, passphrase and bssid, when populating wifi_prov_config_set_data_t structure with received credentials
2019-06-12 05:42:46 +00:00
ae675973be optimize: IGMP and MLD6 timers on demand config added
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-06-12 05:10:32 +00:00
7edef74347 cmake: set variables set by project call
ESP-IDF overrides project() definition for user convenience. This
redefinition lacks setting the variables documented at
the project command documentation
https://cmake.org/cmake/help/v3.5/command/project.html in the parent
scope.

This commit sets those variables.

Closes https://github.com/espressif/esp-idf/issues/3611.
2019-06-12 11:01:59 +08:00
8ee90ee2f1 ldgen: allow multiple mapping fragments to map same library 2019-06-12 10:48:54 +08:00
87aa341e97 ldgen: mapping rules should be grouped by archive 2019-06-12 10:48:54 +08:00
065eb918fd Merge branch 'bugfix/even_more_cmake_fixes' into 'master'
Even more CMake fixes

See merge request idf/esp-idf!5097
2019-06-12 08:08:04 +08:00
0e6ffd08b7 docs: update msys environment links for esp32-2019r1 toolchain 2019-06-11 22:22:14 +08:00
67148e37a6 tools/windows: update toolchain URL in MSYS build script 2019-06-11 22:21:44 +08:00
517c61a4ec docs: fix generation of toolchain links
Closes https://github.com/espressif/esp-idf/issues/3609
2019-06-11 19:46:56 +08:00
8886e3fbc3 Merge branch 'bugfix/esp_event_fix_placement_issue_on_make' into 'master'
esp_event: fix missed placement on make builds

See merge request idf/esp-idf!5179
2019-06-11 19:32:45 +08:00
54ef60f26b component: revert some of the dependency corrections
!4452 and !4897 made some ill-advised corrections to dependency info;
revert those in this MR. Handling pre-built binaries as imported
libraries is retained, however.
2019-06-11 18:09:26 +08:00
3882e48e8a cmake: use new signature form of target_link_library to link components
!4452 used setting LINK_LIBRARIES and INTERFACE_LINK_LIBRARIES to link
components built under ESP-IDF build system. However, LINK_LIBRARIES does
not produce behavior same as linking PRIVATE. This MR uses the new
signature for target_link_libraries directly instead. This also moves
setting dependencies during component registration rather than after all
components have been processed.

The consequence is that internally, components have to use the new
signature form as well. This does not affect linking the components to
external targets, such as with idf_as_lib example. This only affects
linking additional libraries to ESP-IDF libraries outside component processing (after
idf_build_process), which is not even possible for CMake<v3.13 as
target_link_libraries is not valid for targets not created in current
directory. See https://cmake.org/cmake/help/v3.13/policy/CMP0079.html#policy:CMP0079
2019-06-11 18:09:26 +08:00
6365658d3f cmake: revert using EXCLUDE_FROM_ALL when adding component subdirectories
Reverting (for now) the change in !4452 to use EXCLUDE_FROM_ALL.
Apparently this also affects custom targets with ALL option specified,
not causing them to be built with the project.

This is apparently a bug which has a merged fix:
https://gitlab.kitware.com/cmake/cmake/merge_requests/2816
2019-06-11 18:09:26 +08:00
f0f861ccd9 ldgen: use user input filename for processed template
Previously ldgen determines the output file name on its own. This commit
makes it so that user can dictate what the output file name will be
for the processed template, if the user needs it for something else.
2019-06-11 18:09:26 +08:00
70dfcb35d4 mbedtls: component CMakeLists.txt corrections
Since !4452 the common component requirements automatically get
privately linked to libraries built under ESP-IDF build system (this
includes targets from third-party libraries). This removes a variable
that was used for that purpose before !4452.

Since the internal target names were changed, the compile definition for
warning on using deprecated functions is not being passed. Since using
the internal name is unreliable, prefer passing this compile definition
from the test itself.
2019-06-11 18:09:26 +08:00
297b2c5a39 cmake: evaluate component requirements in one go
!4452 simplified early expansion by using an early expansion script that
only does one thing: get the public and private requirements for each
component, albeit one by one. This was also dependent on parsing
the command output of the expansion script.  This commit makes it so that a list of all
components to be processed to passed to the expansion script, generating a cmake
file that sets each component requirements in one go.

This also makes sure that only components that registered themselves get
included in the final build list.
2019-06-11 18:09:26 +08:00
33dd7011be cmake: expand build components before generating config
!4452 had config generation first before building the component list
to be used in the build. This proved to be detrimental when a new target
is added as config generation would consider configs from both targets.
2019-06-11 18:09:26 +08:00
767455dbeb Merge branch 'bugfix/check_for_new_cmakecache_vars' into 'master'
idf.py: Add check for new cmake cache values

Closes IDF-658

See merge request idf/esp-idf!5106
2019-06-11 14:16:14 +08:00
1b5c05e54c Merge branch 'bugfix/confgen_compat_defs' into 'master'
confgen.py: don't output compatibility definitions for options which are not defined

See merge request idf/esp-idf!5162
2019-06-11 14:13:20 +08:00
f59c3e7e3e Updated building-openocd-windows.rst instruction 2019-06-11 09:00:31 +03:00
3836aa9ae6 partition_table,app_update: use config partition table offset 2019-06-11 13:17:14 +08:00
7f7a9272f0 examples: create example for both Python and CLI otatool interfaces 2019-06-11 13:17:14 +08:00
5d41322412 examples: create example for both Python and CLI parttool interfaces 2019-06-11 13:17:14 +08:00
1de627e68a app_update: implement Python API for otatool 2019-06-11 13:17:14 +08:00
63bd57c1d7 partition_table: implement Python API for parttool
Closes https://github.com/espressif/esp-idf/issues/1494
2019-06-11 13:17:14 +08:00
02f1e9fc20 Merge branch 'feature/prov_mgr' into 'master'
Wi-Fi Provisioning Manager

See merge request idf/esp-idf!4805
2019-06-11 09:46:50 +08:00
d0ed0d3f9c Merge branch 'fix/mfg_util' into 'master'
mfg_util: Fix incorrect number of csv files creation for multiple values with REPEAT tags

See merge request idf/esp-idf!5044
2019-06-11 09:22:07 +08:00
2331597ed2 Merge branch 'bugfix/ticks_to_wait_for_uart_and_i2c' into 'master'
driver: Fix ticks_to_wait for uart and i2c

Closes IDFGH-964

See merge request idf/esp-idf!5021
2019-06-11 08:41:44 +08:00
406979e74f Merge branch 'feature/console_nvs_iterators' into 'master'
Feature/nvs iterators

Closes IDF-92

See merge request idf/esp-idf!3846
2019-06-11 08:36:13 +08:00
e08b787d79 ci: Adjust the test_confserver timeout to 2 seconds
On a VM, it seems like 500ms is sometimes a very short time...
2019-06-11 10:16:15 +10:00
c9bf3a3b17 Merge branch 'bugfix/remove_secure_boot_test_mode' into 'master'
remove secure boot test mode

See merge request idf/esp-idf!5059
2019-06-11 07:25:07 +08:00
9192827eec Merge branch 'doc/update_translation_for_get-started-cmake' into 'master'
Update Chinese translation of .rst files in get-started-guide according to the...

See merge request idf/esp-idf!4935
2019-06-11 02:09:27 +08:00
e281164540 Update Chinese translation of .rst files in get-started-guide according to the changes made in English files in these months. 2019-06-11 02:09:26 +08:00
9a013a91f1 Merge branch 'doc/add_ulp_cmake_translation' into 'master'
Doc/add ulp cmake translation

See merge request idf/esp-idf!4163
2019-06-11 01:48:37 +08:00
a37ec9bae6 add translation for ulp cmake
fix formatting

update translation

update translation

formatting
2019-06-11 01:48:36 +08:00
5268960235 Added support for NVS iterators
Closes https://github.com/espressif/esp-idf/issues/129
2019-06-10 16:42:39 +02:00
c34de4cba6 mdns: fix static analysis warnings 2019-06-10 13:21:07 +00:00
bd537083d9 esp_event: fix possible malloc free issues found by static analyzer 2019-06-10 13:10:34 +00:00
243e0b229f tcp_transport: fix minor memory leak found by static analyzer
Closes https://github.com/espressif/esp-idf/issues/3602
2019-06-10 14:28:42 +02:00
bde1c30c5b Merge branch 'bugfix/cmake_check_crosstool_ng_version' into 'master'
cmake: fix crosstool-NG version check regex

See merge request idf/esp-idf!5163
2019-06-10 20:23:57 +08:00
b0bfe937aa mfg_util: Fix unnecessary csv files creation for values with REPEAT tags 2019-06-10 12:08:58 +00:00
af3a2f3aba esp_event: fix placement issue when building with make
The CMake build uses the linker fragment file to place functions in IRAM
on certain configurations. This commit does that for Make as well.
2019-06-10 19:38:55 +08:00
2557442ae9 cmake: fix crosstool-NG version check regex 2019-06-10 09:51:40 +00:00
a92ace034f esp_prov : Support new JSON format of version string while maintaining backward compatibility
Other changes:
* Version check only happens if command line argument is specified
* Minor bugfix in processing apply_config response
2019-06-10 15:13:50 +05:30
f90d3f6d93 Provisioning : Added Wi-Fi Provisioning Manager example and test script 2019-06-10 15:13:50 +05:30
471a0e93a7 wifi_provisioning : Docs updated with information about new provisioning manager 2019-06-10 15:13:50 +05:30
4ef6c85f0c wifi_provisioning : Wi-Fi Provisioning Manager added 2019-06-10 15:13:50 +05:30
f3aab7d536 components/bt: Fix assert due to alloc LMP TX buffer failed 2019-06-10 15:14:23 +08:00
2c55fae6cf Merge branch 'bugfix/cmake_ndebug' into 'master'
cmake: fix setting NDEBUG definition

Closes IDFGH-1305

See merge request idf/esp-idf!5165
2019-06-10 15:07:41 +08:00
912c75372c confgen.py: don't output compatibility definitions for options which are not defined
For example, if a renamed option CONFIG_NEW is a bool with value “n”,
kconfiglib will not generate a define for it in the Kconfig file. The
define (#define CONFIG_NEW 1) will only be generated if the option is
“y” or “m”. However the compatibility definition was always
generated: #define CONFIG_OLD CONFIG_NEW. This broke the #ifdef
checks which depended on the old option names.

This commit wraps each compatibility definition:

    #ifdef CONFIG_NEW
    #define CONFIG_OLD CONFIG_NEW
    #endif

so that the CONFIG_OLD definition is only generated if CONFIG_NEW is
defined.
2019-06-10 06:56:07 +00:00
d1127dd684 Merge branch 'bugfix/cmake_build_system_test' into 'master'
ci: fix idf.py syntax in new build system tests

See merge request idf/esp-idf!5167
2019-06-10 13:54:36 +08:00
bb4ca8c508 Merge branch 'feature/config_option_for_mbedtls_debug_level' into 'master'
mbedtls: add config option for setting debug level

See merge request idf/esp-idf!5154
2019-06-10 11:44:40 +08:00
e701f96bf5 Merge branch 'bugfix/stack_protection_crash_due_to_incorrect_cflag' into 'master'
esp_common: fix stack protection crash due to incorrect CFLAG

See merge request idf/esp-idf!5155
2019-06-10 11:43:31 +08:00
b2bfa8ed95 ci: fix idf.py syntax in new build system tests 2019-06-07 22:03:15 +08:00
6b8c31a198 cmake: fix setting NDEBUG definition
Closes https://github.com/espressif/esp-idf/issues/3596
2019-06-07 21:23:42 +08:00
54c70dc284 Merge branch 'bugfix/target_test_no_setup_tools' into 'master'
ci: don't do idf_tools.py install in target_test stage

See merge request idf/esp-idf!5158
2019-06-07 21:04:41 +08:00
50d2e6b69b Merge branch 'bugfix/cmake_extra_component_dirs' into 'master'
CI: additional CMake build system tests wrt EXTRA_COMPONENT_DIRS

See merge request idf/esp-idf!5104
2019-06-07 07:49:30 +08:00
5f5428233e partition table: Update documentation about "test" partition type
Reported from forum: https://esp32.com/viewtopic.php?f=13&t=10777&p=44164#p44164
2019-06-07 09:45:40 +10:00
a0382de0ea Merge branch 'bugfix/psram_io_struct_uninitialized' into 'master'
Make sure the psram_io struct is initialized

See merge request idf/esp-idf!5147
2019-06-07 07:36:16 +08:00
57f7c77aff ci: don't do idf_tools.py install in target_test stage 2019-06-07 01:17:29 +08:00
4b0b2c6fda Merge branch 'feature/action_specific_flags' into 'master'
idf.py: add support for action specific options

Closes IDF-501, IDFGH-1276, and IDFGH-1275

See merge request idf/esp-idf!5029
2019-06-07 00:44:09 +08:00
f80cce7bb9 esp_common: fix stack protection crash due to incorrect CFLAG 2019-06-06 18:52:32 +05:30
0a5dfd3717 mbedtls: add config option for setting debug level
Closes https://github.com/espressif/esp-idf/issues/3521
2019-06-06 18:28:19 +05:30
095def2111 Merge branch 'feature/docs_get-started_ESP32-Ethernet-Kit' into 'master'
Provide getting started guide for 'ESP32-Ethernet-Kit' board

See merge request idf/esp-idf!4981
2019-06-06 18:04:26 +08:00
345748b7bb Merge branch 'feature/fixed_static_dram_size_pr3222' into 'master'
esp32: Allow fixed static RAM size and DRAM heap size

Closes IDFGH-780

See merge request idf/esp-idf!5043
2019-06-06 17:11:46 +08:00
2b7da2a245 Make unknown psram package version more obvious 2019-06-06 16:57:01 +08:00
542e544faa esp32: Allow fixed static RAM size and DRAM heap size
Merges https://github.com/espressif/esp-idf/pull/3222
2019-06-06 18:23:04 +10:00
e47047075f add translation for ESP32-Ethernet-Kit Getting Started Guide 2019-06-06 15:55:00 +08:00
4e95b1ad21 Provide getting started guide for 'ESP32-Ethernet-Kit' board 2019-06-06 15:45:45 +08:00
19f176eb71 Merge branch 'feature/net_test_suite' into 'master'
execute net test suite for esp32 network stack in ci as weekend tests

Closes IDF-210

See merge request idf/esp-idf!3439
2019-06-06 15:25:03 +08:00
1de7b8d5d3 Merge branch 'bugfix/idf_tools_noninteractive' into 'master'
tools, ci: Use non-interactive mode for idf_tools in CI

See merge request idf/esp-idf!5129
2019-06-06 14:58:58 +08:00
2503af2464 wps: add overlap event
modify some header files to be consistent with vnc
2019-06-06 13:16:20 +08:00
ed17cbbb8a Make sure the psram_io struct is initialized
Closes https://github.com/espressif/esp-idf/issues/3591
2019-06-06 09:05:49 +08:00
3d2b11347d Merge branch 'bugfix/support_tcp_window_scale' into 'master'
esp_wifi/tcpip: support TCP window scale

See merge request idf/esp-idf!5102
2019-06-05 20:08:18 +08:00
7a6ff35a2a idf.py: Add check for new cmake cache values 2019-06-05 11:43:53 +02:00
d95cedd782 Merge branch 'bugfix/keep_sco_data_path_on_hci_reset' into 'master'
Bugfix/keep_sco_data_path_on_hci_reset

See merge request idf/esp-idf!4949
2019-06-05 17:10:21 +08:00
dcc9459690 tools, ci: Use non-interactive mode for idf_tools in CI 2019-06-05 15:56:03 +07:00
c8d967417c bootloader: remove duplicate region overlap logic
(MINOR CHANGE)
2019-06-05 14:43:23 +08:00
4988b26e38 Merge branch 'feature/gcc_8' into 'master'
Switch GCC to 8.2 (esp32-2019r1 toolchain release)

Closes IDF-103

See merge request idf/esp-idf!5068
2019-06-05 12:53:01 +08:00
826ff7186a Merge branch 'feature/mqtt_support_event_loop' into 'master'
MQTT: Support for esp event loop

See merge request idf/esp-idf!4815
2019-06-05 11:04:16 +08:00
ed22949847 driver: Add uart and i2c UTs to check ticks_to_wait in some functions 2019-06-05 10:38:23 +08:00
962e35c011 docs/idf_monitor: remove the mention of addr2line bug
Related to https://github.com/espressif/esp-idf/issues/2149.
Since the new toolchain includes the updated version of binutils,
remove the mention of this bug.
2019-06-04 23:43:29 +08:00
ca323fbaad update toolchain to esp32-2019r1 release
Closes https://github.com/espressif/esp-idf/issues/1445 (std::to_string)
Closes https://github.com/espressif/esp-idf/issues/1876 (std::chrono_steady_clock)
Closes https://github.com/espressif/esp-idf/issues/1995 (std::timed_mutex)
Closes https://github.com/espressif/esp-idf/issues/2149 (addr2line)
Closes https://github.com/espressif/esp-idf/issues/2308 (lsiu/lsip)
Closes https://github.com/espressif/esp-idf/issues/2449 (c++17)
Closes https://github.com/espressif/esp-idf/issues/3258 (objdump)
2019-06-04 23:43:29 +08:00
6af7697820 ci: use the toolchain from tools.json 2019-06-04 23:37:46 +08:00
48e32113de component/bt: Allow configuration of default SCO_DATA_PATH in bluetooth controller 2019-06-04 16:31:21 +08:00
5274739fff Merge branch 'bugfix/btdm_a2dp_src_pkt_overflow' into 'master'
component/bt: fix some performance issues in A2DP source data flow control

See merge request idf/esp-idf!4932
2019-06-04 16:07:31 +08:00
684514b3d6 ci: added standard set of network suite for lwip as a part of weekend test 2019-06-04 08:27:53 +02:00
d1e7d04f9b esp_wifi/lwip: support TCP window scale
Support enable/disable TCP Window scale feature via menuconfig
2019-06-04 14:09:04 +08:00
1ae0dfe7ef mqtt: added support for esp event loop, updating examples to register and use event loop handler 2019-06-04 07:41:27 +02:00
c308d7bed6 ci: additional Cmake tests for EXTRA_COMPONENT_DIRS
Tests from
https://gitlab.espressif.cn:6688/idf/esp-idf/merge_requests/4253
2019-06-04 13:37:19 +08:00
9dd1b2ffb6 Merge branch 'bugfix/httpd_open_fn' into 'master'
HTTP Server : Close new session immediately if `open_fn` fails

Closes IDFGH-1165

See merge request idf/esp-idf!5019
2019-06-04 13:29:14 +08:00
045aaf6fb0 Merge branch 'feature/add_xxx_periph_h' into 'master'
soc: Add xxx_periph.h for all modules

Closes IDF-192

See merge request idf/esp-idf!4952
2019-06-04 13:24:14 +08:00
c338cbceb1 Merge branch 'bugfix/cmake_wifi_ut_md5' into 'master'
esp_wifi: fix MD5 unit tests with CMake

See merge request idf/esp-idf!5090
2019-06-04 13:23:06 +08:00
7f0ac87033 Merge branch 'bugfix/set_default_eth_handler' into 'master'
esp_event: fix bug in set_default_eth_handler

See merge request idf/esp-idf!5103
2019-06-04 13:06:55 +08:00
355f209dba uart: Fix ticks_to_wait when 0 or expired
Closes: https://github.com/espressif/esp-idf/issues/3301

Closes: IDFGH-964
2019-06-04 11:50:54 +08:00
22a30e2740 i2c: Fix ticks_to_wait when 0 or time expired
Closes: https://github.com/espressif/esp-idf/issues/3301

Closes: IDFGH-964
2019-06-04 11:50:54 +08:00
db6a30b446 Merge branch 'bugfix/libgcc_fpu_functions' into 'master'
esp32: Use FPU for floating point divide, power, complex multiplications

See merge request idf/esp-idf!5005
2019-06-04 08:41:58 +08:00
a83b4cfc1c Merge branch 'bugfix/cmake_menuconfig' into 'master'
Tools: Fix CMake menuconfig used with combination of MSYS and CMD

Closes IDFGH-1248

See merge request idf/esp-idf!5089
2019-06-04 07:06:40 +08:00
0dc6e869c6 Merge branch 'bugfix/event_minor_leak' into 'master'
esp_event: fix minor memory leak when overwriting already registered handler

See merge request idf/esp-idf!5108
2019-06-03 22:37:06 +08:00
34b308eb79 Merge branch 'bugfix/wpa2_ent_vulnerability' into 'master'
esp_wifi: wpa2 enterprise vulnerability

See merge request idf/esp-idf!4992
2019-06-03 21:57:59 +08:00
a1b66e8984 Merge branch 'bugfix/set_ccount_overflow' into 'master'
clk: Fix the overflow when setting ccount

See merge request idf/esp-idf!4309
2019-06-03 19:50:04 +08:00
89e2b48a18 components/bt: Add API to config EIR data 2019-06-03 19:29:54 +08:00
20156f9702 idf.py: Add support for action specific options
Changes argument parsing mechanism from argparse to a new one, that provides better support for extensions and options that are only applicable to specific subcommands,

Breaking changes:

1. All global options should go before subcommands, i.e. `idf.py build -C ~/some/project` will not work anymore, only `idf.py -C ~/some/project build` is acceptable
2. To provide multiple values to an option like `--define-cache-entry` it's necessary to repeat option many times, i.e. `idf.py -D entry1 entry2 entry3` will not work, right way is: `idf.py -D entry1 -D entry2 -D entry3`
At the moment there are 3 options like this:  `--define-cache-entry` in base list and `--test-components` and `--test-exclude-components` in the unit test extensions
3. Drops `defconfig` and `bootloader-clean` subcommands

Closes https://github.com/espressif/esp-idf/issues/3570
Closes https://github.com/espressif/esp-idf/issues/3571
2019-06-03 13:07:02 +02:00
4d3762a8df clk: Fix the overflow when setting ccount
The multiplication will be overflow when using 160 or 240 MHz, this can lead the inaccuracy of log time stamp in startup.
2019-06-03 11:04:47 +00:00
fa36433199 Merge branch 'feature/multiple_github_prs' into 'master'
Fixes from github PRs

See merge request idf/esp-idf!5040
2019-06-03 18:50:46 +08:00
399d2d2605 all: Using xxx_periph.h
Using xxx_periph.h in whole IDF instead of xxx_reg.h, xxx_struct.h, xxx_channel.h ... .

Cleaned up header files from unnecessary headers (releated to soc/... headers).
2019-06-03 14:15:08 +08:00
3ddab0b8f3 soc: Add xxx_periph.h for all modules
The "xxx_periph" header file includes all SOC-level definitions for that peripheral.

Closes: IDF-192
2019-06-03 13:56:54 +08:00
2f471cb046 Merge branch 'bugfix/pc_ble_example_uuid' into 'master'
protocomm_ble : Example updated to use custom 128bit service UUID

See merge request idf/esp-idf!5100
2019-06-03 13:23:46 +08:00
8b890bdaf3 Merge branch 'bugfix/protocomm_sec_mult_inst' into 'master'
Protocomm : Session security now supports multiple instances of the same type

See merge request idf/esp-idf!4756
2019-06-03 11:46:24 +08:00
92c5f17be0 Merge branch 'bugfix/protocomm_minor' into 'master'
Protocomm : Minor fixes

See merge request idf/esp-idf!5094
2019-06-03 09:48:03 +08:00
bc6b80e7c2 add missing source files to CMakeLists for HFP 2019-05-31 18:54:19 +08:00
b859584f91 Merge branch 'feature/btdm_modem_sleep_with_32K_XTAL_under_light_sleep' into 'master'
Feature/btdm modem sleep with 32 k xtal under light sleep

See merge request idf/esp-idf!4744
2019-05-31 18:51:10 +08:00
1cf1f7e723 Merge branch 'bugfix/docs_rtd_failure_on_missing_submodule' into 'master'
docs: Add mqtt submodule to RTD build configuration. Now any submodule included in...

See merge request idf/esp-idf!5096
2019-05-31 16:26:45 +08:00
30d9ee56fb Merge branch 'feature/config_spi_pins_based_on_efuse_value' into 'master'
feat(psram): config SPI psram pins based on efuse value

See merge request idf/esp-idf!4950
2019-05-31 16:15:56 +08:00
c187f1ef6b esp_event: fix bug in set_default_eth_handler 2019-05-31 16:00:15 +08:00
37c91133ff esp_event: fix minor memory leak when overwriting alredy registered handler 2019-05-31 08:31:06 +02:00
a38b50a8a9 esp_event: extend register/unregister test case to cover overwriting existing handler works as expected 2019-05-31 08:31:06 +02:00
8009320fb4 esp_wifi: fix wpa2 enterprise vulnerability issues
Fix following wpa2 enterprise vulnerability issues:
1. The station can complete 4-way handshake after EAP-FAIL is received
2. The station crashes if EAP-SUCCESS is received before PMK is setup
2019-05-30 21:19:26 +08:00
13908160fb components/bt: Fix make errors due to macro usage error 2019-05-30 20:19:43 +08:00
8cc90bfbb1 esp_wifi: fix MD5 unit tests with CMake 2019-05-30 11:42:12 +08:00
b68f5b4f8c Merge branch 'feature/kconfig_format_docs' into 'master'
docs: Kconfig formatting rules and backward compatibility of options

See merge request idf/esp-idf!5052
2019-05-30 10:11:56 +08:00
0b70dfc27f Add floating point performance test 2019-05-30 10:09:24 +10:00
5b15686e29 docs: Kconfig formatting rules and backward compatibility of options 2019-05-29 14:56:23 +02:00
5034a57605 Tools: Fix CMake menuconfig used with combination of MSYS and CMD 2019-05-29 14:35:57 +02:00
4f8d5d25c4 Delete unneeded code fragments from GPIO-example
Closes https://github.com/espressif/esp-idf/pull/2822
2019-05-29 18:02:18 +05:30
9ade9f68b3 Update i2c.rst
I2C mode is set during configuration, not the 'op(eration) mode'

Closes https://github.com/espressif/esp-idf/pull/3452
2019-05-29 18:02:18 +05:30
1c56e33d1c Improve Linux cmake getting started documentation
Closes https://github.com/espressif/esp-idf/pull/3347
2019-05-29 18:02:18 +05:30
9495b7a7a6 Minor fix on Scheduler Suspension subtitle
Closes https://github.com/espressif/esp-idf/pull/3343
2019-05-29 18:02:18 +05:30
4b1f8ef3a2 Correct seconds calculation from TLM data field
The SEC_CNT field in the eddystone TLM frame represents the number of centiseconds
elapsed since reboot. A divisor of 10 has been placed within the code to derive seconds from SEC_CNT.

Closes https://github.com/espressif/esp-idf/pull/3300
2019-05-29 18:02:18 +05:30
b6ad457904 Update esp_eddystone_api.h
Change incorrect bitshifts in big_endian_read_32() function.
This was giving wrong values of of the 4 byte fieldswithin the eddystone TLM message, namely 'ADV_CNT' and 'SEC_CNT'
2019-05-29 18:02:18 +05:30
485df5e6c5 Fixed inconcsistent file name
Closes https://github.com/espressif/esp-idf/pull/3270
2019-05-29 18:02:18 +05:30
920d35b5d0 Update i2c documentation
Description for i2c_slave_read_buffer had leftover from copying from write fct. data
pointer description described the wrong way (writing into internal buffer)

Closes https://github.com/espressif/esp-idf/pull/3268
2019-05-29 18:02:18 +05:30
4430456b64 Change SPI_USE_RXDATA->SPI_TRANS_USE_RXDATA and SPI_USE_TXDATA->SPI_TRANS_USE_TXDATA on documentation
Closes https://github.com/espressif/esp-idf/pull/2802
2019-05-29 18:02:18 +05:30
058c6afd3c Add option to disable server side SSL session tickets as well as client
Closes https://github.com/espressif/esp-idf/pull/2570
2019-05-29 18:02:18 +05:30
5f62d8be79 Merge branch 'docs/update_idf_monitor' into 'master'
Docs/update idf monitor

See merge request idf/esp-idf!5084
2019-05-29 18:11:41 +08:00
96db6f906a Docs/update idf monitor 2019-05-29 18:11:40 +08:00
1831a375ec protocomm_ble : Example updated to use custom 128bit service UUID
Also removed old hardcoded UUIDs from README of esp_prov
2019-05-29 13:53:08 +05:30
31b854e17d Merge branch 'feature/do_not_use_link_groups' into 'master'
Do not use link groups

See merge request idf/esp-idf!4897
2019-05-29 15:18:31 +08:00
05be37c87c idf_size: Support JSON output
Pass -DOUTPUT_JSON=1 to get JSON formatted output from CMake targets
2019-05-29 17:11:53 +10:00
da13efc17a Merge branch 'feature/btdm_msbc_codec' into 'master'
Wide Band Speech for HFP

See merge request idf/esp-idf!4854
2019-05-29 14:39:21 +08:00
73b90387cb Merge branch 'bugfix/reset_log_uart_port' into 'master'
esp32: Add reset CONSOLE_UART port

See merge request idf/esp-idf!5011
2019-05-29 14:28:37 +08:00
9ac5a464cd Merge branch 'doc/review_pwr_management' into 'master'
Doc/review power management

See merge request idf/esp-idf!4674
2019-05-29 12:59:53 +08:00
588f059159 Doc/review power management 2019-05-29 12:59:52 +08:00
c7a0d5e063 Fix bug in the floating point unit test code 2019-05-29 10:14:31 +10:00
d9a5c8f387 esp32: Use FPU for floating point divide, power, complex multiplications
* Linker was choosing ROM symbols for these, which use integer soft-float
  operations and are much slower.
* _divsf3() moved to IRAM to avoid regressions with any code that does
  integer float division in IRAM interrupt handlers (+88 bytes IRAM)
* Thanks to michal for reporting:
  https://esp32.com/viewtopic.php?f=14&t=10540&p=43367
2019-05-29 10:14:31 +10:00
154fc74f76 Merge branch 'bugfix/nvs_typedef_naming_pr3239' into 'master'
nvs: Append _t to nvs_handle & nvs_open_mode types

Closes IDFGH-891

See merge request idf/esp-idf!4783
2019-05-29 08:14:00 +08:00
80fb837b29 Merge branch 'bugfix/kconfig_checker_message' into 'master'
Tools: Produce a clearer message for Kconfig prefix errors

See merge request idf/esp-idf!5054
2019-05-29 08:10:31 +08:00
9d0ca60398 Merge branch 'bugfix/mqtt_improved_receive' into 'master'
MQTT improved receive and minor updates to weekend tests

See merge request idf/esp-idf!4947
2019-05-29 08:07:17 +08:00
db138ae19b feat(psram): config SPI psram pins based on efuse value 2019-05-28 21:25:16 +08:00
1031f77262 docs: Add mqtt submodule to RTD build configuration. Now any submodule included in documentation build by Doxygen should be included in this file 2019-05-28 20:11:21 +08:00
f678a6289d reduce the minimum delay uncertainty of esp_timer for Bluetooth modem sleep from 1.8ms to 0.5ms for lower power consumption 2019-05-28 19:56:31 +08:00
ff2c583a0d component/bt: Add option to configure BLE SCA through menuconfig and use a fixed value of clock cycle to estimate sleep duration for external 32kHz oscillator 2019-05-28 19:56:26 +08:00
5384338341 Protocomm : Minor fixes
List of changes:
* protocomm_httpd : Reset session_id static variable on start and stop
* security1 : Typo in checking failed dynamic allocation
2019-05-28 14:41:49 +05:30
9c6bec203d HTTP Server : Close new session immediately if open_fn fails
open_fn() was introduced in the context of HTTPS server, as a configurable callback function that is called by the HTTP server, on every newly created socket. It is responsible of allocating resources for per session transport security.

Earlier, if open_fn were to fail, the newly created socket would be closed by the server but the corresponding entry, for the now invalid socket, will remain in the internal socket database until that invalid socket is detected due to error when calling select(). Because of this delayed closing of sockets, the HTTPS server would quickly face shortage of available sessions when a lot of SSL handshake errors are happening (this typically occurs when a browser finds that the server certificate is self signed). This changes in this MR fix this issue by clearing up the socket from internal database, right after open_fn fails.

Closes https://github.com/espressif/esp-idf/issues/3479
2019-05-28 08:49:02 +00:00
d68f1907ef bugfix(flash): improve flash dio read timing
When flash work in DIO Mode, in order to ensure the fast read mode of flash
is a fixed value, we merged the mode bits into address part, and the fast
read mode value is 0 (the default value).
2019-05-28 14:51:04 +08:00
550b1897c8 Merge branch 'feature/idf_tools_dir_2' into 'master'
IDF tools metadata file and IDF_TOOLS_PATH support

See merge request idf/esp-idf!4411
2019-05-28 13:39:47 +08:00
b3b6ce2eea docs: remove reference of using link groups 2019-05-28 13:01:43 +08:00
22514c1dd9 cmake: For gcc8 use linker to find paths to libc, libm, libstdc++, etc
Removes the need to know/guess the paths to these libraries. Once we are gcc 8 only, we
can remove -nostdlib and no additional arguments are needed for system libraries.

The catch is: any time IDF overrides a symbol in the toolchain sysroot, we need
an undefined linker marker to make sure this symbol is seen by linker.
2019-05-28 12:54:37 +08:00
2c12080049 components: correct dependency information for linking without link groups 2019-05-28 10:51:02 +08:00
83ce35d638 cmake: do not use link groups 2019-05-28 10:51:02 +08:00
7963ac65af mqtt_tests: add weekend test for sending and receiving empty payload messages, update config options per new naming convetions 2019-05-27 21:57:18 +02:00
38d15cbd63 mdns tests: adapt mdns fuzzer test to compile with event loop library 2019-05-27 16:31:25 +02:00
d19b20388f lwip tests: adapt fuzzer test mocks to comply with 4.0 refactoring 2019-05-27 16:31:24 +02:00
db121a56e1 tcp_transport: modified ws_read to read payload directly to the read buffer and separately from header bytes
Previous version read all data to the buffer including header which reduced maximum payload read. This version uses a local array to receive header and reads payload bytes to the buffer
2019-05-27 16:31:24 +02:00
7403e8e11c component/bt: remove the pm_lock that prevents light sleep in case that external 32kHz crystal is used as Bluetooth low power clock 2019-05-27 17:47:33 +08:00
801f5d6e82 Merge branch 'bugfix/more_cmake_fixes' into 'master'
More CMake fixes

See merge request idf/esp-idf!5060
2019-05-27 15:48:25 +08:00
b2e54a9cc6 ci: Add IDF_DEPRECATED macro for things we only deprecate in our CI passes 2019-05-27 17:43:38 +10:00
02f2e63662 Merge branch 'feature/use_cmake_function_call_for_embedding_ulp' into 'master'
Use function call for embedding ULP binaries

See merge request idf/esp-idf!4242
2019-05-27 13:14:09 +08:00
c61a0bba4e Merge branch 'docs/translate-getting-started-guides-wrover' into 'master'
Add translation for ESP32-WROVER-KIT Getting Started Guides

See merge request idf/esp-idf!4672
2019-05-27 07:53:20 +08:00
440c42693d Add translation for ESP32-WROVER-KIT Getting Started Guides 2019-05-27 07:53:20 +08:00
0685a2e9f6 Merge branch 'bugfix/fix_no_disconnect_event_when_rx_disassoc_after_send_auth' into 'master'
wifi: fix the bug no disconnect event when STA recv disassoc after sending auth

Closes WIFI-431, WIFI-507, and IDFGH-1160

See merge request idf/esp-idf!4833
2019-05-24 19:56:50 +08:00
fcf4886172 components/bt: Support EV3 packet type 2019-05-24 17:36:10 +08:00
dd906a91a5 components/bt: Enable mSBC and add decoder and encoder 2019-05-24 17:36:10 +08:00
20758443df components/bt: Add packet loss concealment (PLC) for HFP 2019-05-24 17:33:52 +08:00
e10d5aaddc component/bt: modify the SBC decoder to support mSBC mode 2019-05-24 17:33:52 +08:00
7c28611a3d component/bt: modify the SBC encoder to support mSBC mode 2019-05-24 17:33:52 +08:00
f15323b453 component/bt: remove SBC frame scramling 2019-05-24 17:33:52 +08:00
8f7e01baed tools: add metadata file and idf_tools.py 2019-05-24 17:04:23 +08:00
8d1a9c07a0 tools/check_python_dependencies: make aware of IDF_TOOLS_PATH 2019-05-24 17:04:23 +08:00
8d136a103b idf.py: allow overriding the program name 2019-05-24 17:04:23 +08:00
74247ed7f5 ci: keep executables list formatted 2019-05-24 17:04:23 +08:00
22a991bb29 wifi bugfixs:
1. fix the bug no disconnect event when STA recv disassoc after sending auth
2. fix the bug full scan send multi events when recv deauth/disassoc

Closes https://github.com/espressif/esp-idf/issues/3474
2019-05-24 11:23:16 +08:00
fd70355d5d Merge branch 'bugfix/idfpy_confserver' into 'master'
Fix cmake confserver target

See merge request idf/esp-idf!5047
2019-05-23 19:54:04 +08:00
25b539d4fc cmake: make project includes know gcc version as well 2019-05-23 18:39:31 +08:00
74c6c926ea nghttp: move HAVE_CONFIG_H compile definition to component 2019-05-23 18:39:31 +08:00
f125a9aaf4 cmake: restore creation of kconfig_menus.json 2019-05-23 18:39:31 +08:00
49edb193ec Merge branch 'bugfix/fix_some_wifi_bugs_0508' into 'master'
esp_wifi: fix some wifi bugs 0508

Closes WIFI-310, WIFI-384, WIFI-526, and FCS-176

See merge request idf/esp-idf!4957
2019-05-23 17:55:03 +08:00
865b24144e remove secure boot test mode 2019-05-23 14:13:08 +05:30
a52451258e Fix cmake confserver target 2019-05-23 08:29:05 +02:00
c879aff6f5 Merge branch 'bugfix/cmake_git_describe' into 'master'
cmake: Project & IDF git revisions: Show un-annotated tags and -dirty flag

See merge request idf/esp-idf!5042
2019-05-23 12:36:49 +08:00
95dcfecedc cmake: Project & IDF git revisions: Show un-annotated tags and -dirty flag
Adds --tags and --dirty flags to cmake git_describe() calls, and not
pass the HEAD commit hash (incompatible with --dirty)

Makes IDF_VER output the same as in Make build system

Thanks to @william-ferguson-au for reporting this:
https://github.com/espressif/esp-idf/issues/3378#event-2355460974
2019-05-23 13:46:23 +10:00
0cb6b8be01 Merge branch 'feature/example_ota_over_ethernet' into 'master'
update ota example to support both Wi-Fi and Ethernet

Closes IDFGH-427

See merge request idf/esp-idf!4801
2019-05-23 11:27:26 +08:00
197e0ae147 esp_wifi: fix some WiFi bugs
Fix following WiFi bugs:
1. Make smartconfig thread-safe
2. Fix WiFi stop/deinit memory leak
3. Refactor for WiFi init/deinit/ioctl etc
4. Add declaration for esp_wifi_internal_ioctl()
5. Fix the bug that WiFi stop leads to task watchdog
2019-05-22 22:18:05 +08:00
d97d3c2bc7 Tools: Produce a clearer message for Kconfig prefix errors 2019-05-22 15:48:30 +02:00
81ca1c0139 Merge branch 'bugfix/fix_softap_crash_when_sta_reset' into 'master'
wifi: fix softap crash when sta reset

Closes WIFI-509

See merge request idf/esp-idf!4995
2019-05-22 21:00:40 +08:00
1886d8d4ef update ota examples to support both Wi-Fi and Ethernet 2019-05-22 17:56:10 +08:00
0e7442bb7a Merge branch 'feature/spi_slave_support_hal' into 'master'
spi_slave: add HAL support

See merge request idf/esp-idf!4830
2019-05-22 13:42:11 +08:00
1466f37a9b Merge branch 'bugfix/esp_event_unregistration_issue' into 'master'
esp_event: fix issue with post data preparation

Closes #76

See merge request idf/esp-idf!5007
2019-05-22 12:26:47 +08:00
8ed07d0bb2 esp_event: check that event data is prepared properly 2019-05-22 11:30:27 +08:00
136e5bc32d esp_event: style fixes 2019-05-22 11:29:56 +08:00
4042902402 esp_event: always alloc data when not posting from isr 2019-05-22 11:29:17 +08:00
f21b8bbf55 esp_event: fix issue with post data preparation
Fixes an issue with post instance data preparation. Currently, there is
no way to check if event data has really been set during handler
execution preparation. When data is not allocated from the heap, user
could have passed 0x0 which can lead to failed checks.

This also implements using the already allocated data memory for posting
events from non-ISR functions when data size is less than the capacity.
2019-05-22 11:28:39 +08:00
e8ade3c68d Merge branch 'feature/Kconfig_rename' into 'master'
Rename Kconfig options

Closes IDF-265

See merge request idf/esp-idf!4883
2019-05-22 11:08:36 +08:00
897bb55482 nvs: Append _t to nvs_handle & nvs_open_mode types
Merges https://github.com/espressif/esp-idf/pull/3239/
2019-05-22 02:53:28 +00:00
32027805d4 docs: update instructions on how to embed ulp binaries 2019-05-21 20:00:06 +08:00
443850b1a8 example: update ulp example to use cmake function 2019-05-21 20:00:06 +08:00
4483724df8 ulp: use cmake function to embed ulp binaries 2019-05-21 20:00:06 +08:00
e1db12993b bootloader: pass legacy header config variable to subproject 2019-05-21 17:03:45 +08:00
e1a3dc50de Merge branch 'bugfix/cmake_changes_fixes' into 'master'
CMake: various bugfixes

See merge request idf/esp-idf!5030
2019-05-21 15:53:15 +08:00
151f757912 Rename Kconfig options (examples) 2019-05-21 09:32:55 +02:00
1ad2283641 Rename Kconfig options (components/bootloader) 2019-05-21 09:32:55 +02:00
997b29a9ca Rename Kconfig options (components/esptool_py) 2019-05-21 09:32:55 +02:00
6c0a7a66f3 Rename Kconfig options (components/app_trace) 2019-05-21 09:32:55 +02:00
a1bddb923b Rename Kconfig options (components/bt) 2019-05-21 09:09:01 +02:00
24a2e5a17e Rename Kconfig options (components/tcpip_adapter) 2019-05-21 09:09:01 +02:00
d61d58e78d Rename Kconfig options (components/pthread) 2019-05-21 09:09:01 +02:00
0ae53691ba Rename Kconfig options (components/esp32) 2019-05-21 09:09:01 +02:00
d4af5e6fff Rename Kconfig options (components/ethernet) 2019-05-21 09:09:01 +02:00
b8111ab1d5 Rename Kconfig options (components/esp_wifi) 2019-05-21 09:09:01 +02:00
92950db44e Rename Kconfig options (components/lwip) 2019-05-21 09:09:01 +02:00
e9f1011b1b Rename Kconfig options (components/driver) 2019-05-21 09:09:01 +02:00
bf626f2aba Rename Kconfig options (components/esp_event) 2019-05-21 09:09:01 +02:00
976d2a4b7f Rename Kconfig options (components/freemodbus) 2019-05-21 09:09:01 +02:00
64c2aa15aa Rename Kconfig options (components/freertos) 2019-05-21 09:09:01 +02:00
c5000c83d2 Rename Kconfig options (root) 2019-05-21 09:09:01 +02:00
1af263ebb2 tools: Check syntax also of Kconfig.in files 2019-05-21 09:09:01 +02:00
979e1e32cb tools: Ignore sdkconfig.rename files from the example directory 2019-05-21 09:09:01 +02:00
67e7cd8a0f tools: Kconfig checker ignores test files 2019-05-21 09:09:01 +02:00
254c1c1085 Confgen: link config options to parent choices in the docs 2019-05-21 09:09:01 +02:00
30ca5c7a88 Confgen: Fix prefix removal to work for exact match only 2019-05-21 09:09:01 +02:00
3bf56cdd17 Merge branch 'bugfix/ws_read_fragmented_header' into 'master'
Fix reading http header if received in multiple chunks

See merge request idf/esp-idf!4996
2019-05-21 14:56:34 +08:00
be6f5563b4 esp32: Add reset uart
Fixed the case when the first part of log was missed
this was happened when:
 * CONFIG_CONSOLE_UART_CUSTOM option is selected (UART1)
 * The selected CONSOLE_UART port is used also for the console component
 * in code esp_restart() or abort() functions were called.
2019-05-21 06:18:28 +00:00
ba51e9fb5c Merge branch 'bugfix/aes_fault_inj' into 'master'
mbedtls: Add simple fault injection check for hardware AES peripheral

See merge request idf/esp-idf!5023
2019-05-21 13:44:32 +08:00
0ccb7541f5 Merge branch 'feature/nvs_check_item_modified' into 'master'
nvs: Check if an item is modified before writing out an identical copy

See merge request idf/esp-idf!4934
2019-05-21 10:54:21 +08:00
6b08e8b449 esp_timer: handle esp_timer_delete in timer task
Closes https://github.com/espressif/esp-idf/issues/3458
2019-05-21 10:48:28 +08:00
af98ca6b46 hwcrypto: Add AES fault injection check
Hardware AES-CBC performance changes:

Release config 11.0MB/sec -> 10.8MB/sec
Debug config 9.4MB/sec -> 9.8MB/sec

(Unrolling the loop to optimize the check improves
performance at -Og, even with the fault check.)
2019-05-21 12:41:42 +10:00
c9edb7c8a9 mbedtls: Add AES-CBC performance test
Hardware AES engine gets 11.0MB/sec on Release config
Software AES is around 2.3MB/sec on Release config
2019-05-21 12:41:40 +10:00
ef05ccf666 Merge branch 'feature/download_fonts_only_if_missing' into 'master'
Download font file only is not exists in target location

See merge request idf/esp-idf!4979
2019-05-21 09:51:39 +08:00
52cf8c39aa Download font file only is not exists in target location 2019-05-21 09:51:39 +08:00
d41d70b8ef tcp_transport: reading http header in a chunked mode until header terminator received (or timeout) to correctly receive all header if fragmented
Closes https://github.com/espressif/esp-idf/issues/3461
2019-05-20 16:40:03 +02:00
2273646bda wifi: fix softap crash when sta reset 2019-05-20 19:57:50 +08:00
b4ad6c1426 cmake: refactor quick check given component dirs 2019-05-20 19:24:17 +08:00
e1726a91ce cmake: project includes should know about ESP_PLATFORM variable 2019-05-20 18:24:34 +08:00
e3eb945fd2 cmake: restore use of GNU extensions from libc 2019-05-20 18:24:34 +08:00
5175a152d9 cmake: exclude dot-dirs from added components 2019-05-20 18:24:34 +08:00
078c69e689 cmake: remove redundant variable setting 2019-05-20 18:24:34 +08:00
33db6d608e spi_slave: add HAL support 2019-05-20 07:34:34 +00:00
595d702e97 Merge branch 'feature/update_esp_tls_config' into 'master'
esp-tls: Add support to add CN from config and validate PEM buffers

See merge request idf/esp-idf!4929
2019-05-20 14:00:37 +08:00
c8a2760741 Merge branch 'bugfix/windows_detection_on_make' into 'master'
Windows detection on Makefiles cleanup

See merge request idf/esp-idf!4945
2019-05-20 13:59:05 +08:00
8c6ff874af Merge branch 'bugfix/custom_log_uart_rx_pin' into 'master'
bootloader_support: Fix UART RXD pin for console output (CUSTOM option)

Closes IDFGH-505

See merge request idf/esp-idf!5009
2019-05-20 13:58:37 +08:00
826acbc3de Merge branch 'bugfix/custom_bootloader_subproject_build' into 'master'
CMake: Fix custom bootloader does not override original

See merge request idf/esp-idf!5000
2019-05-20 13:58:03 +08:00
6ca07eca68 esp_common: add version definitions in code and build system
Closes https://github.com/espressif/esp-idf/issues/2482
Closes IDF-253
2019-05-20 13:14:56 +08:00
113e02aa3a Merge branch 'bugfix/idf_py_fixes' into 'master'
idf.py fixes from GitHub

Closes IDFGH-1005 and IDFGH-1006

See merge request idf/esp-idf!5012
2019-05-20 12:22:19 +08:00
2b301f53e4 Merge branch 'bugfix/fix_build_make_macos' into 'master'
make: fix build failure on macos with GNU make <= 3.81

See merge request idf/esp-idf!5010
2019-05-20 10:44:49 +08:00
d1c6bbf42e esp-tls: Add support to add CN from config and validate PEM buffers 2019-05-17 20:06:44 +05:30
1cf6964386 ci: check that custom bootloader overrides original 2019-05-17 15:17:54 +08:00
927007fdd2 cmake: fix custom bootloader issue
Issue is that when users creates a custom bootloader from
$IDF_PATH/components/bootloader. Parent project build uses the copy but
bootloader subproject build uses the original still. The issue is solved
by passing the custom bootloader as extra component directory so
bootloader build knows to use the new copy (itself) in the build.
2019-05-17 15:17:32 +08:00
5c0ce79f59 idf.py: Fix encoding issue with serial port names on Windows
Closes https://github.com/espressif/esp-idf/issues/3334
2019-05-17 14:25:53 +08:00
907471ce41 Merge branch 'feature/cmake_changes_for_4.0' into 'master'
CMake for 4.0

See merge request idf/esp-idf!4452
2019-05-17 14:21:48 +08:00
f91d969c13 idf.py: Use mingw32-make for version check
Closes https://github.com/espressif/esp-idf/issues/3333
2019-05-16 21:20:10 +08:00
8f91d730da make: fix build failure on macos with GNU make <= 3.81
Closes https://github.com/espressif/esp-idf/issues/3459
2019-05-16 14:09:43 +02:00
6cdfde094d Merge branch 'bugfix/protocomm_ble_128bit_uuid' into 'master'
protocomm_ble : Fix support for custom service UUIDs

See merge request idf/esp-idf!4978
2019-05-16 19:55:47 +08:00
98c77cebb2 bootloader_support: Fix UART RXD pin for console output (CUSTOM option)
The RXD pin is assigned as input (fix for custom uart option).

Closes: https://github.com/espressif/esp-idf/issues/2843

Closes: IDFGH-505
2019-05-16 11:18:56 +00:00
ad3b820e70 Merge branch 'bugfix/docs_build_failure_on_rtd' into 'master'
Fixed Breathe version to avoid docs build failure on ReadTheDocs server....

See merge request idf/esp-idf!4928
2019-05-15 21:27:40 +08:00
dc3f7824dc Merge branch 'doc/add_translation_for_api-reference_index.rst' into 'master'
Add Chinese translation for index.rst files and esp_wifi.rst file in api-reference following Kirill's English review

See merge request idf/esp-idf!4943
2019-05-15 21:05:45 +08:00
2864d6deb3 Add Chinese translation for index.rst files and esp_wifi.rst file in api-reference following Kirill's English review, including:
-network/index.rst
-network/esp_wifi.rst
-peripherals/index.rst
-provisioning/index.rst
2019-05-15 21:05:44 +08:00
27fe2006de Fixed Breathe version to avoid docs build failure on ReadTheDocs server. Provided RTD project configuration file to be able to select python version for specific to esp-idf release. 2019-05-15 20:40:48 +08:00
015922f8d9 esp_prov : Runtime discovery of Service UUID and endpoint name mapping
List of changes:
* Retrieve UUID property from Bluez device object before connecting to retrieve UUID contained in advertisement
* Read Characteristic User Descriptions attribute of each UUID for mapping endpoint names
* To support older implementations with hardcoded Name-UUID map, revert to fallback mode in order if advertisement data has no UUID field
2019-05-15 12:27:03 +00:00
120bd3a456 protocomm_ble : Fixed custom service UUID support
List of changes:
* Use 128 bit characteristic UUIDs when creating GATT table entries
* Change primary service attribute value to 128 bit custom service UUID
* Use raw advertisement data to convey flags and 128 bit primary service UUID
* Use raw scan response to send device name as complete local name
* Increase maximum device name length in relation to maximum scan response length
* Set Characteristic User Description attributes for each characteristic to convey protocomm endpoint names
2019-05-15 12:27:03 +00:00
f9043c43c9 Merge branch 'bugfix/win_py_case_insensitive' into 'master'
idf.py: Add more case-insensitive support on Win

See merge request idf/esp-idf!4991
2019-05-15 14:16:52 +08:00
208e1ecc29 Merge branch 'bugfix/mdns_docs_usage' into 'master'
mdns: documentation: fixed inconsistent enum in example of reading mdns results

See merge request idf/esp-idf!4997
2019-05-15 12:57:24 +08:00
1b4c7d30e5 Merge branch 'bugfix/esp_efuse_fields_unused_variable' into 'master'
efuse: Fix unused variable warning when NDEBUG

Closes IDFGH-1114

See merge request idf/esp-idf!4955
2019-05-15 12:48:28 +08:00
3f7bd872ac Merge branch 'refactor/power_management' into 'master'
power_management: Using port*_CRITICAL_ISR to be consistent with FreeRTOS

See merge request idf/esp-idf!4412
2019-05-15 12:27:58 +08:00
786f5641f7 mdns: documentation: fixed inconsistent enum in example of reading mdns results 2019-05-14 16:41:07 +02:00
0458bacc4e Merge branch 'bugfix/httpd_log_purge' into 'master'
esp_http_server : Logging of purged data to monitor made configurable

Closes IDFGH-1034

See merge request idf/esp-idf!4941
2019-05-14 18:07:51 +08:00
7493bd2e28 cmake: add command to get config value 2019-05-14 18:01:14 +08:00
de9bb5a160 cmake: fix scope issues 2019-05-14 18:01:14 +08:00
477fa49fc0 examples: update idf_as_lib example to use new api 2019-05-14 18:01:14 +08:00
c564d1730f esp_common: append gc sections link flag 2019-05-14 18:01:14 +08:00
d214bb912f examples: update with build system changes 2019-05-14 18:01:14 +08:00
eb867aeff3 idf.py: Add more case-insensitive support 2019-05-14 11:45:39 +07:00
ffec9d4947 components: update with build system changes 2019-05-13 19:59:17 +08:00
ee92352bf8 docs: update with build system changes 2019-05-13 19:57:39 +08:00
99f8a811fd cmake: Warn if something which looks like a component directory isn't
Otherwise, fails build at the add_subdirectory stage
2019-05-13 19:57:39 +08:00
3cf56ea6b6 cmake: Fix menuconfig target
need to load mconf path as build property
2019-05-13 19:57:39 +08:00
c6dc47b3e2 cmake: build system changes 2019-05-13 19:57:39 +08:00
e6a714480d unit-test-app: freertos_compliance config added
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-05-13 16:39:19 +05:30
d803465ec6 ref_clock: port*_CRITICAL vanilla FreeRTOS compliance
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-05-13 16:39:19 +05:30
a190b527ac power_management: port*_CRITICAL vanilla FreeRTOS compliance
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-05-13 16:39:19 +05:30
db8041a67f intr_alloc: port*_CRITICAL vanilla FreeRTOS compliance
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-05-13 16:39:19 +05:30
f3db0b5a4a crosscore_init: port*_CRITICAL vanilla FreeRTOS compliance
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-05-13 16:39:19 +05:30
5979086379 timer: port*_CRITICAL vanilla FreeRTOS compliance
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-05-13 16:39:19 +05:30
7f37824eb7 rtc_module: port*_CRITICAL vanilla FreeRTOS compliance
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-05-13 16:39:19 +05:30
da41885e85 rmt: port*_CRITICAL vanilla FreeRTOS compliance
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-05-13 16:39:19 +05:30
e9898b1280 periph_ctrl: port*_CRITICAL vanilla FreeRTOS compliance
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-05-13 16:39:19 +05:30
5c6b9adf11 freertos: port*_CRITICAL_SAFE API added
port*_CRITICAL_SAFE API calls port*_CRITICAL or port*_CRITICAL_ISR
depending on the context (Non-ISR or ISR respectively).

FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE Kconfig option added

Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-05-13 16:39:19 +05:30
56078159d4 Merge branch 'bugfix/xTaskIncrementTick' into 'master'
freertos: Fix xTaskIncrementTick for unwind the Tick for CPU1

Closes IDF-183

See merge request idf/esp-idf!4792
2019-05-13 12:34:54 +08:00
6488e8a8b5 Merge branch 'feature/example_restful_server' into 'master'
add http restful server example

Closes IDF-584

See merge request idf/esp-idf!4829
2019-05-13 12:33:21 +08:00
ecd3db0795 Merge branch 'feature/sha_rewrite_rom_functions' into 'master'
esp32: Rewrite esp_sha() function with mbedtls APIs

See merge request idf/esp-idf!4236
2019-05-13 12:32:45 +08:00
bbdeff1da1 esp32: Rewrite esp_sha function
It removes using a STALL_OTHER_CPU while sha operations.
It improves performance with SHA.
2019-05-13 12:32:45 +08:00
014de712ab Merge branch 'feature/update_cjson_lib_to_1.7.11' into 'master'
cJSON: update to v1.7.11

Closes IDFGH-1004

See merge request idf/esp-idf!4881
2019-05-13 12:31:19 +08:00
01b738055b Merge branch 'docs/translate-getting-started-guides-pico' into 'master'
Add translation for ESP32-PICO-KIT Getting Started Guides

See merge request idf/esp-idf!4640
2019-05-13 11:19:52 +08:00
975a9c49f0 Add translation for ESP32-PICO-KIT Getting Started Guides 2019-05-13 11:19:52 +08:00
6fd535c985 Merge branch 'docs/translate_idf_versions' into 'master'
Add translation for version file

See merge request idf/esp-idf!4917
2019-05-10 19:17:49 +08:00
0caabec88f Add translation for version file 2019-05-10 19:17:49 +08:00
6bf423d1e1 esp_http_server : Logging of purged data to monitor made configurable
List of changes:
* Kconfig option HTTPD_LOG_PURGE_DATA enables logging of purged data
* Kconfig option HTTPD_PURGE_BUF_LEN sets purge buffer length
* Purged data is logged in hex

Closes https://github.com/espressif/esp-idf/issues/3359
2019-05-10 14:25:39 +05:30
1c46caf70c Merge branch 'bugfix/modify_TCP_MSS_range' into 'master'
Change the default value of TCP_MSS to 1440 and TCP_MSS Range : [536 1460]

See merge request idf/esp-idf!4968
2019-05-10 13:52:16 +08:00
11c17ab5b6 add RESTful API server example 2019-05-10 13:21:14 +08:00
ce45e7806b Merge branch 'feature/add_promiscuous_control_for_ethernet' into 'master'
add promiscuous mode control for Ethernet

See merge request idf/esp-idf!4953
2019-05-10 12:51:15 +08:00
b6a24bbd25 Merge branch 'feature/esp-https-ota-basic-auth' into 'master'
esp_https_ota: component refactoring, bugfixes and feature additions

See merge request idf/esp-idf!4245
2019-05-10 12:39:14 +08:00
b991aa1ecb Merge branch 'bugfix/fix_minor_gh_issues' into 'master'
mdns: minor fixes mainly from GitHub

Closes #77

See merge request idf/esp-idf!4930
2019-05-10 12:31:30 +08:00
073573aa5d Merge branch 'bugfix/issue_with_encryption_flag_for_partition' into 'master'
partition: Fix "encrypted" read/write when encryption is disabled

See merge request idf/esp-idf!4927
2019-05-10 10:51:21 +08:00
8720a13d0f Merge branch 'bugfix/spiffsgen_path_on_windows' into 'master'
Fix issue with spiffsgen path when creating image in Windows

Closes IDFGH-1095

See merge request idf/esp-idf!4931
2019-05-10 10:23:28 +08:00
b4979f9c2a Merge branch 'bugfix/restore_ccache_use' into 'master'
CMake : Restore ccache use

Closes IDFGH-673

See merge request idf/esp-idf!4944
2019-05-10 10:16:04 +08:00
403f588fd0 Change the default value of TCP_MSS to 1440 and TCP_MSS Range : [536 1460] 2019-05-09 19:49:59 +08:00
c2aef48a57 Merge branch 'bugfix/pass_IDF_TARGET_to_bootloader_build' into 'master'
pass IDF_TARGET variable to bootloader build process

See merge request idf/esp-idf!4963
2019-05-09 19:45:20 +08:00
67dd55eae8 Change the default value of TCP_MSS to 1440 and TCP_MSS Range : [576 1460] 2019-05-09 17:59:25 +08:00
63e4677c55 pass IDF_TARGET variable to bootloader build process 2019-05-09 14:19:02 +08:00
eeca0804e6 Merge branch 'bugfix/https_doc_api' into 'master'
esp_http_server : Minor clarification in httpd_req_get_url_query_str() API documentation

Closes IDFGH-1052

See merge request idf/esp-idf!4942
2019-05-09 11:23:01 +08:00
c549581b7c Merge branch 'bugfix/err_to_name_include' into 'master'
Fixes for error code generator

Closes IDFGH-1103

See merge request idf/esp-idf!4946
2019-05-09 11:21:52 +08:00
15070ea648 add promiscuous mode control in emac driver
1. add promiscuous mode control in emac driver
2. fix minor bugs in IP101 driver
2019-05-08 17:15:21 +08:00
7822484aaa efuse: Fix unused variable warning when NDEBUG
Merges: https://github.com/espressif/esp-idf/pull/3429
Closes: https://github.com/espressif/esp-idf/issues/3432
2019-05-08 09:14:24 +08:00
afe57d6ff4 ci: check that build uses ccache when present 2019-05-07 12:00:41 +08:00
bfe5b13905 tools/gen_esp_err_to_name.py: Don't include already included headers 2019-05-06 15:08:37 +02:00
20bd142077 Fix paths to the new esp_common in the ESP error code generator 2019-05-06 15:07:27 +02:00
051b5c45c5 Fix includes in esp_err_to_name.c.in.
esp_err_t provided by esp_err.h and thus is required and not optional.
While the python script adds the header, it wraps it with an __has_include
directive that is not supported on all compilers (notably GCC 4.8).

Closes https://github.com/espressif/esp-idf/pull/3424
2019-05-06 14:52:13 +02:00
0ad13cd40f ldgen,make: simplify os check 2019-05-06 20:31:05 +08:00
459dd29444 cmake: restore ccache use when present
Closes https://github.com/espressif/esp-idf/issues/3116
2019-05-06 20:04:07 +08:00
417cac6654 Merge branch 'bugfix/blockdiag_seqdiag_cn_fonts' into 'master'
Introduce separate fonts used by blockdiag, sequdiag, actdiag, nwdiag, rackdiag…

See merge request idf/esp-idf!4646
2019-05-06 18:09:21 +08:00
5e1c19d73d esp_http_server : Minor clarification in httpd_req_get_url_query_str() API documentation
Closes https://github.com/espressif/esp-idf/issues/3374
2019-05-06 14:32:24 +05:30
e0097bc740 cJSON: update to v1.7.11
Closes https://github.com/espressif/esp-idf/issues/3332
2019-05-06 14:07:54 +08:00
754a454402 Introduce separate fonts used by blockdiag, sequdiag, actdiag, nwdiag, rackdiag and packetdiag for Chinese and English version of documentation 2019-05-06 13:19:58 +08:00
394d89e7da Correct diagram layout to make text descriptions fit into blocks 2019-05-06 13:19:58 +08:00
df61612f8f Merge branch 'bugifx/httpd_reuseaddr' into 'master'
esp_http_server : Allow binding to same address and port upon restarting server without delay

Closes IDFGH-1060

See merge request idf/esp-idf!4903
2019-05-06 08:45:09 +08:00
f3f4e58313 project_config_mk: fix if condition 2019-05-05 19:12:33 +03:00
867ea68d5a fix spiffsgen.py wrong path delimiter on windows 2019-05-05 17:50:15 +08:00
38ec1b9a86 component/bt: fix some performance issues in A2DP source data flow control
1. modify the limit of frames to send to avoid dropping packet on A2DP source due to TX data queue overflow
2. reduce the A2DP source data queue size in order to achieve faster control respnonse
2019-05-05 11:42:27 +08:00
1ca60c46f1 Merge branch 'bugfix/kconfig_no_split_headers' into 'master'
kconfig: Don't create "split" directory structures under build/include/config

Closes IDFGH-962

See merge request idf/esp-idf!4768
2019-05-05 11:31:34 +08:00
6faaeafcdd Merge branch 'bugfix/http_file_server' into 'master'
File Server Example : Check longer than allowed filenames when converting from URIs to filepaths

See merge request idf/esp-idf!4886
2019-05-05 11:24:52 +08:00
af48977f21 mdns: fixed mdns crashing on reception of txt packet without a corresponding service
closes #2866
2019-05-03 16:37:43 +02:00
c050a75616 mdns: use const char* for mdns txt items types to remove warning when assigning 2019-05-03 16:31:32 +02:00
a851aac255 mdns: updated doxygen comments documenting mdns api
Closes https://github.com/espressif/esp-idf/issues/1718
2019-05-03 16:29:12 +02:00
eddd5c4f2c mdns: update mdns_out_question_s to be in line with mdns_parsed_question_s struct
Closes  https://github.com/espressif/esp-idf/issues/1568
2019-05-03 14:54:59 +02:00
7892cf6a03 partition: Fix "encrypted" read/write when encryption is disabled
According to the documentation[1][2] for partitions, setting the encrypted
flag for partitions should be a no-op when system level encryption isn't
enabled.  The current implementation, however, does not actually match
the documentation and it ends up with an unreadable partition via the
partition API if a partition flag is marked as encrypted without
system-level encryption enabled.  (This is because the writes go through
the encryption block, and reads do not go through the encryption block
when this situation occurs causing unreadable data to the application
running.) This fixes up the read-back of the partition table to match
whether or not the partition is currently encrypted under the hood.

This should not affect the bootloader's code for reading/writing encrypted
partitions as the bootloader directly invokes the spi_flash_write*(...)
APIs.

[1] https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/partition-tables.html#flags
[2] https://docs.espressif.com/projects/esp-idf/en/latest/security/flash-encryption.html#encrypted-partition-flag

Closes https://github.com/espressif/esp-idf/pull/3328

Signed-off-by: Tim Nordell <tim.nordell@nimbelink.com>
2019-05-03 15:03:04 +05:30
ef49c41e15 Merge branch 'bugfix/esp_http_client_event_name' into 'master'
esp-http-client: Fix incorrect event name HTTP_EVENT_HEADER_SENT

See merge request idf/esp-idf!4921
2019-05-03 14:57:09 +08:00
9563931c3a Merge branch 'fix/nvs_console' into 'master'
nvs_console: Fix type comparison

See merge request idf/esp-idf!4920
2019-05-03 14:47:27 +08:00
22a89c50e8 Merge branch 'bugfix/win_fullclean_symlink' into 'master'
idf.py: Detect symlinks on Windows during fullclean

Closes IDFGH-1055

See merge request idf/esp-idf!4915
2019-05-03 12:10:04 +08:00
4e6d39f009 esp-http-client: Fix incorrect event name HTTP_EVENT_HEADER_SENT
Closes https://github.com/espressif/esp-idf/issues/3095
2019-05-02 16:15:59 +05:30
893c1d82f7 nvs_console: Fix type comparison
Closes https://github.com/espressif/esp-idf/issues/3320
2019-05-02 15:31:57 +05:30
6ccdca5114 idf.py: Detect symlinks on Windows during fullclean
Closes https://github.com/espressif/esp-idf/issues/3377
2019-05-02 10:03:11 +02:00
64e3ab364e examples/system/ota/advanced_https_ota: Add example for newly introduced APIs in esp_https_ota component 2019-05-02 12:29:29 +05:30
ffad8b27a3 esp_http_server : Allow binding to same address and port upon restarting server without delay
Issue : Restarting the server without 30sec delay between httpd_stop() and httpd_start() causes EADDRINUSE error
Resolution : Use setsockopt() to enable SO_REUSEADDR on listener socket

Closes https://github.com/espressif/esp-idf/issues/3381
2019-05-02 05:29:38 +00:00
c5f58d11e8 Merge branch 'bugfix/missing_ldgen_libraries_file_on_windows' into 'master'
make: fix missing rule for creating ldgen_libraries file

See merge request idf/esp-idf!4907

Closes https://github.com/espressif/esp-idf/issues/3394
2019-05-01 13:08:23 +08:00
c3fa2497b9 nvs: Check if an item is modified before writing out an identical copy
This prevents wear and tear on the flash, and it also is faster in some
cases since the read-out of flash is a cheaper operation than the erasure
of flash.  Some library modules (such as the esp_wifi) write out to NVS
upon every initialization without checking first that the existing value
is the same, and this speeds up initialization of modules that make
these design choices and moves it into a centralized place.

The comparison functions are based on the read-out functions of the same
name, and changes out the memcpy(...) operations for memcmp(...)
operations.

Signed-off-by: Tim Nordell <tim.nordell@nimbelink.com>
2019-04-30 11:39:58 -05:00
db86b31ef4 Merge branch 'fix/spi_master_dio_qio_hal' into 'master'
spi_master: fix the dual/quad io issue

See merge request idf/esp-idf!4894
2019-04-30 16:14:53 +08:00
f94f158cf5 Merge branch 'bugfix/move_spiffsgen_example_to_storage' into 'master'
spiffsgen follow-ups

See merge request idf/esp-idf!4893
2019-04-30 13:48:54 +08:00
4cc8b92d22 make: fix missing rule for creating ldgen_libraries file 2019-04-30 11:54:01 +08:00
f49e91f744 esp_https_ota: Add support for URL redirection, basic auth and more control with new APIs
Bugfixes:
- Fix http url redirection issue
- Fix basic/digest auth issue with http url

Features:
- Add support for adding custom http header
- Add support for reading firmware image header
- Add support for monitoring upgrade status
  - This requires breaking down esp_https_ota API such that it allows finer application level control
  - For simpler use-cases previous API is still supported

Closes https://github.com/espressif/esp-idf/issues/3218
Closes https://github.com/espressif/esp-idf/issues/2921
2019-04-29 18:58:07 +05:30
59afbe4eed File Server Example : Check longer than allowed filenames when converting from URIs to filepaths
This change prevents buffer overflows in case of really long file paths.

Other changes:
* Remove query (?) and fragment (#) component from URI when converting to file path
* /index.html and favicon.ico can be overridden by files with same name and path in SPIFFS
* README.md updated
2019-04-29 12:19:59 +05:30
86e1fc564e esp_http_client: Add API for adding authorization info
There was existing support for adding authorization info in esp_http_client
but it was functional only while using `esp_http_client_perform` API. This commit just moves
existing authorization addition logic into publicly exposed API.
2019-04-29 11:44:37 +05:30
ba1ff1692b Merge branch 'doc/review_api-reference_indexes' into 'master'
Doc/review api reference indexes

See merge request idf/esp-idf!4876
2019-04-29 10:53:42 +08:00
b672002a5f Doc/review api reference indexes 2019-04-29 10:53:42 +08:00
eb3791faba Merge branch 'bugfix/udp_multicast_example_errors' into 'master'
udp_multicast_example: better handling wrong addresses

Closes IDFGH-979

See merge request idf/esp-idf!4784
2019-04-29 09:21:07 +08:00
1ed3be9c79 Merge branch 'feature/use_libraries_directly_with_ldgen' into 'master'
Pass libraries as arguments to ldgen directly

See merge request idf/esp-idf!4887
2019-04-29 08:49:42 +08:00
3694ed30eb Merge branch 'bugfix/ldgen_fails_when_wifi_ram_opt_off' into 'master'
ldgen: do not generate rules when no condition is true

See merge request idf/esp-idf!4757
2019-04-29 08:44:13 +08:00
0b523c2300 spi_master: fix the dual/quad io issue
introduced in f871cc5ffa

The issue is caused by

1. The hal didn't pass the io_mode to LL.
2. The setup_device function overwrite the trans-specific settings.
2019-04-27 01:36:47 +08:00
4a288c9f30 example: use mbedtls to compute hash in spiffsgen example 2019-04-26 22:37:41 +08:00
fa21b5f33b spiffs: move spiffsgen example with other storage related examples 2019-04-26 22:37:41 +08:00
643d0f2164 freertos/test: Add unit tests for xTaskIncrementTick 2019-04-26 22:36:12 +08:00
b1ecd75d83 ldgen: pass component libraries directly 2019-04-26 20:06:53 +08:00
ca6cff7637 Merge branch 'bugfix/fix_build_cmake_example_failing' into 'master'
Fix false positive errors with CMake example builds

See merge request idf/esp-idf!4608
2019-04-26 18:20:53 +08:00
fe2565f5d7 Merge branch 'feature/make_bootloader_support_target_dependent' into 'master'
make bootloader_support depend on IDF_TARGET

See merge request idf/esp-idf!4798
2019-04-26 15:36:48 +08:00
6890326504 Merge branch 'test/always_deploy_test_result_on_master' into 'master'
CI: always deploy test result to Jira on master

See merge request idf/esp-idf!4840
2019-04-26 14:34:57 +08:00
df9113e0e1 Merge branch 'feature/kconfig_backward_comp' into 'master'
Rename deprecated Kconfig options in a backward compatible way

Closes IDF-155

See merge request idf/esp-idf!4551
2019-04-26 10:09:29 +08:00
207e87932b Merge branch 'fix/fix_soc_dram_low_addr' into 'master'
fix the dram low addr defined in the soc.h header

See merge request idf/esp-idf!4882
2019-04-26 08:43:22 +08:00
b5bbd42b9a Merge branch 'bugfix/btdm_abort_if_deinit_spp_without_init' into 'master'
components/bt: Fix abort if call esp_spp_deinit without calling esp_spp_init

See merge request idf/esp-idf!4859
2019-04-25 20:38:37 +08:00
9c7fb51d7d Merge branch 'feature/btdm_add_ble_link_timeout_config' into 'master'
Component/bt: add ble link timeout config in menuconfig

See merge request idf/esp-idf!4786
2019-04-25 20:04:53 +08:00
89798b328b Merge branch 'bugfix/select_init_sem' into 'master'
VFS: Allocate socket select semaphore outside ISR

See merge request idf/esp-idf!4591
2019-04-25 19:10:08 +08:00
9a00b7706e fix the dram low addr defined in the soc.h header 2019-04-25 17:29:48 +08:00
7724a2e1a0 Merge branch 'bugfix/wifi_fix_wps_fail_when_ap_is_encrypted' into 'master'
esp_wifi: fix the bug that WPS fails when AP is encrypted

Closes IDF-623

See merge request idf/esp-idf!4827
2019-04-25 17:05:48 +08:00
8e434c1bf0 freertos: Fix xTaskIncrementTick for unwind the Tick for CPU1
xTaskIncrementTick have to unwind uxPendedTicks on CPU1 and CPU0.

Use case: If an erase operation was run on the CPU1 then it leads
to starving other tasks which waiting time. Waited tasks just skipped.

Closes: https://github.com/espressif/esp-idf/issues/1952

Closes: IDF-183
2019-04-25 13:03:01 +08:00
23ee93ea76 Rename deprecated Kconfig options in a backward compatible way 2019-04-24 12:53:02 +02:00
2522268c20 ldgen: do not generate rules when no condition is true
Closes https://github.com/espressif/esp-idf/issues/3295
2019-04-24 18:25:24 +08:00
cf9f2aa466 Merge branch 'feature/set_redirection' into 'master'
Add a `esp_http_client_set_redirection` function

See merge request idf/esp-idf!4856
2019-04-24 15:50:53 +08:00
e1f743c8eb esp_wifi: fix the bug that WPS fails when AP is encrypted 2019-04-24 13:57:14 +08:00
db6b210a5f components/bt: Fix abort if call esp_spp_deinit without calling esp_spp_init 2019-04-24 11:17:54 +08:00
e1592c8c81 Merge branch 'bugfix/docs_tutorials' into 'master'
Docs update

See merge request idf/esp-idf!4150
2019-04-24 08:36:20 +08:00
e0d796bf33 Add a esp_http_client_set_redirection function When using direct operations instead of esp_http_client_perform, we need a way to set redirection URL when we get 30x response codes. Added the function for the same. User can now check status code and call esp_http_client_set_redirection function to enable redirection. Related change in adf: https://gitlab.espressif.cn:6688/adf/esp-adf-internal/merge_requests/187
Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2019-04-23 19:29:49 +05:30
a0f0c19e15 Merge branch 'doc/review_versions' into 'master'
Review the versions.rst document.

See merge request idf/esp-idf!4753
2019-04-23 17:22:41 +08:00
b89ff9e6db Review the versions.rst document. 2019-04-23 06:03:33 +00:00
8513b8ead4 Merge branch 'bugfix/pyparsing' into 'master'
Temporarily fix incompatibility with pyparsing 2.4.0

See merge request idf/esp-idf!4809
2019-04-23 10:35:50 +08:00
1718a93119 Merge branch 'bugfix/scan_fail_when_no_ap_found' into 'master'
fix the bug when scan fail after STA failed to connect to a nonexistent AP

Closes WIFI-76

See merge request idf/esp-idf!4630
2019-04-23 10:20:43 +08:00
823395dea6 Merge branch 'bugfix/fix_iperf_exit_error' into 'master'
examples: fix iperf exit error

Closes XIAOMI-62

See merge request idf/esp-idf!4788
2019-04-22 19:47:10 +08:00
0ae4eb4f09 Component/bt: add ble link timeout config in menuconfig
- add ble link timeout config in menuconfig
- disable background connection when call gatts_open
2019-04-22 09:16:19 +00:00
5e15840ac1 examples: fix iperf exit error 2019-04-22 12:14:21 +08:00
513353c641 wifi: fix the bug when scan fail after STA failed to connect to a nonexistent AP 2019-04-22 11:59:40 +08:00
47988e90ea Merge branch 'feature/esp_event_loop_examples_provisioning' into 'master'
examples/provisioning: use esp_event library for event handling

Closes IDF-55

See merge request idf/esp-idf!4030
2019-04-22 07:48:48 +08:00
50ecd6c3b6 CI: always deploy test result to Jira on master 2019-04-21 13:14:28 +08:00
7ca556a3ca Merge branch 'feature/jira_test_management' into 'master'
test: jira test management

See merge request idf/esp-idf!4751
2019-04-21 10:37:01 +08:00
9549ae4c12 test: sync integration test cases 2019-04-19 16:44:00 +08:00
af4daf6a22 test: include chip in test case ID 2019-04-19 14:39:44 +08:00
b7d26ddfe3 CI: add job to sync test to Jira 2019-04-19 14:39:44 +08:00
4b526ec0c4 test: let CI import integration test report 2019-04-19 14:39:44 +08:00
ad0d8a4767 test: save throughput result to junit report 2019-04-19 14:39:44 +08:00
b75400294a test: collect unit-test performance items and save to report 2019-04-19 14:39:44 +08:00
0462620a23 tiny-test-fw: support save performance to junit report:
1. support get performance from DUT
2. update performance to `testcase.stdout` in JunitReport
2019-04-19 12:17:13 +08:00
4b9a38d883 Merge branch 'feature/freemodbus_master_support_upd_arch' into 'master'
examples: freemodbus port common master and slave interface implementation

See merge request idf/esp-idf!3707
2019-04-18 12:42:05 +08:00
dd9de16100 Merge branch 'test/modify_mesh_ci_master' into 'master'
test: update mesh test cases for ci test

See merge request idf/esp-idf!4647
2019-04-18 11:28:50 +08:00
912c8e31fc Merge branch 'bugfix/pm_isr_exit_lock' into 'master'
pm: prevent interrupt nesting during esp_pm_impl_isr_hook

See merge request idf/esp-idf!4775
2019-04-18 11:16:26 +08:00
a20d02b7f1 Merge branch 'feature/remove_dependency_to_soc' into 'master'
global: remove dependency to soc everywhere except driver and kernel components

See merge request idf/esp-idf!4678
2019-04-18 08:08:41 +08:00
66c5fb5e5a Merge branch 'bugfix/fix_signal_test_bug' into 'master'
esp_wifi: fix a bug caused by signal test code

See merge request idf/esp-idf!4810
2019-04-17 22:06:43 +08:00
9cb08ebe4c Merge branch 'feature/add_cloud_frameworks_doc' into 'master'
Add documentation for Cloud Frameworks

See merge request idf/esp-idf!4547
2019-04-17 20:24:55 +08:00
3cbb378948 docs: Add cloud frameworks doc 2019-04-17 10:29:05 +00:00
801e2cdaa3 test: update mesh test cases for ci
add mesh cases in files:
TC_IT_MESH_EST.yml, TC_IT_MESH_COMM.yml and TC_IT_MESH_MISC.yml
2019-04-17 17:05:33 +08:00
4c50e51305 esp_wifi: fix a bug caused by signal test code
Fix a bug caused by signal test code.
2019-04-17 16:32:15 +08:00
3bb7dba995 Merge branch 'bugfix/use_libc_gnu_extensions' into 'master'
build: Add a standard way to use GNU extensions from libc

See merge request idf/esp-idf!4769
2019-04-17 16:22:37 +08:00
08adc39102 Temporarily fix incompatibility with pyparsing 2.4.0 2019-04-17 09:57:42 +02:00
48109e1f5d Merge branch 'bugfix/adjtime_ut' into 'master'
newlib: Fix adjtime

See merge request idf/esp-idf!4676
2019-04-17 15:15:31 +08:00
d31ee806be pm: prevent interrupt nesting during esp_pm_impl_isr_hook
Follows the approach proposed in https://github.com/espressif/esp-idf/pull/3110,
but masks the interrupts during the entire ISR hook, not only during
leave_idle. Interrupt nesting during update_ccompare may also cause
issues.

Closes https://github.com/espressif/esp-idf/issues/3057
2019-04-17 07:13:52 +00:00
92989b5718 Merge branch 'bugfix/esp_tls_closing_fd0' into 'master'
esp_tls: fix incorrect closing of fd 0 on connection failure

See merge request idf/esp-idf!4726
2019-04-17 15:10:20 +08:00
8edc995ad6 Merge branch 'bugfix/pr_3250' into 'master'
Fix: Lost username when setting new URL with a path.

Closes IDFGH-904

See merge request idf/esp-idf!4755
2019-04-17 15:08:26 +08:00
327963e0cc Merge branch 'bugfix/ut_leaks_tags' into 'master'
test: clean up "leaks" tags from most unit tests

See merge request idf/esp-idf!4779
2019-04-17 14:52:34 +08:00
269c4c74d2 udp_multicast_example: better handling wrong addresses
inet_aton returns 0 on failure, but socket_add_ipv4_multicast_group has to return negative values for failures
getaddrinfo sets res to zero of address could not resolved, but doesn't necessarily return an
error. res is now checked for zero before dereferencing

Merges https://github.com/espressif/esp-idf/pull/2814
2019-04-17 06:52:23 +00:00
410f5c3f7d build: Add a standard way to use GNU extensions from libc, since we have a general configured newlib in the toolchain 2019-04-17 12:08:36 +07:00
853dd3ff7a Merge branch 'bugfix/gcc8_compat' into 'master'
Remove warning (gcc8)

See merge request idf/esp-idf!4795
2019-04-17 13:02:47 +08:00
453a33ce79 mdns example: Remove a warned unused constant 2019-04-17 11:21:53 +07:00
3a9e24d7b4 Merge branch 'bugfix/fix_set_config_bug_for_bssid_set' into 'master'
wifi: fix the set config bug for bssid_set

Closes WIFI-419

See merge request idf/esp-idf!4785
2019-04-16 20:27:09 +08:00
bb4f5617ab test: clean up "leaks" tags from most unit tests 2019-04-16 20:07:40 +08:00
3f2d6a0891 make bootloader_support depend on IDF_TARGET
1. move chip-specific code(e.g. encryption) into IDF_TARGET directory
2. splict app-only code to idf directory which won't be compiled into bootloader
2019-04-16 17:37:56 +08:00
449d2a6367 freemodbus: Fix bug with incorrect coils read mask
Contains two different component folders per each implementation (serial_master and serial_slave) with concrete ports.
Added common public api for master and slave and common interface for master and slave implementation.
Add support of cmake system (added cmake files).
Added sdkconfig.defaults files for slave and master modbus examples.
Updated make file and KConfig for freemodbus component
Update according to review and fix doxygen warnings
Fix Doxyfile to pass documentation build
Update headers and change interface file names as per review comments
Merge  branch feature/freemodbus_move_rs485_mode_control
Update after review:
The stack modbus folder updated to support master and slave ports together and moved into freemodbus/modbus
Stack and port files updated to remove duplicated simbols
Make file, KConfig and CMakeLists.txt updated to compile master and slave stacks, common interface and concrete implementations of ports
Stack callback functions execute callbacks using interface pointer from concrete port implementation
User can instantiate any of concrete port using common API (only one concrete port at a time) and it does not require to select port by KConfig
Port pins and mode configuration moved into example files from port files to allow user select pins and port mode (customer request)
Changes tested using pymodbus, ModbusPoll and communication between two boards
Updated DoxyFile according to public include path
Fix maximum instance size for slave (merge from master of customer issue)
Fix critical section issue TW#28622 (change spin lock based critical section to semaphore)
Move serial port files into component port folder for master and slave accordingly
Fix example issue showed in the log when IO slave is not configured correctly
Fix conflicts while merging from origin/master
Fix errors handling in modbus controller interface + some final corrections according to review
Update maximum allowed number of slaves in the network segment
Fix bug with incorrect coils read mask

Closes https://github.com/espressif/esp-idf/issues/858
2019-04-16 10:21:20 +02:00
86e9acc2c9 Protocomm : Added new APIs for opening and closing secure sessions
New APIs:
* protocomm_open_session()
* protocomm_close_session()

This allows external applications using protocomm to manually create and close sessions.

These internally call the new_transport_session() and close_transport_session() APIs implemented by the security scheme in use.

Updated unit tests with usage of new APIs
2019-04-16 13:50:01 +05:30
cccf829366 Protocomm : Session security now supports multiple instances of the same type
List of changes:
* Security APIs accept handle to instance created during initialization
* Protocomm internally stores the security instance handle and calls security APIs with this handle as first parameter
2019-04-16 13:47:13 +05:30
74dd9b4f5f esp_http_client: fix CI issues & return value 2019-04-16 09:03:14 +02:00
4a6c5032f4 Fix: Lost username when setting new URL with a path.
Closes https://github.com/espressif/esp-idf/pull/3250
2019-04-16 08:58:36 +02:00
562af8f65e global: move the soc component out of the common list
This MR removes the common dependency from every IDF components to the SOC component.

Currently, in the ``idf_functions.cmake`` script, we include the header path of SOC component by default for all components.
But for better code organization (or maybe also benifits to the compiling speed), we may remove the dependency to SOC components for most components except the driver and kernel related components.

In CMAKE, we have two kinds of header visibilities (set by include path visibility):

(Assume component A --(depends on)--> B, B is the current component)

1. public (``COMPONENT_ADD_INCLUDEDIRS``): means this path is visible to other depending components (A) (visible to A and B)
2. private (``COMPONENT_PRIV_INCLUDEDIRS``): means this path is only visible to source files inside the component (visible to B only)

and we have two kinds of depending ways:

(Assume component A --(depends on)--> B --(depends on)--> C, B is the current component)

1. public (```COMPONENT_REQUIRES```): means B can access to public include path of C. All other components rely on you (A) will also be available for the public headers. (visible to A, B)
2. private (``COMPONENT_PRIV_REQUIRES``): means B can access to public include path of C, but don't propagate this relation to other components (A). (visible to B)

1. remove the common requirement in ``idf_functions.cmake``, this makes the SOC components invisible to all other components by default.
2. if a component (for example, DRIVER) really needs the dependency to SOC, add a private dependency to SOC for it.
3. some other components that don't really depends on the SOC may still meet some errors saying "can't find header soc/...", this is because it's depended component (DRIVER) incorrectly include the header of SOC in its public headers. Moving all this kind of #include into source files, or private headers
4. Fix the include requirements for some file which miss sufficient #include directives. (Previously they include some headers by the long long long header include link)

This is a breaking change. Previous code may depends on the long include chain.
You may need to include the following headers for some files after this commit:

- soc/soc.h
- soc/soc_memory_layout.h
- driver/gpio.h
- esp_sleep.h

The major broken include chain includes:

1. esp_system.h no longer includes esp_sleep.h. The latter includes driver/gpio.h and driver/touch_pad.h.
2. ets_sys.h no longer includes soc/soc.h
3. freertos/portmacro.h no longer includes soc/soc_memory_layout.h

some peripheral headers no longer includes their hw related headers, e.g. rom/gpio.h no longer includes soc/gpio_pins.h and soc/gpio_reg.h

BREAKING CHANGE
2019-04-16 13:21:15 +08:00
7097e5b0d0 wifi: fix the set config bug for bssid_set 2019-04-16 10:57:00 +08:00
936ee2884b Merge branch 'bugfix/esp_efuse_get_pkg_ver' into 'master'
efuse: Fix excess data coming from uninitialized variable

Closes IDFGH-976

See merge request idf/esp-idf!4778
2019-04-16 08:10:53 +08:00
652302bd06 Merge branch 'feature/sntp_cb_function' into 'master'
sntp: Add some modes for time synchronization

Closes IDF-236

See merge request idf/esp-idf!4472
2019-04-16 07:28:04 +08:00
0e69a7efc2 efuse: Fix excess data coming from uninitialized variable
Fixed esp_efuse_get_pkg_ver() function

Closes: https://github.com/espressif/esp-idf/pull/3309
Closes: IDFGH-976
2019-04-15 12:32:26 +00:00
1c21bc5c81 Merge branch 'bugfix/freemodbus_fix_incorrect_read_coil_event' into 'master'
freemodbus: fix incorrectly set coils read event in modbus controller

See merge request idf/esp-idf!4749
2019-04-15 19:41:49 +08:00
603d293365 Merge branch 'feature/btdm_AVRCP_TG' into 'master'
component/bt: implement AVRCP Target APIs

See merge request idf/esp-idf!3899
2019-04-15 18:53:51 +08:00
15be5e47a1 softap_prov_test : example script updated to accomodate for changes in logs 2019-04-15 10:19:29 +00:00
d784fbb314 examples/provisioning : Call esp_wifi_init() only in main function before starting provisioning
Removed all other instances of call to esp_wifi_init(), because every time this is called it
will override its previously set default event handler and hence cause numerous warnings.

Also, call nvs_flash_init() only once, that is before calling esp_wifi_init() in main function
2019-04-15 10:19:29 +00:00
3608f9bde4 examples/provisioning : use esp_event library to handle WiFi/IP events 2019-04-15 10:19:29 +00:00
7e5be1b58c sntp/lwip: Add some modes for time synchronization
Closes: IDF-236
Closes: https://github.com/espressif/esp-idf/pull/1668
2019-04-15 18:11:47 +08:00
8b2128ce07 Merge branch 'feature/add_support_for_signal_test' into 'master'
esp_wifi:  add support for signal test

Closes WIFI-324

See merge request idf/esp-idf!4717
2019-04-15 17:45:01 +08:00
d359d4c77c Merge branch 'bugfix/fix_deprecated_warning_with_dfs_init_auto_config' into 'master'
cpu_start: fix warnings with CONFIG_PM_DFS_INIT_AUTO option

See merge request idf/esp-idf!4761
2019-04-15 15:57:49 +08:00
95a1683158 Merge branch 'feature/esp_event_loop_examples_protocols' into 'master'
examples/protocols: move Wi-Fi connection code into helper component, support Ethernet

See merge request idf/esp-idf!3766
2019-04-15 15:54:22 +08:00
77645472ae esp_tls: fix incorrect closing of fd 0 on connection failure
Closes https://github.com/espressif/esp-idf/issues/3149
2019-04-15 10:59:50 +05:30
9a5e93c286 kconfig: Don't create "split" directory structures under build/include/config
Reported in https://github.com/espressif/esp-idf/issues/3299

If a config item contains a reserved filename in Windows like _CON_ then an invalid
directory is created.

We don't rely on this feature all, so disable it.
2019-04-15 05:28:46 +00:00
f935294c48 Merge branch 'doc/move_WiFi_Kconfig' into 'master'
move WiFi-specific Kconfig to esp-wifi component

See merge request idf/esp-idf!4736
2019-04-15 12:00:59 +08:00
9628c60a1d examples/protocols/mdns: use common network component 2019-04-15 03:32:05 +00:00
aa4a7804ec examples/protocols/asio: use common network component 2019-04-15 03:32:05 +00:00
ee3035257a examples/protocols/coap: use common network component 2019-04-15 03:32:05 +00:00
fbc407f088 examples/protocols/esp_http_client: use common network component 2019-04-15 03:32:05 +00:00
e1d1f10e8a examples/protocols/http(s,2)_request: use common network component 2019-04-15 03:32:05 +00:00
a5b0f5d6ed examples/protocols/http(s)_server: use common network component 2019-04-15 03:32:05 +00:00
6548afcf49 examples/protocols/mqtt: use common network component 2019-04-15 03:32:05 +00:00
a46d94250d examples/protocols/openssl: use common network component 2019-04-15 03:32:05 +00:00
e0f3f62cdf examples/protocols/sntp: use common network component 2019-04-15 03:32:05 +00:00
28cf1c83df examples/protocols/sockets: use common network component 2019-04-15 03:32:05 +00:00
b3a235945e ci: don’t look for project CMakeLists in common_components 2019-04-15 03:32:05 +00:00
22bef90bd3 examples: add component for protocol examples network functionality 2019-04-15 03:32:05 +00:00
eebbced5b6 freemodbus: fix incorrectly set coils read event
incorrect set of the MB_EVENT_COILS_WR event is changed while read coils in mbcontroller.c file
added read/write handling for appropriate registers in freemodbus.c example file

Closes https://github.com/espressif/esp-idf/issues/3289
2019-04-15 03:30:31 +00:00
f4328e5346 cpu_start: fix warnings with CONFIG_PM_DFS_INIT_AUTO option
Closes https://github.com/espressif/esp-idf/issues/3297
2019-04-15 03:08:26 +00:00
2e129ca31d esp_wifi: add support for signal test
Add support for WiFi signal test
2019-04-15 10:14:31 +08:00
f871cc5ffa Merge branch 'feat/spi_hal_support' into 'master'
spi_master: refactor and add HAL support

See merge request idf/esp-idf!4159
2019-04-15 07:57:11 +08:00
a9efefdc73 Merge branch 'bugfix/rename_ldgen_common_module' into 'master'
ldgen: rename common module

See merge request idf/esp-idf!4758
2019-04-14 11:20:22 +08:00
7150ac61cd ldgen: rename common module 2019-04-13 08:59:32 +08:00
6a323a6d7c Merge branch 'feature/wifi_refactor_softap_power_save' into 'master'
refactor softap power save

Closes WIFI-415 and IDF-81

See merge request idf/esp-idf!1905
2019-04-12 23:48:11 +08:00
0e1a39f813 Merge branch 'bugfix/nvs_fix_erase_any' into 'master'
nvs_flash: Multi-page blob erased using nvs_erase_key should be cleaned properly

See merge request idf/esp-idf!4634
2019-04-12 23:04:10 +08:00
ab672a5ee7 Merge branch 'bugfix/btdm_fix_memory_leak_when_set_txpwr' into 'master'
component/bt: fix memory leak when settig tx power

See merge request idf/esp-idf!4712
2019-04-12 23:00:44 +08:00
91eb59f543 Merge branch 'bugfix/improve_spi_timing_for_psram_and_flash' into 'master'
bugfix(psram): improve spi cs timing settings for psram

See merge request idf/esp-idf!4641
2019-04-12 22:57:04 +08:00
7728f8755e Merge branch 'feat/example_sdio_over_spi' into 'master'
sdio: support SDIO over spi

See merge request idf/esp-idf!3069
2019-04-12 16:12:57 +08:00
65664f8e99 Merge branch 'feature/move_aws_iot_to_independent_repository' into 'master'
aws_iot: moving AWS IoT to independent repository

See merge request idf/esp-idf!4624
2019-04-12 16:06:38 +08:00
0b186bc4e3 Merge branch 'feature/esp_event_loop_examples_wifi' into 'master'
examples/wifi,ethernet,system: use esp_event library for event handling

See merge request idf/esp-idf!3765
2019-04-12 13:55:15 +08:00
0bca9d20d8 Merge branch 'feature/esp_event_loop_library_compat_base' into 'master'
Implement Wi-Fi, Ethernet, IP event handling based on esp_event library

Closes IDF-37 and IDF-267

See merge request idf/esp-idf!3635
2019-04-12 13:54:18 +08:00
1cfa09d4e8 aws_iot: moving AWS IoT to independent repository
Like other cloud frameworks, AWS IoT will also be supported through
independent repository, https://github.com/espressif/esp-aws-iot
2019-04-12 05:36:05 +00:00
f2ce4fc81b Merge branch 'bugfix/enb_secboot_post_flash_enc' into 'master'
Enable secure boot only after encrypting flash

Closes IDF-234

See merge request idf/esp-idf!4709
2019-04-12 13:33:50 +08:00
e259f3eb70 Merge branch 'feature/unit_test_tag_leaks' into 'master'
Add support a [leaks] tag for UT

Closes IDF-143

See merge request idf/esp-idf!4333
2019-04-12 09:31:23 +08:00
5021129e71 Add support a [leaks] tag for UT 2019-04-12 09:31:23 +08:00
9985c33a46 sdio: support SDIO over spi in the example 2019-04-12 02:24:29 +08:00
8a364b4bdf sdmmc: support SDIO over SPI 2019-04-12 02:24:28 +08:00
b576bf25a7 refactor softap power save
1. Softap support multicast and broadcast saving and flushing
    when the associated stations enable IEEE80211 legacy power
    save(which is called modem sleep in ESP32).
    2. Improve the frame saving and flushing mechanism of softap power
    save.
2019-04-11 20:16:58 +08:00
3ec7bec6a7 Merge branch 'doc/review_system_log-index' into 'master'
Review log.rst and index.rst files in api-reference/system

See merge request idf/esp-idf!4738
2019-04-11 15:33:39 +08:00
a01ec59f74 Review log.rst and index.rst files in api-reference/system 2019-04-11 15:33:38 +08:00
a50fc4f015 Final formulation of the sentence in a Command Line chapter 2019-04-11 09:27:52 +03:00
c3324d5645 Added some words about a non-obvious point at the Command Line section 2019-04-11 09:27:51 +03:00
c0df805ded make esp_wifi component depend on CONFIG_NO_BLOBS
If CONFIG_NO_BLOBS is enabled, esp_wifi won't link wifi library.
2019-04-11 14:07:52 +08:00
958c2792e3 move WiFi-specific Kconfig to esp-wifi component
1. separate Kconfig from esp32 component
2. modify component.mk for esp_wifi a little bit to make it depend on IDF_TARGET
2019-04-11 12:33:15 +08:00
b4056560c0 examples/wifi: use esp_event library to handle events 2019-04-11 12:32:03 +08:00
11355c4162 examples/system: use esp_event library to handle events 2019-04-11 12:32:03 +08:00
2a48db0f48 examples/ethernet: use esp_event library to handle events 2019-04-11 12:32:03 +08:00
70eda3d221 Merge branch 'feature/gcc8_use_bundled_newlib' into 'master'
Use newlib headers and libraries from toolchain when compiling with GCC 8.2

See merge request idf/esp-idf!4450
2019-04-11 12:19:29 +08:00
25784ba87a wifi: don’t disable event handling for SoftAP
Events are needed to initialise the tcpip_adapter and start the DHCP server
2019-04-11 12:05:27 +08:00
74cd8dac9d esp_event: don’t warn if no handlers are present for specific event 2019-04-11 12:05:27 +08:00
198d7d4754 tcpip_adapter: unregister shutdown handlers, don’t fail on repeated registration 2019-04-11 12:04:58 +08:00
b1a722b2ca system_api: return error on repeated registration of shutdown handler 2019-04-11 12:04:58 +08:00
bd309a133f system_api: add esp_unregister_shutdown_handler 2019-04-11 12:04:58 +08:00
b94fcb192e event: re-add wifi disconnect reason logging (e621e0af) 2019-04-11 12:04:58 +08:00
6890ea09cd docs: add event handling API guide 2019-04-11 12:04:58 +08:00
a2d59525e5 mdns: use esp_event library to handle events 2019-04-11 12:04:58 +08:00
b1d1e37f87 event loop: re-implement based on esp_event library
Includes ds2ds unit test fix, iperf example test fix
2019-04-11 12:04:58 +08:00
1872e34115 tcpip_adapter: add event declarations 2019-04-11 12:04:58 +08:00
c001553027 ethernet: add event declarations 2019-04-11 12:04:58 +08:00
8b57fe9515 wifi: add event declarations 2019-04-11 12:04:58 +08:00
e37b0ad648 esp_event: move trailing semicolons out of defines 2019-04-11 12:04:58 +08:00
76b39403ad Merge branch 'bugfix/wifi_spike_power' into 'master'
esp32: fix the issue that the spike transmit power of WiFi is higher than configured when WiFi and Bluetooth coexist

See merge request idf/esp-idf!4611
2019-04-11 11:49:26 +08:00
0b59b6069e Merge branch 'feature/post_events_from_isr' into 'master'
Support posting events from ISR

See merge request idf/esp-idf!4283
2019-04-11 09:15:13 +08:00
a567b6c1f6 pthread: Use a definition only if we have the old toolchain 2019-04-10 21:07:10 +07:00
62b0d51c02 Enable secure boot only after encrypting flash
This prevents a device from being bricked in case when both secure boot & flash encryption are enabled and encryption gets interrupted during first boot. After interruption, all partitions on the device need to be reflashed (including the bootloader).

List of changes:
* Secure boot key generation and bootloader digest generation logic, implemented inside function esp_secure_boot_permanently_enable(), has been pulled out into new API esp_secure_boot_generate_digest(). The enabling of R/W protection of secure boot key on EFUSE still happens inside esp_secure_boot_permanently_enable()
* Now esp_secure_boot_permanently_enable() is called only after flash encryption process completes
* esp_secure_boot_generate_digest() is called before flash encryption process starts
2019-04-10 18:17:58 +05:30
9a319772e1 nvs_flash: Multi-page blob erased using nvs_erase_key should be cleaned properly
Earlier eraseItem function in Storage class would do lazy cleanup of
multi-page blobs if called using type "ANY" instead of "BLOB". It used to
just delete BLOB data and index would remain as is. Any subsequent read
would delete index entry as well. This however would return a valid
length without error if nvs_get_blob API was just used for finding
length and not reading the complete blob. This change fixes this issue.

Closes https://github.com/espressif/esp-idf/issues/3255
2019-04-10 11:45:29 +00:00
659f1a1253 esp_event: test posting from interrupt handler 2019-04-10 18:06:05 +08:00
2b914f2d22 esp_event: allow posting events from ISRs 2019-04-10 18:06:05 +08:00
c43a83596b ci: add unit test job 2019-04-10 18:06:05 +08:00
72eb170c4f components/bt: Fix errors caused by rebase 2019-04-10 17:59:23 +08:00
61bd453c15 component/bt: implement AVRCP Target APIs
1. Add more notification events to the enum according to the event list in AVRCP specification.
2. Add API and callback events for basic AVRCP target functionalities to do init, deinit, callback-registration, connection status indication.
3. Implement API to set/get supported PASSTHROUGH command on local AVRCP TG, implement callback events for remote passthrough command indication.
4. Implement API to set/get supported notification eventIDs on local AVRCP TG, implement API to send event notifications to remote CT. \
   Currently supported event in TG only includes ESP_AVRC_RN_VOLUME_CHANGE(0xd), which can be extended in later commits.
5. Implement callback events for SetAbsoluteVolume command indication on TG.
6. Add limitation of event_ids supported in RegisterNotification command in CT. The supported event_ids include: \
   ESP_AVRC_RN_PLAY_STATUS_CHANGE(0x1), ESP_AVRC_RN_TRACK_CHANGE(0x2), ESP_AVRC_RN_PLAY_POS_CHANGE(0x5), ESP_AVRC_RN_VOLUME_CHANGE(0xd).
7. Add feature bit mask in parameter of callback event ESP_AVRC_CT_REMOTE_FEATURES_EVT for peer feature information got from SDP.
8. Add API and callback event to AVRCP CT to retrieve remote TG's supported notification event capabilities.
9. Modify data type for parameter of callback event ESP_AVRC_CT_CHANGE_NOTIFY_EVT.
10. Change AVRCP version from 1.3 to 1.4 for compatibility cause in using AbsoluteVolume feature.
11. Modify local AVRCP device to be category 1 as CT and category 2 as TG that applies to bluetooth headphones or speakers.
12. Update the use of AVRCP APIs and events in the two examples: a2dp_sink and a2dp_gatts_coex, which include the demo of volume control and notification.
2019-04-10 16:34:13 +08:00
a9425cd045 Merge branch 'bugfix/http_client_redirection' into 'master'
Fix url redirection issue

See merge request idf/esp-idf!4623
2019-04-10 14:48:22 +08:00
2e6c8cdce3 esp32: disable -Wframe-address
Since the behavior is well defined on Xtensa with Window ABI we can
suppress a frame-address warning. Also fix the CMAKE_C*_FLAGS parsing.
2019-04-10 13:52:30 +08:00
5719cd6fac newlib: when compiling with GCC8, use newlib headers and libraries from toolchain 2019-04-10 13:52:30 +08:00
05aab5c0b9 newlib: force including IDF locks implementation 2019-04-10 13:52:30 +08:00
898b4bdf4d newlib: when compiling with GCC8, use newlib headers and libraries from toolchain 2019-04-10 13:52:30 +08:00
8c2f2867d8 esp_rom: don’t include locale functions when compiling with newlib 3 2019-04-10 13:52:30 +08:00
e84b26f531 esp_rom: export newlib functions as strong symbols 2019-04-10 13:52:30 +08:00
31b4fc8eb8 pthread: add dummy implementation of pthread_setcancelstate
Used by new versions of newlib in stdio functions.
2019-04-10 13:48:57 +08:00
d15e18aa5d newlib: fixes for compatibility with newlib 3.0 2019-04-10 13:48:57 +08:00
4770acf1cb newlib: add missing tzset() to the time test 2019-04-10 13:48:57 +08:00
5a203a5371 sysview: fix test case for compatibility with new binutils
Since the ‘addr2line’ works correctly in the new version of binutils,
line numbers are different.
2019-04-10 13:48:57 +08:00
7027d2dfe8 spi_master: compile as C11 due to use of stdatomic.h
stdatomic.h is available both in newlib and GCC include directories.
Normally (if you invoke the compiler without any flags) GCC include
directories are first on the list, so GCC’s stdatomic.h is used. In
IDF, we used to pass newlib include path as an extra include
directory, so newlib’s stdint.h got included instead.

Newlib 2.2.0 stdatomic implementation is compatible with -std=gnu99
but incompatible with -std=gnu11. And GCC doesn’t support atomic_load
with -std=gnu99 (it’s a C11 feature). So when we used atomic_load
with -std=gnu99, it worked due to newlib’s header.

Since we are no longer going to be including newlib headers into IDF,
GCC stdatomic will be used instead. Hence, add -std=gnu11 for source
files which use atomic features.
2019-04-10 13:48:57 +08:00
a875505546 Fix url redirection issue.
Operation:
In `esp_http_client_set_url`, we check for if old_host is same as new_host.
Delete and open new connection if host is different.

Issue:
We just pointed `client->connection_info.host` to `old_host` and reassigned it.
This made old_host and new_host always point to same location and hence, using old_host with new request.

Fix:
Made a separate copy for old_host using strdup.

Closes https://github.com/espressif/esp-idf/issues/2631

Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2019-04-10 05:40:16 +00:00
c064e00842 Merge branch 'bugfix/make_bootloader_depends_on_target' into 'master'
make bootloader depend on IDF_TARGET

See merge request idf/esp-idf!4704
2019-04-10 13:07:52 +08:00
62a9eacced newlib: Fix adjtime
Fixed adjtime function: While using the adjtime() function,
the time correction accumulated an error
when reading the time frequently (using gettimeofday).
2019-04-10 04:33:44 +00:00
c580eecf89 esp32_wifi: fix the issue that the spike transmit power of WiFi is higher
than configured when WiFi and Bluetooth coexist
2019-04-10 10:19:55 +08:00
83d2ff07c6 Merge branch 'bugfix/increase_block_scan_timeout_value' into 'master'
esp_wifi: increase block scan timeout value

Closes WIFI-396

See merge request idf/esp-idf!4695
2019-04-09 20:45:21 +08:00
448d32bc53 bugfix(psram): improve spi cs timing settings for psram
1. remove redundant SPI clock settings, use rom functions to set clock.
2. remove redundant SPI cs setup and hold settings.
3. for old 32Mbit psram, cs hold time must only be 0.5T due to the special driving mode.(cs_setup = 0; cs_hold = 0)
4. for new 64Mbit psram, cs hold time is recommended to be 2.5T. (cs_setup = 1, cs_setup_time = 0;cs_hold = 1, cs_hold_time = 1)
2019-04-09 11:24:10 +08:00
2cf4a69f9b Merge branch 'bugfix/ws_transport_crash_on_connect_fail' into 'master'
transport_ws: Stop connecting when the parent's connect call has failed

See merge request idf/esp-idf!4701
2019-04-09 10:19:47 +08:00
911e503a36 Merge branch 'bugfix/prov_fix_conn_id' into 'master'
Unified Provisioning: Miscellaneous fixes in BLE

See merge request idf/esp-idf!4691
2019-04-09 09:28:18 +08:00
005f95e3f3 esp_wifi: increase WiFi block scan timeout value
Increase WiFi block scan internal timeout value.
2019-04-09 09:24:34 +08:00
49d04250e9 Merge branch 'fix/mfg_util_todo_leftback' into 'master'
mfg_util: Remove to-do line leftback

See merge request idf/esp-idf!4707
2019-04-09 09:18:44 +08:00
8e91677701 Merge branch 'bugfix/bootloader_flash_crypt_cnt_ff' into 'master'
flash encryption: reduce FLASH_CRYPT_CNT bit width to 7 bits

See merge request idf/esp-idf!4642
2019-04-09 08:10:06 +08:00
daee3dfa5f Merge branch 'bugfix/wifi_fix_no_tbtt_after_rx_wrong_beacon' into 'master'
esp_wifi: fix the bug that no TBTT will be generated anymore after receiving wrong beacon when WiFi and BT coexist.

Closes IDF-589

See merge request idf/esp-idf!4716
2019-04-08 19:38:23 +08:00
78034879a8 make bootloader depend on IDF_TARGET 2019-04-08 11:08:06 +08:00
5d43ec64bd esp_wifi: fix the bug that no TBTT will be generated anymore after receiving
wrong beacon when WiFi and BT coexist.
2019-04-08 10:36:29 +08:00
a717825b7e Unified Provisioning: Miscellaneous fixes in BLE
1. Pass the correct conn_id to protocomm_req_handle
In transport_simple_ble_write(), passing param->exec_write.conn_id would
be invalid. Instead param->write.conn_id should be passed
Similar change in transport_simple_ble_exec_write() to use
param->exec_write.conn_id

2. simple_ble_start() assumes that the mode is BLE only and enables
Bluetooth controller accordingly. For, cases having BT + BLE like Alexa
(Provisioning over BLE + Audio over classic BT), this assumption should
be removed.
2019-04-05 14:27:24 +05:30
041c784ff8 Merge branch 'feature/common_fragment_grammar' into 'master'
ldgen: Common fragment grammar

See merge request idf/esp-idf!4576
2019-04-05 07:19:22 +08:00
16ee5663ad transport_ws: Stop connecting when the parent's connect call has failed
Merges https://github.com/espressif/esp-idf/pull/3164
2019-04-04 16:14:42 +02:00
791209d0eb Merge branch 'bugfix/coex_bt_disconn' into 'master'
components/coex: Fix BT disconnecting due to too many reset BB

See merge request idf/esp-idf!4675
2019-04-04 20:53:04 +08:00
6e4a89ffce component/bt: fix memory leak when settig tx power 2019-04-04 19:49:23 +08:00
3ab9d00219 Merge branch 'bugfix/btdm_fix_warning_when_disable_logs' into 'master'
components/bt: Fix warning when disable debug logs or in release mode and improve the code structure

See merge request idf/esp-idf!4618
2019-04-04 18:45:25 +08:00
e7f85f1987 Merge branch 'bugfix/btdm_disconn_with_apple_device' into 'master'
components/bt: Fix disconnect with apple device

See merge request idf/esp-idf!4665
2019-04-04 18:44:53 +08:00
c81ebbf38e ldgen: add backward-compatibility with previous mapping fragment style 2019-04-04 16:33:56 +08:00
94bc240a5e docs: update linker script generation docs 2019-04-04 16:33:56 +08:00
3996316524 mfg_util: Remove todo line leftback 2019-04-04 13:59:52 +05:30
90ee405afd ldgen: update component linker fragment files 2019-04-04 15:57:34 +08:00
7900178b7c ldgen: update tests for common fragment parsing 2019-04-04 15:56:46 +08:00
7dcef2c33c ldgen: implement common fragment parsing 2019-04-04 15:56:14 +08:00
e349329d86 Merge branch 'doc/fix-an-important-typo-in-Getting-Started-Guide' into 'master'
Fixed a typo that cannot wait

See merge request idf/esp-idf!4685
2019-04-04 15:40:56 +08:00
34e89c46de Merge branch 'update/mfg_util' into 'master'
mfg_util: Add changes to mfg_util as per changes in nvs_util

See merge request idf/esp-idf!3573
2019-04-04 14:40:33 +08:00
63261ec2d7 Merge branch 'bugfix/httpd_accept_conn' into 'master'
esp_http_server : Only accept new connections if server has capacity to handle more

Closes IDFGH-749

See merge request idf/esp-idf!4655
2019-04-04 14:26:49 +08:00
5136b76798 Merge branch 'feature/micro-ecc-only-in-bootloader' into 'master'
Use micro_ecc library only in bootloader

See merge request idf/esp-idf!4082
2019-04-04 14:26:48 +08:00
d6394818b0 Merge branch 'feature/misc_adjustment_of_esp32' into 'master'
misc adjustment of esp32 component

Closes IDF-36

See merge request idf/esp-idf!4627
2019-04-04 11:16:46 +08:00
203af5c0a5 Merge branch 'bugfix/soc_register_struct_names' into 'master'
soc:Added names to anonymous register structs

See merge request idf/esp-idf!4668
2019-04-04 07:42:24 +08:00
9542063236 esp_http_server : Test added to check limit on max_open_sockets config option 2019-04-03 13:34:12 +00:00
7e676c1055 esp_http_server : Only accept new connections if server has capacity to handle more
This fix prevents HTTP server from accepting new connections when the total count of connected
sockets has reached the max_open_sockets limit set during configuration. The pending connections
are kept in backlog until atleast one of the connected sockets is closed. The maximum number of
connection requests that can kept in backlog is specified as backlog_conn configuration option.
Note that this modification has no effect when LRU purge is enabled.

Also added sanity check on setting for max_open_sockets during configuration.

Solution suggested by jimparis https://github.com/espressif/esp-idf/issues/3183#issue-421234265

Closes https://github.com/espressif/esp-idf/issues/3183
2019-04-03 13:34:12 +00:00
88efcdbe35 components/coex: Fix BT disconnecting due to too many reset BB
Update coex version to 1.1.6
2019-04-03 20:42:03 +08:00
f5b03c9ea3 misc adjustment of esp32 component 2019-04-03 19:57:46 +08:00
1cee7d4746 Fix a very important typo that cannot wait 2019-04-03 18:34:34 +08:00
a332bca0c7 components/bt: Fix disconnect with apple device
1. Fix disconnect with apple device
    2. Fix hci_refresh_enc_key_cmd will be ignored
    3. Fix hci_refresh_enc_key_cmd will crash

    Closes https://github.com/espressif/esp-idf/issues/3140
2019-04-03 17:22:01 +08:00
a88b40483d mfg_util: Add changes to mfg_util as per changes in nvs_util
revert changeson this file

Update README for mfg util

Update to correct coding style of script
2019-04-03 11:31:49 +05:30
30e3e26834 Merge branch 'feature/support_comments_in_csv' into 'master'
nvs_util: Add support to include comments in csv file

See merge request idf/esp-idf!4656
2019-04-03 11:12:51 +08:00
4aac441e46 soc:Added names to anonymous register structs
For typedef volatile struct in components/soc/esp32/include/soc

Merges https://github.com/espressif/esp-idf/pull/3199
2019-04-03 03:09:44 +00:00
4b4cd7fb51 efuse/flash encryption: Reduce FLASH_CRYPT_CNT to a 7 bit efuse field
8th bit is not used by hardware.

As reported https://esp32.com/viewtopic.php?f=2&t=7800&p=40895#p40894
2019-04-03 14:07:20 +11:00
dd6e8db7ec Merge branch 'doc/translate_404_page' into 'master'
Add translation for 404 page

See merge request idf/esp-idf!4635
2019-04-02 17:49:43 +08:00
53daf930c3 Merge branch 'bugfix/fix_some_sta_certification_issues' into 'master'
esp32: fix some STA certification issues

Closes WIFI-295, WIFI-299, WIFI-305, WIFI-306, WIFI-358, WIFI-367, and WIFI-368

See merge request idf/esp-idf!4434
2019-04-02 14:32:26 +08:00
3af14a065d Merge branch 'bugfix/undefined_partition_table_bin_warning' into 'master'
make: fix undefined variables warning for PARTITION_TABLE_BIN

Closes IDFGH-685

See merge request idf/esp-idf!4633
2019-04-02 11:49:58 +08:00
43d3e75125 Merge branch 'feature/derive_esp_wifi_from_esp32' into 'master'
derive esp_wifi from esp32 component

See merge request idf/esp-idf!4602
2019-04-02 10:13:15 +08:00
ae585b6615 Merge branch 'bugfix/external_rtc_start_fail' into 'master'
Bugfix/external rtc start fail

See merge request idf/esp-idf!4374
2019-04-02 09:42:27 +08:00
fd91818074 Merge branch 'feature/sysview_heap_tracing' into 'master'
SystemView based heap and log tracing

See merge request idf/esp-idf!3952
2019-04-02 09:07:55 +08:00
3914f17d26 apptrace: Adds test for logtrace_proc script 2019-04-01 19:31:45 +03:00
296c9549a4 sys_view: Adds heap & log tracing example 2019-04-01 19:31:45 +03:00
d2db2ef03c docs: Adds host-based heap tracing description 2019-04-01 19:31:45 +03:00
8c6a924cdf sys_view: Adds processing scripts for heap & log traces 2019-04-01 19:31:45 +03:00
5ef3a64c00 sys_view: Adds heap tracing API 2019-04-01 19:31:27 +03:00
2f8b6cfc77 Merge branch 'feature/btdm_add_mesh_adv_type_and_srv_uuid_for_dup_scan_except' into 'master'
Component/bt: add mesh beacon adv and svc uuid for duplicate scan exceptional list

See merge request idf/esp-idf!4592
2019-04-01 21:49:18 +08:00
b82872102e esp32: fix some STA certification issues
Fix following STA WFA certification issues:
1. STA HT2040 coexist
2. Disallow WEP/TKIP with HT rates
3. WPA2 improvement
4. Minor refactor for WiFi internal global variable auth_type
2019-04-01 21:39:47 +08:00
335576013e heap: Separate standalone and common part of tracing module 2019-04-01 15:56:15 +03:00
2d52ac48f9 apptrace: Adds checks for user arguments in apptrace API 2019-04-01 15:56:14 +03:00
c0f37a324e apptrace: Fixes tracing xQueueGiveFromISR 2019-04-01 15:56:13 +03:00
d52ecb71d6 Merge branch 'feature/spiffs_image_generator' into 'master'
SPIFFS Image Generator

See merge request idf/esp-idf!4156
2019-04-01 20:08:40 +08:00
79bb5de426 derive esp_wifi from esp32 component 2019-04-01 20:04:52 +08:00
66e38e9bac nvs_util: Add support to include comments in csv file
Closes https://github.com/espressif/esp-idf/issues/2965
2019-04-01 16:52:43 +05:30
fd28549dfa ci: Fix the cleaning stale submodule script to support difference in sub-pathes 2019-04-01 15:47:01 +05:30
816fe38f3a app_update: remove redundant (additional) check for signature verification
Call `esp_image_verify` takes care of validating image signature.
2019-04-01 15:47:01 +05:30
fcff80ecf8 fix cmake build for bootloader 2019-04-01 15:47:01 +05:30
202f689baa bootloader: use mbedTLS for secure boot verification in firmware 2019-04-01 15:46:52 +05:30
369e170ebc micro-ecc: move into booloader directory 2019-04-01 15:45:26 +05:30
5b2247df2d Merge branch 'bugfix/increase_block_scan_time' into 'master'
wifi: increase the block scan time

Closes WIFI-378 and WIFI-379

See merge request idf/esp-idf!4645
2019-04-01 17:24:04 +08:00
8914f6f9cd Merge branch 'bugfix/http_server_lf_term_hdr' into 'master'
HTTP Server : Fix for tolerating LF terminated headers

Closes IDFGH-748

See merge request idf/esp-idf!4588
2019-04-01 13:25:24 +08:00
b13ceaf468 wifi: increase the block scan time because of changing channel will take at 30nm when BT/WiFi coexist 2019-04-01 03:12:20 +00:00
7cbd863d04 Merge branch 'bugfix/coap_gcc8_format_error' into 'master'
coap: fix format error with GCC 8, define WITH_POSIX in the port header

See merge request idf/esp-idf!4639
2019-03-29 23:50:52 +08:00
005c5196e9 Merge branch 'doc/review_get_st_wrover_kit_rm' into 'master'
Delete a file which accidentally ended up in the idf's root derictory. Its…

See merge request idf/esp-idf!4632
2019-03-29 01:52:43 +08:00
e2ce0860f6 Updated 404 page not found pages, both Chinese and English versions. 2019-03-28 19:06:43 +08:00
af2fc96ee1 spi_master: refactor and add HAL support 2019-03-28 17:14:50 +08:00
624725d6e0 coap: define WITH_POSIX in coap_config.h instead of globally 2019-03-28 16:29:13 +08:00
8016448fb1 coap: silence format truncation warning (appears with GCC 8) 2019-03-28 16:28:25 +08:00
76da10a665 Merge branch 'docs/translate-getting-started-guides-devkitc2' into 'master'
Add translation for Devkitc guides and index files

See merge request idf/esp-idf!4522
2019-03-28 15:34:17 +08:00
6fcfdd3d6a Merge branch 'update/nvs_partition_util' into 'master'
Update for creation of unique filename for encryption keys

See merge request idf/esp-idf!3808
2019-03-28 15:07:44 +08:00
0acc2f59e5 Component/bt: add mesh beacon adv and svc uuid for duplicate scan exceptional list 2019-03-28 06:09:19 +00:00
85fb54a501 Merge branch 'feature/separate_xtensa_from_esp32' into 'master'
separate xtensa from esp32

See merge request idf/esp-idf!4625
2019-03-28 14:04:03 +08:00
cd8c42600c nvs_util: Add support for creation of unique encryption keys 2019-03-28 05:06:12 +00:00
1db51e18b9 Merge branch 'bugfix/restore_deleted_factory_offset' into 'master'
partition_table: restore needed factory offset variable

See merge request idf/esp-idf!4601
2019-03-28 12:03:27 +08:00
957301f293 add translation for devkitc guides and index files 2019-03-27 17:41:36 +00:00
f14d61966d Merge branch 'feature/docs_provide_404_page' into 'master'
docs: Introduced custom 404 page in readthedocs documentation to replace…

See merge request idf/esp-idf!4541
2019-03-28 01:38:31 +08:00
cb87e786a5 docs: Introduced custom 404 page in readthedocs documentation to replace… 2019-03-28 01:38:31 +08:00
7112b9492e make: fix undefined variables warning for PARTITION_TABLE_BIN
Closes https://github.com/espressif/esp-idf/issues/3136
2019-03-27 21:02:55 +08:00
dbdb299bb1 create xtensa component
1. move xtensa specific files out of esp32 component
2. merge xtensa-debug-module component into xtensa
2019-03-27 20:24:28 +08:00
da90966828 Merge branch 'feature/mqtt_weekend_tests' into 'master'
introducing weekend tests for mqtt and fuzzer test (mdns, LWIP)

Closes IDF-540

See merge request idf/esp-idf!4230
2019-03-27 19:12:33 +08:00
ade05b4802 Delete a file which accidentally ended up in the idf's root derictory. Its original copy is safe and sound where it should be and is up to date. 2019-03-27 18:09:13 +08:00
18946a5421 Merge branch 'feature/common_parts_into_esp_common' into 'master'
move common include files from esp32 into esp_common

See merge request idf/esp-idf!4515
2019-03-27 17:00:58 +08:00
21f6b4d6c3 Merge branch 'bugfix/modify_wifi_reason_code' into 'master'
wifi: modify wifi reason code

Closes WIFI-268 and WIFI-388

See merge request idf/esp-idf!4604
2019-03-27 16:50:35 +08:00
fe793eb574 Merge branch 'bugfix/btdm_modify_HCI_GET_CMD_BUF' into 'master'
Component/bt: modify HCI_GET_CMD_BUF

See merge request idf/esp-idf!4465
2019-03-27 14:23:52 +08:00
fc6b413667 Merge branch 'bugfix/btdm_add_new_param_for_update_whitelist_api' into 'master'
Component/bt: add new param for update_whitelist API

See merge request idf/esp-idf!4493
2019-03-27 14:23:12 +08:00
db95996453 docs: Add documentation for spiffsgen 2019-03-27 09:09:47 +08:00
09d7383180 example: Add SPIFFS image generation from build system example 2019-03-27 09:09:47 +08:00
a1218478a1 Merge branch 'feature/move_hwcrypto_to_mbedtls' into 'master'
move hwcrypto from esp32 to mbedtls

See merge request idf/esp-idf!4610
2019-03-27 09:07:52 +08:00
94bd4e0a26 HTTP Server : Added example tests for verifying parser behavior on arbitrary HTTP terminations (LF, CRLF, etc.) 2019-03-26 14:21:40 +05:30
990af312d1 HTTP Server : Fix for tolerating LF terminated headers
List of changes:
* When parsing requests, count termination from LF characters only
* Correct memcpy() length parameter in httpd_unrecv() (pointed out by jimparis in GitHub issue thread)
* Use ssize_t to store results of length subtractions during parsing
* Modify some comments to reduce ambiguity

Closes https://github.com/espressif/esp-idf/issues/3182
2019-03-26 14:21:40 +05:30
709a320f33 move hwcrypto from esp32 to mbedtls 2019-03-26 16:24:22 +08:00
e2ed49cdc3 Merge branch 'doc/review_get_st_wrover_kit' into 'master'
Doc/review get st wrover kit

See merge request idf/esp-idf!4579
2019-03-26 16:12:42 +08:00
a1c39e4a53 Doc/review get st wrover kit 2019-03-26 16:12:42 +08:00
54c6bf0b9b Merge branch 'doc/review_get_st_pico' into 'master'
Doc/review get st pico

See merge request idf/esp-idf!4603
2019-03-26 16:11:11 +08:00
bae824439e Doc/review get st pico 2019-03-26 16:11:11 +08:00
59d77660ef components/bt: Fix warning when disable debug logs or in release mode and improve the code structure 2019-03-26 14:37:37 +08:00
a2f07b0806 move common include files from esp32 into esp_common 2019-03-26 11:57:03 +08:00
9f3b550ff4 Merge branch 'bugfix/from_github' into 'master'
Bugfixes from GitHub

See merge request idf/esp-idf!4607
2019-03-26 11:17:46 +08:00
ebe7190f01 wifi: modify wifi reason code 2019-03-26 11:16:47 +08:00
4d9c3a262d cmake,make: Support SPIFFS image generation from build systems 2019-03-25 12:51:52 +08:00
ca06f73a51 spiffs: Add host test for generated spiffs image 2019-03-25 12:51:52 +08:00
8ba10bf3dc spiffs: Implement spiffs image generation 2019-03-25 12:51:52 +08:00
eb5abca23d nvs_flash: Fix typo in README.rst
Merges https://github.com/espressif/esp-idf/pull/3216

This should read "except for the new key-value pair" instead of
"expect for the new key-value pair".

Signed-off-by: Tim Nordell <tim.nordell@nimbelink.com>
2019-03-24 19:56:10 +01:00
955aa2e4e0 Update README.md
Merges https://github.com/espressif/esp-idf/pull/3104
2019-03-24 19:54:00 +01:00
Dan
eb83924e95 Fix math: 8192 = 2 ** 13
Merges https://github.com/espressif/esp-idf/pull/3133
2019-03-24 19:54:00 +01:00
3a4354c770 ci: fix cmake example build fail 2019-03-24 16:51:48 +08:00
2df9fb057d VFS: Allocate socket select semaphore outside ISR 2019-03-22 13:47:32 +00:00
c0bdea6aae Component/bt: add new param for update_whitelist() 2019-03-22 12:22:51 +00:00
bc60bbbeaf fuzzer tests: update of mdns and lwip host compilation for fuzzer testing
Closes IDF-540
2019-03-22 11:37:26 +01:00
997883be1e ci: assign fuzzer tests to be executed as weekend tests 2019-03-22 11:37:26 +01:00
5141e0ec24 tcp_transport: ws fix on reception of longer data than receive buffer 2019-03-22 11:37:26 +01:00
f05228be36 tiny-test-fw: update sdkconfig python dictionary to contain values without trailing newlines 2019-03-22 11:37:26 +01:00
1465f53f49 mqtt tests: adding weekend test for mqtt library to exercise publishing/receiving different data and references esp-mqtt commits to pass these tests
testing conditions:
transports (tcp, ssl, ws..)
qos (0, 1, 2)
short repeated messages (packed packets)
oversized messages (fragmented packets)
publish from a different thread

Closes https://github.com/espressif/esp-idf/issues/2870 by means of including commit 815623dfe5a0e41fa0e51ab4e336feb3eaa5ba15 from esp-mqtt
Closes https://github.com/espressif/esp-idf/issues/2975 by means of including commit 752953dc3be007cca4255b66a35d3087e61f6a54 from esp-mqtt
Closes https://github.com/espressif/esp-idf/issues/2850 by means of including commits df455d2a5fe562dd1b8351da99a1d6d82b66eff3 17fd713bced4f2d00df7ed664ed82a7d108ab317 from esp-mqtt
2019-03-22 11:37:26 +01:00
7e93d4986c partition_table: restore needed factory offset variable 2019-03-22 15:24:23 +08:00
69b58f1e9c Merge branch 'bugfix/tinydtls_mirror' into 'master'
ci: add mirror for tinydtls submodule

See merge request idf/esp-idf!4597
2019-03-22 15:22:14 +08:00
24bd5f3267 ci: add mirror for tinydtls submodule 2019-03-22 14:27:08 +08:00
c2d1f83bce Merge branch 'mesh/decouple_addition' into 'master'
wifi: decouple mesh functions from net80211

See merge request idf/esp-idf!4393
2019-03-22 12:57:03 +08:00
1be147c457 Merge branch 'feature/allow_components_to_declare_images_to_flash' into 'master'
Allow components to present their own images to flash

See merge request idf/esp-idf!4148
2019-03-22 11:14:37 +08:00
426bb08552 Merge branch 'feature/move_common_src_to_esp_common' into 'master'
move common source files from esp32 to esp_common

See merge request idf/esp-idf!4589
2019-03-22 11:12:05 +08:00
fcedf442ce move common source files from esp32 to esp_common 2019-03-22 10:35:03 +08:00
80dd3ae749 Merge branch 'bugfix/cmake_component_path' into 'master'
cmake: Set COMPONENT_PATH during early expansion of dependencies

Closes IDFGH-787

See merge request idf/esp-idf!4557
2019-03-22 07:13:11 +08:00
940a1f6e79 Merge branch 'feature/separate_rom_from_esp32' into 'master'
separate rom from esp32 component to esp_rom

Closes IDF-542

See merge request idf/esp-idf!4500
2019-03-21 22:10:45 +08:00
3a779380a7 Merge branch 'feature/semihost_vfs' into 'master'
Adds semihosting VFS driver

Closes IDF-367

See merge request idf/esp-idf!4145
2019-03-21 22:03:06 +08:00
58314feff9 Merge branch 'feature/http_server_pinned_to_core_support' into 'master'
HTTP Server: Added ability to select core

See merge request idf/esp-idf!4586
2019-03-21 19:19:13 +08:00
ffa8bed7c8 Merge branch 'bugfix/nvs_util_write_single_page_big_blob_data' into 'master'
nvs_util: Fix to support write operation of multiple single page big blob data

See merge request idf/esp-idf!4268
2019-03-21 19:10:29 +08:00
eee89118d9 Merge branch 'feature/idf_monitor_save_log' into 'master'
tools: Create log files from IDF Monitor

Closes IDF-364

See merge request idf/esp-idf!4414
2019-03-21 19:06:31 +08:00
bf5e3de955 Merge branch 'doc/app_trace_zh_CN' into 'master'
zh_CN translation of app_trace

See merge request idf/esp-idf!4087
2019-03-21 18:58:32 +08:00
c159984264 separate rom from esp32 component to esp_rom
1. separate rom include files and linkscript to esp_rom
2. modefiy "include rom/xxx.h" to "include esp32/rom/xxx.h"
3. Forward compatible
4. update mqtt
2019-03-21 18:51:45 +08:00
4fc548112e Merge branch 'bugfix/ldgen_type_1_fails_on_windows' into 'master'
Fix library path parsing in windows

Closes IDFGH-733

See merge request idf/esp-idf!4516
2019-03-21 18:38:51 +08:00
33d555dbdd Merge branch 'doc/http_server_zh_CN' into 'master'
zh_CN translation of HTTP Server API reference

See merge request idf/esp-idf!4548
2019-03-21 18:37:15 +08:00
77e7af4e90 Merge branch 'feature/update_libcoap_4.2.0' into 'master'
Update component/coap to libcoap version release-4.2.0

See merge request idf/esp-idf!4499
2019-03-21 18:35:20 +08:00
106dc05903 Merge branch 'feature/specify_includes_belonging_esp32' into 'master'
move esp32 chip specific includes to esp32/xxx.h

See merge request idf/esp-idf!4534
2019-03-21 18:34:08 +08:00
57e1b5dad8 Merge branch 'bugfix/newlib_fcntl_r_signature' into 'master'
vfs: change fcntl argument to int (instead of va_list), add weak fcntl

See merge request idf/esp-idf!4549
2019-03-21 18:30:34 +08:00
ce07a1057c Merge branch 'feature/make-debug-verbose-usable' into 'master'
logs: Make verbose and debug logging cleaner

Closes IDFGH-782

See merge request idf/esp-idf!4578
2019-03-21 18:29:50 +08:00
743fa44544 Merge branch 'bugfix/esp_debug_includes' into 'master'
mbedtls: Fix esp_debug not including its dependencies

See merge request idf/esp-idf!4581
2019-03-21 18:28:39 +08:00
47b5c5bc90 Merge branch 'bugfix/fixes_from_github' into 'master'
Fixes from Github

See merge request idf/esp-idf!4510
2019-03-21 18:27:53 +08:00
efcd10ea31 Fix missing declaration of __bswap64 in endian.h
Merges https://github.com/espressif/esp-idf/pull/2983
2019-03-21 15:08:11 +08:00
fc880e2429 Fixed a small spelling mistake
Merges https://github.com/espressif/esp-idf/pull/3089
2019-03-21 15:08:11 +08:00
36c73e6d70 Easier use of -Wsign-conversion warnings needs changes.
Merges https://github.com/espressif/esp-idf/pull/3129
2019-03-21 15:08:04 +08:00
e5e41e0a5e Fix comment typos in WiFi types header
Merges https://github.com/espressif/esp-idf/pull/3145
2019-03-21 15:06:24 +08:00
85653acfb4 check-lxdialog.sh: Support libintl on FreeBSD
To unbreak "make menuconfig."

Merges https://github.com/espressif/esp-idf/pull/3168
2019-03-21 15:06:24 +08:00
e24ac7a346 Add another auto-generated file to .gitignore.
* Update tools/kconfig/.gitignore for auto-generated file *.o.

Merges https://github.com/espressif/esp-idf/pull/3073
2019-03-21 15:06:24 +08:00
6f5f40dae4 updated buffer size too small for popular carrier in India Airtel -> airtelgprs.com
Merges https://github.com/espressif/esp-idf/pull/3010
2019-03-21 15:06:24 +08:00
178c9d15de Fix comments in ULP MOVE instruction examples
Merges https://github.com/espressif/esp-idf/pull/2992
2019-03-21 15:06:24 +08:00
d43e3e7fc6 Merge branch 'feature/ci_use_custom_toolchain' into 'master'
ci: Add an ability to use custom toolchain for testing

See merge request idf/esp-idf!4561
2019-03-21 14:51:12 +08:00
13cf867023 logs: Make verbose and debug logging cleaner
* Closes #3193
* Closes IDFGH-782

The logs that are deleted in this commit make debug and verbose mode
unusable.
2019-03-21 11:54:04 +05:30
25043c4d56 Merge branch 'feature/merge_flash_data_type-flash_partitions' into 'master'
merge esp_flash_data_types into esp_flash_partitions

See merge request idf/esp-idf!4504
2019-03-21 13:40:40 +08:00
6d4a7b1a7e Merge branch 'bugfix/cmake_soc_test' into 'master'
soc: fix compiling unit tests with CMake

Closes IDF-499

See merge request idf/esp-idf!4545
2019-03-21 13:34:58 +08:00
7f1047847a HTTP Server: Added ability to select core
The task that runs the HTTP server can now be pinned to a particular core by setting `core_id`
in the HTTP server configuration.  By default, the core is set to `tskNO_AFFINITY`, meaning
it can run on any core.

Merges https://github.com/espressif/esp-idf/pull/3190
2019-03-21 11:22:58 +08:00
7cec2e8342 ci: Add an ability to use custom toolchain for testing 2019-03-21 09:50:26 +07:00
c1e5e19d0b Merge branch 'bugfix/heap_caps_int_overflows' into 'master'
heap: Add integer overflow checks on MALLOC_CAP_32BIT & MALLOC_CAP_EXEC

See merge request idf/esp-idf!4451
2019-03-21 09:47:38 +08:00
112c54e043 Merge branch 'doc/ota_readme_cert_cn' into 'master'
ota example: Mention the certificate needs CN set correctly

See merge request idf/esp-idf!4441
2019-03-21 09:26:12 +08:00
b7ee11231d mbedtls: Fix esp_debug not including its dependencies
As reported on forum: https://esp32.com/viewtopic.php?f=13&t=9782&p=40464#p40464
2019-03-21 10:48:55 +11:00
2994d25f27 Merge branch 'bugfix/sphinx_build_failure_on_rtd' into 'master'
docs: Upgraded sphinx package version to prevent build failures on readthedocs…

See merge request idf/esp-idf!4552
2019-03-21 02:14:36 +08:00
bd103f3743 Merge branch 'feature/btdm_add_api_to_clean_gattc_cache' into 'master'
Component/bt: add api to clean gattc cache

See merge request idf/esp-idf!3951
2019-03-20 22:05:00 +08:00
c1600f28d1 Merge branch 'bugfix/btdm_fix_no_adv_report_when_scaning_with_sleep_enable' into 'master'
Component/bt: fix no adv report when scanning with sleep enable

See merge request idf/esp-idf!4535
2019-03-20 21:36:23 +08:00
c5fb88c2e2 Merge branch 'bugfix/btdm_fix_build_warning_when_bluedroid_disable_log' into 'master'
Component/bt: fix build warning when bluedroid disable log

See merge request idf/esp-idf!4524
2019-03-20 21:09:59 +08:00
7f606d0c2b Component/bt: modify HCI_GET_CMD_BUF 2019-03-20 19:35:06 +08:00
95301c16bd Fix external start fail 2019-03-20 18:34:01 +08:00
5ba87240b5 soc/rtc: Bypass touchpad current to external 32k crystal oscillator 2019-03-20 18:34:01 +08:00
b5ac319160 vfs: Adds example for semihosting VFS driver 2019-03-20 12:52:52 +03:00
9efd7d3d34 zh_CN translation of HTTP Server API reference 2019-03-20 16:45:16 +08:00
60b5cdde20 nvs_util: Fix to support write of multiple singlepage big blob data
Closes https://github.com/espressif/esp-idf/issues/3011
2019-03-20 08:15:36 +00:00
b2b0f75fbb Decouple Wifi and ESP-Mesh to reduce bin size
Do not link mesh code when mesh is not used
2019-03-20 15:17:03 +08:00
d31a137f9c Merge branch 'bugfix/mesh_memory_leak' into 'master'
mesh: fix memory leak and group send

See merge request idf/esp-idf!4438
2019-03-20 14:57:05 +08:00
34d118d445 Merge branch 'feature/optimized_gpio_intr_service' into 'master'
driver: Add optimization by speed in ISR functions for gpio, rmt, pcnt

Closes IDF-328

See merge request idf/esp-idf!4241
2019-03-20 14:19:17 +08:00
dc5ff1d633 Merge branch 'bugfix/btdm_fix_blufi_prepare_write_crash' into 'master'
Component/bt: fix blufi prepare write crash

See merge request idf/esp-idf!4447
2019-03-20 11:46:15 +08:00
886d8a6f28 Merge branch 'bugfix/newlib_misc_cleanups' into 'master'
newlib: minor cleanup

See merge request idf/esp-idf!4550
2019-03-20 11:08:20 +08:00
fe92829971 Merge branch 'feature/separate_eventloop_from_esp32' into 'master'
separate legacy esp_event from esp32 component to esp_event

See merge request idf/esp-idf!4539
2019-03-20 09:59:17 +08:00
abdc9f50d8 cmake: Set COMPONENT_PATH during early expansion of dependencies
Works around bug where components/soc/CMakeLists.txt was testing "EXISTS
${COMPONENT_PATH}/${SOC_NAME}" and this test could pass during early
expansion if COMPONENT_PATH was empty and a directory /esp32 exists
on Windows.

Closes https://github.com/espressif/esp-idf/issues/3195
2019-03-20 10:45:45 +11:00
b7b5c3a8c7 Merge branch 'bugfix/error_in_bootloader_loadprohibited' into 'master'
esp_tool: Exclude elf-sha256 from bootloader

Closes IDFGH-690

See merge request idf/esp-idf!4520
2019-03-20 07:28:09 +08:00
57b2d5ae56 docs: Upgraded sphinx package version to prevent build failures on readthedocs site. Upgraded versions of other packages that are used during documentation build. 2019-03-19 17:04:58 +01:00
1d0bffb20a lwip, wpa_supplicant: use endianness macros from libc if possible 2019-03-19 22:15:32 +08:00
068b700786 newlib: remove usage of pre-ANSI defines 2019-03-19 22:15:26 +08:00
ac612b5422 newlib: enable timeradd, timersub, and similar macros
This uses a hack (temporarily defining __rtems__ from a wrapper header
file) to include timeradd, timersub, and similar macros, without
modifying newlib headers.
2019-03-19 22:15:12 +08:00
76d4b0150d Revert "feat(time): enable the macro timeradd, timersub, timerclear, etc."
This reverts commit 8f994b9dce.
2019-03-19 22:15:06 +08:00
48b1433772 vfs: change fcntl argument to int (instead of va_list), add weak fcntl 2019-03-19 21:44:17 +08:00
060cf9d6b4 Merge branch 'power_management/i2s+i2c' into 'master'
Power management/i2s+i2c

See merge request idf/esp-idf!4338
2019-03-19 17:27:59 +08:00
9a5fc6228b Merge branch 'bugfix/fix_minor_make_build_system_issue' into 'master'
make: use `shell` command to extract version string

See merge request idf/esp-idf!4526
2019-03-19 17:24:30 +08:00
f19ecbbbfa Merge branch 'test/detect_exception_in_idf_dut' into 'master'
tiny-test-fw: support detect exception in IDFDUT

See merge request idf/esp-idf!4527
2019-03-19 17:23:55 +08:00
0514a65cc9 esptool: Only insert SHA256 if overwriting zero data 2019-03-19 13:29:07 +08:00
98db4d2eb6 esp_tool: Exclude elf-sha256 from bootloader
Closes: IDFGH-690
2019-03-19 12:54:25 +08:00
73851e0b5c soc: fix compiling unit tests with CMake
soc unit tests have not been included when compiling with CMake,
because ../${SOC_NAME}/test was not evaluated relative to the
CMakeLists.txt directory.

Also call register_components() regardless of the presence of test
directory for particular target.
2019-03-19 11:42:51 +08:00
0a3975e80d test: handle exception by unit test script:
unit test script will detect exception, we don't need to let test fail
when exception happened.
2019-03-19 11:24:08 +08:00
b85e9e5cda tiny-test-fw: support translate backtrace in IDFDUT 2019-03-19 11:24:08 +08:00
f11eba7802 tiny-test-fw: support detect exception in IDFDUT 2019-03-19 11:24:08 +08:00
8fbb63c2a7 Merge branch 'bugfix/i2c_driver_release_opt' into 'master'
driver/i2c: write i2c command structure to hardware in one operation

See merge request idf/esp-idf!4538
2019-03-19 10:59:21 +08:00
2a419fa599 tools: Create log files from IDF Monitor 2019-03-18 19:33:20 +01:00
ab4b57e03d example:coap_server: Change app task stack size 2019-03-18 12:33:52 +00:00
fecd7a16d4 example:coap_client: Change app task stack size 2019-03-18 12:33:52 +00:00
bc9d1a65d7 Update component/coap to libcoap version release-4.2.0
This takes the code up to the latest released version of libcoap.

As there have been API changes, coap_client and coap_server in
examples/protocols have been updated to use the new APIs.

Further information on the new libcoap APIs can be found at
https://libcoap.net/doc/reference/4.2.0/

coap_client has been updated to handle BLOCK2 responses from
"coap://californium.eclipse.org"
coap_client has been modified to only send out one request (and wait for
the response)

coap_server has been updated to support Observe subscriptions, and well as
adding in PUT and DELETE handlers to work on the Espressif resource

coap_server and coap_client have had their stack sizes increased.

port/coap_io.c has been added, a copy of libcoap/src/coap_io.c with support
added for systems that do not have RFC 3542 section 20 support.

port/coap_io_socket.c has been removed as a lot of the code is now
replicated in different libcoap files.

Once this PR is place, then adding in DTLS will be a lot simpler (as a
separate PR)

Signed-off-by: Jitin George <jitin@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/3148
2019-03-18 12:33:52 +00:00
fd9bc30aca separate legacy esp_event from esp32 component to esp_event 2019-03-18 19:58:04 +08:00
f0a82d7185 driver/i2c: write i2c command structure to hardware in one operation
GCC compiler can generate 8-bit stores when modifying bitfields of
volatile structs (https://github.com/espressif/esp-idf/issues/597).
In the specific case of I2C driver, this resulted in byte_num field
to be written using s8i. However the peripheral requires 32-bit
writes, and ignores 8-bit writes. This change modifies the code to
compose the 32-bit command register value first, and then write the
complete value to the hardware.
2019-03-18 18:23:50 +08:00
96aa08a0ff Merge branch 'bugfix/coredump_fixes' into 'master'
espcoredump fixes for GCC 8.2

See merge request idf/esp-idf!4528
2019-03-18 18:23:25 +08:00
956c25dedd move esp32 chip specific includes to esp32/xxx.h 2019-03-18 17:14:05 +08:00
fae39dc326 merge esp_flash_data_types into esp_flash_partitions 2019-03-18 08:51:55 +00:00
a628577f64 Component/bt: fix no adv report when scaning with sleep enable 2019-03-18 16:35:50 +08:00
4de5ae7468 PM: I2S and I2C added in the Power Management docs
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-03-18 08:21:21 +00:00
7fc6445035 I2S: Enable Power Management locks
Acquires PM_APB_FREQ_MAX lock when carrying any transaction on I2S if
Power Management Framework is enabled.

Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-03-18 08:21:21 +00:00
d0234ad24a I2C: Enable Power Management locks
Acquires PM_APB_FREQ_MAX lock when carrying any transaction on I2C if
Power Management Framework is enabled.

Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-03-18 08:21:21 +00:00
7d96b3442a mesh: fix memory leak and group send
fix a bug in group send
fix esp_mesh_set_router when router_t not initialized
fix mesh memory leak with invalid option
2019-03-18 14:43:21 +08:00
f1e9078cb0 Merge branch 'bugfix/fix_the_bug_cal_PMK_too_long' into 'master'
wifi: fix the bug that calculate PMK too long

Closes IDFGH-524

See merge request idf/esp-idf!4349
2019-03-18 14:26:48 +08:00
1940ee0910 Component/bt: fix build warning when bluedroid disable log 2019-03-18 14:18:12 +08:00
63dabd1a17 espcoredump: fix test with esp32-2018r1 toolchain 2019-03-18 12:47:29 +08:00
6221f5a819 espcoredump: fix test compilation error with GCC 8 2019-03-18 12:47:22 +08:00
2dd3344342 heap: Add integer overflow checks on MALLOC_CAP_32BIT & MALLOC_CAP_EXEC 2019-03-18 01:41:58 +00:00
9ce7ffb440 ldgen: fix library path parsing in windows
Closes https://github.com/espressif/esp-idf/issues/3173
2019-03-18 03:47:38 +08:00
234de8de55 cmake: Allow components to present their own images to flash 2019-03-18 03:45:22 +08:00
e4d97bef3d make: use shell command to extract version string 2019-03-17 21:33:22 +08:00
5beb2802e0 Merge branch 'bugfix/bluetooth_fix_API_esp_bt_gap_set_scan_mode' into 'master'
Modify esp_bt_gap_set_scan_mode() to be able to set connection modes as well as discoverable modes

See merge request idf/esp-idf!2208
2019-03-17 14:19:11 +08:00
8e4b82548a Merge branch 'bugfix/suppress_dhcpserver_debug_output' into 'master'
dhcpserver: suppress send_nak debug output

Closes IDFGH-557

See merge request idf/esp-idf!4491
2019-03-17 14:12:58 +08:00
f6665cf90b Merge branch 'bugfix/esp_prov_ble_rw_except' into 'master'
esp_prov : Catch DBus exception when reading/writing to BLE GATT characteristic

See merge request idf/esp-idf!4503
2019-03-15 21:10:53 +08:00
6408ef9e7c wifi: fix the bug that when call set_config before connecting to an encrypted AP, PMK will be recalculated
Closes https://github.com/espressif/esp-idf/issues/2880
2019-03-15 16:28:58 +08:00
b1a81e8167 Merge branch 'bugfix/bb_watchdog_reset' into 'master'
esp32: add WiFi baseband watchdog reset

See merge request idf/esp-idf!4409
2019-03-15 16:12:30 +08:00
6400714d9b Merge branch 'feature/confserver_v2' into 'master'
confserver: Add v2 confserver protocol with separate visibility info

See merge request idf/esp-idf!4162
2019-03-15 14:49:05 +08:00
cc9b06d4da Merge branch 'bugfix/esp_sha_signing_sha256' into 'master'
secure boot: Fix esp_sha INT WDT, switch to using mbedTLS API

Closes IDFGH-681

See merge request idf/esp-idf!4440
2019-03-15 14:35:38 +08:00
87881b76ad Merge branch 'bugfix/make_gcc_version_evaluation' into 'master'
make: Ensure that component_project_vars.mk not generated before config

See merge request idf/esp-idf!4474
2019-03-15 14:30:48 +08:00
b4d87191ef Merge branch 'bugfix/esp-http-client-event-fixes' into 'master'
Minor bugfixes in esp_http_client and tcp_transport

See merge request idf/esp-idf!4467
2019-03-15 11:45:40 +08:00
416b756ea4 Merge branch 'bugfix/name_conflict_esp32_project_ld' into 'master'
esp32: Rename esp32.common.ld to esp32.project.ld to avoid build errors when downgrading

See merge request idf/esp-idf!4484
2019-03-15 11:42:20 +08:00
a44f43c2ea confserver: Send an error response if JSON request is malformatted 2019-03-15 14:31:45 +11:00
6897dab2de confserver: In protocol V2, a "load" should only send back changes not all items 2019-03-15 14:31:45 +11:00
02802a5113 confserver: Add support for new V2 protocol
V2 adds:
* Independent result for visibility (showing/hiding menus)
* Includes adding IDs for all items (menus & symbols) in kconfig_menus.json

Still backwards compatible with V1, with some small changes (menu items now listed in results).

Also added some protocol docs, changed the "listening on stdin" message to come after any kconfiglib warnings
2019-03-15 14:31:45 +11:00
f02ceb747e Merge branch 'bugfix/idf_py_windows_relpath' into 'master'
idf.py: Fix Windows issue if project and IDF are on different drives

Closes IDFGH-478

See merge request idf/esp-idf!4404
2019-03-15 09:36:25 +08:00
048cd2a887 esp_prov : Catch DBus exception when reading/writing to BLE GATT characteristic
This is useful in the context of provisioning when server initiates disconnection if secure session establishment fails.
2019-03-14 18:33:34 +05:30
b8f23fbd42 Merge branch 'bugfix/ble_assert_8192' into 'master'
fix the bug assert(8192 0) in rwble.c 234

See merge request idf/esp-idf!4461
2019-03-14 20:24:33 +08:00
9b0e6e3b49 esp_http_client: Fix header sent event bug 2019-03-14 14:31:28 +05:30
d943c8de94 tcp_transport: Fix case sensitive header comparison
Closes https://github.com/espressif/esp-idf/issues/3106
2019-03-14 14:31:28 +05:30
ce6b73ca5f Merge branch 'bugfix/console_allow_buffered' into 'master'
console example: use buffered stdout by default

See merge request idf/esp-idf!4476
2019-03-14 15:40:42 +08:00
1b3373543f Merge branch 'feature/trim_idf_ver_to_fit_32bit_field' into 'master'
tools/test_build_system: Trim IDF_VER to fit a 32-bit field

Closes IDFGH-682

See merge request idf/esp-idf!4477
2019-03-14 15:39:20 +08:00
b39bd0615c fix the bug assert(8192 0) in rwble.c 234 2019-03-14 15:38:23 +08:00
7c69f6172b Merge branch 'bugfix/spi_flash_mmap_stale_data_issue' into 'master'
spi_flash: fix stale read issue for memory mapped partition

See merge request idf/esp-idf!4437
2019-03-14 14:56:12 +08:00
fa2998d70b dhcpserver: suppress send_nak debug output
Closes https://github.com/espressif/esp-idf/issues/2924
2019-03-14 14:00:35 +08:00
12bdf8e45b esp32: Chunk input blocks for esp_sha() function performance, add perf test 2019-03-14 05:56:06 +00:00
1cc726b2a3 secure boot: Use mbedtls_sha256() not esp_sha()
Latter is probably compiled into most firmwares already, saves some size.

Ref https://github.com/espressif/esp-idf/issues/3127
2019-03-14 05:56:06 +00:00
6a6fbde83d esp32 hwcrypto: Prevent esp_sha() from disabling interrupts for extended period
* Closes https://github.com/espressif/esp-idf/issues/3127
* Closes IDFGH-681

Also reported at https://esp32.com/viewtopic.php?f=13&t=9506
2019-03-14 05:56:06 +00:00
981585df95 Merge branch 'feature/github_sync_prs_jira' into 'master'
github: Sync PRs to JIRA as well

See merge request idf/esp-idf!4487
2019-03-14 13:53:10 +08:00
d6a2590e40 Merge branch 'ci/print_error_label_check' into 'master'
ci: Print an error in the log if the label check fails

See merge request idf/esp-idf!4485
2019-03-14 11:37:20 +08:00
d0739861e8 github: Sync PRs to JIRA as well
Currently the GitHub sync half-syncs these (as it will create a JIRA issue as soon as the first
comment is made on the PR).
2019-03-14 14:29:46 +11:00
31ca6e399b Merge branch 'bugfix/mdns_add_remove_multiple_srv_master' into 'master'
mdns: fix possible crash if tx packet contained answer to removed service

Closes IDF-498 and IDF-504

See merge request idf/esp-idf!4348
2019-03-14 08:10:23 +08:00
f552977309 make: Ensure that component_project_vars.mk not generated before config
* Fix the situation where component_project_vars.mk is generated before config exists
* Does not fix situation where config is changed and component_project_vars.mk contents should be
  changed. This may still require a rebuild.
2019-03-14 10:57:36 +11:00
3bfb0d86e3 ci: Print an error in the log if the label check fails
One less step for a developer to figure out why this failed.
2019-03-14 10:15:49 +11:00
974796fa6c Merge branch 'bugfix/remove_malloc_ble_prov' into 'master'
Protocomm BLE: Make changes in handling BLE read/write requests

See merge request idf/esp-idf!4444
2019-03-14 07:08:50 +08:00
a79c5b8271 esp32: Rename esp32.common.ld to esp32.project.ld to avoid build errors when downgrading
Linker script generator produces build/esp32/esp32.common.ld from
components/esp32/ld/esp32.common.ld.in

This works fine until IDF is downgraded to V3.1 which uses components/esp32/ld/esp32.common.ld and
doesn't track build/esp32/esp32.common.ld at all.

At this point, the linker runs in the build/esp32 directory and "-T esp32.common.ld" picks up the
linker script generated .ld file, which causes mis-builds.

As reported on forums: https://esp32.com/viewtopic.php?f=13&t=9684&p=40105
2019-03-14 09:59:31 +11:00
16b2fd2dce Merge branch 'doc/review_get_started' into 'master'
Update IDF getting started sections for make and cmake as well as IDF monitor…

See merge request idf/esp-idf!4331
2019-03-14 00:10:26 +08:00
49cca9288f Update IDF getting started sections for make and cmake as well as IDF monitor… 2019-03-14 00:10:26 +08:00
b1b5849c4c rmt/driver: Sped the rmt_driver_isr_default ISR
Used __builtin_ctz function to sped ISR.
2019-03-13 13:50:43 +00:00
3307735bc0 pcnt/driver: Sped the pcnt_intr_service ISR
Used __builtin_ctz function to sped ISR.
2019-03-13 13:50:43 +00:00
b8dc48ab18 gpio/driver: Sped the gpio_intr_service ISR up by 1.5 uSeconds (+-50% faster).
Removed as much branching (if statements) from the
gpio_intr_service ISR, as possible and split the while loop into
two. Also forced writing the two status*_w1tc variables only once,
instead of every time after calling the external function hooks.

The measurements below, was done using the following tools:

Toolchain version: crosstool-ng-1.22.0-80-g6c4433a
Compiler version: 5.2.0

Here follows a comparison of the gpio_intr_service ISR's
execution time, using a DS1054 oscilloscope. All the time spent
calling external functions, via the function pointers
gpio_isr_func[gpio_num].fn, were disregarded.

With OPTIMIZATION_FLAGS = -Og, 1.34 uSeconds faster:

3.22 uSec (with this patch)
4.56 uSec (with commit 71c90ac4)

100 - (100 * 4.56 / 3.22) = 42% faster

With OPTIMIZATION_FLAGS = -Os, 1.65 uSeconds faster:

2.89 uSec (with this patch)
4.54 uSec (with commit 71c90ac4)

100 - (100 * 4.54 / 2.89) = 57% faster

Signed-off-by: Konstantin Kondrashov <konstantin@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/2861
2019-03-13 13:50:43 +00:00
126d6b2de2 tools/test_build_system: Add tests with long IDF_VER 2019-03-13 20:43:33 +08:00
d34ca0b897 Merge branch 'test/fix_some_ut_not_assigned' into 'master'
test: fix some ut case not assigned

See merge request idf/esp-idf!4449
2019-03-13 20:42:24 +08:00
945bd36884 examples: don't enable buffering on stdout in console examples
newlib uses significantly more stack space when printing to an
unbuffered stream. To reduce the amount of stack space required to
use the console, don’t disable buffering. linenoise should support
unbuffered stdout instead.
2019-03-13 20:32:37 +08:00
fa57fb3c1c console/linenoise: support buffered stdout 2019-03-13 20:17:25 +08:00
f8ca296438 cmake: Trim IDF_VER to fit a 32-bit field 2019-03-13 20:04:43 +08:00
53208f6324 make: Trim IDF_VER to fit a 32-bit field
Closes: https://github.com/espressif/esp-idf/issues/3131
2019-03-13 20:01:28 +08:00
296fbca2e7 Component/bt: fix blufi prepare write crash 2019-03-13 17:57:25 +08:00
265e983a45 mdns: fix possible crash when probing on particular interface with duplicated service instances due to naming conflicts on network
Issue: MDNS server initially sends probing packets to resolve naming confilicts with already registered service instances. In case of a conflict, instance name is altered and probing restarts. Original instance however wasnnot removed from the structure and upon service removal only one entry was removed and a dangling service might have been kept in the structure to bring about a crash.
Resolution: Keep only one instance of a service in the probing structure.

Closes IDF-498
2019-03-13 10:22:41 +01:00
c87f0cb6ca mdns: enable pcbs before starting service thread to avoid updating pcb's internal variables from concurent tasks
possible race condition: user task runs mdns_init, which enables pcbs while mdns-task already created could execute enable/disable of the same pcbs if an appropriate system event received
2019-03-13 10:22:41 +01:00
48b5501c25 mdns: fix possible deadlock on mdns deinit calling mdns_free()
mnds_free() initiates stop and delete timer tasks, which after locking the mutex could lead to a dead lock in case timer task executed before deleting the task, as it would wait indefinitelly for unlocking the mutex. This condition is fixed by calling _mdns_stop_timer without locking the mutex, because there's no need to protect any data when stopping and deleting the timer task

Closes https://github.com/espressif/esp-idf/issues/1696
2019-03-13 10:22:41 +01:00
021dc5d453 mdsn: fix race condition in updating packet data from user task when failed to allocate or queue a new service
Issue: mdns_service_add API allocates and queues an action to be processed in mdns task context; when allocation or queueing fails, allocated structure needs to be freed. Function _mdns_free_service did not only fee all the structures, but also updates packet data.
Resolution: Moved removal of packet data outside of _mdns_free_service function.
2019-03-13 10:22:41 +01:00
67051a286b mdns: fix possible crash when packet scheduled to transmit contained service which might have been already removed
packets scheduled to transmit are pushed to action queue and removed from tx_queue_head structure, which is searched for all remaining services and while service is removed, then service questions/asnwers are also removed from this structure. This update fixes possible crash when packet is pushed to action queue, and when service is removed, its answers are removed from tx_queue_head, but not from action queue. this could lead to a crash when the packet is poped from action queue containing questions/answers to already removed (freed) service

Closes IDF-504
2019-03-13 10:22:41 +01:00
75287eb569 Merge branch 'feature/btdm_add_adv_report_flow_control' into 'master'
Component/bt: add BLE adv report flow control

See merge request idf/esp-idf!4423
2019-03-13 16:58:07 +08:00
d5e78e79d3 Component/bt: add api to clean gattc cache 2019-03-13 15:23:33 +08:00
7541d23523 Merge branch 'feat/spi_master_variable_dummy' into 'master'
spi_master: add support for variable dummy length in a same device

See merge request idf/esp-idf!4360
2019-03-13 15:15:58 +08:00
e77540b695 Merge branch 'test/spi_sio_test' into 'master'
spi: add test for sio mode

See merge request idf/esp-idf!3416
2019-03-13 15:15:43 +08:00
5107f9f9b2 Merge branch 'bugfix/confgen_expr_value' into 'master'
confgen: Fix bug with JSON metadata conditional range generation

See merge request idf/esp-idf!4402
2019-03-13 13:54:17 +08:00
d9ce0bb705 Modify esp_bt_gap_set_scan_mode() to be able to set connection modes as well as discoverable modes
The current API is insufficient to allow the users to set different combinations of connection and discoverable mode

Users should be able to choose the device modes independently:
1. Connectable-
  i. Non-connectable mode
  ii. Connectable mode

2. Discoverable-
  i. Non-discoverable mode
  ii. Limited discoverable mode
  iii. General discoverable mode
2019-03-13 11:24:00 +05:30
16adb9d62a spi_flash: add test case for stale read issue on memory mapped partition 2019-03-13 05:38:01 +00:00
2752654043 spi_flash: fix stale read issue for memory mapped partition
On flash program operation (either erase or write), if corresponding address has
cache mapping present then cache is explicitly flushed (for both pro and app cpu)

Closes https://github.com/espressif/esp-idf/issues/2146
2019-03-13 05:38:01 +00:00
fa5bc5d58b Merge branch 'bugfix/ssid_passwords_null_terminated' into 'master'
wifi: Specify that SSID & Password fields should be NULL terminated strings

See merge request idf/esp-idf!4468
2019-03-13 13:29:09 +08:00
710bcbd447 Merge branch 'feature/freertos_check_mutex_owner' into 'master'
freertos: check that mutex is released by owner task

See merge request idf/esp-idf!4012
2019-03-13 13:15:34 +08:00
961e433395 Merge branch 'bugfix/spi_flash_exclude_encrypted' into 'master'
esp_partition: disable encrypted reads/writes if flash encryption is disabled

See merge request idf/esp-idf!4099
2019-03-13 13:15:24 +08:00
f44dcf4878 Merge branch 'bugfix/macros_trailing_semicolon' into 'master'
Remove trialing semicolon from function-like macros

See merge request idf/esp-idf!4397
2019-03-13 13:15:12 +08:00
674d234283 esp32: add WiFi baseband watchdog reset
When WiFi enter into a special status (11b weak mode), then reset
Wifi baseband to recover to normal mode.
2019-03-13 11:09:30 +08:00
79d37b75f3 wifi: Specify that SSID & Password fields should be NULL terminated strings
Closes https://github.com/espressif/esp-idf/issues/1176
2019-03-13 11:44:41 +11:00
d5f15a45ca Component/bt: add BLE adv report flow control 2019-03-12 11:10:26 +08:00
1bc1fb7005 ci: add one more unit test job 2019-03-11 14:40:54 +00:00
37144dfa07 mdns: use binary semaphore instead of mutex when searching
mdns_search_once_t::lock is used to synchronize tasks (taken by one
task and given by the other) so it should not be a mutex.
Convert to semaphore, and rename to indicate its purpose.
2019-03-11 14:40:54 +00:00
d539183b40 esp32: use binary semaphore instead of mutex in dport tests 2019-03-11 14:40:54 +00:00
13523c95b4 freertos: check that mutex is released by owner task
Mutex type semaphores should be acquired and released by the same task.
Add a check to xQueueGenericSend for this condition.
2019-03-11 14:40:54 +00:00
ce065f1a4f Protocomm BLE: Make changes in handling BLE read/write requests
1. Remove unwanted malloc during BLE send response
2. Populate the missing parameters in the response - handle, offset, auth_req
2019-03-11 19:39:26 +05:30
ee7dd2c128 test: fix some ut case not assigned:
we didn't remove UT case file correctly for cmake build. even we use
artifact from make jobs, cmake case file will be used to assign test.
2019-03-11 09:44:47 +00:00
4a575d5449 idf.py: Fix Windows issue if project and IDF are on different drives
Closes https://github.com/espressif/esp-idf/issues/2753
2019-03-11 04:31:13 +00:00
4fc14e8eb6 vfs: Adds semihosting VFS driver 2019-03-08 15:08:10 +03:00
8d62b0d173 ota example: Mention the certificate needs CN set correctly 2019-03-08 18:32:55 +11:00
673441aba0 confgen: Fix bug with JSON metadata conditional range generation
When generating JSON metadata for ranges where there are conditional ranges (ie different allowed range
depending on another config setting), the JSON metadata would always have the last named range as
the expression was not evaluated properly.

Thanks to ulfalizer on GitHub for pointing this out.

Closes https://github.com/espressif/esp-idf/issues/2195
2019-03-01 15:38:23 +11:00
59d1ecc78b esp32: Remove trialing semicolon from function-like macros
This commit removes trailing semicolons following a while(0) from
function-like macros in IDF. This will force those macros to be called
with a semicolon when called.
2019-02-28 21:58:47 +08:00
b812520b19 spi_master: add support for variable dummy length in a same device
Resolves https://github.com/espressif/esp-idf/issues/2741
2019-02-27 02:13:33 +08:00
2dc3c61114 test: add unit test for spi sio mode 2019-01-30 20:57:26 +08:00
305354d0a2 test: change spi test host to macros 2019-01-30 20:57:25 +08:00
61839fc4a5 esp-idf | revise app_trace EN version 2019-01-30 11:39:23 +08:00
fb2ebb19c6 translate app_trace to zh_CN 2019-01-30 11:35:15 +08:00
bf35ef1ce7 esp_partition: disable encrypted reads/writes if flash encryption is disabled
Saves 400 bytes of IRAM.
2019-01-10 21:51:09 +08:00
3658 changed files with 243612 additions and 77608 deletions

19
.flake8
View File

@ -140,15 +140,16 @@ exclude =
.git,
__pycache__,
# submodules
components/bootloader/subproject/components/micro-ecc/micro-ecc,
components/esptool_py/esptool,
components/micro-ecc/micro-ecc,
components/nghttp/nghttp2,
components/libsodium/libsodium,
components/json/cJSON,
components/mbedtls/mbedtls,
components/expat/expat,
components/json/cJSON,
components/libsodium/libsodium,
components/mbedtls/mbedtls,
components/nghttp/nghttp2,
components/bt/host/nimble/nimble,
components/unity/unity,
examples/build_system/cmake/import_lib/main/lib/tinyxml2
examples/build_system/cmake/import_lib/main/lib/tinyxml2,
# other third-party libraries
tools/kconfig_new/kconfiglib.py,
# autogenerated scripts
@ -156,10 +157,8 @@ exclude =
components/protocomm/python/sec0_pb2.py,
components/protocomm/python/sec1_pb2.py,
components/protocomm/python/session_pb2.py,
components/wifi_provisioning/python/wifi_scan_pb2.py,
components/wifi_provisioning/python/wifi_config_pb2.py,
components/wifi_provisioning/python/wifi_constants_pb2.py,
components/esp_local_ctrl/python/esp_local_ctrl_pb2.py,
examples/provisioning/custom_config/components/custom_provisioning/python/custom_config_pb2.py,
# temporary list (should be empty)
components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py,
tools/esp_app_trace/pylibelf,
tools/mass_mfg/mfg_gen.py,

View File

@ -3,11 +3,16 @@ workflow "Sync issues to JIRA" {
resolves = ["Sync to JIRA"]
}
workflow "Sync issue comments to JIRA" {
workflow "Sync issue and PR comments to JIRA" {
on = "issue_comment"
resolves = ["Sync to JIRA"]
}
workflow "Sync PRs to JIRA" {
on = "pull_request"
resolves = ["Sync to JIRA"]
}
action "Sync to JIRA" {
uses = "espressif/github-actions/sync_issues_to_jira@master"
secrets = ["GITHUB_TOKEN", "JIRA_URL", "JIRA_USER", "JIRA_PASS"]

14
.gitignore vendored
View File

@ -36,6 +36,10 @@ docs/*/xml_in/
docs/*/man/
docs/doxygen_sqlite3.db
# Downloaded font files
docs/_static/DejaVuSans.ttf
docs/_static/NotoSansSC-Regular.otf
# Unit test app files
tools/unit-test-app/sdkconfig
tools/unit-test-app/sdkconfig.old
@ -48,22 +52,12 @@ tools/test_idf_monitor/outputs
TEST_LOGS
# AWS IoT Examples require device-specific certs/keys
examples/protocols/aws_iot/*/main/certs/*.pem.*
# gcov coverage reports
*.gcda
*.gcno
coverage.info
coverage_report/
# Windows tools installer build
tools/windows/tool_setup/.*
tools/windows/tool_setup/input
tools/windows/tool_setup/dl
tools/windows/tool_setup/keys
tools/windows/tool_setup/Output
test_multi_heap_host
# VS Code Settings

File diff suppressed because it is too large Load Diff

59
.gitmodules vendored
View File

@ -1,71 +1,76 @@
[submodule "components/esp32/lib"]
path = components/esp32/lib
url = https://github.com/espressif/esp32-wifi-lib.git
#
# All the relative URL paths are intended to be GitHub ones
# For Espressif's public projects please use '../../espressif/proj', not a '../proj'
#
[submodule "components/esptool_py/esptool"]
path = components/esptool_py/esptool
url = https://github.com/espressif/esptool.git
url = ../../espressif/esptool.git
[submodule "components/bt/lib"]
path = components/bt/lib
url = https://github.com/espressif/esp32-bt-lib.git
[submodule "components/bt/controller/lib"]
path = components/bt/controller/lib
url = ../../espressif/esp32-bt-lib.git
[submodule "components/micro-ecc/micro-ecc"]
path = components/micro-ecc/micro-ecc
url = https://github.com/kmackay/micro-ecc.git
[submodule "components/bootloader/subproject/components/micro-ecc/micro-ecc"]
path = components/bootloader/subproject/components/micro-ecc/micro-ecc
url = ../../kmackay/micro-ecc.git
[submodule "components/coap/libcoap"]
path = components/coap/libcoap
url = https://github.com/obgm/libcoap.git
[submodule "components/aws_iot/aws-iot-device-sdk-embedded-C"]
path = components/aws_iot/aws-iot-device-sdk-embedded-C
url = https://github.com/espressif/aws-iot-device-sdk-embedded-C.git
url = ../../obgm/libcoap.git
[submodule "components/nghttp/nghttp2"]
path = components/nghttp/nghttp2
url = https://github.com/nghttp2/nghttp2.git
url = ../../nghttp2/nghttp2.git
[submodule "components/libsodium/libsodium"]
path = components/libsodium/libsodium
url = https://github.com/jedisct1/libsodium.git
url = ../../jedisct1/libsodium.git
[submodule "components/spiffs/spiffs"]
path = components/spiffs/spiffs
url = https://github.com/pellepl/spiffs.git
url = ../../pellepl/spiffs.git
[submodule "components/json/cJSON"]
path = components/json/cJSON
url = https://github.com/DaveGamble/cJSON.git
url = ../../DaveGamble/cJSON.git
[submodule "components/mbedtls/mbedtls"]
path = components/mbedtls/mbedtls
url = https://github.com/espressif/mbedtls.git
url = ../../espressif/mbedtls.git
[submodule "components/asio/asio"]
path = components/asio/asio
url = https://github.com/espressif/asio.git
url = ../../espressif/asio.git
[submodule "components/expat/expat"]
path = components/expat/expat
url = https://github.com/libexpat/libexpat.git
url = ../../libexpat/libexpat.git
[submodule "components/lwip/lwip"]
path = components/lwip/lwip
url = https://github.com/espressif/esp-lwip.git
url = ../../espressif/esp-lwip.git
[submodule "components/mqtt/esp-mqtt"]
path = components/mqtt/esp-mqtt
url = https://github.com/espressif/esp-mqtt.git
url = ../../espressif/esp-mqtt.git
[submodule "components/protobuf-c/protobuf-c"]
path = components/protobuf-c/protobuf-c
url = https://github.com/protobuf-c/protobuf-c
url = ../../protobuf-c/protobuf-c.git
[submodule "components/unity/unity"]
path = components/unity/unity
url = https://github.com/ThrowTheSwitch/Unity
url = ../../ThrowTheSwitch/Unity.git
[submodule "examples/build_system/cmake/import_lib/main/lib/tinyxml2"]
path = examples/build_system/cmake/import_lib/main/lib/tinyxml2
url = https://github.com/leethomason/tinyxml2
url = ../../leethomason/tinyxml2.git
[submodule "components/esp_wifi/lib_esp32"]
path = components/esp_wifi/lib_esp32
url = ../../espressif/esp32-wifi-lib.git
[submodule "components/bt/host/nimble/nimble"]
path = components/bt/host/nimble/nimble
url = ../../espressif/esp-nimble.git

21
.readthedocs.yml Normal file
View File

@ -0,0 +1,21 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Optionally build your docs in additional formats such as PDF and ePub
formats:
- pdf
# Optionally set the version of Python and requirements required to build your docs
python:
version: 2.7
install:
- requirements: docs/requirements.txt
# We need to list all the submodules included in documenation build by DOxygen
submodules:
include:
- components/mqtt/esp-mqtt

View File

@ -1,161 +1,83 @@
cmake_minimum_required(VERSION 3.5)
project(esp-idf C CXX ASM)
if(NOT IDF_PATH)
set(IDF_PATH ${CMAKE_CURRENT_LIST_DIR})
unset(compile_options)
unset(c_compile_options)
unset(cxx_compile_options)
unset(compile_definitions)
# Add the following build specifications here, since these seem to be dependent
# on config values on the root Kconfig.
if(CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE)
list(APPEND compile_options "-Os")
list(APPEND compile_options "-freorder-blocks")
else()
list(APPEND compile_options "-Og")
endif()
include(tools/cmake/idf_functions.cmake)
#
# Set variables that control the build configuration and the build itself
#
idf_set_variables()
kconfig_set_variables()
#
# Generate a component dependencies file, enumerating components to be included in the build
# as well as their dependencies.
#
execute_process(COMMAND "${CMAKE_COMMAND}"
-D "COMPONENTS=${IDF_COMPONENTS}"
-D "COMPONENT_REQUIRES_COMMON=${IDF_COMPONENT_REQUIRES_COMMON}"
-D "EXCLUDE_COMPONENTS=${IDF_EXCLUDE_COMPONENTS}"
-D "TEST_COMPONENTS=${IDF_TEST_COMPONENTS}"
-D "TEST_EXCLUDE_COMPONENTS=${IDF_TEST_EXCLUDE_COMPONENTS}"
-D "BUILD_TESTS=${IDF_BUILD_TESTS}"
-D "DEPENDENCIES_FILE=${CMAKE_BINARY_DIR}/component_depends.cmake"
-D "COMPONENT_DIRS=${IDF_COMPONENT_DIRS}"
-D "BOOTLOADER_BUILD=${BOOTLOADER_BUILD}"
-D "IDF_TARGET=${IDF_TARGET}"
-D "IDF_PATH=${IDF_PATH}"
-D "DEBUG=${DEBUG}"
-P "${IDF_PATH}/tools/cmake/scripts/expand_requirements.cmake"
WORKING_DIRECTORY "${PROJECT_PATH}"
RESULT_VARIABLE expand_requirements_result)
if(expand_requirements_result)
message(FATAL_ERROR "Failed to expand component requirements")
if(CONFIG_COMPILER_CXX_EXCEPTIONS)
list(APPEND cxx_compile_options "-fexceptions")
else()
list(APPEND cxx_compile_options "-fno-exceptions")
endif()
include("${CMAKE_BINARY_DIR}/component_depends.cmake")
if(CONFIG_COMPILER_DISABLE_GCC8_WARNINGS)
list(APPEND compile_options "-Wno-parentheses"
"-Wno-sizeof-pointer-memaccess"
"-Wno-clobbered")
#
# We now have the following component-related variables:
#
# IDF_COMPONENTS is the list of initial components set by the user
# (or empty to include all components in the build).
# BUILD_COMPONENTS is the list of components to include in the build.
# BUILD_COMPONENT_PATHS is the paths to all of these components, obtained from the component dependencies file.
#
# Print the list of found components and test components
#
string(REPLACE ";" " " BUILD_COMPONENTS_SPACES "${BUILD_COMPONENTS}")
message(STATUS "Component names: ${BUILD_COMPONENTS_SPACES}")
unset(BUILD_COMPONENTS_SPACES)
message(STATUS "Component paths: ${BUILD_COMPONENT_PATHS}")
# Print list of test components
if(TESTS_ALL EQUAL 1 OR TEST_COMPONENTS)
string(REPLACE ";" " " BUILD_TEST_COMPONENTS_SPACES "${BUILD_TEST_COMPONENTS}")
message(STATUS "Test component names: ${BUILD_TEST_COMPONENTS_SPACES}")
unset(BUILD_TEST_COMPONENTS_SPACES)
message(STATUS "Test component paths: ${BUILD_TEST_COMPONENT_PATHS}")
endif()
# Generate project configuration
kconfig_process_config()
# Include sdkconfig.cmake so rest of the build knows the configuration
include(${SDKCONFIG_CMAKE})
# Verify the environment is configured correctly
idf_verify_environment()
# Check git revision (may trigger reruns of cmake)
## sets IDF_VER to IDF git revision
idf_get_git_revision()
# Check that the targets set in cache, sdkconfig, and in environment all match
idf_check_config_target()
## get PROJECT_VER
if(NOT BOOTLOADER_BUILD)
app_get_revision("${CMAKE_SOURCE_DIR}")
endif()
# Add some idf-wide definitions
idf_set_global_compile_options()
# generate compile_commands.json (needs to come after project)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
#
# Setup variables for linker script generation
#
ldgen_set_variables()
# Include any top-level project_include.cmake files from components
foreach(component ${BUILD_COMPONENT_PATHS})
set(COMPONENT_PATH "${component}")
include_if_exists("${component}/project_include.cmake")
unset(COMPONENT_PATH)
endforeach()
#
# Add each component to the build as a library
#
foreach(COMPONENT_PATH ${BUILD_COMPONENT_PATHS})
get_filename_component(COMPONENT_NAME ${COMPONENT_PATH} NAME)
list(FIND BUILD_TEST_COMPONENT_PATHS ${COMPONENT_PATH} idx)
if(NOT idx EQUAL -1)
list(GET BUILD_TEST_COMPONENTS ${idx} test_component)
set(COMPONENT_NAME ${test_component})
# doesn't use GCC_NOT_5_2_0 because idf_set_global_variables was not called before
if(GCC_NOT_5_2_0)
list(APPEND compile_options "-Wno-format-overflow"
"-Wno-stringop-truncation"
"-Wno-misleading-indentation"
"-Wno-cast-function-type"
"-Wno-implicit-fallthrough"
"-Wno-unused-const-variable"
"-Wno-switch-unreachable"
"-Wno-format-truncation"
"-Wno-memset-elt-size"
"-Wno-int-in-bool-context")
endif()
component_get_target(COMPONENT_TARGET ${COMPONENT_NAME})
add_subdirectory(${COMPONENT_PATH} ${COMPONENT_NAME})
endforeach()
unset(COMPONENT_NAME)
unset(COMPONENT_PATH)
# each component should see the include directories of its requirements
#
# (we can't do this until all components are registered and targets exist in cmake, as we have
# a circular requirements graph...)
foreach(component ${BUILD_COMPONENTS})
component_get_target(component_target ${component})
if(TARGET ${component_target})
get_component_requirements(${component} deps priv_deps)
list(APPEND priv_deps ${IDF_COMPONENT_REQUIRES_COMMON})
foreach(dep ${deps})
component_get_target(dep_target ${dep})
add_component_dependencies(${component_target} ${dep_target} PUBLIC)
endforeach()
foreach(dep ${priv_deps})
component_get_target(dep_target ${dep})
add_component_dependencies(${component_target} ${dep_target} PRIVATE)
endforeach()
endif()
endforeach()
if(IDF_BUILD_ARTIFACTS)
# Write project description JSON file
make_json_list("${BUILD_COMPONENTS}" build_components_json)
make_json_list("${BUILD_COMPONENT_PATHS}" build_component_paths_json)
configure_file("${IDF_PATH}/tools/cmake/project_description.json.in"
"${IDF_BUILD_ARTIFACTS_DIR}/project_description.json")
unset(build_components_json)
unset(build_component_paths_json)
endif()
set(BUILD_COMPONENTS ${BUILD_COMPONENTS} PARENT_SCOPE)
if(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE)
list(APPEND compile_definitions "-DNDEBUG")
endif()
ldgen_add_dependencies()
if(CONFIG_COMPILER_STACK_CHECK_MODE_NORM)
list(APPEND compile_options "-fstack-protector")
elseif(CONFIG_COMPILER_STACK_CHECK_MODE_STRONG)
list(APPEND compile_options "-fstack-protector-strong")
elseif(CONFIG_COMPILER_STACK_CHECK_MODE_ALL)
list(APPEND compile_options "-fstack-protector-all")
endif()
idf_build_set_property(COMPILE_OPTIONS "${compile_options}" APPEND)
idf_build_set_property(C_COMPILE_OPTIONS "${c_compile_options}" APPEND)
idf_build_set_property(CXX_COMPILE_OPTIONS "${cxx_compile_options}" APPEND)
idf_build_set_property(COMPILE_DEFINITIONS "${compile_definitions}" APPEND)
idf_build_get_property(build_component_targets __BUILD_COMPONENT_TARGETS)
# Add each component as a subdirectory, processing each component's CMakeLists.txt
foreach(component_target ${build_component_targets})
__component_get_property(dir ${component_target} COMPONENT_DIR)
__component_get_property(_name ${component_target} COMPONENT_NAME)
__component_get_property(prefix ${component_target} __PREFIX)
__component_get_property(alias ${component_target} COMPONENT_ALIAS)
set(COMPONENT_NAME ${_name})
set(COMPONENT_DIR ${dir})
set(COMPONENT_ALIAS ${alias})
set(COMPONENT_PATH ${dir}) # for backward compatibility only, COMPONENT_DIR is preferred
idf_build_get_property(build_prefix __PREFIX)
set(__idf_component_context 1)
if(NOT prefix STREQUAL build_prefix)
add_subdirectory(${dir} ${prefix}_${_name})
else()
add_subdirectory(${dir} ${_name})
endif()
set(__idf_component_context 0)
endforeach()

81
Kconfig
View File

@ -4,6 +4,12 @@
#
mainmenu "Espressif IoT Development Framework Configuration"
# Hidden option to support checking for this specific target in C code and Kconfig files
config IDF_TARGET_ESP32
bool
default "y" if IDF_TARGET="esp32"
default "n"
config IDF_CMAKE
bool
option env="IDF_CMAKE"
@ -25,14 +31,14 @@ mainmenu "Espressif IoT Development Framework Configuration"
menu "SDK tool configuration"
config TOOLPREFIX
config SDK_TOOLPREFIX
string "Compiler toolchain path/prefix"
default "xtensa-esp32-elf-"
help
The prefix/path that is used to call the toolchain. The default setting assumes
a crosstool-ng gcc setup that is in your PATH.
config PYTHON
config SDK_PYTHON
string "Python 2 interpreter"
depends on !IDF_CMAKE
default "python"
@ -40,11 +46,11 @@ mainmenu "Espressif IoT Development Framework Configuration"
The executable name/path that is used to run python. On some systems Python 2.x
may need to be invoked as python2.
(Note: This option is used with the GNU Make build system only, not idf.py
or CMake-based builds.)
(Note: This option is used with the legacy GNU Make build system only.)
config MAKE_WARN_UNDEFINED_VARIABLES
config SDK_MAKE_WARN_UNDEFINED_VARIABLES
bool "'make' warns on undefined variables"
depends on !IDF_CMAKE
default "y"
help
Adds --warn-undefined-variables to MAKEFLAGS. This causes make to
@ -54,15 +60,17 @@ mainmenu "Espressif IoT Development Framework Configuration"
or otherwise missing, but it can be unwanted if you have Makefiles which
depend on undefined variables expanding to an empty string.
(Note: this option is used with the legacy GNU Make build system only.)
endmenu # SDK tool configuration
source "$COMPONENT_KCONFIGS_PROJBUILD"
menu "Compiler options"
choice OPTIMIZATION_COMPILER
choice COMPILER_OPTIMIZATION
prompt "Optimization Level"
default OPTIMIZATION_LEVEL_DEBUG
default COMPILER_OPTIMIZATION_LEVEL_DEBUG
help
This option sets compiler optimization level (gcc -O argument).
@ -76,15 +84,15 @@ mainmenu "Espressif IoT Development Framework Configuration"
in project makefile, before including $(IDF_PATH)/make/project.mk. Note that
custom optimization levels may be unsupported.
config OPTIMIZATION_LEVEL_DEBUG
config COMPILER_OPTIMIZATION_LEVEL_DEBUG
bool "Debug (-Og)"
config OPTIMIZATION_LEVEL_RELEASE
config COMPILER_OPTIMIZATION_LEVEL_RELEASE
bool "Release (-Os)"
endchoice
choice OPTIMIZATION_ASSERTION_LEVEL
choice COMPILER_OPTIMIZATION_ASSERTION_LEVEL
prompt "Assertion level"
default OPTIMIZATION_ASSERTIONS_ENABLED
default COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
help
Assertions can be:
@ -96,20 +104,20 @@ mainmenu "Espressif IoT Development Framework Configuration"
- Disabled entirely (not recommended for most configurations.) -DNDEBUG is added
to CPPFLAGS in this case.
config OPTIMIZATION_ASSERTIONS_ENABLED
config COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
prompt "Enabled"
bool
help
Enable assertions. Assertion content and line number will be printed on failure.
config OPTIMIZATION_ASSERTIONS_SILENT
config COMPILER_OPTIMIZATION_ASSERTIONS_SILENT
prompt "Silent (saves code size)"
bool
help
Enable silent assertions. Failed assertions will abort(), user needs to
use the aborting address to find the line number with the failed assertion.
config OPTIMIZATION_ASSERTIONS_DISABLED
config COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
prompt "Disabled (sets -DNDEBUG)"
bool
help
@ -117,7 +125,7 @@ mainmenu "Espressif IoT Development Framework Configuration"
endchoice # assertions
menuconfig CXX_EXCEPTIONS
menuconfig COMPILER_CXX_EXCEPTIONS
bool "Enable C++ exceptions"
default n
help
@ -129,17 +137,17 @@ mainmenu "Espressif IoT Development Framework Configuration"
Enabling this option currently adds an additional ~500 bytes of heap overhead
when an exception is thrown in user code for the first time.
config CXX_EXCEPTIONS_EMG_POOL_SIZE
config COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE
int "Emergency Pool Size"
default 0
depends on CXX_EXCEPTIONS
depends on COMPILER_CXX_EXCEPTIONS
help
Size (in bytes) of the emergency memory pool for C++ exceptions. This pool will be used to allocate
memory for thrown exceptions when there is not enough memory on the heap.
choice STACK_CHECK_MODE
choice COMPILER_STACK_CHECK_MODE
prompt "Stack smashing protection mode"
default STACK_CHECK_NONE
default COMPILER_STACK_CHECK_MODE_NONE
help
Stack smashing protection mode. Emit extra code to check for buffer overflows, such as stack
smashing attacks. This is done by adding a guard variable to functions with vulnerable objects.
@ -162,23 +170,23 @@ mainmenu "Espressif IoT Development Framework Configuration"
- coverage: NORMAL < STRONG < OVERALL
config STACK_CHECK_NONE
config COMPILER_STACK_CHECK_MODE_NONE
bool "None"
config STACK_CHECK_NORM
config COMPILER_STACK_CHECK_MODE_NORM
bool "Normal"
config STACK_CHECK_STRONG
config COMPILER_STACK_CHECK_MODE_STRONG
bool "Strong"
config STACK_CHECK_ALL
config COMPILER_STACK_CHECK_MODE_ALL
bool "Overall"
endchoice
config STACK_CHECK
config COMPILER_STACK_CHECK
bool
default !STACK_CHECK_NONE
default !COMPILER_STACK_CHECK_MODE_NONE
help
Stack smashing protection.
config WARN_WRITE_STRINGS
config COMPILER_WARN_WRITE_STRINGS
bool "Enable -Wwrite-strings warning flag"
default "n"
help
@ -192,7 +200,7 @@ mainmenu "Espressif IoT Development Framework Configuration"
For C++, this warns about the deprecated conversion from string
literals to ``char *``.
config DISABLE_GCC8_WARNINGS
config COMPILER_DISABLE_GCC8_WARNINGS
bool "Disable new warnings introduced in GCC 6 - 8"
default "n"
help
@ -205,3 +213,22 @@ mainmenu "Espressif IoT Development Framework Configuration"
menu "Component config"
source "$COMPONENT_KCONFIGS"
endmenu
menu "Compatibility options"
config LEGACY_INCLUDE_COMMON_HEADERS
bool "Include headers accross components as before IDF v4.0"
default n
help
Soc, esp32, and driver components, the most common
components. Some header of these components are included
implicitly by headers of other components before IDF v4.0.
It's not required for high-level components, but still
included through long header chain everywhere.
This is harmful to the modularity. So it's changed in IDF
v4.0.
You can still include these headers in a legacy way until it
is totally deprecated by enable this option.
endmenu #Compatibility options

View File

@ -13,6 +13,14 @@ See setup guides for detailed instructions to set up the ESP-IDF:
* [Getting Started Guide for the stable ESP-IDF version](https://docs.espressif.com/projects/esp-idf/en/stable/get-started/)
* [Getting Started Guide for the latest (master branch) ESP-IDF version](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/)
### Non-GitHub forks
ESP-IDF uses relative locations as its submodules URLs ([.gitmodules](.gitmodules)). So they link to GitHub.
If ESP-IDF is forked to a Git repository which is not on GitHub, you will need to run the script
[tools/set-submodules-to-github.sh](tools/set-submodules-to-github.sh) after git clone.
The script sets absolute URLs for all submodules, allowing `git submodule update --init --recursive` to complete.
If cloning ESP-IDF from GitHub, this step is not needed.
## Finding a Project
As well as the [esp-idf-template](https://github.com/espressif/esp-idf-template) project mentioned in Getting Started, ESP-IDF comes with some example projects in the [examples](examples) directory.
@ -25,9 +33,17 @@ To start your own project based on an example, copy the example project director
See the Getting Started guide links above for a detailed setup guide. This is a quick reference for common commands when working with ESP-IDF projects:
## Setup Build Environment
(See Getting Started guide for a full list of required steps with details.)
* Install host build dependencies mentioned in Getting Started guide.
* Add `tools/` directory to the PATH
* Run `python -m pip install -r requirements.txt` to install Python dependencies
## Configuring the Project
`make menuconfig`
`idf.py menuconfig`
* Opens a text-based configuration menu for the project.
* Use up & down arrow keys to navigate the menu.
@ -41,76 +57,48 @@ Once done configuring, press Escape multiple times to exit and say "Yes" to save
## Compiling the Project
`make -j4 all`
`idf.py build`
... will compile app, bootloader and generate a partition table based on the config.
NOTE: The `-j4` option causes `make` to run 4 parallel jobs. This is much faster than the default single job. The recommended number to pass to this option is `-j(number of CPUs + 1)`.
## Flashing the Project
When the build finishes, it will print a command line to use esptool.py to flash the chip. However you can also do this automatically by running:
`make -j4 flash`
`idf.py -p PORT flash`
This will flash the entire project (app, bootloader and partition table) to a new chip. The settings for serial port flashing can be configured with `make menuconfig`.
Replace PORT with the name of your serial port (like `COM3` on Windows, `/dev/ttyUSB0` on Linux, or `/dev/cu.usbserial-X` on MacOS. If the `-p` option is left out, `idf.py flash` will try to flash the first available serial port.
You don't need to run `make all` before running `make flash`, `make flash` will automatically rebuild anything which needs it.
This will flash the entire project (app, bootloader and partition table) to a new chip. The settings for serial port flashing can be configured with `idf.py menuconfig`.
You don't need to run `idf.py build` before running `idf.py flash`, `idf.py flash` will automatically rebuild anything which needs it.
## Viewing Serial Output
The `make monitor` target uses the [idf_monitor tool](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/idf-monitor.html) to display serial output from the ESP32. idf_monitor also has a range of features to decode crash output and interact with the device. [Check the documentation page for details](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/idf-monitor.html).
The `idf.py monitor` target uses the [idf_monitor tool](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/idf-monitor.html) to display serial output from the ESP32. idf_monitor also has a range of features to decode crash output and interact with the device. [Check the documentation page for details](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/idf-monitor.html).
Exit the monitor by typing Ctrl-].
To build, flash and monitor output in one pass, you can run:
`make -j4 flash monitor`
`idf.py flash monitor`
## Compiling & Flashing Only the App
After the initial flash, you may just want to build and flash just your app, not the bootloader and partition table:
* `make app` - build just the app.
* `make app-flash` - flash just the app.
* `idf.py app` - build just the app.
* `idf.py app-flash` - flash just the app.
`make app-flash` will automatically rebuild the app if any source files have changed.
`idf.py app-flash` will automatically rebuild the app if any source files have changed.
(In normal development there's no downside to reflashing the bootloader and partition table each time, if they haven't changed.)
## Parallel Builds
ESP-IDF supports compiling multiple files in parallel, so all of the above commands can be run as `make -jN` where `N` is the number of parallel make processes to run (generally N should be equal to the number of CPU cores in your system, plus one.)
Multiple make functions can be combined into one. For example: to build the app & bootloader using 5 jobs in parallel, then flash everything, and then display serial output from the ESP32 run:
```
make -j5 flash monitor
```
## The Partition Table
Once you've compiled your project, the "build" directory will contain a binary file with a name like "my_app.bin". This is an ESP32 image binary that can be loaded by the bootloader.
A single ESP32's flash can contain multiple apps, as well as many different kinds of data (calibration data, filesystems, parameter storage, etc). For this reason a partition table is flashed to offset 0x8000 in the flash.
Each entry in the partition table has a name (label), type (app, data, or something else), subtype and the offset in flash where the partition is loaded.
The simplest way to use the partition table is to `make menuconfig` and choose one of the simple predefined partition tables:
* "Single factory app, no OTA"
* "Factory app, two OTA definitions"
In both cases the factory app is flashed at offset 0x10000. If you `make partition_table` then it will print a summary of the partition table.
For more details about partition tables and how to create custom variations, view the [`docs/en/api-guides/partition-tables.rst`](docs/en/api-guides/partition-tables.rst) file.
## Erasing Flash
The `make flash` target does not erase the entire flash contents. However it is sometimes useful to set the device back to a totally erased state, particularly when making partition table changes or OTA app updates. To erase the entire flash, run `make erase_flash`.
The `idf.py flash` target does not erase the entire flash contents. However it is sometimes useful to set the device back to a totally erased state, particularly when making partition table changes or OTA app updates. To erase the entire flash, run `idf.py erase_flash`.
This can be combined with other targets, ie `make erase_flash flash` will erase everything and then re-flash the new app, bootloader and partition table.
This can be combined with other targets, ie `idf.py -p PORT erase_flash flash` will erase everything and then re-flash the new app, bootloader and partition table.
# Resources

View File

@ -9,8 +9,7 @@
if [ -z ${IDF_PATH} ]; then
echo "IDF_PATH must be set before including this script."
else
IDF_ADD_PATHS_EXTRAS=
IDF_ADD_PATHS_EXTRAS="${IDF_ADD_PATHS_EXTRAS}:${IDF_PATH}/components/esptool_py/esptool"
IDF_ADD_PATHS_EXTRAS="${IDF_PATH}/components/esptool_py/esptool"
IDF_ADD_PATHS_EXTRAS="${IDF_ADD_PATHS_EXTRAS}:${IDF_PATH}/components/espcoredump"
IDF_ADD_PATHS_EXTRAS="${IDF_ADD_PATHS_EXTRAS}:${IDF_PATH}/components/partition_table/"
IDF_ADD_PATHS_EXTRAS="${IDF_ADD_PATHS_EXTRAS}:${IDF_PATH}/tools/"

View File

@ -1,29 +1,36 @@
set(COMPONENT_SRCS "app_trace.c"
"app_trace_util.c"
"host_file_io.c"
"gcov/gcov_rtio.c")
set(COMPONENT_ADD_INCLUDEDIRS "include")
set(srcs
"app_trace.c"
"app_trace_util.c"
"host_file_io.c"
"gcov/gcov_rtio.c")
set(include_dirs "include")
if(CONFIG_SYSVIEW_ENABLE)
list(APPEND COMPONENT_ADD_INCLUDEDIRS
list(APPEND include_dirs
sys_view/Config
sys_view/SEGGER
sys_view/Sample/OS)
list(APPEND COMPONENT_SRCS "sys_view/SEGGER/SEGGER_SYSVIEW.c"
"sys_view/Sample/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c"
"sys_view/Sample/OS/SEGGER_SYSVIEW_FreeRTOS.c"
"sys_view/esp32/SEGGER_RTT_esp32.c")
list(APPEND srcs
"sys_view/SEGGER/SEGGER_SYSVIEW.c"
"sys_view/Sample/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c"
"sys_view/Sample/OS/SEGGER_SYSVIEW_FreeRTOS.c"
"sys_view/esp32/SEGGER_RTT_esp32.c"
"sys_view/ext/heap_trace_module.c"
"sys_view/ext/logging.c")
endif()
set(COMPONENT_REQUIRES)
set(COMPONENT_PRIV_REQUIRES xtensa-debug-module)
set(COMPONENT_ADD_LDFRAGMENTS linker.lf)
if(CONFIG_HEAP_TRACING_TOHOST)
list(APPEND srcs "heap_trace_tohost.c")
endif()
register_component()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
PRIV_REQUIRES soc
LDFRAGMENTS linker.lf)
# disable --coverage for this component, as it is used as transport
# for gcov
component_compile_options("-fno-profile-arcs" "-fno-test-coverage")
target_link_libraries(${COMPONENT_TARGET} gcov)
target_compile_options(${COMPONENT_LIB} PRIVATE "-fno-profile-arcs" "-fno-test-coverage")
target_link_libraries(${COMPONENT_LIB} PUBLIC gcov ${LIBC} ${LIBM} gcc)

View File

@ -16,8 +16,8 @@ menu "Application Level Tracing"
config ESP32_APPTRACE_ENABLE
bool
depends on !ESP32_TRAX
select MEMMAP_TRACEMEM
select MEMMAP_TRACEMEM_TWOBANKS
select ESP32_MEMMAP_TRACEMEM
select ESP32_MEMMAP_TRACEMEM_TWOBANKS
default n
help
Enables/disable application tracing module.
@ -37,7 +37,7 @@ menu "Application Level Tracing"
Timeout for flushing last trace data to host in case of panic. In ms.
Use -1 to disable timeout and wait forever.
config ESP32_APPTRACE_POSTMORTEM_FLUSH_TRAX_THRESH
config ESP32_APPTRACE_POSTMORTEM_FLUSH_THRESH
int "Threshold for flushing last trace data to host on panic"
depends on ESP32_APPTRACE_DEST_TRAX
range 0 16384
@ -107,6 +107,14 @@ menu "Application Level Tracing"
help
Configures maximum supported tasks in sysview debug
config SYSVIEW_BUF_WAIT_TMO
int "Trace buffer wait timeout"
depends on SYSVIEW_ENABLE
default 500
help
Configures timeout (in us) to wait for free space in trace buffer.
Set to -1 to wait forever and avoid lost events.
config SYSVIEW_EVT_OVERFLOW_ENABLE
bool "Trace Buffer Overflow Event"
depends on SYSVIEW_ENABLE

View File

@ -75,7 +75,8 @@
// trace data are necessary, e.g. for analyzing crashes. On panic the latest data from current input block are exposed to host and host can read them.
// It can happen that system panic occurs when there are very small amount of data which are not exposed to host yet (e.g. crash just after the
// TRAX block switch). In this case the previous 16KB of collected data will be dropped and host will see the latest, but very small piece of trace.
// It can be insufficient to diagnose the problem. To avoid such situations there is menuconfig option CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_TRAX_THRESH
// It can be insufficient to diagnose the problem. To avoid such situations there is menuconfig option
// CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_THRESH
// which controls the threshold for flushing data in case of panic.
// - Streaming mode. Tracing module enters this mode when host connects to target and sets respective bits in control registers (per core).
// In this mode before switching the block tracing module waits for the host to read all the data from the previously exposed block.
@ -159,8 +160,7 @@
#include "soc/dport_reg.h"
#include "eri.h"
#include "trax.h"
#include "soc/timer_group_struct.h"
#include "soc/timer_group_reg.h"
#include "soc/timer_periph.h"
#include "freertos/FreeRTOS.h"
#include "esp_app_trace.h"
@ -929,6 +929,9 @@ esp_err_t esp_apptrace_read(esp_apptrace_dest_t dest, void *buf, uint32_t *size,
ESP_APPTRACE_LOGE("Trace destinations other then TRAX are not supported yet!");
return ESP_ERR_NOT_SUPPORTED;
}
if (buf == NULL || size == NULL || *size == 0) {
return ESP_ERR_INVALID_ARG;
}
//TODO: callback system
esp_apptrace_tmo_init(&tmo, user_tmo);
@ -963,8 +966,10 @@ uint8_t *esp_apptrace_down_buffer_get(esp_apptrace_dest_t dest, uint32_t *size,
ESP_APPTRACE_LOGE("Trace destinations other then TRAX are not supported yet!");
return NULL;
}
if (size == NULL || *size == 0) {
return NULL;
}
// ESP_APPTRACE_LOGE("esp_apptrace_down_buffer_get %d", *size);
esp_apptrace_tmo_init(&tmo, user_tmo);
return hw->get_down_buffer(size, &tmo);
}
@ -985,6 +990,9 @@ esp_err_t esp_apptrace_down_buffer_put(esp_apptrace_dest_t dest, uint8_t *ptr, u
ESP_APPTRACE_LOGE("Trace destinations other then TRAX are not supported yet!");
return ESP_ERR_NOT_SUPPORTED;
}
if (ptr == NULL) {
return ESP_ERR_INVALID_ARG;
}
esp_apptrace_tmo_init(&tmo, user_tmo);
return hw->put_down_buffer(ptr, &tmo);
@ -1007,6 +1015,9 @@ esp_err_t esp_apptrace_write(esp_apptrace_dest_t dest, const void *data, uint32_
ESP_APPTRACE_LOGE("Trace destinations other then TRAX are not supported yet!");
return ESP_ERR_NOT_SUPPORTED;
}
if (data == NULL || size == 0) {
return ESP_ERR_INVALID_ARG;
}
esp_apptrace_tmo_init(&tmo, user_tmo);
ptr = hw->get_up_buffer(size, &tmo);
@ -1040,6 +1051,9 @@ int esp_apptrace_vprintf_to(esp_apptrace_dest_t dest, uint32_t user_tmo, const c
ESP_APPTRACE_LOGE("Trace destinations other then TRAX are not supported yet!");
return ESP_ERR_NOT_SUPPORTED;
}
if (fmt == NULL) {
return ESP_ERR_INVALID_ARG;
}
esp_apptrace_tmo_init(&tmo, user_tmo);
ESP_APPTRACE_LOGD("fmt %x", fmt);
@ -1101,6 +1115,9 @@ uint8_t *esp_apptrace_buffer_get(esp_apptrace_dest_t dest, uint32_t size, uint32
ESP_APPTRACE_LOGE("Trace destinations other then TRAX are not supported yet!");
return NULL;
}
if (size == 0) {
return NULL;
}
esp_apptrace_tmo_init(&tmo, user_tmo);
return hw->get_up_buffer(size, &tmo);
@ -1122,6 +1139,9 @@ esp_err_t esp_apptrace_buffer_put(esp_apptrace_dest_t dest, uint8_t *ptr, uint32
ESP_APPTRACE_LOGE("Trace destinations other then TRAX are not supported yet!");
return ESP_ERR_NOT_SUPPORTED;
}
if (ptr == NULL) {
return ESP_ERR_INVALID_ARG;
}
esp_apptrace_tmo_init(&tmo, user_tmo);
return hw->put_up_buffer(ptr, &tmo);

View File

@ -15,7 +15,7 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_app_trace_util.h"
#include "esp_clk.h"
#include "esp32/clk.h"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////// TIMEOUT /////////////////////////////////////

View File

@ -23,7 +23,8 @@ COMPONENT_SRCDIRS += \
sys_view/SEGGER \
sys_view/Sample/OS \
sys_view/Sample/Config \
sys_view/esp32
sys_view/esp32 \
sys_view/ext
else
COMPONENT_SRCDIRS += gcov
endif

View File

@ -18,10 +18,9 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "soc/cpu.h"
#include "soc/timer_group_struct.h"
#include "soc/timer_group_reg.h"
#include "soc/timer_periph.h"
#include "esp_app_trace.h"
#include "esp_dbg_stubs.h"
#include "esp_private/dbg_stubs.h"
#if CONFIG_ESP32_GCOV_ENABLE

View File

@ -0,0 +1,114 @@
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <sdkconfig.h>
#define HEAP_TRACE_SRCFILE /* don't warn on inclusion here */
#include "esp_heap_trace.h"
#undef HEAP_TRACE_SRCFILE
#if CONFIG_SYSVIEW_ENABLE
#include "esp_app_trace.h"
#include "esp_sysview_trace.h"
#endif
#define STACK_DEPTH CONFIG_HEAP_TRACING_STACK_DEPTH
#ifdef CONFIG_HEAP_TRACING_TOHOST
#if !CONFIG_SYSVIEW_ENABLE
#error None of the heap tracing backends is enabled! You must enable SystemView compatible tracing to use this feature.
#endif
static bool s_tracing;
esp_err_t heap_trace_init_tohost()
{
if (s_tracing) {
return ESP_ERR_INVALID_STATE;
}
return ESP_OK;
}
esp_err_t heap_trace_start(heap_trace_mode_t mode_param)
{
#if CONFIG_SYSVIEW_ENABLE
esp_err_t ret = esp_sysview_heap_trace_start((uint32_t)-1);
if (ret != ESP_OK) {
return ret;
}
#endif
s_tracing = true;
return ESP_OK;
}
esp_err_t heap_trace_stop(void)
{
esp_err_t ret = ESP_ERR_NOT_SUPPORTED;
#if CONFIG_SYSVIEW_ENABLE
ret = esp_sysview_heap_trace_stop();
#endif
s_tracing = false;
return ret;
}
esp_err_t heap_trace_resume(void)
{
return heap_trace_start(HEAP_TRACE_ALL);
}
size_t heap_trace_get_count(void)
{
return 0;
}
esp_err_t heap_trace_get(size_t index, heap_trace_record_t *record)
{
return ESP_ERR_NOT_SUPPORTED;
}
void heap_trace_dump(void)
{
return;
}
/* Add a new allocation to the heap trace records */
static IRAM_ATTR void record_allocation(const heap_trace_record_t *record)
{
if (!s_tracing) {
return;
}
#if CONFIG_SYSVIEW_ENABLE
esp_sysview_heap_trace_alloc(record->address, record->size, record->alloced_by);
#endif
}
/* record a free event in the heap trace log
For HEAP_TRACE_ALL, this means filling in the freed_by pointer.
For HEAP_TRACE_LEAKS, this means removing the record from the log.
*/
static IRAM_ATTR void record_free(void *p, void **callers)
{
if (!s_tracing) {
return;
}
#if CONFIG_SYSVIEW_ENABLE
esp_sysview_heap_trace_free(p, callers);
#endif
}
#include "heap_trace.inc"
#endif /*CONFIG_HEAP_TRACING_TOHOST*/

View File

@ -145,6 +145,9 @@ void *esp_apptrace_fopen(esp_apptrace_dest_t dest, const char *path, const char
esp_apptrace_fopen_args_t cmd_args;
ESP_EARLY_LOGV(TAG, "esp_apptrace_fopen '%s' '%s'", path, mode);
if (path == NULL || mode == NULL) {
return 0;
}
cmd_args.path = path;
cmd_args.path_len = strlen(path) + 1;
@ -213,6 +216,10 @@ size_t esp_apptrace_fwrite(esp_apptrace_dest_t dest, const void *ptr, size_t siz
ESP_EARLY_LOGV(TAG, "esp_apptrace_fwrite f %p l %d", stream, size*nmemb);
if (ptr == NULL) {
return 0;
}
cmd_args.buf = (void *)ptr;
cmd_args.size = size * nmemb;
cmd_args.file = stream;
@ -248,6 +255,10 @@ size_t esp_apptrace_fread(esp_apptrace_dest_t dest, void *ptr, size_t size, size
ESP_EARLY_LOGV(TAG, "esp_apptrace_fread f %p l %d", stream, size*nmemb);
if (ptr == NULL) {
return 0;
}
cmd_args.size = size * nmemb;
cmd_args.file = stream;
esp_err_t ret = esp_apptrace_file_cmd_send(dest, ESP_APPTRACE_FILE_CMD_FREAD, esp_apptrace_fread_args_prepare,

View File

@ -0,0 +1,80 @@
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef ESP_SYSVIEW_TRACE_H_
#define ESP_SYSVIEW_TRACE_H_
#include <stdarg.h>
#include "esp_err.h"
#include "SEGGER_RTT.h" // SEGGER_RTT_ESP32_Flush
#include "esp_app_trace_util.h" // ESP_APPTRACE_TMO_INFINITE
/**
* @brief Flushes remaining data in SystemView trace buffer to host.
*
* @param tmo Timeout for operation (in us). Use ESP_APPTRACE_TMO_INFINITE to wait indefinetly.
*
* @return ESP_OK.
*/
static inline esp_err_t esp_sysview_flush(uint32_t tmo)
{
SEGGER_RTT_ESP32_Flush(0, tmo);
return ESP_OK;
}
/**
* @brief vprintf-like function to sent log messages to the host.
*
* @param format Address of format string.
* @param args List of arguments.
*
* @return Number of bytes written.
*/
int esp_sysview_vprintf(const char * format, va_list args);
/**
* @brief Starts SystemView heap tracing.
*
* @param tmo Timeout (in us) to wait for the host to be connected. Use -1 to wait forever.
*
* @return ESP_OK on success, ESP_ERR_TIMEOUT if operation has been timed out.
*/
esp_err_t esp_sysview_heap_trace_start(uint32_t tmo);
/**
* @brief Stops SystemView heap tracing.
*
* @return ESP_OK.
*/
esp_err_t esp_sysview_heap_trace_stop(void);
/**
* @brief Sends heap allocation event to the host.
*
* @param addr Address of allocated block.
* @param size Size of allocated block.
* @param callers Pointer to array with callstack addresses.
* Array size must be CONFIG_HEAP_TRACING_STACK_DEPTH.
*/
void esp_sysview_heap_trace_alloc(void *addr, uint32_t size, const void *callers);
/**
* @brief Sends heap de-allocation event to the host.
*
* @param addr Address of de-allocated block.
* @param callers Pointer to array with callstack addresses.
* Array size must be CONFIG_HEAP_TRACING_STACK_DEPTH.
*/
void esp_sysview_heap_trace_free(void *addr, const void *callers);
#endif //ESP_SYSVIEW_TRACE_H_

View File

@ -1,12 +1,18 @@
[mapping]
[mapping:app_trace]
archive: libapp_trace.a
entries:
* (noflash)
app_trace (noflash)
app_trace_util (noflash)
SEGGER_SYSVIEW (noflash)
SEGGER_RTT_esp32 (noflash)
SEGGER_SYSVIEW_Config_FreeRTOS (noflash)
SEGGER_SYSVIEW_FreeRTOS (noflash)
[mapping]
[mapping:driver]
archive: libdriver.a
entries:
: SYSVIEW_TS_SOURCE_TIMER_00 = y || SYSVIEW_TS_SOURCE_TIMER_01 = y
|| SYSVIEW_TS_SOURCE_TIMER_10 = y || SYSVIEW_TS_SOURCE_TIMER_11 = y
timer (noflash)
if SYSVIEW_TS_SOURCE_TIMER_00 = y || SYSVIEW_TS_SOURCE_TIMER_01 = y
|| SYSVIEW_TS_SOURCE_TIMER_10 = y || SYSVIEW_TS_SOURCE_TIMER_11 = y:
timer (noflash)
else:
* (default)

View File

@ -0,0 +1,23 @@
# idf_create_lcov_report
#
# Create coverage report.
function(idf_create_coverage_report report_dir)
set(gcov_tool ${CONFIG_SDK_TOOLPREFIX}gcov)
idf_build_get_property(project_name PROJECT_NAME)
add_custom_target(lcov-report
COMMENT "Generating coverage report in: ${report_dir}"
COMMAND ${CMAKE_COMMAND} -E echo "Using gcov: ${gcov_tool}"
COMMAND ${CMAKE_COMMAND} -E make_directory ${report_dir}/html
COMMAND lcov --gcov-tool ${gcov_tool} -c -d ${CMAKE_CURRENT_BINARY_DIR} -o ${report_dir}/${project_name}.info
COMMAND genhtml -o ${report_dir}/html ${report_dir}/${project_name}.info)
endfunction()
# idf_clean_coverage_report
#
# Clean coverage report.
function(idf_clean_coverage_report report_dir)
add_custom_target(cov-data-clean
COMMENT "Clean coverage report in: ${report_dir}"
COMMAND ${CMAKE_COMMAND} -E remove_directory ${report_dir})
endfunction()

View File

@ -0,0 +1,4 @@
# sdkconfig replacement configurations for deprecated options formatted as
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_TRAX_THRESH CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_THRESH

View File

@ -160,6 +160,7 @@ unsigned SEGGER_RTT_WriteSkipNoLock (unsigned BufferIndex, const voi
unsigned SEGGER_RTT_WriteString (unsigned BufferIndex, const char* s);
void SEGGER_RTT_WriteWithOverwriteNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
void SEGGER_RTT_ESP32_FlushNoLock (unsigned long min_sz, unsigned long tmo);
void SEGGER_RTT_ESP32_Flush (unsigned long min_sz, unsigned long tmo);
//
// Function macro for performance optimization
//

View File

@ -1689,6 +1689,10 @@ void SEGGER_SYSVIEW_Stop(void) {
RECORD_END();
}
U8 SEGGER_SYSVIEW_Started(void) {
return _SYSVIEW_Globals.EnableState;
}
/*********************************************************************
*
* SEGGER_SYSVIEW_GetSysDesc()
@ -2678,7 +2682,7 @@ void SEGGER_SYSVIEW_ErrorfTarget(const char* s, ...) {
void SEGGER_SYSVIEW_Print(const char* s) {
U8* pPayload;
U8* pPayloadStart;
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32 + SEGGER_SYSVIEW_MAX_STRING_LEN);
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32 + SEGGER_SYSVIEW_MAX_STRING_LEN + 3/*1 or 3 bytes for string length*/);
//
pPayload = _EncodeStr(pPayloadStart, s, SEGGER_SYSVIEW_MAX_STRING_LEN);
ENCODE_U32(pPayload, SEGGER_SYSVIEW_LOG);

View File

@ -230,6 +230,8 @@ void SEGGER_SYSVIEW_GetSysDesc (void);
void SEGGER_SYSVIEW_SendTaskList (void);
void SEGGER_SYSVIEW_SendTaskInfo (const SEGGER_SYSVIEW_TASKINFO* pInfo);
void SEGGER_SYSVIEW_SendSysDesc (const char* sSysDesc);
// Checks whether tracing has been started
U8 SEGGER_SYSVIEW_Started(void);
/*********************************************************************
*

View File

@ -63,11 +63,11 @@ Revision: $Rev: 3734 $
*/
#include "freertos/FreeRTOS.h"
#include "SEGGER_SYSVIEW.h"
#include "rom/ets_sys.h"
#include "esp32/rom/ets_sys.h"
#include "esp_app_trace.h"
#include "esp_app_trace_util.h"
#include "esp_intr_alloc.h"
#include "esp_clk.h"
#include "esp32/clk.h"
extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;

View File

@ -244,8 +244,10 @@ Notes:
#define traceQUEUE_SEND( pxQueue ) SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), 0, 0, xCopyPosition)
#endif
#define traceQUEUE_SEND_FAILED( pxQueue ) SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, xTicksToWait, xCopyPosition)
#define traceQUEUE_SEND_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiFastID_OFFSET + apiID_XQUEUEGENERICSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pxHigherPriorityTaskWoken)
#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiFastID_OFFSET + apiID_XQUEUEGENERICSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pxHigherPriorityTaskWoken)
#define traceQUEUE_SEND_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XQUEUEGENERICSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, (U32)pxHigherPriorityTaskWoken, xCopyPosition)
#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XQUEUEGENERICSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, (U32)pxHigherPriorityTaskWoken, xCopyPosition)
#define traceQUEUE_GIVE_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiFastID_OFFSET + apiID_XQUEUEGIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pxHigherPriorityTaskWoken)
#define traceQUEUE_GIVE_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiFastID_OFFSET + apiID_XQUEUEGIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pxHigherPriorityTaskWoken)
#if( portSTACK_GROWTH < 0 )
#define traceTASK_CREATE(pxNewTCB) if (pxNewTCB != NULL) { \

View File

@ -16,8 +16,9 @@
#include "freertos/FreeRTOS.h"
#include "SEGGER_RTT.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_Conf.h"
#include "rom/ets_sys.h"
#include "esp32/rom/ets_sys.h"
#include "esp_app_trace.h"
#include "esp_log.h"
@ -27,8 +28,12 @@ const static char *TAG = "segger_rtt";
// size of down channel data buf
#define SYSVIEW_DOWN_BUF_SIZE 32
#define SEGGER_HOST_WAIT_TMO 500 //us
#define SEGGER_STOP_WAIT_TMO 1000000 //us
#if CONFIG_SYSVIEW_BUF_WAIT_TMO == -1
#define SEGGER_HOST_WAIT_TMO ESP_APPTRACE_TMO_INFINITE
#else
#define SEGGER_HOST_WAIT_TMO CONFIG_SYSVIEW_BUF_WAIT_TMO
#endif
static uint8_t s_events_buf[SYSVIEW_EVENTS_BUF_SZ];
static uint16_t s_events_buf_filled;
@ -57,9 +62,12 @@ static uint8_t s_down_buf[SYSVIEW_DOWN_BUF_SIZE];
*/
void SEGGER_RTT_ESP32_FlushNoLock(unsigned long min_sz, unsigned long tmo)
{
esp_err_t res = esp_apptrace_write(ESP_APPTRACE_DEST_TRAX, s_events_buf, s_events_buf_filled, tmo);
if (res != ESP_OK) {
ESP_LOGE(TAG, "Failed to flush buffered events (%d)!\n", res);
esp_err_t res;
if (s_events_buf_filled > 0) {
res = esp_apptrace_write(ESP_APPTRACE_DEST_TRAX, s_events_buf, s_events_buf_filled, tmo);
if (res != ESP_OK) {
ESP_LOGE(TAG, "Failed to flush buffered events (%d)!\n", res);
}
}
// flush even if we failed to write buffered events, because no new events will be sent after STOP
res = esp_apptrace_flush_nolock(ESP_APPTRACE_DEST_TRAX, min_sz, tmo);
@ -69,6 +77,27 @@ void SEGGER_RTT_ESP32_FlushNoLock(unsigned long min_sz, unsigned long tmo)
s_events_buf_filled = 0;
}
/*********************************************************************
*
* SEGGER_RTT_ESP32_Flush()
*
* Function description
* Flushes buffered events.
*
* Parameters
* min_sz Threshold for flushing data. If current filling level is above this value, data will be flushed. TRAX destinations only.
* tmo Timeout for operation (in us). Use ESP_APPTRACE_TMO_INFINITE to wait indefinetly.
*
* Return value
* None.
*/
void SEGGER_RTT_ESP32_Flush(unsigned long min_sz, unsigned long tmo)
{
SEGGER_SYSVIEW_LOCK();
SEGGER_RTT_ESP32_FlushNoLock(min_sz, tmo);
SEGGER_SYSVIEW_UNLOCK();
}
/*********************************************************************
*
* SEGGER_RTT_ReadNoLock()

View File

@ -0,0 +1,100 @@
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stdint.h>
#include <sdkconfig.h>
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_RTT.h"
#include "esp_app_trace.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_log.h"
const static char *TAG = "sysview_heap_trace";
#ifdef CONFIG_HEAP_TRACING_STACK_DEPTH
#define CALLSTACK_SIZE CONFIG_HEAP_TRACING_STACK_DEPTH
#else
#define CALLSTACK_SIZE 0
#endif
static SEGGER_SYSVIEW_MODULE s_esp_sysview_heap_module = {
.sModule = "ESP32 SystemView Heap Tracing Module",
.NumEvents = 2,
};
static bool s_mod_registered;
esp_err_t esp_sysview_heap_trace_start(uint32_t tmo)
{
uint32_t tmo_ticks = tmo/(1000*portTICK_PERIOD_MS);
ESP_EARLY_LOGV(TAG, "%s", __func__);
do {
if (tmo != (uint32_t)-1) {
// Currently timeout implementation is simple and has granularity of 1 OS tick,
// so just count down the number of times to call vTaskDelay
if (tmo_ticks-- == 0) {
return ESP_ERR_TIMEOUT;
}
}
vTaskDelay(1);
} while(!SEGGER_SYSVIEW_Started());
SEGGER_SYSVIEW_RegisterModule(&s_esp_sysview_heap_module);
s_mod_registered = true;
return ESP_OK;
}
esp_err_t esp_sysview_heap_trace_stop(void)
{
ESP_EARLY_LOGV(TAG, "%s", __func__);
SEGGER_RTT_ESP32_Flush(0, ESP_APPTRACE_TMO_INFINITE);
return ESP_OK;
}
void esp_sysview_heap_trace_alloc(const void *addr, uint32_t size, const void *callers)
{
U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + (2+CALLSTACK_SIZE)*SEGGER_SYSVIEW_QUANTA_U32];
U8* pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket);
U32 *calls = (U32 *)callers;
if (!s_mod_registered) {
return;
}
ESP_EARLY_LOGV(TAG, "%s %p %lu", __func__, addr, size);
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, (U32)addr);
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, size);
for (int i = 0; i < CALLSTACK_SIZE; i++) {
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, calls[i]);
}
SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, s_esp_sysview_heap_module.EventOffset + 0);
}
void esp_sysview_heap_trace_free(const void *addr, const void *callers)
{
U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + (1+CALLSTACK_SIZE)*SEGGER_SYSVIEW_QUANTA_U32];
U8* pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket);
U32 *calls = (U32 *)callers;
if (!s_mod_registered) {
return;
}
ESP_EARLY_LOGV(TAG, "%s %p", __func__, addr);
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, (U32)addr);
for (int i = 0; i < CALLSTACK_SIZE; i++) {
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, calls[i]);
}
SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, s_esp_sysview_heap_module.EventOffset + 1);
}

View File

@ -0,0 +1,34 @@
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stdio.h>
#include <stdarg.h>
#include <sdkconfig.h>
#include "SEGGER_SYSVIEW_Int.h"
#include "freertos/FreeRTOS.h"
static portMUX_TYPE s_log_mutex = portMUX_INITIALIZER_UNLOCKED;
int esp_sysview_vprintf(const char * format, va_list args)
{
static char log_buffer[SEGGER_SYSVIEW_MAX_STRING_LEN];
portENTER_CRITICAL(&s_log_mutex);
size_t len = vsnprintf(log_buffer, sizeof(log_buffer), format, args);
if (len > sizeof(log_buffer) - 1) {
log_buffer[sizeof(log_buffer - 1)] = 0;
}
SEGGER_SYSVIEW_Print(log_buffer);
portEXIT_CRITICAL(&s_log_mutex);
return len;
}

View File

@ -1,6 +1,3 @@
set(COMPONENT_SRCDIRS ".")
set(COMPONENT_ADD_INCLUDEDIRS ".")
set(COMPONENT_REQUIRES unity)
register_component()
idf_component_register(SRC_DIRS "."
INCLUDE_DIRS "."
REQUIRES unity)

View File

@ -1,40 +1,57 @@
set(COMPONENT_SRCS "esp_ota_ops.c"
"esp_app_desc.c")
set(COMPONENT_ADD_INCLUDEDIRS "include")
idf_component_register(SRCS "esp_ota_ops.c"
"esp_app_desc.c"
INCLUDE_DIRS "include"
REQUIRES spi_flash partition_table bootloader_support)
set(COMPONENT_REQUIRES spi_flash partition_table bootloader_support)
register_component()
# esp_app_desc structure is added as an undefined symbol because otherwise the
# esp_app_desc structure is added as an undefined symbol because otherwise the
# linker will ignore this structure as it has no other files depending on it.
target_link_libraries(${COMPONENT_TARGET} "-u esp_app_desc")
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_app_desc")
# cut PROJECT_VER and PROJECT_NAME to required 32 characters.
string(SUBSTRING "${PROJECT_VER}" 0 31 PROJECT_VER_CUT)
string(SUBSTRING "${PROJECT_NAME}" 0 31 PROJECT_NAME_CUT)
idf_build_get_property(project_ver PROJECT_VER)
idf_build_get_property(project_name PROJECT_NAME)
string(SUBSTRING "${project_ver}" 0 31 PROJECT_VER_CUT)
string(SUBSTRING "${project_name}" 0 31 PROJECT_NAME_CUT)
set_source_files_properties(
SOURCE "esp_app_desc.c"
PROPERTIES COMPILE_DEFINITIONS
PROPERTIES COMPILE_DEFINITIONS
"PROJECT_VER=\"${PROJECT_VER_CUT}\"; PROJECT_NAME=\"${PROJECT_NAME_CUT}\"")
# Add custom target for generating empty otadata partition for flashing
if(OTADATA_PARTITION_OFFSET AND OTADATA_PARTITION_SIZE)
add_custom_command(OUTPUT "${IDF_BUILD_ARTIFACTS_DIR}/${BLANK_OTADATA_FILE}"
COMMAND ${PYTHON} ${IDF_PATH}/components/partition_table/parttool.py
--partition-type data --partition-subtype ota -q
--partition-table-file ${PARTITION_CSV_PATH} generate_blank_partition_file
--output "${IDF_BUILD_ARTIFACTS_DIR}/${BLANK_OTADATA_FILE}")
if(NOT BOOTLOADER_BUILD)
partition_table_get_partition_info(otadata_offset "--partition-type data --partition-subtype ota" "offset")
partition_table_get_partition_info(otadata_size "--partition-type data --partition-subtype ota" "size")
add_custom_target(blank_ota_data ALL DEPENDS "${IDF_BUILD_ARTIFACTS_DIR}/${BLANK_OTADATA_FILE}")
add_dependencies(flash blank_ota_data)
# Add custom target for generating empty otadata partition for flashing
if(otadata_size AND otadata_offset)
idf_build_get_property(build_dir BUILD_DIR)
set(blank_otadata_file ${build_dir}/ota_data_initial.bin)
idf_build_get_property(idf_path IDF_PATH)
idf_build_get_property(python PYTHON)
add_custom_command(OUTPUT ${blank_otadata_file}
COMMAND ${python} ${idf_path}/components/partition_table/gen_empty_partition.py
${otadata_size} ${blank_otadata_file})
add_custom_target(blank_ota_data ALL DEPENDS ${blank_otadata_file})
add_dependencies(flash blank_ota_data)
set(otatool_py ${python} ${COMPONENT_DIR}/otatool.py)
set(esptool_args --esptool-args before=${CONFIG_ESPTOOLPY_BEFORE} after=${CONFIG_ESPTOOLPY_AFTER})
add_custom_target(read_otadata DEPENDS "${PARTITION_CSV_PATH}"
COMMAND ${otatool_py} ${esptool_args}
--partition-table-file ${PARTITION_CSV_PATH}
--partition-table-offset ${PARTITION_TABLE_OFFSET}
read_otadata)
add_custom_target(erase_otadata DEPENDS "${PARTITION_CSV_PATH}"
COMMAND ${otatool_py} ${esptool_args}
--partition-table-file ${PARTITION_CSV_PATH}
--partition-table-offset ${PARTITION_TABLE_OFFSET}
erase_otadata)
esptool_py_flash_project_args(otadata ${otadata_offset} "${blank_otadata_file}" FLASH_IN_PROJECT)
endif()
endif()
set(otatool_py ${PYTHON} ${COMPONENT_PATH}/otatool.py)
add_custom_target(read_otadata DEPENDS "${PARTITION_CSV_PATH}"
COMMAND ${otatool_py} --partition-table-file ${PARTITION_CSV_PATH} read_otadata)
add_custom_target(erase_otadata DEPENDS "${PARTITION_CSV_PATH}"
COMMAND ${otatool_py} --partition-table-file ${PARTITION_CSV_PATH} erase_otadata)

View File

@ -8,10 +8,16 @@ PARTTOOL_PY := $(PYTHON) $(IDF_PATH)/components/partition_table/parttool.py
# Generate blank partition file
BLANK_OTA_DATA_FILE = $(BUILD_DIR_BASE)/ota_data_initial.bin
$(BLANK_OTA_DATA_FILE): partition_table_get_info $(PARTITION_TABLE_BIN) | check_python_dependencies
# Copy PARTITION_TABLE_CSV_PATH definition here from $IDF_PATH/components/partition_table/Makefile.projbuild
# to avoid undefined variables warning for PARTITION_TABLE_CSV_PATH
ifndef PARTITION_TABLE_CSV_PATH
PARTITION_TABLE_ROOT := $(call dequote,$(if $(CONFIG_PARTITION_TABLE_CUSTOM),$(PROJECT_PATH),$(IDF_PATH)/components/partition_table))
PARTITION_TABLE_CSV_PATH := $(call dequote,$(abspath $(PARTITION_TABLE_ROOT)/$(call dequote,$(CONFIG_PARTITION_TABLE_FILENAME))))
endif
$(BLANK_OTA_DATA_FILE): partition_table_get_info $(PARTITION_TABLE_CSV_PATH) | check_python_dependencies
$(shell if [ "$(OTA_DATA_OFFSET)" != "" ] && [ "$(OTA_DATA_SIZE)" != "" ]; then \
$(PARTTOOL_PY) --partition-type data --partition-subtype ota --partition-table-file $(PARTITION_TABLE_BIN) \
-q generate_blank_partition_file --output $(BLANK_OTA_DATA_FILE); \
$(PYTHON) $(IDF_PATH)/components/partition_table/gen_empty_partition.py $(OTA_DATA_SIZE) $(BLANK_OTA_DATA_FILE); \
fi; )
$(eval BLANK_OTA_DATA_FILE = $(shell if [ "$(OTA_DATA_OFFSET)" != "" ] && [ "$(OTA_DATA_SIZE)" != "" ]; then \
echo $(BLANK_OTA_DATA_FILE); else echo " "; fi) )
@ -22,17 +28,26 @@ blank_ota_data: $(BLANK_OTA_DATA_FILE)
# expand to empty values.
ESPTOOL_ALL_FLASH_ARGS += $(OTA_DATA_OFFSET) $(BLANK_OTA_DATA_FILE)
erase_otadata: $(PARTITION_TABLE_BIN) partition_table_get_info | check_python_dependencies
$(OTATOOL_PY) --partition-table-file $(PARTITION_TABLE_BIN) erase_otadata
ESPTOOL_ARGS := --esptool-args port=$(CONFIG_ESPTOOLPY_PORT) baud=$(CONFIG_ESPTOOLPY_BAUD) before=$(CONFIG_ESPTOOLPY_BEFORE) after=$(CONFIG_ESPTOOLPY_AFTER)
read_otadata: $(PARTITION_TABLE_BIN) partition_table_get_info | check_python_dependencies
$(OTATOOL_PY) --partition-table-file $(PARTITION_TABLE_BIN) read_otadata
erase_otadata: $(PARTITION_TABLE_CSV_PATH) partition_table_get_info | check_python_dependencies
$(OTATOOL_PY) $(ESPTOOL_ARGS) --partition-table-file $(PARTITION_TABLE_CSV_PATH) \
--partition-table-offset $(PARTITION_TABLE_OFFSET) \
erase_otadata
read_otadata: $(PARTITION_TABLE_CSV_PATH) partition_table_get_info | check_python_dependencies
$(OTATOOL_PY) $(ESPTOOL_ARGS) --partition-table-file $(PARTITION_TABLE_CSV_PATH) \
--partition-table-offset $(partition_table_offset) \
read_otadata
erase_ota: erase_otadata
@echo "WARNING: erase_ota is deprecated. Use erase_otadata instead."
all: blank_ota_data
flash: blank_ota_data
ifdef CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
encrypted-flash: blank_ota_data
endif
TMP_DEFINES := $(BUILD_DIR_BASE)/app_update/tmp_cppflags.txt
export TMP_DEFINES

View File

@ -34,8 +34,8 @@ const __attribute__((section(".rodata_desc"))) esp_app_desc_t esp_app_desc = {
#endif
.idf_ver = IDF_VER,
#ifdef CONFIG_APP_SECURE_VERSION
.secure_version = CONFIG_APP_SECURE_VERSION,
#ifdef CONFIG_BOOTLOADER_APP_SECURE_VERSION
.secure_version = CONFIG_BOOTLOADER_APP_SECURE_VERSION,
#else
.secure_version = 0,
#endif

View File

@ -32,11 +32,10 @@
#include "sdkconfig.h"
#include "esp_ota_ops.h"
#include "rom/queue.h"
#include "rom/crc.h"
#include "soc/dport_reg.h"
#include "sys/queue.h"
#include "esp32/rom/crc.h"
#include "esp_log.h"
#include "esp_flash_data_types.h"
#include "esp_flash_partitions.h"
#include "bootloader_common.h"
#include "sys/param.h"
#include "esp_system.h"
@ -108,19 +107,12 @@ static esp_err_t image_validate(const esp_partition_t *partition, esp_image_load
return ESP_ERR_OTA_VALIDATE_FAILED;
}
#ifdef CONFIG_SECURE_SIGNED_ON_UPDATE
esp_err_t ret = esp_secure_boot_verify_signature(partition->address, data.image_len);
if (ret != ESP_OK) {
return ESP_ERR_OTA_VALIDATE_FAILED;
}
#endif
return ESP_OK;
}
static esp_ota_img_states_t set_new_state_otadata(void)
{
#ifdef CONFIG_APP_ROLLBACK_ENABLE
#ifdef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
ESP_LOGD(TAG, "Monitoring the first boot of the app is enabled.");
return ESP_OTA_IMG_NEW;
#else
@ -151,7 +143,7 @@ esp_err_t esp_ota_begin(const esp_partition_t *partition, size_t image_size, esp
return ESP_ERR_OTA_PARTITION_CONFLICT;
}
#ifdef CONFIG_APP_ROLLBACK_ENABLE
#ifdef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
esp_ota_img_states_t ota_state_running_part;
if (esp_ota_get_state_partition(running_partition, &ota_state_running_part) == ESP_OK) {
if (ota_state_running_part == ESP_OTA_IMG_PENDING_VERIFY) {
@ -401,7 +393,7 @@ esp_err_t esp_ota_set_boot_partition(const esp_partition_t *partition)
return ESP_ERR_NOT_FOUND;
}
} else {
#ifdef CONFIG_APP_ANTI_ROLLBACK
#ifdef CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
esp_app_desc_t partition_app_desc;
esp_err_t err = esp_ota_get_partition_description(partition, &partition_app_desc);
if (err != ESP_OK) {
@ -589,7 +581,7 @@ esp_err_t esp_ota_get_partition_description(const esp_partition_t *partition, es
return ESP_OK;
}
#ifdef CONFIG_APP_ANTI_ROLLBACK
#ifdef CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
static esp_err_t esp_ota_set_anti_rollback(void) {
const esp_app_desc_t *app_desc = esp_ota_get_app_description();
return esp_efuse_update_secure_version(app_desc->secure_version);
@ -621,7 +613,7 @@ bool esp_ota_check_rollback_is_possible(void)
int last_active_ota = (~active_ota)&1;
const esp_partition_t *partition = NULL;
#ifndef CONFIG_APP_ANTI_ROLLBACK
#ifndef CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
if (valid_otadata[last_active_ota] == false) {
partition = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_FACTORY, NULL);
if (partition != NULL) {
@ -637,7 +629,7 @@ bool esp_ota_check_rollback_is_possible(void)
partition = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_OTA_MIN + slot, NULL);
if (partition != NULL) {
if(image_validate(partition, ESP_IMAGE_VERIFY_SILENT) == ESP_OK) {
#ifdef CONFIG_APP_ANTI_ROLLBACK
#ifdef CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
esp_app_desc_t app_desc;
if (esp_ota_get_partition_description(partition, &app_desc) == ESP_OK &&
esp_efuse_check_secure_version(app_desc.secure_version) == true) {
@ -668,7 +660,7 @@ static esp_err_t esp_ota_current_ota_is_workable(bool valid)
otadata[active_otadata].ota_state = ESP_OTA_IMG_VALID;
ESP_LOGD(TAG, "OTA[current] partition is marked as VALID");
esp_err_t err = rewrite_ota_seq(otadata, otadata[active_otadata].ota_seq, active_otadata, otadata_partition);
#ifdef CONFIG_APP_ANTI_ROLLBACK
#ifdef CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
if (err == ESP_OK) {
return esp_ota_set_anti_rollback();
}

View File

@ -21,7 +21,7 @@
#include "esp_err.h"
#include "esp_partition.h"
#include "esp_image_format.h"
#include "esp_flash_data_types.h"
#include "esp_flash_partitions.h"
#ifdef __cplusplus
extern "C"

View File

@ -21,16 +21,20 @@ import argparse
import os
import sys
import binascii
import subprocess
import tempfile
import collections
import struct
__version__ = '1.0'
try:
from parttool import PartitionName, PartitionType, ParttoolTarget, PARTITION_TABLE_OFFSET
except ImportError:
COMPONENTS_PATH = os.path.expandvars(os.path.join("$IDF_PATH", "components"))
PARTTOOL_DIR = os.path.join(COMPONENTS_PATH, "partition_table")
IDF_COMPONENTS_PATH = os.path.expandvars(os.path.join("$IDF_PATH", "components"))
sys.path.append(PARTTOOL_DIR)
from parttool import PartitionName, PartitionType, ParttoolTarget, PARTITION_TABLE_OFFSET
PARTTOOL_PY = os.path.join(IDF_COMPONENTS_PATH, "partition_table", "parttool.py")
__version__ = '2.0'
SPI_FLASH_SEC_SIZE = 0x2000
@ -42,121 +46,72 @@ def status(msg):
print(msg)
def _invoke_parttool(parttool_args, args, output=False, partition=None):
invoke_args = []
class OtatoolTarget():
if partition:
invoke_args += [sys.executable, PARTTOOL_PY] + partition
else:
invoke_args += [sys.executable, PARTTOOL_PY, "--partition-type", "data", "--partition-subtype", "ota"]
OTADATA_PARTITION = PartitionType("data", "ota")
if quiet:
invoke_args += ["-q"]
def __init__(self, port=None, baud=None, partition_table_offset=PARTITION_TABLE_OFFSET, partition_table_file=None,
spi_flash_sec_size=SPI_FLASH_SEC_SIZE, esptool_args=[], esptool_write_args=[],
esptool_read_args=[], esptool_erase_args=[]):
self.target = ParttoolTarget(port, baud, partition_table_offset, partition_table_file, esptool_args,
esptool_write_args, esptool_read_args, esptool_erase_args)
self.spi_flash_sec_size = spi_flash_sec_size
if args.port != "":
invoke_args += ["--port", args.port]
temp_file = tempfile.NamedTemporaryFile(delete=False)
temp_file.close()
try:
self.target.read_partition(OtatoolTarget.OTADATA_PARTITION, temp_file.name)
with open(temp_file.name, "rb") as f:
self.otadata = f.read()
except Exception:
self.otadata = None
finally:
os.unlink(temp_file.name)
if args.partition_table_file:
invoke_args += ["--partition-table-file", args.partition_table_file]
def _check_otadata_partition(self):
if not self.otadata:
raise Exception("No otadata partition found")
if args.partition_table_offset:
invoke_args += ["--partition-table-offset", args.partition_table_offset]
def erase_otadata(self):
self._check_otadata_partition()
self.target.erase_partition(OtatoolTarget.OTADATA_PARTITION)
invoke_args += parttool_args
def _get_otadata_info(self):
info = []
if output:
return subprocess.check_output(invoke_args)
else:
return subprocess.check_call(invoke_args)
otadata_info = collections.namedtuple("otadata_info", "seq crc")
for i in range(2):
start = i * (self.spi_flash_sec_size >> 1)
def _get_otadata_contents(args, check=True):
global quiet
seq = bytearray(self.otadata[start:start + 4])
crc = bytearray(self.otadata[start + 28:start + 32])
if check:
check_args = ["get_partition_info", "--info", "offset", "size"]
seq = struct.unpack('>I', seq)
crc = struct.unpack('>I', crc)
quiet = True
output = _invoke_parttool(check_args, args, True).split(b" ")
quiet = args.quiet
info.append(otadata_info(seq[0], crc[0]))
if not output:
raise RuntimeError("No ota_data partition found")
return info
with tempfile.NamedTemporaryFile(delete=False) as f:
f_name = f.name
def _get_partition_id_from_ota_id(self, ota_id):
if isinstance(ota_id, int):
return PartitionType("app", "ota_" + str(ota_id))
else:
return PartitionName(ota_id)
try:
invoke_args = ["read_partition", "--output", f_name]
_invoke_parttool(invoke_args, args)
with open(f_name, "rb") as f:
contents = f.read()
finally:
os.unlink(f_name)
def switch_ota_partition(self, ota_id):
self._check_otadata_partition()
return contents
sys.path.append(PARTTOOL_DIR)
import gen_esp32part as gen
def _get_otadata_status(otadata_contents):
status = []
otadata_status = collections.namedtuple("otadata_status", "seq crc")
for i in range(2):
start = i * (SPI_FLASH_SEC_SIZE >> 1)
seq = bytearray(otadata_contents[start:start + 4])
crc = bytearray(otadata_contents[start + 28:start + 32])
seq = struct.unpack('>I', seq)
crc = struct.unpack('>I', crc)
status.append(otadata_status(seq[0], crc[0]))
return status
def read_otadata(args):
status("Reading ota_data partition contents...")
otadata_info = _get_otadata_contents(args)
otadata_info = _get_otadata_status(otadata_info)
print(otadata_info)
print("\t\t{:11}\t{:8s}|\t{:8s}\t{:8s}".format("OTA_SEQ", "CRC", "OTA_SEQ", "CRC"))
print("Firmware: 0x{:8x} \t 0x{:8x} |\t0x{:8x} \t 0x{:8x}".format(otadata_info[0].seq, otadata_info[0].crc,
otadata_info[1].seq, otadata_info[1].crc))
def erase_otadata(args):
status("Erasing ota_data partition contents...")
_invoke_parttool(["erase_partition"], args)
status("Erased ota_data partition contents")
def switch_otadata(args):
sys.path.append(os.path.join(IDF_COMPONENTS_PATH, "partition_table"))
import gen_esp32part as gen
with tempfile.NamedTemporaryFile(delete=False) as f:
f_name = f.name
try:
def is_otadata_status_valid(status):
def is_otadata_info_valid(status):
seq = status.seq % (1 << 32)
crc = hex(binascii.crc32(struct.pack("I", seq), 0xFFFFFFFF) % (1 << 32))
return seq < (int('0xFFFFFFFF', 16) % (1 << 32)) and status.crc == crc
status("Looking for ota app partitions...")
# In order to get the number of ota app partitions, we need the partition table
partition_table = None
invoke_args = ["get_partition_info", "--table", f_name]
_invoke_parttool(invoke_args, args)
partition_table = open(f_name, "rb").read()
partition_table = gen.PartitionTable.from_binary(partition_table)
partition_table = self.target.partition_table
ota_partitions = list()
@ -171,39 +126,36 @@ def switch_otadata(args):
ota_partitions = sorted(ota_partitions, key=lambda p: p.subtype)
if not ota_partitions:
raise RuntimeError("No ota app partitions found")
status("Verifying partition to switch to exists...")
raise Exception("No ota app partitions found")
# Look for the app partition to switch to
ota_partition_next = None
try:
if args.name:
ota_partition_next = filter(lambda p: p.name == args.name, ota_partitions)
if isinstance(ota_id, int):
ota_partition_next = filter(lambda p: p.subtype - gen.MIN_PARTITION_SUBTYPE_APP_OTA == ota_id, ota_partitions)
else:
ota_partition_next = filter(lambda p: p.subtype - gen.MIN_PARTITION_SUBTYPE_APP_OTA == args.slot, ota_partitions)
ota_partition_next = filter(lambda p: p.name == ota_id, ota_partitions)
ota_partition_next = list(ota_partition_next)[0]
except IndexError:
raise RuntimeError("Partition to switch to not found")
raise Exception("Partition to switch to not found")
otadata_contents = _get_otadata_contents(args)
otadata_status = _get_otadata_status(otadata_contents)
otadata_info = self._get_otadata_info()
# Find the copy to base the computation for ota sequence number on
otadata_compute_base = -1
# Both are valid, take the max as computation base
if is_otadata_status_valid(otadata_status[0]) and is_otadata_status_valid(otadata_status[1]):
if otadata_status[0].seq >= otadata_status[1].seq:
if is_otadata_info_valid(otadata_info[0]) and is_otadata_info_valid(otadata_info[1]):
if otadata_info[0].seq >= otadata_info[1].seq:
otadata_compute_base = 0
else:
otadata_compute_base = 1
# Only one copy is valid, use that
elif is_otadata_status_valid(otadata_status[0]):
elif is_otadata_info_valid(otadata_info[0]):
otadata_compute_base = 0
elif is_otadata_status_valid(otadata_status[1]):
elif is_otadata_info_valid(otadata_info[1]):
otadata_compute_base = 1
# Both are invalid (could be initial state - all 0xFF's)
else:
@ -216,7 +168,7 @@ def switch_otadata(args):
# Find the next ota sequence number
if otadata_compute_base == 0 or otadata_compute_base == 1:
base_seq = otadata_status[otadata_compute_base].seq % (1 << 32)
base_seq = otadata_info[otadata_compute_base].seq % (1 << 32)
i = 0
while base_seq > target_seq % ota_partitions_num + i * ota_partitions_num:
@ -231,47 +183,68 @@ def switch_otadata(args):
ota_seq_crc_next = binascii.crc32(ota_seq_next, 0xFFFFFFFF) % (1 << 32)
ota_seq_crc_next = struct.pack("I", ota_seq_crc_next)
with open(f_name, "wb") as otadata_next_file:
start = (1 if otadata_compute_base == 0 else 0) * (SPI_FLASH_SEC_SIZE >> 1)
temp_file = tempfile.NamedTemporaryFile(delete=False)
temp_file.close()
otadata_next_file.write(otadata_contents)
try:
with open(temp_file.name, "wb") as otadata_next_file:
start = (1 if otadata_compute_base == 0 else 0) * (self.spi_flash_sec_size >> 1)
otadata_next_file.seek(start)
otadata_next_file.write(ota_seq_next)
otadata_next_file.write(self.otadata)
otadata_next_file.seek(start + 28)
otadata_next_file.write(ota_seq_crc_next)
otadata_next_file.seek(start)
otadata_next_file.write(ota_seq_next)
otadata_next_file.flush()
otadata_next_file.seek(start + 28)
otadata_next_file.write(ota_seq_crc_next)
_invoke_parttool(["write_partition", "--input", f_name], args)
status("Updated ota_data partition")
finally:
os.unlink(f_name)
otadata_next_file.flush()
self.target.write_partition(OtatoolTarget.OTADATA_PARTITION, temp_file.name)
finally:
os.unlink(temp_file.name)
def read_ota_partition(self, ota_id, output):
self.target.read_partition(self._get_partition_id_from_ota_id(ota_id), output)
def write_ota_partition(self, ota_id, input):
self.target.write_partition(self._get_partition_id_from_ota_id(ota_id), input)
def erase_ota_partition(self, ota_id):
self.target.erase_partition(self._get_partition_id_from_ota_id(ota_id))
def _get_partition_specifier(args):
if args.name:
return ["--partition-name", args.name]
else:
return ["--partition-type", "app", "--partition-subtype", "ota_" + str(args.slot)]
def _read_otadata(target):
target._check_otadata_partition()
otadata_info = target._get_otadata_info()
print(" {:8s} \t {:8s} | \t {:8s} \t {:8s}".format("OTA_SEQ", "CRC", "OTA_SEQ", "CRC"))
print("Firmware: 0x{:8x} \t0x{:8x} | \t0x{:8x} \t 0x{:8x}".format(otadata_info[0].seq, otadata_info[0].crc,
otadata_info[1].seq, otadata_info[1].crc))
def read_ota_partition(args):
invoke_args = ["read_partition", "--output", args.output]
_invoke_parttool(invoke_args, args, partition=_get_partition_specifier(args))
status("Read ota partition contents to file {}".format(args.output))
def _erase_otadata(target):
target.erase_otadata()
status("Erased ota_data partition contents")
def write_ota_partition(args):
invoke_args = ["write_partition", "--input", args.input]
_invoke_parttool(invoke_args, args, partition=_get_partition_specifier(args))
status("Written contents of file {} to ota partition".format(args.input))
def _switch_ota_partition(target, ota_id):
target.switch_ota_partition(ota_id)
def erase_ota_partition(args):
invoke_args = ["erase_partition"]
_invoke_parttool(invoke_args, args, partition=_get_partition_specifier(args))
def _read_ota_partition(target, ota_id, output):
target.read_ota_partition(ota_id, output)
status("Read ota partition contents to file {}".format(output))
def _write_ota_partition(target, ota_id, input):
target.write_ota_partition(ota_id, input)
status("Written contents of file {} to ota partition".format(input))
def _erase_ota_partition(target, ota_id):
target.erase_ota_partition(ota_id)
status("Erased contents of ota partition")
@ -281,20 +254,29 @@ def main():
parser = argparse.ArgumentParser("ESP-IDF OTA Partitions Tool")
parser.add_argument("--quiet", "-q", help="suppress stderr messages", action="store_true")
parser.add_argument("--esptool-args", help="additional main arguments for esptool", nargs="+")
parser.add_argument("--esptool-write-args", help="additional subcommand arguments for esptool write_flash", nargs="+")
parser.add_argument("--esptool-read-args", help="additional subcommand arguments for esptool read_flash", nargs="+")
parser.add_argument("--esptool-erase-args", help="additional subcommand arguments for esptool erase_region", nargs="+")
# There are two possible sources for the partition table: a device attached to the host
# or a partition table CSV/binary file. These sources are mutually exclusive.
partition_table_info_source_args = parser.add_mutually_exclusive_group()
parser.add_argument("--port", "-p", help="port where the device to read the partition table from is attached")
partition_table_info_source_args.add_argument("--port", "-p", help="port where the device to read the partition table from is attached", default="")
partition_table_info_source_args.add_argument("--partition-table-file", "-f", help="file (CSV/binary) to read the partition table from", default="")
parser.add_argument("--baud", "-b", help="baudrate to use", type=int)
parser.add_argument("--partition-table-offset", "-o", help="offset to read the partition table from", default="0x8000")
parser.add_argument("--partition-table-offset", "-o", help="offset to read the partition table from", type=str)
parser.add_argument("--partition-table-file", "-f", help="file (CSV/binary) to read the partition table from; \
overrides device attached to specified port as the partition table source when defined")
subparsers = parser.add_subparsers(dest="operation", help="run otatool -h for additional help")
spi_flash_sec_size = argparse.ArgumentParser(add_help=False)
spi_flash_sec_size.add_argument("--spi-flash-sec-size", help="value of SPI_FLASH_SEC_SIZE macro", type=str)
# Specify the supported operations
subparsers.add_parser("read_otadata", help="read otadata partition")
subparsers.add_parser("read_otadata", help="read otadata partition", parents=[spi_flash_sec_size])
subparsers.add_parser("erase_otadata", help="erase otadata partition")
slot_or_name_parser = argparse.ArgumentParser(add_help=False)
@ -302,7 +284,7 @@ def main():
slot_or_name_parser_args.add_argument("--slot", help="slot number of the ota partition", type=int)
slot_or_name_parser_args.add_argument("--name", help="name of the ota partition")
subparsers.add_parser("switch_otadata", help="switch otadata partition", parents=[slot_or_name_parser])
subparsers.add_parser("switch_ota_partition", help="switch otadata partition", parents=[slot_or_name_parser, spi_flash_sec_size])
read_ota_partition_subparser = subparsers.add_parser("read_ota_partition", help="read contents of an ota partition", parents=[slot_or_name_parser])
read_ota_partition_subparser.add_argument("--output", help="file to write the contents of the ota partition to")
@ -322,17 +304,84 @@ def main():
parser.print_help()
sys.exit(1)
# Else execute the operation
operation_func = globals()[args.operation]
target_args = {}
if args.port:
target_args["port"] = args.port
if args.partition_table_file:
target_args["partition_table_file"] = args.partition_table_file
if args.partition_table_offset:
target_args["partition_table_offset"] = int(args.partition_table_offset, 0)
try:
if args.spi_flash_sec_size:
target_args["spi_flash_sec_size"] = int(args.spi_flash_sec_size, 0)
except AttributeError:
pass
if args.esptool_args:
target_args["esptool_args"] = args.esptool_args
if args.esptool_write_args:
target_args["esptool_write_args"] = args.esptool_write_args
if args.esptool_read_args:
target_args["esptool_read_args"] = args.esptool_read_args
if args.esptool_erase_args:
target_args["esptool_erase_args"] = args.esptool_erase_args
if args.baud:
target_args["baud"] = args.baud
target = OtatoolTarget(**target_args)
# Create the operation table and execute the operation
common_args = {'target':target}
ota_id = []
try:
if args.name is not None:
ota_id = ["name"]
else:
if args.slot is not None:
ota_id = ["slot"]
except AttributeError:
pass
otatool_ops = {
'read_otadata':(_read_otadata, []),
'erase_otadata':(_erase_otadata, []),
'switch_ota_partition':(_switch_ota_partition, ota_id),
'read_ota_partition':(_read_ota_partition, ["output"] + ota_id),
'write_ota_partition':(_write_ota_partition, ["input"] + ota_id),
'erase_ota_partition':(_erase_ota_partition, ota_id)
}
(op, op_args) = otatool_ops[args.operation]
for op_arg in op_args:
common_args.update({op_arg:vars(args)[op_arg]})
try:
common_args['ota_id'] = common_args.pop('name')
except KeyError:
try:
common_args['ota_id'] = common_args.pop('slot')
except KeyError:
pass
if quiet:
# If exceptions occur, suppress and exit quietly
try:
operation_func(args)
op(**common_args)
except Exception:
sys.exit(2)
else:
operation_func(args)
op(**common_args)
if __name__ == '__main__':

View File

@ -1,9 +0,0 @@
# Set empty otadata partition file for flashing, if OTA data partition in
# partition table
# (NB: because of component dependency, we know partition_table
# project_include.cmake has already been included.)
if(OTADATA_PARTITION_OFFSET AND OTADATA_PARTITION_SIZE AND IDF_BUILD_ARTIFACTS)
set(BLANK_OTADATA_FILE "ota_data_initial.bin")
endif()

View File

@ -1,6 +1,3 @@
set(COMPONENT_SRCDIRS ".")
set(COMPONENT_ADD_INCLUDEDIRS ".")
set(COMPONENT_REQUIRES unity test_utils app_update bootloader_support nvs_flash)
register_component()
idf_component_register(SRC_DIRS "."
INCLUDE_DIRS "."
REQUIRES unity test_utils app_update bootloader_support nvs_flash)

View File

@ -5,10 +5,11 @@
#include <esp_types.h>
#include <stdio.h>
#include "string.h"
#include "sdkconfig.h"
#include "rom/spi_flash.h"
#include "rom/rtc.h"
#include "rom/ets_sys.h"
#include "esp32/rom/spi_flash.h"
#include "esp32/rom/rtc.h"
#include "esp32/rom/ets_sys.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
@ -28,8 +29,8 @@
#include "nvs_flash.h"
#include "driver/gpio.h"
#include "esp_sleep.h"
#include "sdkconfig.h"
RTC_DATA_ATTR static int boot_count = 0;
static const char *TAG = "ota_test";
@ -239,7 +240,7 @@ static void reset_output_pin(uint32_t num_pin)
static void mark_app_valid(void)
{
#ifdef CONFIG_APP_ROLLBACK_ENABLE
#ifdef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
TEST_ESP_OK(esp_ota_mark_app_valid_cancel_rollback());
#endif
}
@ -295,7 +296,7 @@ static void test_flow1(void)
// 3 Stage: run OTA0 -> check it -> copy OTA0 to OTA1 -> reboot --//--
// 4 Stage: run OTA1 -> check it -> copy OTA1 to OTA0 -> reboot --//--
// 5 Stage: run OTA0 -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, OTA1, OTA0", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow1, test_flow1, test_flow1, test_flow1);
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, OTA1, OTA0", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow1, test_flow1, test_flow1, test_flow1);
static void test_flow2(void)
{
@ -332,7 +333,7 @@ static void test_flow2(void)
// 2 Stage: run factory -> check it -> copy factory to OTA0 -> reboot --//--
// 3 Stage: run OTA0 -> check it -> corrupt ota data -> reboot --//--
// 4 Stage: run factory -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, corrupt ota_sec1, factory", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow2, test_flow2, test_flow2);
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, corrupt ota_sec1, factory", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow2, test_flow2, test_flow2);
static void test_flow3(void)
{
@ -376,7 +377,7 @@ static void test_flow3(void)
// 3 Stage: run OTA0 -> check it -> copy OTA0 to OTA1 -> reboot --//--
// 3 Stage: run OTA1 -> check it -> corrupt ota sector2 -> reboot --//--
// 4 Stage: run OTA0 -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, OTA1, currupt ota_sec2, OTA0", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow3, test_flow3, test_flow3, test_flow3);
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, OTA1, currupt ota_sec2, OTA0", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow3, test_flow3, test_flow3, test_flow3);
#ifdef CONFIG_BOOTLOADER_FACTORY_RESET
#define STORAGE_NAMESPACE "update_ota"
@ -386,7 +387,7 @@ static void test_flow4(void)
boot_count++;
ESP_LOGI(TAG, "boot count %d", boot_count);
const esp_partition_t *cur_app = get_running_firmware();
nvs_handle handle = 0;
nvs_handle_t handle = 0;
int boot_count_nvs = 0;
switch (boot_count) {
case 2:
@ -443,7 +444,7 @@ static void test_flow4(void)
// 2 Stage: run factory -> check it -> copy factory to OTA0 -> reboot --//--
// 3 Stage: run OTA0 -> check it -> set_pin_factory_reset -> reboot --//--
// 4 Stage: run factory -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, sets pin_factory_reset, factory", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow4, test_flow4, test_flow4);
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, sets pin_factory_reset, factory", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow4, test_flow4, test_flow4);
#endif
#ifdef CONFIG_BOOTLOADER_APP_TEST
@ -486,7 +487,7 @@ static void test_flow5(void)
// 2 Stage: run factory -> check it -> copy factory to Test and set pin_test_app -> reboot --//--
// 3 Stage: run test -> check it -> reset pin_test_app -> reboot --//--
// 4 Stage: run factory -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Switching between factory, test, factory", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow5, test_flow5, test_flow5);
TEST_CASE_MULTIPLE_STAGES("Switching between factory, test, factory", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow5, test_flow5, test_flow5);
#endif
static const esp_partition_t* app_update(void)
@ -518,7 +519,7 @@ static void test_rollback1(void)
TEST_ESP_ERR(ESP_ERR_NOT_SUPPORTED, esp_ota_get_state_partition(cur_app, &ota_state));
update_partition = app_update();
TEST_ESP_OK(esp_ota_get_state_partition(update_partition, &ota_state));
#ifndef CONFIG_APP_ROLLBACK_ENABLE
#ifndef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
TEST_ASSERT_EQUAL(ESP_OTA_IMG_UNDEFINED, ota_state);
#else
TEST_ASSERT_EQUAL(ESP_OTA_IMG_NEW, ota_state);
@ -530,7 +531,7 @@ static void test_rollback1(void)
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_OTA_0, cur_app->subtype);
TEST_ASSERT_NULL(esp_ota_get_last_invalid_partition());
TEST_ESP_OK(esp_ota_get_state_partition(cur_app, &ota_state));
#ifndef CONFIG_APP_ROLLBACK_ENABLE
#ifndef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
TEST_ASSERT_EQUAL(ESP_OTA_IMG_UNDEFINED, ota_state);
#else
TEST_ASSERT_EQUAL(ESP_OTA_IMG_PENDING_VERIFY, ota_state);
@ -580,7 +581,7 @@ static void test_rollback1_1(void)
// 3 Stage: run OTA0 -> check it -> esp_ota_mark_app_valid_cancel_rollback() -> reboot --//--
// 4 Stage: run OTA0 -> check it -> esp_ota_mark_app_invalid_rollback_and_reboot() -> reboot
// 5 Stage: run factory -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Test rollback. factory, OTA0, OTA0, rollback -> factory", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, SW_CPU_RESET]", start_test, test_rollback1, test_rollback1, test_rollback1, test_rollback1_1);
TEST_CASE_MULTIPLE_STAGES("Test rollback. factory, OTA0, OTA0, rollback -> factory", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, SW_CPU_RESET]", start_test, test_rollback1, test_rollback1, test_rollback1, test_rollback1_1);
static void test_rollback2(void)
{
@ -597,7 +598,7 @@ static void test_rollback2(void)
TEST_ESP_ERR(ESP_ERR_NOT_SUPPORTED, esp_ota_get_state_partition(cur_app, &ota_state));
update_partition = app_update();
TEST_ESP_OK(esp_ota_get_state_partition(update_partition, &ota_state));
#ifndef CONFIG_APP_ROLLBACK_ENABLE
#ifndef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
TEST_ASSERT_EQUAL(ESP_OTA_IMG_UNDEFINED, ota_state);
#else
TEST_ASSERT_EQUAL(ESP_OTA_IMG_NEW, ota_state);
@ -609,7 +610,7 @@ static void test_rollback2(void)
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_OTA_0, cur_app->subtype);
TEST_ASSERT_NULL(esp_ota_get_last_invalid_partition());
TEST_ESP_OK(esp_ota_get_state_partition(cur_app, &ota_state));
#ifndef CONFIG_APP_ROLLBACK_ENABLE
#ifndef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
TEST_ASSERT_EQUAL(ESP_OTA_IMG_UNDEFINED, ota_state);
#else
TEST_ASSERT_EQUAL(ESP_OTA_IMG_PENDING_VERIFY, ota_state);
@ -620,7 +621,7 @@ static void test_rollback2(void)
TEST_ASSERT_EQUAL(ESP_OTA_IMG_VALID, ota_state);
update_partition = app_update();
TEST_ESP_OK(esp_ota_get_state_partition(update_partition, &ota_state));
#ifndef CONFIG_APP_ROLLBACK_ENABLE
#ifndef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
TEST_ASSERT_EQUAL(ESP_OTA_IMG_UNDEFINED, ota_state);
#else
TEST_ASSERT_EQUAL(ESP_OTA_IMG_NEW, ota_state);
@ -632,7 +633,7 @@ static void test_rollback2(void)
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_OTA_1, cur_app->subtype);
TEST_ASSERT_NULL(esp_ota_get_last_invalid_partition());
TEST_ESP_OK(esp_ota_get_state_partition(cur_app, &ota_state));
#ifndef CONFIG_APP_ROLLBACK_ENABLE
#ifndef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
TEST_ASSERT_EQUAL(ESP_OTA_IMG_UNDEFINED, ota_state);
TEST_ESP_OK(esp_ota_mark_app_invalid_rollback_and_reboot());
#else
@ -665,7 +666,7 @@ static void test_rollback2_1(void)
TEST_ESP_OK(esp_ota_get_state_partition(cur_app, &ota_state));
TEST_ASSERT_EQUAL(ESP_OTA_IMG_VALID, ota_state);
TEST_ESP_OK(esp_ota_get_state_partition(invalid_partition, &ota_state));
#ifndef CONFIG_APP_ROLLBACK_ENABLE
#ifndef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
TEST_ASSERT_EQUAL(ESP_OTA_IMG_INVALID, ota_state);
#else
TEST_ASSERT_EQUAL(ESP_OTA_IMG_ABORTED, ota_state);
@ -678,7 +679,7 @@ static void test_rollback2_1(void)
// 3 Stage: run OTA0 -> check it -> esp_ota_mark_app_valid_cancel_rollback(), copy to next app slot -> reboot --//--
// 4 Stage: run OTA1 -> check it -> PENDING_VERIFY/esp_ota_mark_app_invalid_rollback_and_reboot() -> reboot
// 5 Stage: run OTA0(rollback) -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Test rollback. factory, OTA0, OTA1, rollback -> OTA0", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, SW_CPU_RESET]", start_test, test_rollback2, test_rollback2, test_rollback2, test_rollback2_1);
TEST_CASE_MULTIPLE_STAGES("Test rollback. factory, OTA0, OTA1, rollback -> OTA0", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, SW_CPU_RESET]", start_test, test_rollback2, test_rollback2, test_rollback2, test_rollback2_1);
static void test_erase_last_app_flow(void)
{
@ -729,4 +730,4 @@ static void test_erase_last_app_rollback(void)
// 3 Stage: run OTA0 -> check it -> copy factory to OTA1 -> reboot --//--
// 4 Stage: run OTA1 -> check it -> erase OTA0 and rollback -> reboot
// 5 Stage: run factory -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Test erase_last_boot_app_partition. factory, OTA1, OTA0, factory", "[app_update][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, SW_CPU_RESET]", start_test, test_erase_last_app_flow, test_erase_last_app_flow, test_erase_last_app_flow, test_erase_last_app_rollback);
TEST_CASE_MULTIPLE_STAGES("Test erase_last_boot_app_partition. factory, OTA1, OTA0, factory", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, SW_CPU_RESET]", start_test, test_erase_last_app_flow, test_erase_last_app_flow, test_erase_last_app_flow, test_erase_last_app_rollback);

View File

@ -1,6 +1,3 @@
set(COMPONENT_ADD_INCLUDEDIRS asio/asio/include port/include)
set(COMPONENT_SRCS "asio/asio/src/asio.cpp")
set(COMPONENT_REQUIRES lwip)
register_component()
idf_component_register(SRCS "asio/asio/src/asio.cpp"
INCLUDE_DIRS "asio/asio/include" "port/include"
REQUIRES lwip)

View File

@ -18,9 +18,9 @@
// Enabling exceptions only when they are enabled in menuconfig
//
# include <sdkconfig.h>
# ifndef CONFIG_CXX_EXCEPTIONS
# ifndef CONFIG_COMPILER_CXX_EXCEPTIONS
# define ASIO_NO_EXCEPTIONS
# endif // CONFIG_CXX_EXCEPTIONS
# endif // CONFIG_COMPILER_CXX_EXCEPTIONS
//
// LWIP compatifility inet and address macros/functions

View File

@ -18,7 +18,7 @@
//
// This exception stub is enabled only if exceptions are disabled in menuconfig
//
#if !defined(CONFIG_CXX_EXCEPTIONS) && defined (ASIO_NO_EXCEPTIONS)
#if !defined(CONFIG_COMPILER_CXX_EXCEPTIONS) && defined (ASIO_NO_EXCEPTIONS)
#include "esp_log.h"
@ -34,6 +34,6 @@ void throw_exception(const Exception& e)
abort();
}
}}
#endif // CONFIG_CXX_EXCEPTIONS==1 && defined (ASIO_NO_EXCEPTIONS)
#endif // CONFIG_COMPILER_CXX_EXCEPTIONS==1 && defined (ASIO_NO_EXCEPTIONS)
#endif // _ESP_EXCEPTION_H_

View File

@ -1,30 +0,0 @@
if(CONFIG_AWS_IOT_SDK)
set(COMPONENT_ADD_INCLUDEDIRS "include aws-iot-device-sdk-embedded-C/include")
set(aws_sdk_dir aws-iot-device-sdk-embedded-C/src)
set(COMPONENT_SRCS "${aws_sdk_dir}/aws_iot_jobs_interface.c"
"${aws_sdk_dir}/aws_iot_jobs_json.c"
"${aws_sdk_dir}/aws_iot_jobs_topics.c"
"${aws_sdk_dir}/aws_iot_jobs_types.c"
"${aws_sdk_dir}/aws_iot_json_utils.c"
"${aws_sdk_dir}/aws_iot_mqtt_client.c"
"${aws_sdk_dir}/aws_iot_mqtt_client_common_internal.c"
"${aws_sdk_dir}/aws_iot_mqtt_client_connect.c"
"${aws_sdk_dir}/aws_iot_mqtt_client_publish.c"
"${aws_sdk_dir}/aws_iot_mqtt_client_subscribe.c"
"${aws_sdk_dir}/aws_iot_mqtt_client_unsubscribe.c"
"${aws_sdk_dir}/aws_iot_mqtt_client_yield.c"
"${aws_sdk_dir}/aws_iot_shadow.c"
"${aws_sdk_dir}/aws_iot_shadow_actions.c"
"${aws_sdk_dir}/aws_iot_shadow_json.c"
"${aws_sdk_dir}/aws_iot_shadow_records.c"
"port/network_mbedtls_wrapper.c"
"port/threads_freertos.c"
"port/timer.c")
else()
message(STATUS "Building empty aws_iot component due to configuration")
endif()
set(COMPONENT_REQUIRES "mbedtls")
set(COMPONENT_PRIV_REQUIRES "jsmn")
register_component()

View File

@ -1,164 +0,0 @@
menuconfig AWS_IOT_SDK
bool "Amazon Web Services IoT Platform"
help
Select this option to enable support for the AWS IoT platform,
via the esp-idf component for the AWS IoT Device C SDK.
config AWS_IOT_MQTT_HOST
string "AWS IoT Endpoint Hostname"
depends on AWS_IOT_SDK
default ""
help
Default endpoint host name to connect to AWS IoT MQTT/S gateway
This is the custom endpoint hostname and is specific to an AWS
IoT account. You can find it by logging into your AWS IoT
Console and clicking the Settings button. The endpoint hostname
is shown under the "Custom Endpoint" heading on this page.
If you need per-device hostnames for different regions or
accounts, you can override the default hostname in your app.
config AWS_IOT_MQTT_PORT
int "AWS IoT MQTT Port"
depends on AWS_IOT_SDK
default 8883
range 0 65535
help
Default port number to connect to AWS IoT MQTT/S gateway
If you need per-device port numbers for different regions, you can
override the default port number in your app.
config AWS_IOT_MQTT_TX_BUF_LEN
int "MQTT TX Buffer Length"
depends on AWS_IOT_SDK
default 512
range 32 65536
help
Maximum MQTT transmit buffer size. This is the maximum MQTT
message length (including protocol overhead) which can be sent.
Sending longer messages will fail.
config AWS_IOT_MQTT_RX_BUF_LEN
int "MQTT RX Buffer Length"
depends on AWS_IOT_SDK
default 512
range 32 65536
help
Maximum MQTT receive buffer size. This is the maximum MQTT
message length (including protocol overhead) which can be
received.
Longer messages are dropped.
config AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS
int "Maximum MQTT Topic Filters"
depends on AWS_IOT_SDK
default 5
range 1 100
help
Maximum number of concurrent MQTT topic filters.
config AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL
int "Auto reconnect initial interval (ms)"
depends on AWS_IOT_SDK
default 1000
range 10 3600000
help
Initial delay before making first reconnect attempt, if the AWS IoT connection fails.
Client will perform exponential backoff, starting from this value.
config AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL
int "Auto reconnect maximum interval (ms)"
depends on AWS_IOT_SDK
default 128000
range 10 3600000
help
Maximum delay between reconnection attempts. If the exponentially increased delay
interval reaches this value, the client will stop automatically attempting to reconnect.
menu "Thing Shadow"
depends on AWS_IOT_SDK
config AWS_IOT_OVERRIDE_THING_SHADOW_RX_BUFFER
bool "Override Shadow RX buffer size"
depends on AWS_IOT_SDK
default n
help
Allows setting a different Thing Shadow RX buffer
size. This is the maximum size of a Thing Shadow
message in bytes, plus one.
If not overridden, the default value is the MQTT RX Buffer length plus one. If overriden, do not set
higher than the default value.
config AWS_IOT_SHADOW_MAX_SIZE_OF_RX_BUFFER
int "Maximum RX Buffer (bytes)"
depends on AWS_IOT_OVERRIDE_THING_SHADOW_RX_BUFFER
default 513
range 32 65536
help
Allows setting a different Thing Shadow RX buffer size.
This is the maximum size of a Thing Shadow message in bytes,
plus one.
config AWS_IOT_SHADOW_MAX_SIZE_OF_UNIQUE_CLIENT_ID_BYTES
int "Maximum unique client ID size (bytes)"
depends on AWS_IOT_SDK
default 80
range 4 1000
help
Maximum size of the Unique Client Id.
config AWS_IOT_SHADOW_MAX_SIMULTANEOUS_ACKS
int "Maximum simultaneous responses"
depends on AWS_IOT_SDK
default 10
range 1 100
help
At any given time we will wait for this many responses. This will correlate to the rate at which the
shadow actions are requested
config AWS_IOT_SHADOW_MAX_SIMULTANEOUS_THINGNAMES
int "Maximum simultaneous Thing Name operations"
depends on AWS_IOT_SDK
default 10
range 1 100
help
We could perform shadow action on any thing Name and this is maximum Thing Names we can act on at any
given time
config AWS_IOT_SHADOW_MAX_JSON_TOKEN_EXPECTED
int "Maximum expected JSON tokens"
depends on AWS_IOT_SDK
default 120
help
These are the max tokens that is expected to be in the Shadow JSON document. Includes the metadata which
is published
config AWS_IOT_SHADOW_MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME
int "Maximum topic length (not including Thing Name)"
depends on AWS_IOT_SDK
default 60
range 10 1000
help
All shadow actions have to be published or subscribed to a topic which is of the format
$aws/things/{thingName}/shadow/update/accepted. This refers to the size of the topic without the Thing
Name
config AWS_IOT_SHADOW_MAX_SIZE_OF_THING_NAME
int "Maximum Thing Name length"
depends on AWS_IOT_SDK
default 20
range 4 1000
help
Maximum length of a Thing Name.
endmenu # Thing Shadow

View File

@ -1,20 +0,0 @@
#
# Component Makefile
#
ifdef CONFIG_AWS_IOT_SDK
COMPONENT_ADD_INCLUDEDIRS := include aws-iot-device-sdk-embedded-C/include
COMPONENT_SRCDIRS := aws-iot-device-sdk-embedded-C/src port
# Check the submodule is initialised
COMPONENT_SUBMODULES := aws-iot-device-sdk-embedded-C
else
# Disable AWS IoT support
COMPONENT_ADD_INCLUDEDIRS :=
COMPONENT_ADD_LDFLAGS :=
COMPONENT_SRCDIRS :=
endif

View File

@ -1,65 +0,0 @@
/*
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/**
* @file aws_iot_config.h
* @brief AWS IoT specific configuration file
*/
#ifndef _AWS_IOT_CONFIG_H_
#define _AWS_IOT_CONFIG_H_
#include "aws_iot_log.h"
// This configuration macro needs to be available globally to enable threading
#define _ENABLE_THREAD_SUPPORT_
// These values are defined in the menuconfig of the AWS IoT component.
// However, you can override these constants from your own code.
#define AWS_IOT_MQTT_HOST CONFIG_AWS_IOT_MQTT_HOST ///< Customer specific MQTT HOST. The same will be used for Thing Shadow
#define AWS_IOT_MQTT_PORT CONFIG_AWS_IOT_MQTT_PORT ///< default port for MQTT/S
// These values are defaults and are used for ShadowConnectParametersDefault.
// You should override them from your own code.
#define AWS_IOT_MQTT_CLIENT_ID "ESP32" ///< MQTT client ID should be unique for every device
#define AWS_IOT_MY_THING_NAME "ESP32" ///< Thing Name of the Shadow this device is associated with
// MQTT PubSub
#define AWS_IOT_MQTT_TX_BUF_LEN CONFIG_AWS_IOT_MQTT_TX_BUF_LEN ///< Any time a message is sent out through the MQTT layer. The message is copied into this buffer anytime a publish is done. This will also be used in the case of Thing Shadow
#define AWS_IOT_MQTT_RX_BUF_LEN CONFIG_AWS_IOT_MQTT_RX_BUF_LEN ///< Any message that comes into the device should be less than this buffer size. If a received message is bigger than this buffer size the message will be dropped.
#define AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS CONFIG_AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS ///< Maximum number of topic filters the MQTT client can handle at any given time. This should be increased appropriately when using Thing Shadow
// Thing Shadow specific configs
#ifdef CONFIG_AWS_IOT_OVERRIDE_THING_SHADOW_RX_BUFFER
#define SHADOW_MAX_SIZE_OF_RX_BUFFER CONFIG_AWS_IOT_SHADOW_MAX_SIZE_OF_RX_BUFFER ///< Maximum size of the SHADOW buffer to store the received Shadow message, including NULL terminating byte
#else
#define SHADOW_MAX_SIZE_OF_RX_BUFFER (AWS_IOT_MQTT_RX_BUF_LEN + 1)
#endif
#define MAX_SIZE_OF_UNIQUE_CLIENT_ID_BYTES 80 ///< Maximum size of the Unique Client Id. For More info on the Client Id refer \ref response "Acknowledgments"
#define MAX_SIZE_CLIENT_ID_WITH_SEQUENCE (MAX_SIZE_OF_UNIQUE_CLIENT_ID_BYTES + 10) ///< This is size of the extra sequence number that will be appended to the Unique client Id
#define MAX_SIZE_CLIENT_TOKEN_CLIENT_SEQUENCE (MAX_SIZE_CLIENT_ID_WITH_SEQUENCE + 20) ///< This is size of the the total clientToken key and value pair in the JSON
#define MAX_ACKS_TO_COMEIN_AT_ANY_GIVEN_TIME CONFIG_AWS_IOT_SHADOW_MAX_SIMULTANEOUS_ACKS ///< At Any given time we will wait for this many responses. This will correlate to the rate at which the shadow actions are requested
#define MAX_THINGNAME_HANDLED_AT_ANY_GIVEN_TIME CONFIG_AWS_IOT_SHADOW_MAX_SIMULTANEOUS_THINGNAMES ///< We could perform shadow action on any thing Name and this is maximum Thing Names we can act on at any given time
#define MAX_JSON_TOKEN_EXPECTED CONFIG_AWS_IOT_SHADOW_MAX_JSON_TOKEN_EXPECTED ///< These are the max tokens that is expected to be in the Shadow JSON document. Include the metadata that gets published
#define MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME CONFIG_AWS_IOT_SHADOW_MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME ///< All shadow actions have to be published or subscribed to a topic which is of the formablogt $aws/things/{thingName}/shadow/update/accepted. This refers to the size of the topic without the Thing Name
#define MAX_SIZE_OF_THING_NAME CONFIG_AWS_IOT_SHADOW_MAX_SIZE_OF_THING_NAME ///< The Thing Name should not be bigger than this value. Modify this if the Thing Name needs to be bigger
#define MAX_SHADOW_TOPIC_LENGTH_BYTES (MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME + MAX_SIZE_OF_THING_NAME) ///< This size includes the length of topic with Thing Name
// Auto Reconnect specific config
#define AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL CONFIG_AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL ///< Minimum time before the First reconnect attempt is made as part of the exponential back-off algorithm
#define AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL CONFIG_AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL ///< Maximum time interval after which exponential back-off will stop attempting to reconnect.
#endif /* _AWS_IOT_CONFIG_H_ */

View File

@ -1,44 +0,0 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
/* (these two headers aren't used here, but AWS IoT SDK code relies on them
being included from here...) */
#include <stdio.h>
#include <stdlib.h>
#include "esp_log.h"
/* This is a stub replacement for the aws_iot_log.h header in the AWS IoT SDK,
which redirects their logging framework into the esp-idf logging framework.
The current (2.1.1) upstream AWS IoT SDK doesn't allow this as some of its
headers include aws_iot_log.h, but our modified fork does.
*/
// redefine the AWS IoT log functions to call into the IDF log layer
#define IOT_DEBUG(format, ...) ESP_LOGD("aws_iot", format, ##__VA_ARGS__)
#define IOT_INFO(format, ...) ESP_LOGI("aws_iot", format, ##__VA_ARGS__)
#define IOT_WARN(format, ...) ESP_LOGW("aws_iot", format, ##__VA_ARGS__)
#define IOT_ERROR(format, ...) ESP_LOGE("aws_iot", format, ##__VA_ARGS__)
/* Function tracing macros used in AWS IoT SDK,
mapped to "verbose" level output
*/
#define FUNC_ENTRY ESP_LOGV("aws_iot", "FUNC_ENTRY: %s L#%d \n", __func__, __LINE__)
#define FUNC_EXIT_RC(x) \
do { \
ESP_LOGV("aws_iot", "FUNC_EXIT: %s L#%d Return Code : %d \n", __func__, __LINE__, x); \
return x; \
} while(0)

View File

@ -1,64 +0,0 @@
/*
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Additions Copyright 2016 Espressif Systems (Shanghai) PTE LTD
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#ifndef IOTSDKC_NETWORK_MBEDTLS_PLATFORM_H_H
#if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#include "mbedtls/platform.h"
#include "mbedtls/net_sockets.h"
#include "mbedtls/ssl.h"
#include "mbedtls/entropy.h"
#include "mbedtls/ctr_drbg.h"
#include "mbedtls/certs.h"
#include "mbedtls/x509.h"
#include "mbedtls/error.h"
#include "mbedtls/debug.h"
#include "mbedtls/timing.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief TLS Connection Parameters
*
* Defines a type containing TLS specific parameters to be passed down to the
* TLS networking layer to create a TLS secured socket.
*/
typedef struct _TLSDataParams {
mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_ssl_context ssl;
mbedtls_ssl_config conf;
uint32_t flags;
mbedtls_x509_crt cacert;
mbedtls_x509_crt clicert;
mbedtls_pk_context pkey;
mbedtls_net_context server_fd;
}TLSDataParams;
#define IOTSDKC_NETWORK_MBEDTLS_PLATFORM_H_H
#ifdef __cplusplus
}
#endif
#endif //IOTSDKC_NETWORK_MBEDTLS_PLATFORM_H_H

View File

@ -1,45 +0,0 @@
/*
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Additions Copyright 2016 Espressif Systems (Shanghai) PTE LTD
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#include "threads_interface.h"
#ifndef AWS_IOTSDK_THREADS_PLATFORM_H
#define AWS_IOTSDK_THREADS_PLATFORM_H
#ifdef __cplusplus
extern "C" {
#endif
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
/**
* @brief Mutex Type
*
* definition of the Mutex struct. Platform specific
*
*/
struct _IoT_Mutex_t {
SemaphoreHandle_t mutex;
};
#ifdef __cplusplus
}
#endif
#endif /* AWS_IOTSDK_THREADS_PLATFORM_H */

View File

@ -1,40 +0,0 @@
/*
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Additions Copyright 2016 Espressif Systems (Shanghai) PTE LTD
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#ifndef AWS_IOT_PLATFORM_H
#define AWS_IOT_PLATFORM_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "timer_interface.h"
/**
* definition of the Timer struct. Platform specific
*/
struct Timer {
uint32_t start_ticks;
uint32_t timeout_ticks;
uint32_t last_polled_ticks;
};
#ifdef __cplusplus
}
#endif
#endif /* AWS_IOT_PLATFORM_H */

View File

@ -1,419 +0,0 @@
/*
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Additions Copyright 2016 Espressif Systems (Shanghai) PTE LTD
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#include <sys/param.h>
#include <stdbool.h>
#include <string.h>
#include <timer_platform.h>
#include <network_interface.h>
#include "aws_iot_config.h"
#include "aws_iot_error.h"
#include "network_interface.h"
#include "network_platform.h"
#include "mbedtls/esp_debug.h"
#include "esp_log.h"
#include "esp_vfs.h"
static const char *TAG = "aws_iot";
/* This is the value used for ssl read timeout */
#define IOT_SSL_READ_TIMEOUT 10
/*
* This is a function to do further verification if needed on the cert received.
*
* Currently used to print debug-level information about each cert.
*/
static int _iot_tls_verify_cert(void *data, mbedtls_x509_crt *crt, int depth, uint32_t *flags) {
char buf[256];
((void) data);
if (LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) {
ESP_LOGD(TAG, "Verify requested for (Depth %d):", depth);
mbedtls_x509_crt_info(buf, sizeof(buf) - 1, "", crt);
ESP_LOGD(TAG, "%s", buf);
if((*flags) == 0) {
ESP_LOGD(TAG, " This certificate has no flags");
} else {
ESP_LOGD(TAG, "Verify result:%s", buf);
}
}
return 0;
}
static void _iot_tls_set_connect_params(Network *pNetwork, const char *pRootCALocation, const char *pDeviceCertLocation,
const char *pDevicePrivateKeyLocation, const char *pDestinationURL,
uint16_t destinationPort, uint32_t timeout_ms, bool ServerVerificationFlag) {
pNetwork->tlsConnectParams.DestinationPort = destinationPort;
pNetwork->tlsConnectParams.pDestinationURL = pDestinationURL;
pNetwork->tlsConnectParams.pDeviceCertLocation = pDeviceCertLocation;
pNetwork->tlsConnectParams.pDevicePrivateKeyLocation = pDevicePrivateKeyLocation;
pNetwork->tlsConnectParams.pRootCALocation = pRootCALocation;
pNetwork->tlsConnectParams.timeout_ms = timeout_ms;
pNetwork->tlsConnectParams.ServerVerificationFlag = ServerVerificationFlag;
}
IoT_Error_t iot_tls_init(Network *pNetwork, const char *pRootCALocation, const char *pDeviceCertLocation,
const char *pDevicePrivateKeyLocation, const char *pDestinationURL,
uint16_t destinationPort, uint32_t timeout_ms, bool ServerVerificationFlag) {
_iot_tls_set_connect_params(pNetwork, pRootCALocation, pDeviceCertLocation, pDevicePrivateKeyLocation,
pDestinationURL, destinationPort, timeout_ms, ServerVerificationFlag);
pNetwork->connect = iot_tls_connect;
pNetwork->read = iot_tls_read;
pNetwork->write = iot_tls_write;
pNetwork->disconnect = iot_tls_disconnect;
pNetwork->isConnected = iot_tls_is_connected;
pNetwork->destroy = iot_tls_destroy;
pNetwork->tlsDataParams.flags = 0;
return SUCCESS;
}
IoT_Error_t iot_tls_is_connected(Network *pNetwork) {
/* Use this to add implementation which can check for physical layer disconnect */
return NETWORK_PHYSICAL_LAYER_CONNECTED;
}
IoT_Error_t iot_tls_connect(Network *pNetwork, TLSConnectParams *params) {
int ret = SUCCESS;
TLSDataParams *tlsDataParams = NULL;
char portBuffer[6];
char info_buf[256];
if(NULL == pNetwork) {
return NULL_VALUE_ERROR;
}
if(NULL != params) {
_iot_tls_set_connect_params(pNetwork, params->pRootCALocation, params->pDeviceCertLocation,
params->pDevicePrivateKeyLocation, params->pDestinationURL,
params->DestinationPort, params->timeout_ms, params->ServerVerificationFlag);
}
tlsDataParams = &(pNetwork->tlsDataParams);
mbedtls_net_init(&(tlsDataParams->server_fd));
mbedtls_ssl_init(&(tlsDataParams->ssl));
mbedtls_ssl_config_init(&(tlsDataParams->conf));
#ifdef CONFIG_MBEDTLS_DEBUG
mbedtls_esp_enable_debug_log(&(tlsDataParams->conf), 4);
#endif
mbedtls_ctr_drbg_init(&(tlsDataParams->ctr_drbg));
mbedtls_x509_crt_init(&(tlsDataParams->cacert));
mbedtls_x509_crt_init(&(tlsDataParams->clicert));
mbedtls_pk_init(&(tlsDataParams->pkey));
ESP_LOGD(TAG, "Seeding the random number generator...");
mbedtls_entropy_init(&(tlsDataParams->entropy));
if((ret = mbedtls_ctr_drbg_seed(&(tlsDataParams->ctr_drbg), mbedtls_entropy_func, &(tlsDataParams->entropy),
(const unsigned char *) TAG, strlen(TAG))) != 0) {
ESP_LOGE(TAG, "failed! mbedtls_ctr_drbg_seed returned -0x%x", -ret);
return NETWORK_MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED;
}
/* Load root CA...
Certs/keys can be paths or they can be raw data. These use a
very basic heuristic: if the cert starts with '/' then it's a
path, if it's longer than this then it's raw cert data (PEM or DER,
neither of which can start with a slash. */
if (pNetwork->tlsConnectParams.pRootCALocation[0] == '/') {
ESP_LOGD(TAG, "Loading CA root certificate from file ...");
ret = mbedtls_x509_crt_parse_file(&(tlsDataParams->cacert), pNetwork->tlsConnectParams.pRootCALocation);
} else {
ESP_LOGD(TAG, "Loading embedded CA root certificate ...");
ret = mbedtls_x509_crt_parse(&(tlsDataParams->cacert), (const unsigned char *)pNetwork->tlsConnectParams.pRootCALocation,
strlen(pNetwork->tlsConnectParams.pRootCALocation)+1);
}
if(ret < 0) {
ESP_LOGE(TAG, "failed! mbedtls_x509_crt_parse returned -0x%x while parsing root cert", -ret);
return NETWORK_X509_ROOT_CRT_PARSE_ERROR;
}
ESP_LOGD(TAG, "ok (%d skipped)", ret);
/* Load client certificate... */
if (pNetwork->tlsConnectParams.pDeviceCertLocation[0] == '/') {
ESP_LOGD(TAG, "Loading client cert from file...");
ret = mbedtls_x509_crt_parse_file(&(tlsDataParams->clicert),
pNetwork->tlsConnectParams.pDeviceCertLocation);
} else {
ESP_LOGD(TAG, "Loading embedded client certificate...");
ret = mbedtls_x509_crt_parse(&(tlsDataParams->clicert),
(const unsigned char *)pNetwork->tlsConnectParams.pDeviceCertLocation,
strlen(pNetwork->tlsConnectParams.pDeviceCertLocation)+1);
}
if(ret != 0) {
ESP_LOGE(TAG, "failed! mbedtls_x509_crt_parse returned -0x%x while parsing device cert", -ret);
return NETWORK_X509_DEVICE_CRT_PARSE_ERROR;
}
/* Parse client private key... */
if (pNetwork->tlsConnectParams.pDevicePrivateKeyLocation[0] == '/') {
ESP_LOGD(TAG, "Loading client private key from file...");
ret = mbedtls_pk_parse_keyfile(&(tlsDataParams->pkey),
pNetwork->tlsConnectParams.pDevicePrivateKeyLocation,
"");
} else {
ESP_LOGD(TAG, "Loading embedded client private key...");
ret = mbedtls_pk_parse_key(&(tlsDataParams->pkey),
(const unsigned char *)pNetwork->tlsConnectParams.pDevicePrivateKeyLocation,
strlen(pNetwork->tlsConnectParams.pDevicePrivateKeyLocation)+1,
(const unsigned char *)"", 0);
}
if(ret != 0) {
ESP_LOGE(TAG, "failed! mbedtls_pk_parse_key returned -0x%x while parsing private key", -ret);
return NETWORK_PK_PRIVATE_KEY_PARSE_ERROR;
}
/* Done parsing certs */
ESP_LOGD(TAG, "ok");
snprintf(portBuffer, 6, "%d", pNetwork->tlsConnectParams.DestinationPort);
ESP_LOGD(TAG, "Connecting to %s/%s...", pNetwork->tlsConnectParams.pDestinationURL, portBuffer);
if((ret = mbedtls_net_connect(&(tlsDataParams->server_fd), pNetwork->tlsConnectParams.pDestinationURL,
portBuffer, MBEDTLS_NET_PROTO_TCP)) != 0) {
ESP_LOGE(TAG, "failed! mbedtls_net_connect returned -0x%x", -ret);
switch(ret) {
case MBEDTLS_ERR_NET_SOCKET_FAILED:
return NETWORK_ERR_NET_SOCKET_FAILED;
case MBEDTLS_ERR_NET_UNKNOWN_HOST:
return NETWORK_ERR_NET_UNKNOWN_HOST;
case MBEDTLS_ERR_NET_CONNECT_FAILED:
default:
return NETWORK_ERR_NET_CONNECT_FAILED;
};
}
ret = mbedtls_net_set_block(&(tlsDataParams->server_fd));
if(ret != 0) {
ESP_LOGE(TAG, "failed! net_set_(non)block() returned -0x%x", -ret);
return SSL_CONNECTION_ERROR;
} ESP_LOGD(TAG, "ok");
ESP_LOGD(TAG, "Setting up the SSL/TLS structure...");
if((ret = mbedtls_ssl_config_defaults(&(tlsDataParams->conf), MBEDTLS_SSL_IS_CLIENT, MBEDTLS_SSL_TRANSPORT_STREAM,
MBEDTLS_SSL_PRESET_DEFAULT)) != 0) {
ESP_LOGE(TAG, "failed! mbedtls_ssl_config_defaults returned -0x%x", -ret);
return SSL_CONNECTION_ERROR;
}
mbedtls_ssl_conf_verify(&(tlsDataParams->conf), _iot_tls_verify_cert, NULL);
if(pNetwork->tlsConnectParams.ServerVerificationFlag == true) {
mbedtls_ssl_conf_authmode(&(tlsDataParams->conf), MBEDTLS_SSL_VERIFY_REQUIRED);
} else {
mbedtls_ssl_conf_authmode(&(tlsDataParams->conf), MBEDTLS_SSL_VERIFY_OPTIONAL);
}
mbedtls_ssl_conf_rng(&(tlsDataParams->conf), mbedtls_ctr_drbg_random, &(tlsDataParams->ctr_drbg));
mbedtls_ssl_conf_ca_chain(&(tlsDataParams->conf), &(tlsDataParams->cacert), NULL);
ret = mbedtls_ssl_conf_own_cert(&(tlsDataParams->conf), &(tlsDataParams->clicert), &(tlsDataParams->pkey));
if(ret != 0) {
ESP_LOGE(TAG, "failed! mbedtls_ssl_conf_own_cert returned %d", ret);
return SSL_CONNECTION_ERROR;
}
mbedtls_ssl_conf_read_timeout(&(tlsDataParams->conf), pNetwork->tlsConnectParams.timeout_ms);
#ifdef CONFIG_MBEDTLS_SSL_ALPN
/* Use the AWS IoT ALPN extension for MQTT, if port 443 is requested */
if (pNetwork->tlsConnectParams.DestinationPort == 443) {
const char *alpnProtocols[] = { "x-amzn-mqtt-ca", NULL };
if ((ret = mbedtls_ssl_conf_alpn_protocols(&(tlsDataParams->conf), alpnProtocols)) != 0) {
ESP_LOGE(TAG, "failed! mbedtls_ssl_conf_alpn_protocols returned -0x%x", -ret);
return SSL_CONNECTION_ERROR;
}
}
#endif
if((ret = mbedtls_ssl_setup(&(tlsDataParams->ssl), &(tlsDataParams->conf))) != 0) {
ESP_LOGE(TAG, "failed! mbedtls_ssl_setup returned -0x%x", -ret);
return SSL_CONNECTION_ERROR;
}
if((ret = mbedtls_ssl_set_hostname(&(tlsDataParams->ssl), pNetwork->tlsConnectParams.pDestinationURL)) != 0) {
ESP_LOGE(TAG, "failed! mbedtls_ssl_set_hostname returned %d", ret);
return SSL_CONNECTION_ERROR;
}
ESP_LOGD(TAG, "SSL state connect : %d ", tlsDataParams->ssl.state);
mbedtls_ssl_set_bio(&(tlsDataParams->ssl), &(tlsDataParams->server_fd), mbedtls_net_send, NULL,
mbedtls_net_recv_timeout);
ESP_LOGD(TAG, "ok");
ESP_LOGD(TAG, "SSL state connect : %d ", tlsDataParams->ssl.state);
ESP_LOGD(TAG, "Performing the SSL/TLS handshake...");
while((ret = mbedtls_ssl_handshake(&(tlsDataParams->ssl))) != 0) {
if(ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
ESP_LOGE(TAG, "failed! mbedtls_ssl_handshake returned -0x%x", -ret);
if(ret == MBEDTLS_ERR_X509_CERT_VERIFY_FAILED) {
ESP_LOGE(TAG, " Unable to verify the server's certificate. ");
}
return SSL_CONNECTION_ERROR;
}
}
ESP_LOGD(TAG, "ok [ Protocol is %s ] [ Ciphersuite is %s ]", mbedtls_ssl_get_version(&(tlsDataParams->ssl)),
mbedtls_ssl_get_ciphersuite(&(tlsDataParams->ssl)));
if((ret = mbedtls_ssl_get_record_expansion(&(tlsDataParams->ssl))) >= 0) {
ESP_LOGD(TAG, " [ Record expansion is %d ]", ret);
} else {
ESP_LOGD(TAG, " [ Record expansion is unknown (compression) ]");
}
ESP_LOGD(TAG, "Verifying peer X.509 certificate...");
if(pNetwork->tlsConnectParams.ServerVerificationFlag == true) {
if((tlsDataParams->flags = mbedtls_ssl_get_verify_result(&(tlsDataParams->ssl))) != 0) {
ESP_LOGE(TAG, "failed");
mbedtls_x509_crt_verify_info(info_buf, sizeof(info_buf), " ! ", tlsDataParams->flags);
ESP_LOGE(TAG, "%s", info_buf);
ret = SSL_CONNECTION_ERROR;
} else {
ESP_LOGD(TAG, "ok");
ret = SUCCESS;
}
} else {
ESP_LOGW(TAG, " Server Verification skipped");
ret = SUCCESS;
}
if(LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) {
if (mbedtls_ssl_get_peer_cert(&(tlsDataParams->ssl)) != NULL) {
ESP_LOGD(TAG, "Peer certificate information:");
mbedtls_x509_crt_info((char *) info_buf, sizeof(info_buf) - 1, " ", mbedtls_ssl_get_peer_cert(&(tlsDataParams->ssl)));
ESP_LOGD(TAG, "%s", info_buf);
}
}
return (IoT_Error_t) ret;
}
IoT_Error_t iot_tls_write(Network *pNetwork, unsigned char *pMsg, size_t len, Timer *timer, size_t *written_len) {
size_t written_so_far;
bool isErrorFlag = false;
int frags, ret = 0;
TLSDataParams *tlsDataParams = &(pNetwork->tlsDataParams);
for(written_so_far = 0, frags = 0;
written_so_far < len && !has_timer_expired(timer); written_so_far += ret, frags++) {
while(!has_timer_expired(timer) &&
(ret = mbedtls_ssl_write(&(tlsDataParams->ssl), pMsg + written_so_far, len - written_so_far)) <= 0) {
if(ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
ESP_LOGE(TAG, "failed! mbedtls_ssl_write returned -0x%x", -ret);
/* All other negative return values indicate connection needs to be reset.
* Will be caught in ping request so ignored here */
isErrorFlag = true;
break;
}
}
if(isErrorFlag) {
break;
}
}
*written_len = written_so_far;
if(isErrorFlag) {
return NETWORK_SSL_WRITE_ERROR;
} else if(has_timer_expired(timer) && written_so_far != len) {
return NETWORK_SSL_WRITE_TIMEOUT_ERROR;
}
return SUCCESS;
}
IoT_Error_t iot_tls_read(Network *pNetwork, unsigned char *pMsg, size_t len, Timer *timer, size_t *read_len) {
TLSDataParams *tlsDataParams = &(pNetwork->tlsDataParams);
mbedtls_ssl_context *ssl = &(tlsDataParams->ssl);
mbedtls_ssl_config *ssl_conf = &(tlsDataParams->conf);
uint32_t read_timeout;
size_t rxLen = 0;
int ret;
read_timeout = ssl_conf->read_timeout;
while (len > 0) {
/* Make sure we never block on read for longer than timer has left,
but also that we don't block indefinitely (ie read_timeout > 0) */
mbedtls_ssl_conf_read_timeout(ssl_conf, MAX(1, MIN(read_timeout, left_ms(timer))));
ret = mbedtls_ssl_read(ssl, pMsg, len);
/* Restore the old timeout */
mbedtls_ssl_conf_read_timeout(ssl_conf, read_timeout);
if (ret > 0) {
rxLen += ret;
pMsg += ret;
len -= ret;
} else if (ret == 0 || (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE && ret != MBEDTLS_ERR_SSL_TIMEOUT)) {
return NETWORK_SSL_READ_ERROR;
}
// Evaluate timeout after the read to make sure read is done at least once
if (has_timer_expired(timer)) {
break;
}
}
if (len == 0) {
*read_len = rxLen;
return SUCCESS;
}
if (rxLen == 0) {
return NETWORK_SSL_NOTHING_TO_READ;
} else {
return NETWORK_SSL_READ_TIMEOUT_ERROR;
}
}
IoT_Error_t iot_tls_disconnect(Network *pNetwork) {
mbedtls_ssl_context *ssl = &(pNetwork->tlsDataParams.ssl);
int ret = 0;
do {
ret = mbedtls_ssl_close_notify(ssl);
} while(ret == MBEDTLS_ERR_SSL_WANT_WRITE);
/* All other negative return values indicate connection needs to be reset.
* No further action required since this is disconnect call */
return SUCCESS;
}
IoT_Error_t iot_tls_destroy(Network *pNetwork) {
TLSDataParams *tlsDataParams = &(pNetwork->tlsDataParams);
mbedtls_net_free(&(tlsDataParams->server_fd));
mbedtls_x509_crt_free(&(tlsDataParams->clicert));
mbedtls_x509_crt_free(&(tlsDataParams->cacert));
mbedtls_pk_free(&(tlsDataParams->pkey));
mbedtls_ssl_free(&(tlsDataParams->ssl));
mbedtls_ssl_config_free(&(tlsDataParams->conf));
mbedtls_ctr_drbg_free(&(tlsDataParams->ctr_drbg));
mbedtls_entropy_free(&(tlsDataParams->entropy));
return SUCCESS;
}

View File

@ -1,104 +0,0 @@
/*
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Additions Copyright 2016 Espressif Systems (Shanghai) PTE LTD
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "threads_platform.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Initialize the provided mutex
*
* Call this function to initialize the mutex
*
* @param IoT_Mutex_t - pointer to the mutex to be initialized
* @return IoT_Error_t - error code indicating result of operation
*/
IoT_Error_t aws_iot_thread_mutex_init(IoT_Mutex_t *pMutex) {
pMutex->mutex = xSemaphoreCreateRecursiveMutex();
return pMutex->mutex ? SUCCESS : MUTEX_INIT_ERROR;
}
/**
* @brief Lock the provided mutex
*
* Call this function to lock the mutex before performing a state change
* Blocking, thread will block until lock request fails
*
* @param IoT_Mutex_t - pointer to the mutex to be locked
* @return IoT_Error_t - error code indicating result of operation
*/
IoT_Error_t aws_iot_thread_mutex_lock(IoT_Mutex_t *pMutex) {
xSemaphoreTakeRecursive(pMutex->mutex, portMAX_DELAY);
return SUCCESS;
}
/**
* @brief Try to lock the provided mutex
*
* Call this function to attempt to lock the mutex before performing a state change
* Non-Blocking, immediately returns with failure if lock attempt fails
*
* @param IoT_Mutex_t - pointer to the mutex to be locked
* @return IoT_Error_t - error code indicating result of operation
*/
IoT_Error_t aws_iot_thread_mutex_trylock(IoT_Mutex_t *pMutex) {
if (xSemaphoreTakeRecursive(pMutex->mutex, 0)) {
return SUCCESS;
} else {
return MUTEX_LOCK_ERROR;
}
}
/**
* @brief Unlock the provided mutex
*
* Call this function to unlock the mutex before performing a state change
*
* @param IoT_Mutex_t - pointer to the mutex to be unlocked
* @return IoT_Error_t - error code indicating result of operation
*/
IoT_Error_t aws_iot_thread_mutex_unlock(IoT_Mutex_t *pMutex) {
if (xSemaphoreGiveRecursive(pMutex->mutex)) {
return SUCCESS;
} else {
return MUTEX_UNLOCK_ERROR;
}
}
/**
* @brief Destroy the provided mutex
*
* Call this function to destroy the mutex
*
* @param IoT_Mutex_t - pointer to the mutex to be destroyed
* @return IoT_Error_t - error code indicating result of operation
*/
IoT_Error_t aws_iot_thread_mutex_destroy(IoT_Mutex_t *pMutex) {
vSemaphoreDelete(pMutex->mutex);
return SUCCESS;
}
#ifdef __cplusplus
}
#endif

View File

@ -1,83 +0,0 @@
/*
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Additions Copyright 2016 Espressif Systems (Shanghai) PTE LTD
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/**
* @file timer.c
* @brief FreeRTOS implementation of the timer interface uses ticks.
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <limits.h>
#include "timer_platform.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_log.h"
const static char *TAG = "aws_timer";
bool has_timer_expired(Timer *timer) {
uint32_t now = xTaskGetTickCount();
bool expired = (now - timer->start_ticks) >= timer->timeout_ticks;
/* AWS IoT SDK isn't very RTOS friendly because it polls for "done
timers" a lot without ever sleeping on them. So we hack in some
amount of sleeping here: if it seems like the caller is polling
an unexpired timer in a tight loop then we delay a tick to let
things progress elsewhere.
*/
if(!expired && now == timer->last_polled_ticks) {
vTaskDelay(1);
}
timer->last_polled_ticks = now;
return expired;
}
void countdown_ms(Timer *timer, uint32_t timeout) {
timer->start_ticks = xTaskGetTickCount();
timer->timeout_ticks = timeout / portTICK_PERIOD_MS;
timer->last_polled_ticks = 0;
}
uint32_t left_ms(Timer *timer) {
uint32_t now = xTaskGetTickCount();
uint32_t elapsed = now - timer->start_ticks;
if (elapsed < timer->timeout_ticks) {
return (timer->timeout_ticks - elapsed) * portTICK_PERIOD_MS;
} else {
return 0;
}
}
void countdown_sec(Timer *timer, uint32_t timeout) {
if (timeout > UINT32_MAX / 1000) {
ESP_LOGE(TAG, "timeout is out of range: %ds", timeout);
}
countdown_ms(timer, timeout * 1000);
}
void init_timer(Timer *timer) {
timer->start_ticks = 0;
timer->timeout_ticks = 0;
timer->last_polled_ticks = 0;
}
#ifdef __cplusplus
}
#endif

View File

@ -1,7 +1,21 @@
# bootloader component logic is all in project_include.cmake,
# and subproject/CMakeLists.txt.
#
# This file is only included so the build system finds the
# component
idf_component_register(PRIV_REQUIRES partition_table)
# Do not generate flash file when building bootloader or is in early expansion of the build
if(BOOTLOADER_BUILD)
return()
endif()
# When secure boot is enabled, do not flash bootloader along with invocation of `idf.py flash`
if(NOT CONFIG_SECURE_BOOT_ENABLED)
set(flash_bootloader FLASH_IN_PROJECT)
endif()
# Set values used in flash_bootloader_args.in and generate flash file
# for bootloader
esptool_py_flash_project_args(bootloader 0x1000
${BOOTLOADER_BUILD_DIR}/bootloader.bin
${flash_bootloader}
FLASH_FILE_TEMPLATE flash_bootloader_args.in)
esptool_py_custom_target(bootloader-flash bootloader "bootloader")
add_dependencies(bootloader partition_table)

View File

@ -1,38 +1,38 @@
menu "Bootloader config"
choice LOG_BOOTLOADER_LEVEL
choice BOOTLOADER_LOG_LEVEL
bool "Bootloader log verbosity"
default LOG_BOOTLOADER_LEVEL_INFO
default BOOTLOADER_LOG_LEVEL_INFO
help
Specify how much output to see in bootloader logs.
config LOG_BOOTLOADER_LEVEL_NONE
config BOOTLOADER_LOG_LEVEL_NONE
bool "No output"
config LOG_BOOTLOADER_LEVEL_ERROR
config BOOTLOADER_LOG_LEVEL_ERROR
bool "Error"
config LOG_BOOTLOADER_LEVEL_WARN
config BOOTLOADER_LOG_LEVEL_WARN
bool "Warning"
config LOG_BOOTLOADER_LEVEL_INFO
config BOOTLOADER_LOG_LEVEL_INFO
bool "Info"
config LOG_BOOTLOADER_LEVEL_DEBUG
config BOOTLOADER_LOG_LEVEL_DEBUG
bool "Debug"
config LOG_BOOTLOADER_LEVEL_VERBOSE
config BOOTLOADER_LOG_LEVEL_VERBOSE
bool "Verbose"
endchoice
config LOG_BOOTLOADER_LEVEL
config BOOTLOADER_LOG_LEVEL
int
default 0 if LOG_BOOTLOADER_LEVEL_NONE
default 1 if LOG_BOOTLOADER_LEVEL_ERROR
default 2 if LOG_BOOTLOADER_LEVEL_WARN
default 3 if LOG_BOOTLOADER_LEVEL_INFO
default 4 if LOG_BOOTLOADER_LEVEL_DEBUG
default 5 if LOG_BOOTLOADER_LEVEL_VERBOSE
default 0 if BOOTLOADER_LOG_LEVEL_NONE
default 1 if BOOTLOADER_LOG_LEVEL_ERROR
default 2 if BOOTLOADER_LOG_LEVEL_WARN
default 3 if BOOTLOADER_LOG_LEVEL_INFO
default 4 if BOOTLOADER_LOG_LEVEL_DEBUG
default 5 if BOOTLOADER_LOG_LEVEL_VERBOSE
config BOOTLOADER_SPI_WP_PIN
int "SPI Flash WP Pin when customising pins via eFuse (read help)"
range 0 33
default 7
depends on FLASHMODE_QIO || FLASHMODE_QOUT
depends on ESPTOOLPY_FLASHMODE_QIO || ESPTOOLPY_FLASHMODE_QOUT
help
This value is ignored unless flash mode is set to QIO or QOUT *and* the SPI flash pins have been
overriden by setting the eFuses SPI_PAD_CONFIG_xxx.
@ -140,7 +140,7 @@ menu "Bootloader config"
source for slow_clk - and ends calling app_main.
Re-set timeout is needed due to WDT uses a SLOW_CLK clock source. After changing a frequency slow_clk a
time of WDT needs to re-set for new frequency.
slow_clk depends on ESP32_RTC_CLOCK_SOURCE (INTERNAL_RC or EXTERNAL_CRYSTAL).
slow_clk depends on ESP32_RTC_CLK_SRC (INTERNAL_RC or EXTERNAL_CRYSTAL).
config BOOTLOADER_WDT_DISABLE_IN_USER_CODE
bool "Allows RTC watchdog disable in user code"
@ -163,7 +163,7 @@ menu "Bootloader config"
- these options can increase the execution time.
Note: RTC_WDT will reset while encryption operations will be performed.
config APP_ROLLBACK_ENABLE
config BOOTLOADER_APP_ROLLBACK_ENABLE
bool "Enable app rollback support"
default n
help
@ -175,22 +175,22 @@ menu "Bootloader config"
Note: If during the first boot a new app the power goes out or the WDT works, then roll back will happen.
Rollback is possible only between the apps with the same security versions.
config APP_ANTI_ROLLBACK
config BOOTLOADER_APP_ANTI_ROLLBACK
bool "Enable app anti-rollback support"
depends on APP_ROLLBACK_ENABLE
depends on BOOTLOADER_APP_ROLLBACK_ENABLE
default n
help
This option prevents rollback to previous firmware/application image with lower security version.
config APP_SECURE_VERSION
config BOOTLOADER_APP_SECURE_VERSION
int "eFuse secure version of app"
depends on APP_ANTI_ROLLBACK
depends on BOOTLOADER_APP_ANTI_ROLLBACK
default 0
help
The secure version is the sequence number stored in the header of each firmware.
The security version is set in the bootloader, version is recorded in the eFuse field
as the number of set ones. The allocated number of bits in the efuse field
for storing the security version is limited (see APP_SECURE_VERSION_SIZE_EFUSE_FIELD option).
for storing the security version is limited (see BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD option).
Bootloader: When bootloader selects an app to boot, an app is selected that has
a security version greater or equal that recorded in eFuse field.
@ -201,19 +201,19 @@ menu "Bootloader config"
Your partition table should has a scheme with ota_0 + ota_1 (without factory).
config APP_SECURE_VERSION_SIZE_EFUSE_FIELD
config BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD
int "Size of the efuse secure version field"
depends on APP_ANTI_ROLLBACK
depends on BOOTLOADER_APP_ANTI_ROLLBACK
range 1 32
default 32
help
The size of the efuse secure version field. Its length is limited to 32 bits.
This determines how many times the security version can be increased.
config EFUSE_SECURE_VERSION_EMULATE
config BOOTLOADER_EFUSE_SECURE_VERSION_EMULATE
bool "Emulate operations with efuse secure version(only test)"
default n
depends on APP_ANTI_ROLLBACK
depends on BOOTLOADER_APP_ANTI_ROLLBACK
help
This option allow emulate read/write operations with efuse secure version.
It allow to test anti-rollback implemention without permanent write eFuse bits.
@ -234,6 +234,7 @@ menu "Security features"
config SECURE_SIGNED_ON_UPDATE
bool
default y
select MBEDTLS_ECP_DP_SECP256R1_ENABLED
depends on SECURE_BOOT_ENABLED || SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT
config SECURE_SIGNED_APPS
@ -399,7 +400,7 @@ menu "Security features"
Refer to https://docs.espressif.com/projects/esp-idf/en/latest/security/secure-boot.html before enabling.
config FLASH_ENCRYPTION_ENABLED
config SECURE_FLASH_ENC_ENABLED
bool "Enable flash encryption on boot (READ DOCS FIRST)"
default N
help
@ -408,33 +409,43 @@ menu "Security features"
Note: After first boot, the system will be permanently encrypted. Re-flashing an encrypted
system is complicated and not always possible.
Read https://docs.espressif.com/projects/esp-idf/en/latest/security/flash-encryption.html before enabling.
Read https://docs.espressif.com/projects/esp-idf/en/latest/security/flash-encryption.html
before enabling.
config FLASH_ENCRYPTION_INSECURE
bool "Allow potentially insecure options"
depends on FLASH_ENCRYPTION_ENABLED
default N
choice SECURE_FLASH_ENCRYPTION_MODE
bool "Enable usage mode"
depends on SECURE_FLASH_ENC_ENABLED
default SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
help
You can disable some of the default protections offered by flash encryption, in order to enable testing or
a custom combination of security features.
By default Development mode is enabled which allows UART bootloader to perform flash encryption operations
Only enable these options if you are very sure.
Select Release mode only for production or manufacturing. Once enabled you can not reflash using UART
bootloader
Refer to https://docs.espressif.com/projects/esp-idf/en/latest/security/secure-boot.html and
https://docs.espressif.com/projects/esp-idf/en/latest/security/flash-encryption.html for details.
config SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
bool "Development(NOT SECURE)"
select SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC
config SECURE_FLASH_ENCRYPTION_MODE_RELEASE
bool "Release"
endchoice
menu "Potentially insecure options"
visible if FLASH_ENCRYPTION_INSECURE || SECURE_BOOT_INSECURE
visible if SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT || SECURE_BOOT_INSECURE
# NOTE: Options in this menu NEED to have SECURE_BOOT_INSECURE
# and/or FLASH_ENCRYPTION_INSECURE in "depends on", as the menu
# and/or SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT in "depends on", as the menu
# itself doesn't enable/disable its children (if it's not set,
# it's possible for the insecure menu to be disabled but the insecure option
# to remain on which is very bad.)
config SECURE_BOOT_ALLOW_ROM_BASIC
bool "Leave ROM BASIC Interpreter available on reset"
depends on SECURE_BOOT_INSECURE || FLASH_ENCRYPTION_INSECURE
depends on SECURE_BOOT_INSECURE || SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
default N
help
By default, the BASIC ROM Console starts on reset if no valid bootloader is
@ -448,7 +459,7 @@ menu "Security features"
config SECURE_BOOT_ALLOW_JTAG
bool "Allow JTAG Debugging"
depends on SECURE_BOOT_INSECURE || FLASH_ENCRYPTION_INSECURE
depends on SECURE_BOOT_INSECURE || SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
default N
help
If not set (default), the bootloader will permanently disable JTAG (across entire chip) on first boot
@ -473,9 +484,9 @@ menu "Security features"
image to this length. It is generally not recommended to set this option, unless you have a legacy
partitioning scheme which doesn't support 64KB aligned partition lengths.
config FLASH_ENCRYPTION_UART_BOOTLOADER_ALLOW_ENCRYPT
config SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC
bool "Leave UART bootloader encryption enabled"
depends on FLASH_ENCRYPTION_INSECURE
depends on SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
default N
help
If not set (default), the bootloader will permanently disable UART bootloader encryption access on
@ -483,9 +494,9 @@ menu "Security features"
It is recommended to only set this option in testing environments.
config FLASH_ENCRYPTION_UART_BOOTLOADER_ALLOW_DECRYPT
config SECURE_FLASH_UART_BOOTLOADER_ALLOW_DEC
bool "Leave UART bootloader decryption enabled"
depends on FLASH_ENCRYPTION_INSECURE
depends on SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
default N
help
If not set (default), the bootloader will permanently disable UART bootloader decryption access on
@ -494,9 +505,9 @@ menu "Security features"
Only set this option in testing environments. Setting this option allows complete bypass of flash
encryption.
config FLASH_ENCRYPTION_UART_BOOTLOADER_ALLOW_CACHE
config SECURE_FLASH_UART_BOOTLOADER_ALLOW_CACHE
bool "Leave UART bootloader flash cache enabled"
depends on FLASH_ENCRYPTION_INSECURE
depends on SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
default N
help
If not set (default), the bootloader will permanently disable UART bootloader flash cache access on
@ -504,16 +515,6 @@ menu "Security features"
Only set this option in testing environments.
config SECURE_BOOT_TEST_MODE
bool "Secure boot test mode: don't permanently set any eFuses"
depends on SECURE_BOOT_INSECURE
default N
help
If this option is set, all permanent secure boot changes (via eFuse) are disabled.
Log output will state changes which would be applied, but they will not be.
This option is for testing purposes only - it completely disables secure boot protection.
endmenu # Potentially Insecure
endmenu # Security features

View File

@ -1,4 +1,4 @@
--flash_mode ${ESPFLASHMODE}
--flash_size ${ESPFLASHSIZE}
--flash_freq ${ESPFLASHFREQ}
${BOOTLOADER_OFFSET} bootloader/bootloader.bin
${OFFSET} ${IMAGE}

View File

@ -1,65 +1,120 @@
# This is for tracking the top level project path
set(BOOTLOADER_OFFSET 0x1000)
# Do not generate flash file when building bootloader
if(BOOTLOADER_BUILD)
set(main_project_path "${CMAKE_BINARY_DIR}/../..")
else()
set(main_project_path "${IDF_PROJECT_PATH}")
endif()
get_filename_component(secure_boot_signing_key
"${CONFIG_SECURE_BOOT_SIGNING_KEY}"
ABSOLUTE BASE_DIR "${main_project_path}")
if(NOT EXISTS ${secure_boot_signing_key})
# If the signing key is not found, create a phony gen_secure_boot_signing_key target that
# fails the build. fail_at_build_time also touches CMakeCache.txt to cause a cmake run next time
# (to pick up a new signing key if one exists, etc.)
fail_at_build_time(gen_secure_boot_signing_key
"Secure Boot Signing Key ${CONFIG_SECURE_BOOT_SIGNING_KEY} does not exist. Generate using:"
"\tespsecure.py generate_signing_key ${CONFIG_SECURE_BOOT_SIGNING_KEY}")
else()
add_custom_target(gen_secure_boot_signing_key)
endif()
if(BOOTLOADER_BUILD OR NOT IDF_BUILD_ARTIFACTS)
return() # don't keep recursing, generate on project builds
return()
endif()
# Glue to build the bootloader subproject binary as an external
# cmake project under this one
#
#
set(bootloader_build_dir "${IDF_BUILD_ARTIFACTS_DIR}/bootloader")
idf_build_get_property(build_dir BUILD_DIR)
set(BOOTLOADER_BUILD_DIR "${build_dir}/bootloader")
set(bootloader_binary_files
"${bootloader_build_dir}/bootloader.elf"
"${bootloader_build_dir}/bootloader.bin"
"${bootloader_build_dir}/bootloader.map"
"${BOOTLOADER_BUILD_DIR}/bootloader.elf"
"${BOOTLOADER_BUILD_DIR}/bootloader.bin"
"${BOOTLOADER_BUILD_DIR}/bootloader.map"
)
# These additional files may get generated
if(CONFIG_SECURE_BOOTLOADER_REFLASHABLE)
set(bootloader_binary_files
${bootloader_binary_files}
"${bootloader_build_dir}/bootloader-reflash-digest.bin"
"${bootloader_build_dir}/secure-bootloader-key-192.bin"
"${bootloader_build_dir}/secure-bootloader-key-256.bin"
)
idf_build_get_property(project_dir PROJECT_DIR)
# There are some additional processing when CONFIG_CONFIG_SECURE_SIGNED_APPS. This happens
# when either CONFIG_SECURE_BOOT_ENABLED or SECURE_BOOT_BUILD_SIGNED_BINARIES.
# For both cases, the user either sets binaries to be signed during build or not
# using CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES.
#
# Regardless, pass the main project's keys (signing/verification) to the bootloader subproject
# via config.
if(CONFIG_SECURE_SIGNED_APPS)
add_custom_target(gen_secure_boot_keys)
if(CONFIG_SECURE_BOOT_ENABLED)
# Check that the configuration is sane
if((CONFIG_SECURE_BOOTLOADER_REFLASHABLE AND CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH) OR
(NOT CONFIG_SECURE_BOOTLOADER_REFLASHABLE AND NOT CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH))
fail_at_build_time(bootloader "Invalid bootloader target: bad sdkconfig?")
endif()
if(CONFIG_SECURE_BOOTLOADER_REFLASHABLE)
set(bootloader_binary_files
${bootloader_binary_files}
"${BOOTLOADER_BUILD_DIR}/bootloader-reflash-digest.bin"
"${BOOTLOADER_BUILD_DIR}/secure-bootloader-key-192.bin"
"${BOOTLOADER_BUILD_DIR}/secure-bootloader-key-256.bin"
)
endif()
endif()
# Since keys are usually given relative to main project dir, get the absolute paths to the keys
# for use by the bootloader subproject. Replace the values in config with these absolute paths,
# so that bootloader subproject does not need to assume main project dir to obtain path to the keys.
if(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES)
get_filename_component(secure_boot_signing_key
"${CONFIG_SECURE_BOOT_SIGNING_KEY}"
ABSOLUTE BASE_DIR "${project_dir}")
if(NOT EXISTS ${secure_boot_signing_key})
# If the signing key is not found, create a phony gen_secure_boot_signing_key target that
# fails the build. fail_at_build_time causes a cmake run next time
# (to pick up a new signing key if one exists, etc.)
fail_at_build_time(gen_secure_boot_signing_key
"Secure Boot Signing Key ${CONFIG_SECURE_BOOT_SIGNING_KEY} does not exist. Generate using:"
"\tespsecure.py generate_signing_key ${CONFIG_SECURE_BOOT_SIGNING_KEY}")
else()
add_custom_target(gen_secure_boot_signing_key)
endif()
set(SECURE_BOOT_SIGNING_KEY ${secure_boot_signing_key}) # needed by some other components
set(sign_key_arg "-DSECURE_BOOT_SIGNING_KEY=${secure_boot_signing_key}")
add_dependencies(gen_secure_boot_keys gen_secure_boot_signing_key)
else()
get_filename_component(secure_boot_verification_key
${CONFIG_SECURE_BOOT_VERIFICATION_KEY}
ABSOLUTE BASE_DIR "${project_dir}")
if(NOT EXISTS ${secure_boot_verification_key})
# If the verification key is not found, create a phony gen_secure_boot_verification_key target that
# fails the build. fail_at_build_time causes a cmake run next time
# (to pick up a new verification key if one exists, etc.)
fail_at_build_time(gen_secure_boot_verification_key
"Secure Boot Verification Public Key ${CONFIG_SECURE_BOOT_VERIFICATION_KEY} does not exist."
"\tThis can be extracted from the private signing key."
"\tSee docs/security/secure-boot.rst for details.")
else()
add_custom_target(gen_secure_boot_verification_key)
endif()
set(ver_key_arg "-DSECURE_BOOT_VERIFICATION_KEY=${secure_boot_verification_key}")
add_dependencies(gen_secure_boot_keys gen_secure_boot_verification_key)
endif()
endif()
if((NOT CONFIG_SECURE_BOOT_ENABLED) OR
CONFIG_SECURE_BOOTLOADER_REFLASHABLE OR
CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH)
externalproject_add(bootloader
# TODO: support overriding the bootloader in COMPONENT_PATHS
SOURCE_DIR "${IDF_PATH}/components/bootloader/subproject"
BINARY_DIR "${bootloader_build_dir}"
CMAKE_ARGS -DSDKCONFIG=${SDKCONFIG} -DIDF_PATH=${IDF_PATH}
-DSECURE_BOOT_SIGNING_KEY=${secure_boot_signing_key}
INSTALL_COMMAND ""
BUILD_ALWAYS 1 # no easy way around this...
BUILD_BYPRODUCTS ${bootloader_binary_files}
DEPENDS gen_secure_boot_signing_key
)
else()
fail_at_build_time(bootloader "Invalid bootloader target: bad sdkconfig?")
idf_build_get_property(idf_path IDF_PATH)
idf_build_get_property(idf_target IDF_TARGET)
idf_build_get_property(sdkconfig SDKCONFIG)
externalproject_add(bootloader
SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/subproject"
BINARY_DIR "${BOOTLOADER_BUILD_DIR}"
CMAKE_ARGS -DSDKCONFIG=${sdkconfig} -DIDF_PATH=${idf_path} -DIDF_TARGET=${idf_target}
-DPYTHON_DEPS_CHECKED=1
-DEXTRA_COMPONENT_DIRS=${CMAKE_CURRENT_LIST_DIR}
${sign_key_arg} ${ver_key_arg}
# LEGACY_INCLUDE_COMMON_HEADERS has to be passed in via cache variable since
# the bootloader common component requirements depends on this and
# config variables are not available before project() call.
-DLEGACY_INCLUDE_COMMON_HEADERS=${CONFIG_LEGACY_INCLUDE_COMMON_HEADERS}
INSTALL_COMMAND ""
BUILD_ALWAYS 1 # no easy way around this...
BUILD_BYPRODUCTS ${bootloader_binary_files}
)
if(CONFIG_SECURE_SIGNED_APPS)
add_dependencies(bootloader gen_secure_boot_keys)
endif()
# this is a hack due to an (annoying) shortcoming in cmake, it can't
@ -69,4 +124,4 @@ endif()
# So for now we just have the top-level build remove the final build products...
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES
${bootloader_binary_files})
${bootloader_binary_files})

View File

@ -0,0 +1,22 @@
# sdkconfig replacement configurations for deprecated options formatted as
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
CONFIG_LOG_BOOTLOADER_LEVEL CONFIG_BOOTLOADER_LOG_LEVEL
CONFIG_LOG_BOOTLOADER_LEVEL_NONE CONFIG_BOOTLOADER_LOG_LEVEL_NONE
CONFIG_LOG_BOOTLOADER_LEVEL_ERROR CONFIG_BOOTLOADER_LOG_LEVEL_ERROR
CONFIG_LOG_BOOTLOADER_LEVEL_WARN CONFIG_BOOTLOADER_LOG_LEVEL_WARN
CONFIG_LOG_BOOTLOADER_LEVEL_INFO CONFIG_BOOTLOADER_LOG_LEVEL_INFO
CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG
CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE
CONFIG_APP_ROLLBACK_ENABLE CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
CONFIG_APP_ANTI_ROLLBACK CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
CONFIG_APP_SECURE_VERSION CONFIG_BOOTLOADER_APP_SECURE_VERSION
CONFIG_APP_SECURE_VERSION_SIZE_EFUSE_FIELD CONFIG_BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD
CONFIG_EFUSE_SECURE_VERSION_EMULATE CONFIG_BOOTLOADER_EFUSE_SECURE_VERSION_EMULATE
CONFIG_FLASH_ENCRYPTION_ENABLED CONFIG_SECURE_FLASH_ENC_ENABLED
CONFIG_FLASH_ENCRYPTION_INSECURE CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
CONFIG_FLASH_ENCRYPTION_UART_BOOTLOADER_ALLOW_ENCRYPT CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC
CONFIG_FLASH_ENCRYPTION_UART_BOOTLOADER_ALLOW_DECRYPT CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_DEC
CONFIG_FLASH_ENCRYPTION_UART_BOOTLOADER_ALLOW_CACHE CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_CACHE

View File

@ -10,32 +10,24 @@ if(NOT IDF_PATH)
"in by the parent build process.")
endif()
set(COMPONENTS bootloader esptool_py esp32 partition_table soc bootloader_support log spi_flash micro-ecc soc main efuse)
if(NOT IDF_TARGET)
message(FATAL_ERROR "Bootloader subproject expects the IDF_TARGET variable to be passed "
"in by the parent build process.")
endif()
set(COMPONENTS bootloader esptool_py partition_table soc bootloader_support log spi_flash micro-ecc main efuse)
set(BOOTLOADER_BUILD 1)
add_definitions(-DBOOTLOADER_BUILD=1)
set(COMPONENT_REQUIRES_COMMON log esp32 soc)
include("${IDF_PATH}/tools/cmake/project.cmake")
set(common_req log esp_rom esp_common xtensa)
if(LEGACY_INCLUDE_COMMON_HEADERS)
list(APPEND common_req soc)
endif()
idf_build_set_property(__COMPONENT_REQUIRES_COMMON "${common_req}")
idf_build_set_property(__OUTPUT_SDKCONFIG 0)
project(bootloader)
target_linker_script(bootloader.elf
"main/esp32.bootloader.ld"
"main/esp32.bootloader.rom.ld"
)
# as cmake won't attach linker args to a header-only library, attach
# linker args directly to the bootloader.elf
set(ESP32_BOOTLOADER_LINKER_SCRIPTS
"../../esp32/ld/esp32.rom.ld"
"../../esp32/ld/esp32.rom.spiram_incompatible_fns.ld"
"../../esp32/ld/esp32.peripherals.ld")
target_linker_script(bootloader.elf ${ESP32_BOOTLOADER_LINKER_SCRIPTS})
target_link_libraries(bootloader.elf gcc)
set(secure_boot_signing_key ${SECURE_BOOT_SIGNING_KEY})
idf_build_set_property(COMPILE_DEFINITIONS "-DBOOTLOADER_BUILD=1" APPEND)
idf_build_set_property(COMPILE_OPTIONS "-fno-stack-protector" APPEND)
string(REPLACE ";" " " espsecurepy "${ESPSECUREPY}")
string(REPLACE ";" " " espefusepy "${ESPEFUSEPY}")
@ -59,7 +51,7 @@ if(CONFIG_SECURE_BOOTLOADER_REFLASHABLE)
add_custom_command(OUTPUT "${secure_bootloader_key}"
COMMAND ${ESPSECUREPY} digest_private_key
--keylen "${key_digest_len}"
--keyfile "${secure_boot_signing_key}"
--keyfile "${SECURE_BOOT_SIGNING_KEY}"
"${secure_bootloader_key}"
VERBATIM)
@ -73,7 +65,7 @@ if(CONFIG_SECURE_BOOTLOADER_REFLASHABLE)
"\nTo generate one, you can use this command:"
"\n\t${espsecurepy} generate_flash_encryption_key ${secure_bootloader_key}"
"\nIf a signing key is present, then instead use:"
"\n\t${ESPSECUREPY} digest_private_key "
"\n\t${espsecurepy} digest_private_key "
"--keylen (192/256) --keyfile KEYFILE "
"${secure_bootloader_key}")
endif()
@ -84,14 +76,14 @@ if(CONFIG_SECURE_BOOTLOADER_REFLASHABLE)
COMMAND ${CMAKE_COMMAND} -E echo "DIGEST ${bootloader_digest_bin}"
COMMAND ${ESPSECUREPY} digest_secure_bootloader --keyfile "${secure_bootloader_key}"
-o "${bootloader_digest_bin}" "${CMAKE_BINARY_DIR}/bootloader.bin"
DEPENDS gen_secure_bootloader_key "${CMAKE_BINARY_DIR}/bootloader.bin"
DEPENDS gen_secure_bootloader_key gen_project_binary
VERBATIM)
add_custom_target (gen_bootloader_digest_bin ALL DEPENDS "${bootloader_digest_bin}")
endif()
if(CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH)
add_custom_command(TARGET bootloader POST_BUILD
add_custom_command(TARGET bootloader.elf POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo
"=============================================================================="
COMMAND ${CMAKE_COMMAND} -E echo
@ -103,9 +95,8 @@ if(CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH)
COMMAND ${CMAKE_COMMAND} -E echo
"* IMPORTANT: After first boot, BOOTLOADER CANNOT BE RE-FLASHED on same device"
VERBATIM)
elseif(CONFIG_SECURE_BOOTLOADER_REFLASHABLE)
add_custom_command(TARGET bootloader POST_BUILD
add_custom_command(TARGET bootloader.elf POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo
"=============================================================================="
COMMAND ${CMAKE_COMMAND} -E echo

View File

@ -14,8 +14,11 @@ COMPONENTS := esptool_py bootloader_support log spi_flash micro-ecc soc main efu
CFLAGS =
CXXFLAGS =
#We cannot include the esp32 component directly but we need its includes.
CFLAGS += -I $(IDF_PATH)/components/esp32/include
#We cannot include the idf_target, esp_rom, esp_common component directly but we need their includes.
CFLAGS += -I $(IDF_PATH)/components/$(IDF_TARGET)/include
CFLAGS += -I $(IDF_PATH)/components/esp_rom/include
CFLAGS += -I $(IDF_PATH)/components/esp_common/include
CFLAGS += -I $(IDF_PATH)/components/xtensa/include -I $(IDF_PATH)/components/xtensa/$(IDF_TARGET)/include
# The bootloader pseudo-component is also included in this build, for its Kconfig.projbuild to be included.
#

View File

@ -0,0 +1,3 @@
# only compile the "micro-ecc/uECC.c" source file
idf_component_register(SRCS "micro-ecc/uECC.c"
INCLUDE_DIRS micro-ecc)

View File

@ -1,4 +1,8 @@
set(COMPONENT_SRCS "bootloader_start.c")
set(COMPONENT_ADD_INCLUDEDIRS "")
set(COMPONENT_REQUIRES "bootloader bootloader_support")
register_component()
idf_component_register(SRCS "bootloader_start.c"
REQUIRES bootloader bootloader_support)
idf_build_get_property(target IDF_TARGET)
set(scripts "${target}.bootloader.ld"
"${target}.bootloader.rom.ld")
target_linker_script(${COMPONENT_LIB} INTERFACE "${scripts}")

View File

@ -1,4 +1,4 @@
# Submodules normally added in component.mk, but fully qualified
# paths can be added at this level (we need binary librtc to be
# available to link bootloader).
COMPONENT_SUBMODULES += $(IDF_PATH)/components/esp32/lib
COMPONENT_SUBMODULES += $(IDF_PATH)/components/esp_wifi/lib_esp32

View File

@ -16,8 +16,8 @@
#include <stdbool.h>
#include "esp_log.h"
#include "rom/gpio.h"
#include "rom/spi_flash.h"
#include "esp32/rom/gpio.h"
#include "esp32/rom/spi_flash.h"
#include "bootloader_config.h"
#include "bootloader_init.h"
#include "bootloader_utility.h"
@ -111,3 +111,9 @@ static int selected_boot_partition(const bootloader_state_t *bs)
}
return boot_index;
}
// Return global reent struct if any newlib functions are linked to bootloader
struct _reent* __getreent() {
return _GLOBAL_REENT;
}

View File

@ -6,14 +6,14 @@
#
LINKER_SCRIPTS := \
esp32.bootloader.ld \
$(IDF_PATH)/components/esp32/ld/esp32.rom.ld \
$(IDF_PATH)/components/esp32/ld/esp32.rom.spiram_incompatible_fns.ld \
$(IDF_PATH)/components/esp32/ld/esp32.peripherals.ld \
esp32.bootloader.rom.ld
$(IDF_TARGET).bootloader.ld \
$(IDF_TARGET).bootloader.rom.ld \
$(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.ld \
$(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.newlib-funcs.ld \
$(IDF_PATH)/components/$(IDF_TARGET)/ld/$(IDF_TARGET).peripherals.ld
ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH
LINKER_SCRIPTS += $(IDF_PATH)/components/esp32/ld/esp32.rom.spiflash.ld
LINKER_SCRIPTS += $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.spiflash.ld
endif
COMPONENT_ADD_LDFLAGS += -L $(COMPONENT_PATH) $(addprefix -T ,$(LINKER_SCRIPTS))

View File

@ -149,7 +149,6 @@ SECTIONS
*(.gnu.linkonce.lit4.*)
_lit4_end = ABSOLUTE(.);
. = ALIGN(4);
_heap_start = ABSOLUTE(.);
} >dram_seg
.iram.text :

View File

@ -2,3 +2,8 @@ PROVIDE ( ets_update_cpu_frequency = 0x40008550 ); /* Updates g_ticks_per_us on
PROVIDE ( MD5Final = 0x4005db1c );
PROVIDE ( MD5Init = 0x4005da7c );
PROVIDE ( MD5Update = 0x4005da9c );
/* bootloader will use following functions from xtensa hal library */
xthal_get_ccount = 0x4000c050;
xthal_get_ccompare = 0x4000c078;
xthal_set_ccompare = 0x4000c058;

View File

@ -1,60 +1,66 @@
set(COMPONENT_SRCS "src/bootloader_clock.c"
"src/bootloader_common.c"
"src/bootloader_flash.c"
"src/bootloader_random.c"
"src/bootloader_sha.c"
"src/bootloader_utility.c"
"src/esp_image_format.c"
"src/flash_encrypt.c"
"src/flash_partitions.c"
"src/flash_qio_mode.c"
"src/secure_boot.c"
"src/secure_boot_signatures.c")
set(srcs
"src/bootloader_clock.c"
"src/bootloader_common.c"
"src/bootloader_flash.c"
"src/bootloader_flash_config.c"
"src/bootloader_random.c"
"src/bootloader_utility.c"
"src/esp_image_format.c"
"src/flash_encrypt.c"
"src/flash_partitions.c"
"src/flash_qio_mode.c")
if(${BOOTLOADER_BUILD})
set(COMPONENT_ADD_INCLUDEDIRS "include include_bootloader")
set(COMPONENT_REQUIRES)
set(COMPONENT_PRIV_REQUIRES spi_flash micro-ecc efuse)
list(APPEND COMPONENT_SRCS "src/bootloader_init.c")
if(CONFIG_SECURE_SIGNED_APPS)
get_filename_component(secure_boot_verification_key
"signature_verification_key.bin"
ABSOLUTE BASE_DIR "${CMAKE_BINARY_DIR}")
if(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES)
add_custom_command(OUTPUT "${secure_boot_verification_key}"
COMMAND ${ESPSECUREPY}
extract_public_key --keyfile "${secure_boot_signing_key}"
"${secure_boot_verification_key}"
DEPENDS gen_secure_boot_signing_key
VERBATIM)
else()
get_filename_component(orig_secure_boot_verification_key
"${CONFIG_SECURE_BOOT_VERIFICATION_KEY}"
ABSOLUTE BASE_DIR "${main_project_path}")
if(NOT EXISTS ${orig_secure_boot_verification_key})
message(FATAL_ERROR
"Secure Boot Verification Public Key ${CONFIG_SECURE_BOOT_VERIFICATION_KEY} does not exist."
"\nThis can be extracted from the private signing key."
"\nSee docs/security/secure-boot.rst for details.")
endif()
add_custom_command(OUTPUT "${secure_boot_verification_key}"
COMMAND ${CMAKE_COMMAND} -E copy "${orig_secure_boot_verification_key}"
"${secure_boot_verification_key}"
DEPENDS "${orig_secure_boot_verification_key}"
VERBATIM)
endif()
set(COMPONENT_EMBED_FILES "${secure_boot_verification_key}")
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
"${secure_boot_verification_key}")
endif()
if(BOOTLOADER_BUILD)
set(include_dirs "include" "include_bootloader")
set(requires soc) #unfortunately the header directly uses SOC registers
set(priv_requires micro-ecc spi_flash efuse)
list(APPEND srcs
"src/bootloader_init.c"
"src/${IDF_TARGET}/bootloader_sha.c"
"src/${IDF_TARGET}/flash_encrypt.c"
"src/${IDF_TARGET}/secure_boot_signatures.c"
"src/${IDF_TARGET}/secure_boot.c")
else()
set(COMPONENT_ADD_INCLUDEDIRS "include")
set(COMPONENT_PRIV_INCLUDEDIRS "include_bootloader")
set(COMPONENT_REQUIRES)
set(COMPONENT_PRIV_REQUIRES spi_flash mbedtls micro-ecc efuse)
list(APPEND srcs
"src/idf/bootloader_sha.c"
"src/idf/secure_boot_signatures.c")
set(include_dirs "include")
set(priv_include_dirs "include_bootloader")
set(requires soc) #unfortunately the header directly uses SOC registers
set(priv_requires spi_flash mbedtls efuse)
endif()
register_component()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
REQUIRES "${requires}"
PRIV_REQUIRES "${priv_requires}")
if(BOOTLOADER_BUILD AND CONFIG_SECURE_SIGNED_APPS)
# Whether CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES or not, we need verification key to embed
# in the library.
if(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES)
# We generate the key from the signing key. The signing key is passed from the main project.
get_filename_component(secure_boot_signing_key
"${SECURE_BOOT_SIGNING_KEY}"
ABSOLUTE BASE_DIR "${project_dir}")
get_filename_component(secure_boot_verification_key
"signature_verification_key.bin"
ABSOLUTE BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
add_custom_command(OUTPUT "${secure_boot_verification_key}"
COMMAND ${ESPSECUREPY}
extract_public_key --keyfile "${secure_boot_signing_key}"
"${secure_boot_verification_key}"
VERBATIM)
else()
# We expect to 'inherit' the verification key passed from main project.
get_filename_component(secure_boot_verification_key
${SECURE_BOOT_VERIFICATION_KEY}
ABSOLUTE BASE_DIR "${project_dir}")
endif()
target_add_binary_data(${COMPONENT_LIB} "${secure_boot_verification_key}" "BINARY")
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
"${secure_boot_verification_key}")
endif()

View File

@ -9,6 +9,12 @@ endif
COMPONENT_SRCDIRS := src
ifndef IS_BOOTLOADER_BUILD
COMPONENT_SRCDIRS += src/idf # idf sub-directory contains platform agnostic IDF versions
else
COMPONENT_SRCDIRS += src/$(IDF_TARGET) # one sub-dir per chip
endif
ifndef IS_BOOTLOADER_BUILD
COMPONENT_OBJEXCLUDE := src/bootloader_init.o
endif

View File

@ -14,8 +14,16 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
/** @brief Configure clocks for early boot
*
* Called by bootloader, or by the app if the bootloader version is old (pre v2.1).
*/
void bootloader_clock_configure(void);
#ifdef __cplusplus
}
#endif

View File

@ -13,9 +13,13 @@
// limitations under the License.
#pragma once
#include "esp_flash_data_types.h"
#include "esp_flash_partitions.h"
#include "esp_image_format.h"
#ifdef __cplusplus
extern "C" {
#endif
/// Type of hold a GPIO in low state
typedef enum {
GPIO_LONG_HOLD = 1, /*!< The long hold GPIO */
@ -136,3 +140,12 @@ int bootloader_common_select_otadata(const esp_ota_select_entry_t *two_otadata,
* - ESP_FAIL: mapping is fail.
*/
esp_err_t bootloader_common_get_partition_description(const esp_partition_pos_t *partition, esp_app_desc_t *app_desc);
/**
* @brief Configure VDDSDIO, call this API to rise VDDSDIO to 1.9V when VDDSDIO regulator is enabled as 1.8V mode.
*/
void bootloader_common_vddsdio_configure();
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,71 @@
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "esp_image_format.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Update the flash id in g_rom_flashchip(global esp_rom_spiflash_chip_t structure).
*
* @return None
*/
void bootloader_flash_update_id();
/**
* @brief Set the flash CS setup and hold time.
*
* @note CS setup time is recomemded to be 1.5T, and CS hold time is recommended to be 2.5T.
* cs_setup = 1, cs_setup_time = 0; cs_hold = 1, cs_hold_time = 1.
*
* @return None
*/
void bootloader_flash_cs_timing_config();
/**
* @brief Configure SPI flash clock.
*
* @note This function only set clock frequency for SPI0.
*
* @param pfhdr Pointer to App image header, from where to fetch flash settings.
*
* @return None
*/
void bootloader_flash_clock_config(const esp_image_header_t* pfhdr);
/**
* @brief Configure SPI flash gpio, include the IO matrix and drive strength configuration.
*
* @param pfhdr Pointer to App image header, from where to fetch flash settings.
*
* @return None
*/
void bootloader_flash_gpio_config(const esp_image_header_t* pfhdr);
/**
* @brief Configure SPI flash read dummy based on different mode and frequency.
*
* @param pfhdr Pointer to App image header, from where to fetch flash settings.
*
* @return None
*/
void bootloader_flash_dummy_config(const esp_image_header_t* pfhdr);
#ifdef __cplusplus
}
#endif

View File

@ -16,6 +16,10 @@
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Enable early entropy source for RNG
*
@ -47,3 +51,7 @@ void bootloader_random_disable(void);
* @param length This many bytes of random data will be copied to buffer
*/
void bootloader_fill_random(void *buffer, size_t length);
#ifdef __cplusplus
}
#endif

View File

@ -16,6 +16,10 @@
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Check if half-open intervals overlap
*
@ -29,6 +33,11 @@ static inline bool bootloader_util_regions_overlap(
const intptr_t start1, const intptr_t end1,
const intptr_t start2, const intptr_t end2)
{
return (end1 > start2 && end2 > start1) ||
!(end1 <= start2 || end2 <= start1);
assert(end1>start1);
assert(end2>start2);
return (end1 > start2 && end2 > start1);
}
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,109 @@
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
/**
* @brief SPI flash mode, used in esp_image_header_t
*/
typedef enum {
ESP_IMAGE_SPI_MODE_QIO, /*!< SPI mode QIO */
ESP_IMAGE_SPI_MODE_QOUT, /*!< SPI mode QOUT */
ESP_IMAGE_SPI_MODE_DIO, /*!< SPI mode DIO */
ESP_IMAGE_SPI_MODE_DOUT, /*!< SPI mode DOUT */
ESP_IMAGE_SPI_MODE_FAST_READ, /*!< SPI mode FAST_READ */
ESP_IMAGE_SPI_MODE_SLOW_READ /*!< SPI mode SLOW_READ */
} esp_image_spi_mode_t;
/**
* @brief SPI flash clock frequency
*/
typedef enum {
ESP_IMAGE_SPI_SPEED_40M, /*!< SPI clock frequency 40 MHz */
ESP_IMAGE_SPI_SPEED_26M, /*!< SPI clock frequency 26 MHz */
ESP_IMAGE_SPI_SPEED_20M, /*!< SPI clock frequency 20 MHz */
ESP_IMAGE_SPI_SPEED_80M = 0xF /*!< SPI clock frequency 80 MHz */
} esp_image_spi_freq_t;
/**
* @brief Supported SPI flash sizes
*/
typedef enum {
ESP_IMAGE_FLASH_SIZE_1MB = 0, /*!< SPI flash size 1 MB */
ESP_IMAGE_FLASH_SIZE_2MB, /*!< SPI flash size 2 MB */
ESP_IMAGE_FLASH_SIZE_4MB, /*!< SPI flash size 4 MB */
ESP_IMAGE_FLASH_SIZE_8MB, /*!< SPI flash size 8 MB */
ESP_IMAGE_FLASH_SIZE_16MB, /*!< SPI flash size 16 MB */
ESP_IMAGE_FLASH_SIZE_MAX /*!< SPI flash size MAX */
} esp_image_flash_size_t;
#define ESP_IMAGE_HEADER_MAGIC 0xE9 /*!< The magic word for the esp_image_header_t structure. */
/**
* @brief Main header of binary image
*/
typedef struct {
uint8_t magic; /*!< Magic word ESP_IMAGE_HEADER_MAGIC */
uint8_t segment_count; /*!< Count of memory segments */
uint8_t spi_mode; /*!< flash read mode (esp_image_spi_mode_t as uint8_t) */
uint8_t spi_speed: 4; /*!< flash frequency (esp_image_spi_freq_t as uint8_t) */
uint8_t spi_size: 4; /*!< flash chip size (esp_image_flash_size_t as uint8_t) */
uint32_t entry_addr; /*!< Entry address */
uint8_t wp_pin; /*!< WP pin when SPI pins set via efuse (read by ROM bootloader,
* the IDF bootloader uses software to configure the WP
* pin and sets this field to 0xEE=disabled) */
uint8_t spi_pin_drv[3]; /*!< Drive settings for the SPI flash pins (read by ROM bootloader) */
uint8_t reserved[11]; /*!< Reserved bytes in ESP32 additional header space, currently unused */
uint8_t hash_appended; /*!< If 1, a SHA256 digest "simple hash" (of the entire image) is appended after the checksum.
* Included in image length. This digest
* is separate to secure boot and only used for detecting corruption.
* For secure boot signed images, the signature
* is appended after this (and the simple hash is included in the signed data). */
} __attribute__((packed)) esp_image_header_t;
/** @cond */
_Static_assert(sizeof(esp_image_header_t) == 24, "binary image header should be 24 bytes");
/** @endcond */
/**
* @brief Header of binary image segment
*/
typedef struct {
uint32_t load_addr; /*!< Address of segment */
uint32_t data_len; /*!< Length of data */
} esp_image_segment_header_t;
#define ESP_IMAGE_MAX_SEGMENTS 16 /*!< Max count of segments in the image. */
#define ESP_APP_DESC_MAGIC_WORD 0xABCD5432 /*!< The magic word for the esp_app_desc structure that is in DROM. */
/**
* @brief Description about application.
*/
typedef struct {
uint32_t magic_word; /*!< Magic word ESP_APP_DESC_MAGIC_WORD */
uint32_t secure_version; /*!< Secure version */
uint32_t reserv1[2]; /*!< reserv1 */
char version[32]; /*!< Application version */
char project_name[32]; /*!< Project name */
char time[16]; /*!< Compile time */
char date[16]; /*!< Compile date*/
char idf_ver[32]; /*!< Version IDF */
uint8_t app_elf_sha256[32]; /*!< sha256 of elf file */
uint32_t reserv2[20]; /*!< reserv2 */
} esp_app_desc_t;
/** @cond */
_Static_assert(sizeof(esp_app_desc_t) == 256, "esp_app_desc_t should be 256 bytes");
/** @endcond */

View File

@ -0,0 +1,2 @@
#warning esp_flash_data_types.h has been merged into esp_flash_partitions.h, please include esp_flash_partitions.h instead
#include "esp_flash_partitions.h"

View File

@ -11,8 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __ESP32_FLASH_ENCRYPT_H
#define __ESP32_FLASH_ENCRYPT_H
#pragma once
#include <stdbool.h>
#include "esp_attr.h"
@ -20,7 +19,19 @@
#ifndef BOOTLOADER_BUILD
#include "esp_spi_flash.h"
#endif
#include "soc/efuse_reg.h"
#include "soc/efuse_periph.h"
#ifdef __cplusplus
extern "C" {
#endif
/* @brief Flash encryption mode based on efuse values
*/
typedef enum {
ESP_FLASH_ENC_MODE_DISABLED, // flash encryption is not enabled (flash crypt cnt=0)
ESP_FLASH_ENC_MODE_DEVELOPMENT, // flash encryption is enabled but for Development (reflash over UART allowed)
ESP_FLASH_ENC_MODE_RELEASE // flash encryption is enabled for Release (reflash over UART disabled)
} esp_flash_enc_mode_t;
/**
* @file esp_partition.h
@ -110,8 +121,18 @@ esp_err_t esp_flash_encrypt_region(uint32_t src_addr, size_t data_length);
* is enabled but secure boot is not used. This should protect against
* serial re-flashing of an unauthorised code in absence of secure boot.
*
* @return
*/
void esp_flash_write_protect_crypt_cnt();
/** @brief Return the flash encryption mode
*
* The API is called during boot process but can also be called by
* application to check the current flash encryption mode of ESP32
*
* @return
*/
esp_flash_enc_mode_t esp_get_flash_encryption_mode();
#ifdef __cplusplus
}
#endif

View File

@ -11,14 +11,37 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __ESP_FLASH_PARTITIONS_H
#define __ESP_FLASH_PARTITIONS_H
#pragma once
#include "esp_err.h"
#include "esp_flash_data_types.h"
#include <stdbool.h>
#include "esp_types.h"
#include "sdkconfig.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ESP_PARTITION_MAGIC 0x50AA
#define ESP_PARTITION_MAGIC_MD5 0xEBEB
#define PART_TYPE_APP 0x00
#define PART_SUBTYPE_FACTORY 0x00
#define PART_SUBTYPE_OTA_FLAG 0x10
#define PART_SUBTYPE_OTA_MASK 0x0f
#define PART_SUBTYPE_TEST 0x20
#define PART_TYPE_DATA 0x01
#define PART_SUBTYPE_DATA_OTA 0x00
#define PART_SUBTYPE_DATA_RF 0x01
#define PART_SUBTYPE_DATA_WIFI 0x02
#define PART_SUBTYPE_DATA_NVS_KEYS 0x04
#define PART_SUBTYPE_DATA_EFUSE_EM 0x05
#define PART_TYPE_END 0xff
#define PART_SUBTYPE_END 0xff
#define PART_FLAG_ENCRYPTED (1<<0)
/* Pre-partition table fixed flash offsets */
#define ESP_BOOTLOADER_DIGEST_OFFSET 0x0
#define ESP_BOOTLOADER_OFFSET 0x1000 /* Offset of bootloader image. Has matching value in bootloader KConfig.projbuild file. */
@ -27,6 +50,43 @@
#define ESP_PARTITION_TABLE_MAX_LEN 0xC00 /* Maximum length of partition table data */
#define ESP_PARTITION_TABLE_MAX_ENTRIES (ESP_PARTITION_TABLE_MAX_LEN / sizeof(esp_partition_info_t)) /* Maximum length of partition table data, including terminating entry */
/// OTA_DATA states for checking operability of the app.
typedef enum {
ESP_OTA_IMG_NEW = 0x0U, /*!< Monitor the first boot. In bootloader this state is changed to ESP_OTA_IMG_PENDING_VERIFY. */
ESP_OTA_IMG_PENDING_VERIFY = 0x1U, /*!< First boot for this app was. If while the second boot this state is then it will be changed to ABORTED. */
ESP_OTA_IMG_VALID = 0x2U, /*!< App was confirmed as workable. App can boot and work without limits. */
ESP_OTA_IMG_INVALID = 0x3U, /*!< App was confirmed as non-workable. This app will not selected to boot at all. */
ESP_OTA_IMG_ABORTED = 0x4U, /*!< App could not confirm the workable or non-workable. In bootloader IMG_PENDING_VERIFY state will be changed to IMG_ABORTED. This app will not selected to boot at all. */
ESP_OTA_IMG_UNDEFINED = 0xFFFFFFFFU, /*!< Undefined. App can boot and work without limits. */
} esp_ota_img_states_t;
/* OTA selection structure (two copies in the OTA data partition.)
Size of 32 bytes is friendly to flash encryption */
typedef struct {
uint32_t ota_seq;
uint8_t seq_label[20];
uint32_t ota_state;
uint32_t crc; /* CRC32 of ota_seq field only */
} esp_ota_select_entry_t;
typedef struct {
uint32_t offset;
uint32_t size;
} esp_partition_pos_t;
/* Structure which describes the layout of partition table entry.
* See docs/partition_tables.rst for more information about individual fields.
*/
typedef struct {
uint16_t magic;
uint8_t type;
uint8_t subtype;
esp_partition_pos_t pos;
uint8_t label[16];
uint32_t flags;
} esp_partition_info_t;
/* @brief Verify the partition table
*
* @param partition_table Pointer to at least ESP_PARTITION_TABLE_MAX_ENTRIES of potential partition table data. (ESP_PARTITION_TABLE_MAX_LEN bytes.)
@ -44,4 +104,16 @@ inline static __attribute__((deprecated)) esp_err_t esp_partition_table_basic_ve
return esp_partition_table_verify(partition_table, log_errors, num_partitions);
}
/**
* Check whether the region on the main flash is safe to write.
*
* @param addr Start address of the region
* @param size Size of the region
*
* @return true if the region is safe to write, otherwise false.
*/
bool esp_partition_main_flash_region_safe(size_t addr, size_t size);
#ifdef __cplusplus
}
#endif

View File

@ -16,6 +16,11 @@
#include <stdbool.h>
#include <esp_err.h>
#include "esp_flash_partitions.h"
#include "esp_app_format.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ESP_ERR_IMAGE_BASE 0x2000
#define ESP_ERR_IMAGE_FLASH_FAIL (ESP_ERR_IMAGE_BASE + 1)
@ -25,91 +30,8 @@
Can be compiled as part of app or bootloader code.
*/
/* SPI flash mode, used in esp_image_header_t */
typedef enum {
ESP_IMAGE_SPI_MODE_QIO,
ESP_IMAGE_SPI_MODE_QOUT,
ESP_IMAGE_SPI_MODE_DIO,
ESP_IMAGE_SPI_MODE_DOUT,
ESP_IMAGE_SPI_MODE_FAST_READ,
ESP_IMAGE_SPI_MODE_SLOW_READ
} esp_image_spi_mode_t;
/* SPI flash clock frequency */
typedef enum {
ESP_IMAGE_SPI_SPEED_40M,
ESP_IMAGE_SPI_SPEED_26M,
ESP_IMAGE_SPI_SPEED_20M,
ESP_IMAGE_SPI_SPEED_80M = 0xF
} esp_image_spi_freq_t;
/* Supported SPI flash sizes */
typedef enum {
ESP_IMAGE_FLASH_SIZE_1MB = 0,
ESP_IMAGE_FLASH_SIZE_2MB,
ESP_IMAGE_FLASH_SIZE_4MB,
ESP_IMAGE_FLASH_SIZE_8MB,
ESP_IMAGE_FLASH_SIZE_16MB,
ESP_IMAGE_FLASH_SIZE_MAX
} esp_image_flash_size_t;
#define ESP_IMAGE_HEADER_MAGIC 0xE9
/* Main header of binary image */
typedef struct {
uint8_t magic;
uint8_t segment_count;
/* flash read mode (esp_image_spi_mode_t as uint8_t) */
uint8_t spi_mode;
/* flash frequency (esp_image_spi_freq_t as uint8_t) */
uint8_t spi_speed: 4;
/* flash chip size (esp_image_flash_size_t as uint8_t) */
uint8_t spi_size: 4;
uint32_t entry_addr;
/* WP pin when SPI pins set via efuse (read by ROM bootloader, the IDF bootloader uses software to configure the WP
* pin and sets this field to 0xEE=disabled) */
uint8_t wp_pin;
/* Drive settings for the SPI flash pins (read by ROM bootloader) */
uint8_t spi_pin_drv[3];
/* Reserved bytes in ESP32 additional header space, currently unused */
uint8_t reserved[11];
/* If 1, a SHA256 digest "simple hash" (of the entire image) is appended after the checksum. Included in image length. This digest
* is separate to secure boot and only used for detecting corruption. For secure boot signed images, the signature
* is appended after this (and the simple hash is included in the signed data). */
uint8_t hash_appended;
} __attribute__((packed)) esp_image_header_t;
_Static_assert(sizeof(esp_image_header_t) == 24, "binary image header should be 24 bytes");
#define ESP_IMAGE_HASH_LEN 32 /* Length of the appended SHA-256 digest */
/* Header of binary image segment */
typedef struct {
uint32_t load_addr;
uint32_t data_len;
} esp_image_segment_header_t;
#define ESP_APP_DESC_MAGIC_WORD 0xABCD5432 /*!< The magic word for the esp_app_desc structure that is in DROM. */
/**
* @brief Description about application.
*/
typedef struct {
uint32_t magic_word; /*!< Magic word ESP_APP_DESC_MAGIC_WORD */
uint32_t secure_version; /*!< Secure version */
uint32_t reserv1[2]; /*!< --- */
char version[32]; /*!< Application version */
char project_name[32]; /*!< Project name */
char time[16]; /*!< Compile time */
char date[16]; /*!< Compile date*/
char idf_ver[32]; /*!< Version IDF */
uint8_t app_elf_sha256[32]; /*!< sha256 of elf file */
uint32_t reserv2[20]; /*!< --- */
} esp_app_desc_t;
_Static_assert(sizeof(esp_app_desc_t) == 256, "esp_app_desc_t should be 256 bytes");
#define ESP_IMAGE_MAX_SEGMENTS 16
/* Structure to hold on-flash image metadata */
typedef struct {
uint32_t start_addr; /* Start address of image */
@ -240,3 +162,7 @@ typedef struct {
uint32_t irom_load_addr;
uint32_t irom_size;
} esp_image_flash_mapping_t;
#ifdef __cplusplus
}
#endif

View File

@ -15,7 +15,7 @@
#include <stdbool.h>
#include <esp_err.h>
#include "soc/efuse_reg.h"
#include "soc/efuse_periph.h"
#include "sdkconfig.h"
@ -46,6 +46,25 @@ static inline bool esp_secure_boot_enabled(void) {
return REG_READ(EFUSE_BLK0_RDATA6_REG) & EFUSE_RD_ABS_DONE_0;
}
/** @brief Generate secure digest from bootloader image
*
* @important This function is intended to be called from bootloader code only.
*
* If secure boot is not yet enabled for bootloader, this will:
* 1) generate the secure boot key and burn it on EFUSE
* (without enabling R/W protection)
* 2) generate the digest from bootloader and save it
* to flash address 0x0
*
* If first boot gets interrupted after calling this function
* but before esp_secure_boot_permanently_enable() is called, then
* the key burned on EFUSE will not be regenerated, unless manually
* done using espefuse.py tool
*
* @return ESP_OK if secure boot digest is generated
* successfully or found to be already present
*/
esp_err_t esp_secure_boot_generate_digest(void);
/** @brief Enable secure boot if it is not already enabled.
*
@ -54,9 +73,13 @@ static inline bool esp_secure_boot_enabled(void) {
*
* @important This function is intended to be called from bootloader code only.
*
* @important This will enable r/w protection of secure boot key on EFUSE,
* therefore it is to be ensured that esp_secure_boot_generate_digest()
* is called before this
*
* If secure boot is not yet enabled for bootloader, this will
* generate the secure boot digest and enable secure boot by blowing
* the EFUSE_RD_ABS_DONE_0 efuse.
* 1) enable R/W protection of secure boot key on EFUSE
* 2) enable secure boot by blowing the EFUSE_RD_ABS_DONE_0 efuse.
*
* This function does not verify secure boot of the bootloader (the
* ROM bootloader does this.)
@ -64,7 +87,6 @@ static inline bool esp_secure_boot_enabled(void) {
* Will fail if efuses have been part-burned in a way that indicates
* secure boot should not or could not be correctly enabled.
*
*
* @return ESP_ERR_INVALID_STATE if efuse state doesn't allow
* secure boot to be enabled cleanly. ESP_OK if secure boot
* is enabled on this chip from now on.
@ -109,7 +131,6 @@ typedef struct {
uint8_t digest[64];
} esp_secure_boot_iv_digest_t;
#ifdef __cplusplus
}
#endif

View File

@ -21,7 +21,7 @@ extern "C"
{
#endif
#include "esp_flash_data_types.h"
#include "esp_flash_partitions.h"
#include "soc/soc.h"
#define SPI_SEC_SIZE 0x1000

View File

@ -30,6 +30,13 @@
bootloader_support components only.
*/
/**
* @brief Get number of free pages
*
* @return Number of free pages
*/
uint32_t bootloader_mmap_get_free_pages();
/**
* @brief Map a region of flash to data memory
*

View File

@ -17,7 +17,7 @@
that can be used from bootloader or app code.
This header is available to source code in the bootloader & bootloader_support components only.
Use mbedTLS APIs or include hwcrypto/sha.h to calculate SHA256 in IDF apps.
Use mbedTLS APIs or include esp32/sha.h to calculate SHA256 in IDF apps.
*/
#include <stdint.h>
@ -31,26 +31,3 @@ bootloader_sha256_handle_t bootloader_sha256_start();
void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data, size_t data_len);
void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest);
/**
* @brief Converts an array to a printable string.
*
* This function is useful for printing SHA-256 digest.
* \code{c}
* // Example of using. image_hash will be printed
* #define HASH_LEN 32 // SHA-256 digest length
* ...
* char hash_print[HASH_LEN * 2 + 1];
* hash_print[HASH_LEN * 2] = 0;
* bootloader_sha256_hex_to_str(hash_print, image_hash, HASH_LEN);
* ESP_LOGI(TAG, %s", hash_print);
* \endcode
* @param[out] out_str Output string
* @param[in] in_array_hex Pointer to input array
* @param[in] len Length of input array
*
* @return ESP_OK: Successful
* ESP_ERR_INVALID_ARG: Error in the passed arguments
*/
esp_err_t bootloader_sha256_hex_to_str(char *out_str, const uint8_t *in_array_hex, size_t len);

View File

@ -13,6 +13,7 @@
// limitations under the License.
#pragma once
#include "bootloader_config.h"
#include "esp_image_format.h"
/**
@ -62,3 +63,26 @@ __attribute__((noreturn)) void bootloader_utility_load_boot_image(const bootload
* It is not recommended to call this function from an app (if called, the app will abort).
*/
__attribute__((noreturn)) void bootloader_reset(void);
/**
* @brief Converts an array to a printable string.
*
* This function is useful for printing SHA-256 digest.
* \code{c}
* // Example of using. image_hash will be printed
* #define HASH_LEN 32 // SHA-256 digest length
* ...
* char hash_print[HASH_LEN * 2 + 1];
* hash_print[HASH_LEN * 2] = 0;
* bootloader_sha256_hex_to_str(hash_print, image_hash, HASH_LEN);
* ESP_LOGI(TAG, %s", hash_print);
* \endcode
* @param[out] out_str Output string
* @param[in] in_array_hex Pointer to input array
* @param[in] len Length of input array
*
* @return ESP_OK: Successful
* ESP_ERR_INVALID_ARG: Error in the passed arguments
*/
esp_err_t bootloader_sha256_hex_to_str(char *out_str, const uint8_t *in_array_hex, size_t len);

View File

@ -11,13 +11,12 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "rom/uart.h"
#include "rom/rtc.h"
#include "esp32/rom/uart.h"
#include "esp32/rom/rtc.h"
#include "soc/soc.h"
#include "soc/rtc.h"
#include "soc/dport_reg.h"
#include "soc/efuse_reg.h"
#include "soc/rtc_cntl_reg.h"
#include "soc/efuse_periph.h"
void bootloader_clock_configure()
{
@ -53,7 +52,7 @@ void bootloader_clock_configure()
* part of the start up time by enabling 32k XTAL early.
* App startup code will wait until the oscillator has started up.
*/
#ifdef CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL
#ifdef CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS
if (!rtc_clk_32k_enabled()) {
rtc_clk_32k_bootstrap(CONFIG_ESP32_RTC_XTAL_BOOTSTRAP_CYCLES);
}

View File

@ -17,16 +17,14 @@
#include "sdkconfig.h"
#include "esp_err.h"
#include "esp_log.h"
#include "rom/spi_flash.h"
#include "rom/crc.h"
#include "rom/ets_sys.h"
#include "rom/gpio.h"
#include "esp_flash_data_types.h"
#include "esp32/rom/crc.h"
#include "esp32/rom/gpio.h"
#include "esp_secure_boot.h"
#include "esp_flash_partitions.h"
#include "bootloader_flash.h"
#include "bootloader_common.h"
#include "soc/gpio_periph.h"
#include "soc/rtc.h"
#include "esp_image_format.h"
#include "bootloader_sha.h"
#include "sys/param.h"
@ -257,3 +255,18 @@ esp_err_t bootloader_common_get_partition_description(const esp_partition_pos_t
return ESP_OK;
}
void bootloader_common_vddsdio_configure()
{
#if CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V
rtc_vddsdio_config_t cfg = rtc_vddsdio_get_config();
if (cfg.enable == 1 && cfg.tieh == RTC_VDDSDIO_TIEH_1_8V) { // VDDSDIO regulator is enabled @ 1.8V
cfg.drefh = 3;
cfg.drefm = 3;
cfg.drefl = 3;
cfg.force = 1;
rtc_vddsdio_set_config(cfg);
ets_delay_us(10); // wait for regulator to become stable
}
#endif // CONFIG_BOOTLOADER_VDDSDIO_BOOST
}

View File

@ -25,6 +25,11 @@ static const char *TAG = "bootloader_mmap";
static spi_flash_mmap_handle_t map;
uint32_t bootloader_mmap_get_free_pages()
{
return spi_flash_mmap_get_free_pages(SPI_FLASH_MMAP_DATA);
}
const void *bootloader_mmap(uint32_t src_addr, uint32_t size)
{
if (map) {
@ -81,8 +86,8 @@ esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size)
#else
/* Bootloader version, uses ROM functions only */
#include <soc/dport_reg.h>
#include <rom/spi_flash.h>
#include <rom/cache.h>
#include <esp32/rom/spi_flash.h>
#include <esp32/rom/cache.h>
static const char *TAG = "bootloader_flash";
@ -91,12 +96,22 @@ static const char *TAG = "bootloader_flash";
*/
#define MMU_BLOCK0_VADDR 0x3f400000
#define MMU_BLOCK50_VADDR 0x3f720000
#define MMU_FREE_PAGES ((MMU_BLOCK50_VADDR - MMU_BLOCK0_VADDR) / FLASH_BLOCK_SIZE)
static bool mapped;
// Current bootloader mapping (ab)used for bootloader_read()
static uint32_t current_read_mapping = UINT32_MAX;
uint32_t bootloader_mmap_get_free_pages()
{
/**
* Allow mapping up to 50 of the 51 available MMU blocks (last one used for reads)
* Since, bootloader_mmap function below assumes it to be 0x320000 (50 pages), we can safely do this.
*/
return MMU_FREE_PAGES;
}
const void *bootloader_mmap(uint32_t src_addr, uint32_t size)
{
if (mapped) {

View File

@ -0,0 +1,165 @@
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stdbool.h>
#include <assert.h>
#include "string.h"
#include "sdkconfig.h"
#include "esp_err.h"
#include "esp_log.h"
#include "esp32/rom/gpio.h"
#include "esp32/rom/spi_flash.h"
#include "esp32/rom/efuse.h"
#include "soc/gpio_periph.h"
#include "soc/efuse_reg.h"
#include "soc/spi_reg.h"
#include "soc/spi_caps.h"
#include "flash_qio_mode.h"
#include "bootloader_flash_config.h"
void bootloader_flash_update_id()
{
g_rom_flashchip.device_id = bootloader_read_flash_id();
}
void IRAM_ATTR bootloader_flash_cs_timing_config()
{
SET_PERI_REG_MASK(SPI_USER_REG(0), SPI_CS_HOLD_M | SPI_CS_SETUP_M);
SET_PERI_REG_BITS(SPI_CTRL2_REG(0), SPI_HOLD_TIME_V, 1, SPI_HOLD_TIME_S);
SET_PERI_REG_BITS(SPI_CTRL2_REG(0), SPI_SETUP_TIME_V, 0, SPI_SETUP_TIME_S);
SET_PERI_REG_MASK(SPI_USER_REG(1), SPI_CS_HOLD_M | SPI_CS_SETUP_M);
SET_PERI_REG_BITS(SPI_CTRL2_REG(1), SPI_HOLD_TIME_V, 1, SPI_HOLD_TIME_S);
SET_PERI_REG_BITS(SPI_CTRL2_REG(1), SPI_SETUP_TIME_V, 0, SPI_SETUP_TIME_S);
}
void IRAM_ATTR bootloader_flash_clock_config(const esp_image_header_t* pfhdr)
{
uint32_t spi_clk_div = 0;
switch (pfhdr->spi_speed) {
case ESP_IMAGE_SPI_SPEED_80M:
spi_clk_div = 1;
break;
case ESP_IMAGE_SPI_SPEED_40M:
spi_clk_div = 2;
break;
case ESP_IMAGE_SPI_SPEED_26M:
spi_clk_div = 3;
break;
case ESP_IMAGE_SPI_SPEED_20M:
spi_clk_div = 4;
break;
default:
break;
}
esp_rom_spiflash_config_clk(spi_clk_div, 0);
}
void IRAM_ATTR bootloader_flash_gpio_config(const esp_image_header_t* pfhdr)
{
uint32_t drv = 2;
if (pfhdr->spi_speed == ESP_IMAGE_SPI_SPEED_80M) {
drv = 3;
}
uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
uint32_t pkg_ver = chip_ver & 0x7;
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5) {
// For ESP32D2WD the SPI pins are already configured
// flash clock signal should come from IO MUX.
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
} else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2) {
// For ESP32PICOD2 the SPI pins are already configured
// flash clock signal should come from IO MUX.
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
} else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) {
// For ESP32PICOD4 the SPI pins are already configured
// flash clock signal should come from IO MUX.
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
} else {
const uint32_t spiconfig = ets_efuse_get_spiconfig();
if (spiconfig == EFUSE_SPICONFIG_SPI_DEFAULTS) {
gpio_matrix_out(SPI_IOMUX_PIN_NUM_CS, SPICS0_OUT_IDX, 0, 0);
gpio_matrix_out(SPI_IOMUX_PIN_NUM_MISO, SPIQ_OUT_IDX, 0, 0);
gpio_matrix_in(SPI_IOMUX_PIN_NUM_MISO, SPIQ_IN_IDX, 0);
gpio_matrix_out(SPI_IOMUX_PIN_NUM_MOSI, SPID_OUT_IDX, 0, 0);
gpio_matrix_in(SPI_IOMUX_PIN_NUM_MOSI, SPID_IN_IDX, 0);
gpio_matrix_out(SPI_IOMUX_PIN_NUM_WP, SPIWP_OUT_IDX, 0, 0);
gpio_matrix_in(SPI_IOMUX_PIN_NUM_WP, SPIWP_IN_IDX, 0);
gpio_matrix_out(SPI_IOMUX_PIN_NUM_HD, SPIHD_OUT_IDX, 0, 0);
gpio_matrix_in(SPI_IOMUX_PIN_NUM_HD, SPIHD_IN_IDX, 0);
//select pin function gpio
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA0_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA1_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA2_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA3_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CMD_U, PIN_FUNC_GPIO);
// flash clock signal should come from IO MUX.
// set drive ability for clock
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
uint32_t flash_id = g_rom_flashchip.device_id;
if (flash_id == FLASH_ID_GD25LQ32C) {
// Set drive ability for 1.8v flash in 80Mhz.
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA0_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA1_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA2_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA3_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CMD_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, 3, FUN_DRV_S);
}
}
}
}
void IRAM_ATTR bootloader_flash_dummy_config(const esp_image_header_t* pfhdr)
{
int spi_cache_dummy = 0;
uint32_t modebit = READ_PERI_REG(SPI_CTRL_REG(0));
if (modebit & SPI_FASTRD_MODE) {
if (modebit & SPI_FREAD_QIO) { //SPI mode is QIO
spi_cache_dummy = SPI0_R_QIO_DUMMY_CYCLELEN;
} else if (modebit & SPI_FREAD_DIO) { //SPI mode is DIO
spi_cache_dummy = SPI0_R_DIO_DUMMY_CYCLELEN;
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_ADDR_BITLEN_V, SPI0_R_DIO_ADDR_BITSLEN, SPI_USR_ADDR_BITLEN_S);
} else if(modebit & (SPI_FREAD_QUAD | SPI_FREAD_DUAL)) { //SPI mode is QOUT or DIO
spi_cache_dummy = SPI0_R_FAST_DUMMY_CYCLELEN;
}
}
extern uint8_t g_rom_spiflash_dummy_len_plus[];
switch (pfhdr->spi_speed) {
case ESP_IMAGE_SPI_SPEED_80M:
g_rom_spiflash_dummy_len_plus[0] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_80M;
g_rom_spiflash_dummy_len_plus[1] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_80M;
break;
case ESP_IMAGE_SPI_SPEED_40M:
g_rom_spiflash_dummy_len_plus[0] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_40M;
g_rom_spiflash_dummy_len_plus[1] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_40M;
break;
case ESP_IMAGE_SPI_SPEED_26M:
case ESP_IMAGE_SPI_SPEED_20M:
g_rom_spiflash_dummy_len_plus[0] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_20M;
g_rom_spiflash_dummy_len_plus[1] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_20M;
break;
default:
break;
}
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_DUMMY_CYCLELEN_V, spi_cache_dummy + g_rom_spiflash_dummy_len_plus[0],
SPI_USR_DUMMY_CYCLELEN_S);
}

View File

@ -19,27 +19,26 @@
#include "esp_attr.h"
#include "esp_log.h"
#include "rom/cache.h"
#include "rom/efuse.h"
#include "rom/ets_sys.h"
#include "rom/spi_flash.h"
#include "rom/crc.h"
#include "rom/rtc.h"
#include "rom/uart.h"
#include "rom/gpio.h"
#include "rom/secure_boot.h"
#include "esp32/rom/cache.h"
#include "esp32/rom/efuse.h"
#include "esp32/rom/ets_sys.h"
#include "esp32/rom/spi_flash.h"
#include "esp32/rom/crc.h"
#include "esp32/rom/rtc.h"
#include "esp32/rom/uart.h"
#include "esp32/rom/gpio.h"
#include "esp32/rom/secure_boot.h"
#include "soc/soc.h"
#include "soc/cpu.h"
#include "soc/rtc.h"
#include "soc/dport_reg.h"
#include "soc/io_mux_reg.h"
#include "soc/efuse_reg.h"
#include "soc/rtc_cntl_reg.h"
#include "soc/timer_group_reg.h"
#include "soc/gpio_reg.h"
#include "soc/gpio_sig_map.h"
#include "soc/gpio_periph.h"
#include "soc/efuse_periph.h"
#include "soc/rtc_periph.h"
#include "soc/timer_periph.h"
#include "soc/rtc_wdt.h"
#include "soc/spi_periph.h"
#include "sdkconfig.h"
#include "esp_image_format.h"
@ -50,6 +49,8 @@
#include "bootloader_random.h"
#include "bootloader_config.h"
#include "bootloader_clock.h"
#include "bootloader_common.h"
#include "bootloader_flash_config.h"
#include "flash_qio_mode.h"
@ -63,8 +64,7 @@ static const char* TAG = "boot";
static esp_err_t bootloader_main();
static void print_flash_info(const esp_image_header_t* pfhdr);
static void update_flash_config(const esp_image_header_t* pfhdr);
static void vddsdio_configure();
static void flash_gpio_configure(const esp_image_header_t* pfhdr);
static void bootloader_init_flash_configure(const esp_image_header_t* pfhdr);
static void uart_console_configure(void);
static void wdt_reset_check(void);
@ -119,7 +119,7 @@ esp_err_t bootloader_init()
static esp_err_t bootloader_main()
{
vddsdio_configure();
bootloader_common_vddsdio_configure();
/* Read and keep flash ID, for further use. */
g_rom_flashchip.device_id = bootloader_read_flash_id();
esp_image_header_t fhdr;
@ -127,7 +127,7 @@ static esp_err_t bootloader_main()
ESP_LOGE(TAG, "failed to load bootloader header!");
return ESP_FAIL;
}
flash_gpio_configure(&fhdr);
bootloader_init_flash_configure(&fhdr);
#if (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ == 240)
//Check if ESP32 is rated for a CPU frequency of 160MHz only
if (REG_GET_BIT(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_CPU_FREQ_RATED) &&
@ -174,7 +174,7 @@ static esp_err_t bootloader_main()
ESP_LOGI(TAG, "Enabling RNG early entropy source...");
bootloader_random_enable();
#if CONFIG_FLASHMODE_QIO || CONFIG_FLASHMODE_QOUT
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
bootloader_enable_qio_mode();
#endif
@ -287,137 +287,24 @@ static void print_flash_info(const esp_image_header_t* phdr)
#endif
}
static void vddsdio_configure()
{
#if CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V
rtc_vddsdio_config_t cfg = rtc_vddsdio_get_config();
if (cfg.enable == 1 && cfg.tieh == RTC_VDDSDIO_TIEH_1_8V) { // VDDSDIO regulator is enabled @ 1.8V
cfg.drefh = 3;
cfg.drefm = 3;
cfg.drefl = 3;
cfg.force = 1;
rtc_vddsdio_set_config(cfg);
ets_delay_us(10); // wait for regulator to become stable
}
#endif // CONFIG_BOOTLOADER_VDDSDIO_BOOST
}
#define FLASH_CLK_IO 6
#define FLASH_CS_IO 11
#define FLASH_SPIQ_IO 7
#define FLASH_SPID_IO 8
#define FLASH_SPIWP_IO 10
#define FLASH_SPIHD_IO 9
#define FLASH_IO_MATRIX_DUMMY_40M 1
#define FLASH_IO_MATRIX_DUMMY_80M 2
#define FLASH_IO_DRIVE_GD_WITH_1V8PSRAM 3
/*
* Bootloader reads SPI configuration from bin header, so that
* the burning configuration can be different with compiling configuration.
*/
static void IRAM_ATTR flash_gpio_configure(const esp_image_header_t* pfhdr)
static void IRAM_ATTR bootloader_init_flash_configure(const esp_image_header_t* pfhdr)
{
int spi_cache_dummy = 0;
int drv = 2;
switch (pfhdr->spi_mode) {
case ESP_IMAGE_SPI_MODE_QIO:
spi_cache_dummy = SPI0_R_DIO_DUMMY_CYCLELEN;
break;
case ESP_IMAGE_SPI_MODE_DIO:
spi_cache_dummy = SPI0_R_DIO_DUMMY_CYCLELEN; //qio 3
break;
case ESP_IMAGE_SPI_MODE_QOUT:
case ESP_IMAGE_SPI_MODE_DOUT:
default:
spi_cache_dummy = SPI0_R_FAST_DUMMY_CYCLELEN;
break;
}
/* dummy_len_plus values defined in ROM for SPI flash configuration */
extern uint8_t g_rom_spiflash_dummy_len_plus[];
switch (pfhdr->spi_speed) {
case ESP_IMAGE_SPI_SPEED_80M:
g_rom_spiflash_dummy_len_plus[0] = FLASH_IO_MATRIX_DUMMY_80M;
g_rom_spiflash_dummy_len_plus[1] = FLASH_IO_MATRIX_DUMMY_80M;
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_DUMMY_CYCLELEN_V, spi_cache_dummy + FLASH_IO_MATRIX_DUMMY_80M,
SPI_USR_DUMMY_CYCLELEN_S); //DUMMY
drv = 3;
break;
case ESP_IMAGE_SPI_SPEED_40M:
g_rom_spiflash_dummy_len_plus[0] = FLASH_IO_MATRIX_DUMMY_40M;
g_rom_spiflash_dummy_len_plus[1] = FLASH_IO_MATRIX_DUMMY_40M;
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_DUMMY_CYCLELEN_V, spi_cache_dummy + FLASH_IO_MATRIX_DUMMY_40M,
SPI_USR_DUMMY_CYCLELEN_S); //DUMMY
break;
default:
break;
}
uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
uint32_t pkg_ver = chip_ver & 0x7;
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5) {
// For ESP32D2WD the SPI pins are already configured
// flash clock signal should come from IO MUX.
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
} else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2) {
// For ESP32PICOD2 the SPI pins are already configured
// flash clock signal should come from IO MUX.
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
} else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) {
// For ESP32PICOD4 the SPI pins are already configured
// flash clock signal should come from IO MUX.
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
} else {
const uint32_t spiconfig = ets_efuse_get_spiconfig();
if (spiconfig == EFUSE_SPICONFIG_SPI_DEFAULTS) {
gpio_matrix_out(FLASH_CS_IO, SPICS0_OUT_IDX, 0, 0);
gpio_matrix_out(FLASH_SPIQ_IO, SPIQ_OUT_IDX, 0, 0);
gpio_matrix_in(FLASH_SPIQ_IO, SPIQ_IN_IDX, 0);
gpio_matrix_out(FLASH_SPID_IO, SPID_OUT_IDX, 0, 0);
gpio_matrix_in(FLASH_SPID_IO, SPID_IN_IDX, 0);
gpio_matrix_out(FLASH_SPIWP_IO, SPIWP_OUT_IDX, 0, 0);
gpio_matrix_in(FLASH_SPIWP_IO, SPIWP_IN_IDX, 0);
gpio_matrix_out(FLASH_SPIHD_IO, SPIHD_OUT_IDX, 0, 0);
gpio_matrix_in(FLASH_SPIHD_IO, SPIHD_IN_IDX, 0);
//select pin function gpio
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA0_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA1_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA2_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA3_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CMD_U, PIN_FUNC_GPIO);
// flash clock signal should come from IO MUX.
// set drive ability for clock
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
#if CONFIG_SPIRAM_TYPE_ESPPSRAM32
uint32_t flash_id = g_rom_flashchip.device_id;
if (flash_id == FLASH_ID_GD25LQ32C) {
// Set drive ability for 1.8v flash in 80Mhz.
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA0_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA1_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA2_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA3_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CMD_U, FUN_DRV, 3, FUN_DRV_S);
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, 3, FUN_DRV_S);
}
#endif
}
}
bootloader_flash_gpio_config(pfhdr);
bootloader_flash_dummy_config(pfhdr);
bootloader_flash_cs_timing_config();
}
static void uart_console_configure(void)
{
#if CONFIG_CONSOLE_UART_NONE
#if CONFIG_ESP_CONSOLE_UART_NONE
ets_install_putc1(NULL);
ets_install_putc2(NULL);
#else // CONFIG_CONSOLE_UART_NONE
const int uart_num = CONFIG_CONSOLE_UART_NUM;
#else // CONFIG_ESP_CONSOLE_UART_NONE
const int uart_num = CONFIG_ESP_CONSOLE_UART_NUM;
uartAttach();
ets_install_uart_printf();
@ -425,10 +312,10 @@ static void uart_console_configure(void)
// Wait for UART FIFO to be empty.
uart_tx_wait_idle(0);
#if CONFIG_CONSOLE_UART_CUSTOM
#if CONFIG_ESP_CONSOLE_UART_CUSTOM
// Some constants to make the following code less upper-case
const int uart_tx_gpio = CONFIG_CONSOLE_UART_TX_GPIO;
const int uart_rx_gpio = CONFIG_CONSOLE_UART_RX_GPIO;
const int uart_tx_gpio = CONFIG_ESP_CONSOLE_UART_TX_GPIO;
const int uart_rx_gpio = CONFIG_ESP_CONSOLE_UART_RX_GPIO;
// Switch to the new UART (this just changes UART number used for
// ets_printf in ROM code).
uart_tx_switch(uart_num);
@ -442,18 +329,26 @@ static void uart_console_configure(void)
// (arrays should be optimized away by the compiler)
const uint32_t tx_idx_list[3] = { U0TXD_OUT_IDX, U1TXD_OUT_IDX, U2TXD_OUT_IDX };
const uint32_t rx_idx_list[3] = { U0RXD_IN_IDX, U1RXD_IN_IDX, U2RXD_IN_IDX };
const uint32_t uart_reset[3] = { DPORT_UART_RST, DPORT_UART1_RST, DPORT_UART2_RST };
const uint32_t tx_idx = tx_idx_list[uart_num];
const uint32_t rx_idx = rx_idx_list[uart_num];
PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[uart_rx_gpio]);
gpio_pad_pullup(uart_rx_gpio);
gpio_matrix_out(uart_tx_gpio, tx_idx, 0, 0);
gpio_matrix_in(uart_rx_gpio, rx_idx, 0);
DPORT_SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, uart_reset[uart_num]);
DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, uart_reset[uart_num]);
}
#endif // CONFIG_CONSOLE_UART_CUSTOM
#endif // CONFIG_ESP_CONSOLE_UART_CUSTOM
// Set configured UART console baud rate
const int uart_baud = CONFIG_CONSOLE_UART_BAUDRATE;
const int uart_baud = CONFIG_ESP_CONSOLE_UART_BAUDRATE;
uart_div_modify(uart_num, (rtc_clk_apb_freq_get() << 4) / uart_baud);
#endif // CONFIG_CONSOLE_UART_NONE
#endif // CONFIG_ESP_CONSOLE_UART_NONE
}
static void wdt_reset_cpu0_info_enable(void)

View File

@ -14,11 +14,11 @@
#include "bootloader_random.h"
#include "soc/cpu.h"
#include "soc/wdev_reg.h"
#include "soc/rtc_cntl_reg.h"
#include "soc/sens_reg.h"
#include "soc/syscon_reg.h"
#include "soc/rtc_periph.h"
#include "soc/sens_periph.h"
#include "soc/syscon_periph.h"
#include "soc/dport_reg.h"
#include "soc/i2s_reg.h"
#include "soc/i2s_periph.h"
#include "esp_log.h"
#ifndef BOOTLOADER_BUILD

View File

@ -19,26 +19,24 @@
#include "esp_attr.h"
#include "esp_log.h"
#include "rom/cache.h"
#include "rom/efuse.h"
#include "rom/ets_sys.h"
#include "rom/spi_flash.h"
#include "rom/crc.h"
#include "rom/rtc.h"
#include "rom/uart.h"
#include "rom/gpio.h"
#include "rom/secure_boot.h"
#include "esp32/rom/cache.h"
#include "esp32/rom/efuse.h"
#include "esp32/rom/ets_sys.h"
#include "esp32/rom/spi_flash.h"
#include "esp32/rom/crc.h"
#include "esp32/rom/rtc.h"
#include "esp32/rom/uart.h"
#include "esp32/rom/gpio.h"
#include "esp32/rom/secure_boot.h"
#include "soc/soc.h"
#include "soc/cpu.h"
#include "soc/rtc.h"
#include "soc/dport_reg.h"
#include "soc/io_mux_reg.h"
#include "soc/efuse_reg.h"
#include "soc/rtc_cntl_reg.h"
#include "soc/timer_group_reg.h"
#include "soc/gpio_reg.h"
#include "soc/gpio_sig_map.h"
#include "soc/gpio_periph.h"
#include "soc/efuse_periph.h"
#include "soc/rtc_periph.h"
#include "soc/timer_periph.h"
#include "sdkconfig.h"
#include "esp_image_format.h"
@ -169,7 +167,7 @@ bool bootloader_utility_load_partition_table(bootloader_state_t* bs)
break;
case PART_SUBTYPE_DATA_EFUSE_EM:
partition_usage = "efuse";
#ifdef CONFIG_EFUSE_SECURE_VERSION_EMULATE
#ifdef CONFIG_BOOTLOADER_EFUSE_SECURE_VERSION_EMULATE
esp_efuse_init(partition->pos.offset, partition->pos.size);
#endif
break;
@ -243,7 +241,7 @@ static esp_err_t write_otadata(esp_ota_select_entry_t *otadata, uint32_t offset,
static bool check_anti_rollback(const esp_partition_pos_t *partition)
{
#ifdef CONFIG_APP_ANTI_ROLLBACK
#ifdef CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
esp_app_desc_t app_desc;
esp_err_t err = bootloader_common_get_partition_description(partition, &app_desc);
return err == ESP_OK && esp_efuse_check_secure_version(app_desc.secure_version) == true;
@ -252,7 +250,7 @@ static bool check_anti_rollback(const esp_partition_pos_t *partition)
#endif
}
#ifdef CONFIG_APP_ANTI_ROLLBACK
#ifdef CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
static void update_anti_rollback(const esp_partition_pos_t *partition)
{
esp_app_desc_t app_desc;
@ -306,7 +304,7 @@ int bootloader_utility_get_selected_boot_partition(const bootloader_state_t *bs)
ESP_LOGD(TAG, "otadata[0]: sequence values 0x%08x", otadata[0].ota_seq);
ESP_LOGD(TAG, "otadata[1]: sequence values 0x%08x", otadata[1].ota_seq);
#ifdef CONFIG_APP_ROLLBACK_ENABLE
#ifdef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
bool write_encrypted = esp_flash_encryption_enabled();
for (int i = 0; i < 2; ++i) {
if (otadata[i].ota_state == ESP_OTA_IMG_PENDING_VERIFY) {
@ -317,7 +315,7 @@ int bootloader_utility_get_selected_boot_partition(const bootloader_state_t *bs)
}
#endif
#ifndef CONFIG_APP_ANTI_ROLLBACK
#ifndef CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
if ((bootloader_common_ota_select_invalid(&otadata[0]) &&
bootloader_common_ota_select_invalid(&otadata[1])) ||
bs->app_count == 0) {
@ -341,7 +339,7 @@ int bootloader_utility_get_selected_boot_partition(const bootloader_state_t *bs)
#else
ESP_LOGI(TAG, "Enabled a check secure version of app for anti rollback");
ESP_LOGI(TAG, "Secure version (from eFuse) = %d", esp_efuse_read_secure_version());
// When CONFIG_APP_ANTI_ROLLBACK is enabled factory partition should not be in partition table, only two ota_app are there.
// When CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK is enabled factory partition should not be in partition table, only two ota_app are there.
if ((otadata[0].ota_seq == UINT32_MAX || otadata[0].crc != bootloader_common_ota_select_crc(&otadata[0])) &&
(otadata[1].ota_seq == UINT32_MAX || otadata[1].crc != bootloader_common_ota_select_crc(&otadata[1]))) {
ESP_LOGI(TAG, "otadata[0..1] in initial state");
@ -356,19 +354,19 @@ int bootloader_utility_get_selected_boot_partition(const bootloader_state_t *bs)
uint32_t ota_seq = otadata[active_otadata].ota_seq - 1; // Raw OTA sequence number. May be more than # of OTA slots
boot_index = ota_seq % bs->app_count; // Actual OTA partition selection
ESP_LOGD(TAG, "Mapping seq %d -> OTA slot %d", ota_seq, boot_index);
#ifdef CONFIG_APP_ROLLBACK_ENABLE
#ifdef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
if (otadata[active_otadata].ota_state == ESP_OTA_IMG_NEW) {
ESP_LOGD(TAG, "otadata[%d] is selected as new and marked PENDING_VERIFY state", active_otadata);
otadata[active_otadata].ota_state = ESP_OTA_IMG_PENDING_VERIFY;
write_otadata(&otadata[active_otadata], bs->ota_info.offset + FLASH_SECTOR_SIZE * active_otadata, write_encrypted);
}
#endif // CONFIG_APP_ROLLBACK_ENABLE
#endif // CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
#ifdef CONFIG_APP_ANTI_ROLLBACK
#ifdef CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
if(otadata[active_otadata].ota_state == ESP_OTA_IMG_VALID) {
update_anti_rollback(&bs->ota[boot_index]);
}
#endif // CONFIG_APP_ANTI_ROLLBACK
#endif // CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
} else if (bs->factory.offset != 0) {
ESP_LOGE(TAG, "ota data partition invalid, falling back to factory");
@ -414,7 +412,7 @@ static void set_actual_ota_seq(const bootloader_state_t *bs, int index)
bool write_encrypted = esp_flash_encryption_enabled();
write_otadata(&otadata, bs->ota_info.offset + FLASH_SECTOR_SIZE * 0, write_encrypted);
ESP_LOGI(TAG, "Set actual ota_seq=%d in otadata[0]", otadata.ota_seq);
#ifdef CONFIG_APP_ANTI_ROLLBACK
#ifdef CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
update_anti_rollback(&bs->ota[index]);
#endif
}
@ -478,24 +476,71 @@ void bootloader_utility_load_boot_image(const bootloader_state_t *bs, int start_
// Copy loaded segments to RAM, set up caches for mapped segments, and start application.
static void load_image(const esp_image_metadata_t* image_data)
{
#if defined(CONFIG_SECURE_BOOT_ENABLED) || defined(CONFIG_FLASH_ENCRYPTION_ENABLED)
/**
* Rough steps for a first boot, when encryption and secure boot are both disabled:
* 1) Generate secure boot key and write to EFUSE.
* 2) Write plaintext digest based on plaintext bootloader
* 3) Generate flash encryption key and write to EFUSE.
* 4) Encrypt flash in-place including bootloader, then digest,
* then app partitions and other encrypted partitions
* 5) Burn EFUSE to enable flash encryption (FLASH_CRYPT_CNT)
* 6) Burn EFUSE to enable secure boot (ABS_DONE_0)
*
* If power failure happens during Step 1, probably the next boot will continue from Step 2.
* There is some small chance that EFUSEs will be part-way through being written so will be
* somehow corrupted here. Thankfully this window of time is very small, but if that's the
* case, one has to use the espefuse tool to manually set the remaining bits and enable R/W
* protection. Once the relevant EFUSE bits are set and R/W protected, Step 1 will be skipped
* successfully on further reboots.
*
* If power failure happens during Step 2, Step 1 will be skipped and Step 2 repeated:
* the digest will get re-written on the next boot.
*
* If power failure happens during Step 3, it's possible that EFUSE was partially written
* with the generated flash encryption key, though the time window for that would again
* be very small. On reboot, Step 1 will be skipped and Step 2 repeated, though, Step 3
* may fail due to the above mentioned reason, in which case, one has to use the espefuse
* tool to manually set the remaining bits and enable R/W protection. Once the relevant EFUSE
* bits are set and R/W protected, Step 3 will be skipped successfully on further reboots.
*
* If power failure happens after start of 4 and before end of 5, the next boot will fail
* (bootloader header is encrypted and flash encryption isn't enabled yet, so it looks like
* noise to the ROM bootloader). The check in the ROM is pretty basic so if the first byte of
* ciphertext happens to be the magic byte E9 then it may try to boot, but it will definitely
* crash (no chance that the remaining ciphertext will look like a valid bootloader image).
* Only solution is to reflash with all plaintext and the whole process starts again: skips
* Step 1, repeats Step 2, skips Step 3, etc.
*
* If power failure happens after 5 but before 6, the device will reboot with flash
* encryption on and will regenerate an encrypted digest in Step 2. This should still
* be valid as the input data for the digest is read via flash cache (so will be decrypted)
* and the code in secure_boot_generate() tells bootloader_flash_write() to encrypt the data
* on write if flash encryption is enabled. Steps 3 - 5 are skipped (encryption already on),
* then Step 6 enables secure boot.
*/
#if defined(CONFIG_SECURE_BOOT_ENABLED) || defined(CONFIG_SECURE_FLASH_ENC_ENABLED)
esp_err_t err;
#endif
#ifdef CONFIG_SECURE_BOOT_ENABLED
/* Generate secure digest from this bootloader to protect future
modifications */
ESP_LOGI(TAG, "Checking secure boot...");
err = esp_secure_boot_permanently_enable();
/* Steps 1 & 2 (see above for full description):
* 1) Generate secure boot EFUSE key
* 2) Compute digest of plaintext bootloader
*/
err = esp_secure_boot_generate_digest();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Bootloader digest generation failed (%d). SECURE BOOT IS NOT ENABLED.", err);
/* Allow booting to continue, as the failure is probably
due to user-configured EFUSEs for testing...
*/
ESP_LOGE(TAG, "Bootloader digest generation for secure boot failed (%d).", err);
return;
}
#endif
#ifdef CONFIG_FLASH_ENCRYPTION_ENABLED
/* encrypt flash */
#ifdef CONFIG_SECURE_FLASH_ENC_ENABLED
/* Steps 3, 4 & 5 (see above for full description):
* 3) Generate flash encryption EFUSE key
* 4) Encrypt flash contents
* 5) Burn EFUSE to enable flash encryption
*/
ESP_LOGI(TAG, "Checking flash encryption...");
bool flash_encryption_enabled = esp_flash_encryption_enabled();
err = esp_flash_encrypt_check_and_update();
@ -503,7 +548,24 @@ static void load_image(const esp_image_metadata_t* image_data)
ESP_LOGE(TAG, "Flash encryption check failed (%d).", err);
return;
}
#endif
#ifdef CONFIG_SECURE_BOOT_ENABLED
/* Step 6 (see above for full description):
* 6) Burn EFUSE to enable secure boot
*/
ESP_LOGI(TAG, "Checking secure boot...");
err = esp_secure_boot_permanently_enable();
if (err != ESP_OK) {
ESP_LOGE(TAG, "FAILED TO ENABLE SECURE BOOT (%d).", err);
/* Panic here as secure boot is not properly enabled
due to one of the reasons in above function
*/
abort();
}
#endif
#ifdef CONFIG_SECURE_FLASH_ENC_ENABLED
if (!flash_encryption_enabled && esp_flash_encryption_enabled()) {
/* Flash encryption was just enabled for the first time,
so issue a system reset to ensure flash encryption
@ -639,3 +701,21 @@ void bootloader_reset(void)
abort(); /* This function should really not be called from application code */
#endif
}
esp_err_t bootloader_sha256_hex_to_str(char *out_str, const uint8_t *in_array_hex, size_t len)
{
if (out_str == NULL || in_array_hex == NULL || len == 0) {
return ESP_ERR_INVALID_ARG;
}
for (int i = 0; i < len; i++) {
for (int shift = 0; shift < 2; shift++) {
uint8_t nibble = (in_array_hex[i] >> (shift ? 0 : 4)) & 0x0F;
if (nibble < 10) {
out_str[i * 2 + shift] = '0' + nibble;
} else {
out_str[i * 2 + shift] = 'a' + nibble - 10;
}
}
}
return ESP_OK;
}

View File

@ -16,59 +16,16 @@
#include <string.h>
#include <assert.h>
#include <sys/param.h>
#ifndef BOOTLOADER_BUILD
// App version is a wrapper around mbedTLS SHA API
#include <mbedtls/sha256.h>
bootloader_sha256_handle_t bootloader_sha256_start()
{
mbedtls_sha256_context *ctx = (mbedtls_sha256_context *)malloc(sizeof(mbedtls_sha256_context));
if (!ctx) {
return NULL;
}
mbedtls_sha256_init(ctx);
int ret = mbedtls_sha256_starts_ret(ctx, false);
if (ret != 0) {
return NULL;
}
return ctx;
}
void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data, size_t data_len)
{
assert(handle != NULL);
mbedtls_sha256_context *ctx = (mbedtls_sha256_context *)handle;
int ret = mbedtls_sha256_update_ret(ctx, data, data_len);
assert(ret == 0);
}
void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest)
{
assert(handle != NULL);
mbedtls_sha256_context *ctx = (mbedtls_sha256_context *)handle;
if (digest != NULL) {
int ret = mbedtls_sha256_finish_ret(ctx, digest);
assert(ret == 0);
}
mbedtls_sha256_free(ctx);
free(handle);
}
#else // Bootloader version
#include "rom/sha.h"
#include "soc/dport_reg.h"
#include "soc/hwcrypto_reg.h"
#include "rom/ets_sys.h" // TO REMOVE
#include "esp32/rom/sha.h"
#include "soc/hwcrypto_periph.h"
#include "esp32/rom/ets_sys.h" // TO REMOVE
static uint32_t words_hashed;
// Words per SHA256 block
static const size_t BLOCK_WORDS = (64/sizeof(uint32_t));
static const size_t BLOCK_WORDS = (64 / sizeof(uint32_t));
// Words in final SHA256 digest
static const size_t DIGEST_WORDS = (32/sizeof(uint32_t));
static const size_t DIGEST_WORDS = (32 / sizeof(uint32_t));
bootloader_sha256_handle_t bootloader_sha256_start()
{
@ -95,7 +52,7 @@ void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data,
copy_words = MIN(word_len, copy_words);
// Wait for SHA engine idle
while(REG_READ(SHA_256_BUSY_REG) != 0) { }
while (REG_READ(SHA_256_BUSY_REG) != 0) { }
// Copy to memory block
//ets_printf("block_count %d copy_words %d\n", block_count, copy_words);
@ -148,7 +105,7 @@ void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest
bootloader_sha256_data(handle, padding, pad_bytes);
assert(words_hashed % BLOCK_WORDS == 60/4); // 32-bits left in block
assert(words_hashed % BLOCK_WORDS == 60 / 4); // 32-bits left in block
// Calculate 32-bit length for final 32 bits of data
uint32_t bit_count = __builtin_bswap32( data_words * 32 );
@ -156,9 +113,9 @@ void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest
assert(words_hashed % BLOCK_WORDS == 0);
while(REG_READ(SHA_256_BUSY_REG) == 1) { }
while (REG_READ(SHA_256_BUSY_REG) == 1) { }
REG_WRITE(SHA_256_LOAD_REG, 1);
while(REG_READ(SHA_256_BUSY_REG) == 1) { }
while (REG_READ(SHA_256_BUSY_REG) == 1) { }
uint32_t *digest_words = (uint32_t *)digest;
uint32_t *sha_text_reg = (uint32_t *)(SHA_TEXT_BASE);
@ -167,23 +124,3 @@ void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest
}
asm volatile ("memw");
}
#endif
esp_err_t bootloader_sha256_hex_to_str(char *out_str, const uint8_t *in_array_hex, size_t len)
{
if (out_str == NULL || in_array_hex == NULL || len == 0) {
return ESP_ERR_INVALID_ARG;
}
for (int i = 0; i < len; i++) {
for (int shift = 0; shift < 2; shift++) {
uint8_t nibble = (in_array_hex[i] >> (shift ? 0 : 4)) & 0x0F;
if (nibble < 10) {
out_str[i*2+shift] = '0' + nibble;
} else {
out_str[i*2+shift] = 'a' + nibble - 10;
}
}
}
return ESP_OK;
}

View File

@ -0,0 +1,352 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <strings.h>
#include "bootloader_flash.h"
#include "esp_image_format.h"
#include "esp_flash_encrypt.h"
#include "esp_flash_partitions.h"
#include "esp_secure_boot.h"
#include "esp_efuse.h"
#include "esp_log.h"
#include "esp32/rom/secure_boot.h"
#include "soc/rtc_wdt.h"
#include "esp32/rom/cache.h"
#include "esp32/rom/spi_flash.h" /* TODO: Remove this */
/* This file implements FLASH ENCRYPTION related APIs to perform
* various operations such as programming necessary flash encryption
* eFuses, detect whether flash encryption is enabled (by reading eFuse)
* and if required encrypt the partitions in flash memory
*/
static const char *TAG = "flash_encrypt";
/* Static functions for stages of flash encryption */
static esp_err_t initialise_flash_encryption(void);
static esp_err_t encrypt_flash_contents(uint32_t flash_crypt_cnt, bool flash_crypt_wr_dis);
static esp_err_t encrypt_bootloader();
static esp_err_t encrypt_and_load_partition_table(esp_partition_info_t *partition_table, int *num_partitions);
static esp_err_t encrypt_partition(int index, const esp_partition_info_t *partition);
esp_err_t esp_flash_encrypt_check_and_update(void)
{
uint32_t efuse_blk0 = REG_READ(EFUSE_BLK0_RDATA0_REG);
ESP_LOGV(TAG, "efuse_blk0 raw value %08x", efuse_blk0);
uint32_t flash_crypt_cnt = (efuse_blk0 & EFUSE_RD_FLASH_CRYPT_CNT_M) >> EFUSE_RD_FLASH_CRYPT_CNT_S;
bool flash_crypt_wr_dis = efuse_blk0 & EFUSE_WR_DIS_FLASH_CRYPT_CNT;
ESP_LOGV(TAG, "efuse FLASH_CRYPT_CNT 0x%x WR_DIS_FLASH_CRYPT_CNT 0x%x", flash_crypt_cnt, flash_crypt_wr_dis);
if (__builtin_parity(flash_crypt_cnt) == 1) {
/* Flash is already encrypted */
int left = (7 - __builtin_popcount(flash_crypt_cnt)) / 2;
if (flash_crypt_wr_dis) {
left = 0; /* can't update FLASH_CRYPT_CNT, no more flashes */
}
ESP_LOGI(TAG, "flash encryption is enabled (%d plaintext flashes left)", left);
return ESP_OK;
}
else {
/* Flash is not encrypted, so encrypt it! */
return encrypt_flash_contents(flash_crypt_cnt, flash_crypt_wr_dis);
}
}
static esp_err_t initialise_flash_encryption(void)
{
uint32_t coding_scheme = REG_GET_FIELD(EFUSE_BLK0_RDATA6_REG, EFUSE_CODING_SCHEME);
if (coding_scheme != EFUSE_CODING_SCHEME_VAL_NONE && coding_scheme != EFUSE_CODING_SCHEME_VAL_34) {
ESP_LOGE(TAG, "Unknown/unsupported CODING_SCHEME value 0x%x", coding_scheme);
return ESP_ERR_NOT_SUPPORTED;
}
/* Before first flash encryption pass, need to initialise key & crypto config */
/* Generate key */
uint32_t dis_reg = REG_READ(EFUSE_BLK0_RDATA0_REG);
bool efuse_key_read_protected = dis_reg & EFUSE_RD_DIS_BLK1;
bool efuse_key_write_protected = dis_reg & EFUSE_WR_DIS_BLK1;
if (efuse_key_read_protected == false
&& efuse_key_write_protected == false
&& REG_READ(EFUSE_BLK1_RDATA0_REG) == 0
&& REG_READ(EFUSE_BLK1_RDATA1_REG) == 0
&& REG_READ(EFUSE_BLK1_RDATA2_REG) == 0
&& REG_READ(EFUSE_BLK1_RDATA3_REG) == 0
&& REG_READ(EFUSE_BLK1_RDATA4_REG) == 0
&& REG_READ(EFUSE_BLK1_RDATA5_REG) == 0
&& REG_READ(EFUSE_BLK1_RDATA6_REG) == 0
&& REG_READ(EFUSE_BLK1_RDATA7_REG) == 0) {
ESP_LOGI(TAG, "Generating new flash encryption key...");
esp_efuse_write_random_key(EFUSE_BLK1_WDATA0_REG);
esp_efuse_burn_new_values();
ESP_LOGI(TAG, "Read & write protecting new key...");
REG_WRITE(EFUSE_BLK0_WDATA0_REG, EFUSE_WR_DIS_BLK1 | EFUSE_RD_DIS_BLK1);
esp_efuse_burn_new_values();
} else {
if(!(efuse_key_read_protected && efuse_key_write_protected)) {
ESP_LOGE(TAG, "Flash encryption key has to be either unset or both read and write protected");
return ESP_ERR_INVALID_STATE;
}
ESP_LOGW(TAG, "Using pre-loaded flash encryption key in EFUSE block 1");
}
/* CRYPT_CONFIG determines which bits of the AES block key are XORed
with bits from the flash address, to provide the key tweak.
CRYPT_CONFIG == 0 is effectively AES ECB mode (NOT SUPPORTED)
For now this is hardcoded to XOR all 256 bits of the key.
If you need to override it, you can pre-burn this efuse to the
desired value and then write-protect it, in which case this
operation does nothing. Please note this is not recommended!
*/
ESP_LOGI(TAG, "Setting CRYPT_CONFIG efuse to 0xF");
REG_WRITE(EFUSE_BLK0_WDATA5_REG, EFUSE_FLASH_CRYPT_CONFIG_M);
esp_efuse_burn_new_values();
uint32_t new_wdata6 = 0;
#ifndef CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC
ESP_LOGI(TAG, "Disable UART bootloader encryption...");
new_wdata6 |= EFUSE_DISABLE_DL_ENCRYPT;
#else
ESP_LOGW(TAG, "Not disabling UART bootloader encryption");
#endif
#ifndef CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_DEC
ESP_LOGI(TAG, "Disable UART bootloader decryption...");
new_wdata6 |= EFUSE_DISABLE_DL_DECRYPT;
#else
ESP_LOGW(TAG, "Not disabling UART bootloader decryption - SECURITY COMPROMISED");
#endif
#ifndef CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_CACHE
ESP_LOGI(TAG, "Disable UART bootloader MMU cache...");
new_wdata6 |= EFUSE_DISABLE_DL_CACHE;
#else
ESP_LOGW(TAG, "Not disabling UART bootloader MMU cache - SECURITY COMPROMISED");
#endif
#ifndef CONFIG_SECURE_BOOT_ALLOW_JTAG
ESP_LOGI(TAG, "Disable JTAG...");
new_wdata6 |= EFUSE_RD_DISABLE_JTAG;
#else
ESP_LOGW(TAG, "Not disabling JTAG - SECURITY COMPROMISED");
#endif
#ifndef CONFIG_SECURE_BOOT_ALLOW_ROM_BASIC
ESP_LOGI(TAG, "Disable ROM BASIC interpreter fallback...");
new_wdata6 |= EFUSE_RD_CONSOLE_DEBUG_DISABLE;
#else
ESP_LOGW(TAG, "Not disabling ROM BASIC fallback - SECURITY COMPROMISED");
#endif
if (new_wdata6 != 0) {
REG_WRITE(EFUSE_BLK0_WDATA6_REG, new_wdata6);
esp_efuse_burn_new_values();
}
return ESP_OK;
}
/* Encrypt all flash data that should be encrypted */
static esp_err_t encrypt_flash_contents(uint32_t flash_crypt_cnt, bool flash_crypt_wr_dis)
{
esp_err_t err;
esp_partition_info_t partition_table[ESP_PARTITION_TABLE_MAX_ENTRIES];
int num_partitions;
/* If the last flash_crypt_cnt bit is burned or write-disabled, the
device can't re-encrypt itself. */
if (flash_crypt_wr_dis) {
ESP_LOGE(TAG, "Cannot re-encrypt data (FLASH_CRYPT_CNT 0x%02x write disabled %d", flash_crypt_cnt, flash_crypt_wr_dis);
return ESP_FAIL;
}
if (flash_crypt_cnt == 0) {
/* Very first flash of encrypted data: generate keys, etc. */
err = initialise_flash_encryption();
if (err != ESP_OK) {
return err;
}
}
err = encrypt_bootloader();
if (err != ESP_OK) {
return err;
}
err = encrypt_and_load_partition_table(partition_table, &num_partitions);
if (err != ESP_OK) {
return err;
}
/* Now iterate the just-loaded partition table, looking for entries to encrypt
*/
/* Go through each partition and encrypt if necessary */
for (int i = 0; i < num_partitions; i++) {
err = encrypt_partition(i, &partition_table[i]);
if (err != ESP_OK) {
return err;
}
}
ESP_LOGD(TAG, "All flash regions checked for encryption pass");
/* Set least significant 0-bit in flash_crypt_cnt */
int ffs_inv = __builtin_ffs((~flash_crypt_cnt) & EFUSE_RD_FLASH_CRYPT_CNT);
/* ffs_inv shouldn't be zero, as zero implies flash_crypt_cnt == EFUSE_RD_FLASH_CRYPT_CNT (0x7F) */
uint32_t new_flash_crypt_cnt = flash_crypt_cnt + (1 << (ffs_inv - 1));
ESP_LOGD(TAG, "FLASH_CRYPT_CNT 0x%x -> 0x%x", flash_crypt_cnt, new_flash_crypt_cnt);
uint32_t wdata0_reg = ((new_flash_crypt_cnt & EFUSE_FLASH_CRYPT_CNT) << EFUSE_FLASH_CRYPT_CNT_S);
#ifdef CONFIG_SECURE_FLASH_ENCRYPTION_MODE_RELEASE
ESP_LOGI(TAG, "Write protecting FLASH_CRYPT_CNT eFuse");
wdata0_reg |= EFUSE_WR_DIS_FLASH_CRYPT_CNT;
#endif
REG_WRITE(EFUSE_BLK0_WDATA0_REG, wdata0_reg);
esp_efuse_burn_new_values();
ESP_LOGI(TAG, "Flash encryption completed");
return ESP_OK;
}
static esp_err_t encrypt_bootloader()
{
esp_err_t err;
uint32_t image_length;
/* Check for plaintext bootloader (verification will fail if it's already encrypted) */
if (esp_image_verify_bootloader(&image_length) == ESP_OK) {
ESP_LOGD(TAG, "bootloader is plaintext. Encrypting...");
err = esp_flash_encrypt_region(ESP_BOOTLOADER_OFFSET, image_length);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to encrypt bootloader in place: 0x%x", err);
return err;
}
#ifdef CONFIG_SECURE_BOOT_ENABLED
/* If secure boot is enabled and bootloader was plaintext, also
* need to encrypt secure boot IV+digest.
*/
ESP_LOGD(TAG, "Encrypting secure bootloader IV & digest...");
err = esp_flash_encrypt_region(FLASH_OFFS_SECURE_BOOT_IV_DIGEST,
FLASH_SECTOR_SIZE);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to encrypt bootloader IV & digest in place: 0x%x", err);
return err;
}
#endif
}
else {
ESP_LOGW(TAG, "no valid bootloader was found");
}
return ESP_OK;
}
static esp_err_t encrypt_and_load_partition_table(esp_partition_info_t *partition_table, int *num_partitions)
{
esp_err_t err;
/* Check for plaintext partition table */
err = bootloader_flash_read(ESP_PARTITION_TABLE_OFFSET, partition_table, ESP_PARTITION_TABLE_MAX_LEN, false);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to read partition table data");
return err;
}
if (esp_partition_table_verify(partition_table, false, num_partitions) == ESP_OK) {
ESP_LOGD(TAG, "partition table is plaintext. Encrypting...");
esp_err_t err = esp_flash_encrypt_region(ESP_PARTITION_TABLE_OFFSET,
FLASH_SECTOR_SIZE);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to encrypt partition table in place. %x", err);
return err;
}
}
else {
ESP_LOGE(TAG, "Failed to read partition table data - not plaintext?");
return ESP_ERR_INVALID_STATE;
}
/* Valid partition table loded */
return ESP_OK;
}
static esp_err_t encrypt_partition(int index, const esp_partition_info_t *partition)
{
esp_err_t err;
bool should_encrypt = (partition->flags & PART_FLAG_ENCRYPTED);
if (partition->type == PART_TYPE_APP) {
/* check if the partition holds a valid unencrypted app */
esp_image_metadata_t data_ignored;
err = esp_image_verify(ESP_IMAGE_VERIFY,
&partition->pos,
&data_ignored);
should_encrypt = (err == ESP_OK);
} else if ((partition->type == PART_TYPE_DATA && partition->subtype == PART_SUBTYPE_DATA_OTA)
|| (partition->type == PART_TYPE_DATA && partition->subtype == PART_SUBTYPE_DATA_NVS_KEYS)) {
/* check if we have ota data partition and the partition should be encrypted unconditionally */
should_encrypt = true;
}
if (!should_encrypt) {
return ESP_OK;
}
else {
/* should_encrypt */
ESP_LOGI(TAG, "Encrypting partition %d at offset 0x%x...", index, partition->pos.offset);
err = esp_flash_encrypt_region(partition->pos.offset, partition->pos.size);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to encrypt partition %d", index);
}
return err;
}
}
esp_err_t esp_flash_encrypt_region(uint32_t src_addr, size_t data_length)
{
esp_err_t err;
uint32_t buf[FLASH_SECTOR_SIZE / sizeof(uint32_t)];
if (src_addr % FLASH_SECTOR_SIZE != 0) {
ESP_LOGE(TAG, "esp_flash_encrypt_region bad src_addr 0x%x",src_addr);
return ESP_FAIL;
}
for (size_t i = 0; i < data_length; i += FLASH_SECTOR_SIZE) {
rtc_wdt_feed();
uint32_t sec_start = i + src_addr;
err = bootloader_flash_read(sec_start, buf, FLASH_SECTOR_SIZE, false);
if (err != ESP_OK) {
goto flash_failed;
}
err = bootloader_flash_erase_sector(sec_start / FLASH_SECTOR_SIZE);
if (err != ESP_OK) {
goto flash_failed;
}
err = bootloader_flash_write(sec_start, buf, FLASH_SECTOR_SIZE, true);
if (err != ESP_OK) {
goto flash_failed;
}
}
return ESP_OK;
flash_failed:
ESP_LOGE(TAG, "flash operation failed: 0x%x", err);
return err;
}

View File

@ -18,14 +18,12 @@
#include "esp_types.h"
#include "esp_log.h"
#include "rom/cache.h"
#include "rom/ets_sys.h"
#include "rom/secure_boot.h"
#include "esp32/rom/cache.h"
#include "esp32/rom/ets_sys.h"
#include "esp32/rom/secure_boot.h"
#include "soc/dport_reg.h"
#include "soc/io_mux_reg.h"
#include "soc/efuse_reg.h"
#include "soc/rtc_cntl_reg.h"
#include "soc/efuse_periph.h"
#include "soc/rtc_periph.h"
#include "sdkconfig.h"
@ -36,6 +34,10 @@
#include "esp_flash_encrypt.h"
#include "esp_efuse.h"
/* The following API implementations are used only when called
* from the bootloader code.
*/
static const char* TAG = "secure_boot";
/**
@ -95,18 +97,15 @@ static bool secure_boot_generate(uint32_t image_len){
/* Burn values written to the efuse write registers */
static inline void burn_efuses()
{
#ifdef CONFIG_SECURE_BOOT_TEST_MODE
ESP_LOGE(TAG, "SECURE BOOT TEST MODE. Not really burning any efuses! NOT SECURE");
#else
esp_efuse_burn_new_values();
#endif
}
esp_err_t esp_secure_boot_permanently_enable(void) {
esp_err_t esp_secure_boot_generate_digest(void)
{
esp_err_t err;
if (esp_secure_boot_enabled())
{
ESP_LOGI(TAG, "bootloader secure boot is already enabled, continuing..");
if (esp_secure_boot_enabled()) {
ESP_LOGI(TAG, "bootloader secure boot is already enabled."
" No need to generate digest. continuing..");
return ESP_OK;
}
@ -124,6 +123,7 @@ esp_err_t esp_secure_boot_permanently_enable(void) {
return err;
}
/* Generate secure boot key and keep in EFUSE */
uint32_t dis_reg = REG_READ(EFUSE_BLK0_RDATA0_REG);
bool efuse_key_read_protected = dis_reg & EFUSE_RD_DIS_BLK2;
bool efuse_key_write_protected = dis_reg & EFUSE_WR_DIS_BLK2;
@ -140,16 +140,11 @@ esp_err_t esp_secure_boot_permanently_enable(void) {
ESP_LOGI(TAG, "Generating new secure boot key...");
esp_efuse_write_random_key(EFUSE_BLK2_WDATA0_REG);
burn_efuses();
ESP_LOGI(TAG, "Read & write protecting new key...");
REG_WRITE(EFUSE_BLK0_WDATA0_REG, EFUSE_WR_DIS_BLK2 | EFUSE_RD_DIS_BLK2);
burn_efuses();
efuse_key_read_protected = true;
efuse_key_write_protected = true;
} else {
ESP_LOGW(TAG, "Using pre-loaded secure boot key in EFUSE block 2");
}
/* Generate secure boot digest using programmed key in EFUSE */
ESP_LOGI(TAG, "Generating secure boot digest...");
uint32_t image_len = bootloader_data.image_len;
if(bootloader_data.image.hash_appended) {
@ -162,7 +157,28 @@ esp_err_t esp_secure_boot_permanently_enable(void) {
}
ESP_LOGI(TAG, "Digest generation complete.");
#ifndef CONFIG_SECURE_BOOT_TEST_MODE
return ESP_OK;
}
esp_err_t esp_secure_boot_permanently_enable(void)
{
if (esp_secure_boot_enabled()) {
ESP_LOGI(TAG, "bootloader secure boot is already enabled, continuing..");
return ESP_OK;
}
uint32_t dis_reg = REG_READ(EFUSE_BLK0_RDATA0_REG);
bool efuse_key_read_protected = dis_reg & EFUSE_RD_DIS_BLK2;
bool efuse_key_write_protected = dis_reg & EFUSE_WR_DIS_BLK2;
if (efuse_key_read_protected == false
&& efuse_key_write_protected == false) {
ESP_LOGI(TAG, "Read & write protecting new key...");
REG_WRITE(EFUSE_BLK0_WDATA0_REG, EFUSE_WR_DIS_BLK2 | EFUSE_RD_DIS_BLK2);
burn_efuses();
efuse_key_read_protected = true;
efuse_key_write_protected = true;
}
if (!efuse_key_read_protected) {
ESP_LOGE(TAG, "Pre-loaded key is not read protected. Refusing to blow secure boot efuse.");
return ESP_ERR_INVALID_STATE;
@ -171,7 +187,6 @@ esp_err_t esp_secure_boot_permanently_enable(void) {
ESP_LOGE(TAG, "Pre-loaded key is not write protected. Refusing to blow secure boot efuse.");
return ESP_ERR_INVALID_STATE;
}
#endif
ESP_LOGI(TAG, "blowing secure boot efuse...");
ESP_LOGD(TAG, "before updating, EFUSE_BLK0_RDATA6 %x", REG_READ(EFUSE_BLK0_RDATA6_REG));
@ -200,11 +215,7 @@ esp_err_t esp_secure_boot_permanently_enable(void) {
ESP_LOGI(TAG, "secure boot is now enabled for bootloader image");
return ESP_OK;
} else {
#ifdef CONFIG_SECURE_BOOT_TEST_MODE
ESP_LOGE(TAG, "secure boot not enabled due to test mode");
#else
ESP_LOGE(TAG, "secure boot not enabled for bootloader image, EFUSE_RD_ABS_DONE_0 is probably write protected!");
#endif
return ESP_ERR_INVALID_STATE;
}
}

View File

@ -18,17 +18,12 @@
#include "esp_log.h"
#include "esp_image_format.h"
#include "esp_secure_boot.h"
#include "esp32/rom/sha.h"
#include "uECC.h"
#ifdef BOOTLOADER_BUILD
#include "rom/sha.h"
typedef SHA_CTX sha_context;
#else
#include "hwcrypto/sha.h"
#endif
#include <sys/param.h>
static const char* TAG = "secure_boot";
static const char *TAG = "secure_boot";
extern const uint8_t signature_verification_key_start[] asm("_binary_signature_verification_key_bin_start");
extern const uint8_t signature_verification_key_end[] asm("_binary_signature_verification_key_bin_end");
@ -37,6 +32,9 @@ extern const uint8_t signature_verification_key_end[] asm("_binary_signature_ver
#define DIGEST_LEN 32
/* Mmap source address mask */
#define MMAP_ALIGNED_MASK 0x0000FFFF
esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
{
uint8_t digest[DIGEST_LEN];
@ -45,36 +43,53 @@ esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
data = bootloader_mmap(src_addr, length + sizeof(esp_secure_boot_sig_block_t));
if(data == NULL) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", src_addr, length+sizeof(esp_secure_boot_sig_block_t));
return ESP_FAIL;
bootloader_sha256_handle_t handle = bootloader_sha256_start();
uint32_t free_page_count = bootloader_mmap_get_free_pages();
ESP_LOGD(TAG, "free data page_count 0x%08x", free_page_count);
int32_t data_len_remain = length;
uint32_t data_addr = src_addr;
while (data_len_remain > 0) {
uint32_t offset_page = ((data_addr & MMAP_ALIGNED_MASK) != 0) ? 1 : 0;
/* Data we could map in case we are not aligned to PAGE boundary is one page size lesser. */
uint32_t data_len = MIN(data_len_remain, ((free_page_count - offset_page) * SPI_FLASH_MMU_PAGE_SIZE));
data = (const uint8_t *) bootloader_mmap(data_addr, data_len);
if(!data) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", data_addr, data_len);
bootloader_sha256_finish(handle, NULL);
return ESP_FAIL;
}
bootloader_sha256_data(handle, data, data_len);
bootloader_munmap(data);
data_addr += data_len;
data_len_remain -= data_len;
}
// Calculate digest of main image
#ifdef BOOTLOADER_BUILD
bootloader_sha256_handle_t handle = bootloader_sha256_start();
bootloader_sha256_data(handle, data, length);
/* Done! Get the digest */
bootloader_sha256_finish(handle, digest);
#else
/* Use thread-safe esp-idf SHA function */
esp_sha(SHA2_256, data, length, digest);
#endif
// Map the signature block and verify the signature
sigblock = (const esp_secure_boot_sig_block_t *)(data + length);
// Map the signature block
sigblock = (const esp_secure_boot_sig_block_t *) bootloader_mmap(src_addr + length, sizeof(esp_secure_boot_sig_block_t));
if(!sigblock) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", src_addr + length, sizeof(esp_secure_boot_sig_block_t));
return ESP_FAIL;
}
// Verify the signature
esp_err_t err = esp_secure_boot_verify_signature_block(sigblock, digest);
bootloader_munmap(data);
// Unmap
bootloader_munmap(sigblock);
return err;
}
esp_err_t esp_secure_boot_verify_signature_block(const esp_secure_boot_sig_block_t *sig_block, const uint8_t *image_digest)
{
ptrdiff_t keylen;
bool is_valid;
keylen = signature_verification_key_end - signature_verification_key_start;
if(keylen != SIGNATURE_VERIFICATION_KEYLEN) {
if (keylen != SIGNATURE_VERIFICATION_KEYLEN) {
ESP_LOGE(TAG, "Embedded public verification key has wrong length %d", keylen);
return ESP_FAIL;
}
@ -86,11 +101,12 @@ esp_err_t esp_secure_boot_verify_signature_block(const esp_secure_boot_sig_block
ESP_LOGD(TAG, "Verifying secure boot signature");
bool is_valid;
is_valid = uECC_verify(signature_verification_key_start,
image_digest,
DIGEST_LEN,
sig_block->signature,
uECC_secp256r1());
image_digest,
DIGEST_LEN,
sig_block->signature,
uECC_secp256r1());
ESP_LOGD(TAG, "Verification result %d", is_valid);
return is_valid ? ESP_OK : ESP_ERR_IMAGE_INVALID;
}

View File

@ -14,9 +14,9 @@
#include <string.h>
#include <sys/param.h>
#include <rom/rtc.h>
#include <esp32/rom/rtc.h>
#include <soc/cpu.h>
#include <esp_image_format.h>
#include <bootloader_utility.h>
#include <esp_secure_boot.h>
#include <esp_log.h>
#include <esp_spi_flash.h>
@ -368,24 +368,22 @@ static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segme
}
#endif // BOOTLOADER_BUILD
#ifndef BOOTLOADER_BUILD
uint32_t free_page_count = spi_flash_mmap_get_free_pages(SPI_FLASH_MMAP_DATA);
ESP_LOGD(TAG, "free data page_count 0x%08x",free_page_count);
uint32_t offset_page = 0;
while (data_len >= free_page_count * SPI_FLASH_MMU_PAGE_SIZE) {
offset_page = ((data_addr & MMAP_ALIGNED_MASK) != 0)?1:0;
err = process_segment_data(load_addr, data_addr, (free_page_count - offset_page) * SPI_FLASH_MMU_PAGE_SIZE, do_load, sha_handle, checksum);
uint32_t free_page_count = bootloader_mmap_get_free_pages();
ESP_LOGD(TAG, "free data page_count 0x%08x", free_page_count);
int32_t data_len_remain = data_len;
while (data_len_remain > 0) {
uint32_t offset_page = ((data_addr & MMAP_ALIGNED_MASK) != 0) ? 1 : 0;
/* Data we could map in case we are not aligned to PAGE boundary is one page size lesser. */
data_len = MIN(data_len_remain, ((free_page_count - offset_page) * SPI_FLASH_MMU_PAGE_SIZE));
err = process_segment_data(load_addr, data_addr, data_len, do_load, sha_handle, checksum);
if (err != ESP_OK) {
return err;
}
data_addr += (free_page_count - offset_page) * SPI_FLASH_MMU_PAGE_SIZE;
data_len -= (free_page_count - offset_page) * SPI_FLASH_MMU_PAGE_SIZE;
}
#endif
err = process_segment_data(load_addr, data_addr, data_len, do_load, sha_handle, checksum);
if (err != ESP_OK) {
return err;
data_addr += data_len;
data_len_remain -= data_len;
}
return ESP_OK;
err:

Some files were not shown because too many files have changed in this diff Show More