Compare commits

...

2303 Commits

Author SHA1 Message Date
63091bdf8d versions: Update version to 4.3.4 2022-09-12 10:59:15 +02:00
ad857b5f2b Merge branch 'fix/fix_esp_rsa_sign_alt_modifying_input_params_v4.3' into 'release/v4.3'
esp_rsa_sign_alt: Fix esp_init_ds_data_ctx API to not modify user defined data... (v4.3)

See merge request espressif/esp-idf!19715
2022-09-08 13:56:58 +08:00
b4d7495e0d Merge branch 'fix/esp_https_client_compile_warning_v4.3' into 'release/v4.3'
esp_https_ota: Fix build warning when CONFIG_OTA_ALLOW_HTTP is set (v4.3)

See merge request espressif/esp-idf!19981
2022-09-08 13:56:36 +08:00
1dbab6dfc4 Merge branch 'ci/fix_nightly_run_build_jobs_v4.3' into 'release/v4.3'
ci: build all when has env var NIGHTLY_RUN (v4.3)

See merge request espressif/esp-idf!19702
2022-09-08 11:47:18 +08:00
90ef6426a8 Merge branch 'bugfix/ble_disconnect_enable_light_sleep_and_bb_pd_v4.3' into 'release/v4.3'
bt: Fixed bluetooth disconnection issue when light sleep and baseband power down are enabled (v4.3)

See merge request espressif/esp-idf!19804
2022-09-08 10:55:37 +08:00
cfdc0b9fce Merge branch 'bugfix/fix_rtc_clock_freq_value_macro_v4.3' into 'release/v4.3'
rtc_clk: Fix wrong RC_SLOW clock frequency value on ESP32C3 (backport v4.3)

See merge request espressif/esp-idf!19934
2022-09-08 10:41:05 +08:00
ead1587caf esp_https_ota: Warn users when CONFIG_OTA_ALLOW_HTTP is set 2022-09-06 13:54:22 +05:30
460df92e85 esp_https_ota: Fix build warning when CONFIG_OTA_ALLOW_HTTP is set
Fix below build warning when CONFIG_OTA_ALLOW_HTTP is set:
esp_https_ota.c:165:13: warning: 'is_server_verification_enabled' defined but not used [-Wunused-function]

While at it, also simplify the is_server_verification_enabled logic.

Fixes: 48987ad9df ("esp_https_ota: Enable option of using global_ca_store and x509_crt_bundle")
Signed-off-by: Axel Lin <axel.lin@gmail.com>

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

Signed-off-by: Aditya Patwardhan <aditya.patwardhan@espressif.com>
2022-09-06 13:54:22 +05:30
3ce98867a0 rtc_clk: Fix wrong RC_SLOW clock frequency value on ESP32C3 2022-09-02 21:06:24 +08:00
5b81524e63 Merge branch 'bugfix/temp_fix_esp_event_test' into 'release/v4.3'
esp_event: lowered performance threshold temporarily for esp_event test

See merge request espressif/esp-idf!19672
2022-08-31 16:42:37 +08:00
395f0eb5c1 Fix bluetooth disconnection issue when light sleep and baseband power down are enabled 2022-08-26 16:17:14 +08:00
861c3f5025 esp_rsa_sign_alt: Fix esp_init_ds_data_ctx API to not modify user defined data when it is given directory from flash 2022-08-23 13:32:12 +05:30
d7eb0d9d71 ci: build all when has env var NIGHTLY_RUN 2022-08-22 18:53:27 +08:00
6075806400 Merge branch 'bugfix/fix_country_policy_issue_v4.3' into 'release/v4.3'
esp_wifi: fix not update phy according to country code.

See merge request espressif/esp-idf!19655
2022-08-21 19:41:07 +08:00
189bdb2bf8 esp_wifi: fix not update phy according to country code.
1. Fixed not update phy according to country code.
2. Fixed crashed when esp_wifi_set_ant_gpio() called
3. Fixed a bug when ftm used with ps enabled
4. Fixed a potential issue to allocate PSRAM to wifi stack where internal RAM is required
5. Fixed potential fail to scan AP after receiving disassoc/deauth from AP on esp32s2
y
2022-08-21 16:01:34 +08:00
36decb6662 Merge branch 'feature/sae_sta_h2e_v4.3' into 'release/v4.3'
esp_wifi: WPA3 SAE H2E support for station (backport v4.3)

See merge request espressif/esp-idf!18661
2022-08-20 23:46:41 +08:00
662b6c9ad3 Merge branch 'bugfix/i2c_incorrect_speed_v4.3' into 'release/v4.3'
I2C: Fix SCL period timings on ESP targets (backport v4.3)

See merge request espressif/esp-idf!18272
2022-08-20 03:51:44 +08:00
937633ad79 fix (esp_event): lowered performance threshold for esp_event test
The test in question is "performance test - no dedicated task".
Its performance dropped significantly during a WiFi library commit,
although there is no obvious reason. This needs to be investigated
and until then, we temporarily lower the performance threshold to
let the test pass.
2022-08-19 12:02:42 +02:00
e055f5ced7 esp_wifi: WPA3 SAE H2E support for station
Mandate sta threshold wpa3 for ssid after receiving transition disable bit from AP
2022-08-19 15:09:14 +05:30
c2735be0c8 Merge branch 'bugfix/fix_i2c_issues_v4.3' into 'release/v4.3'
I2C: Fix task wait too long on an event & timeout WDT triggered (backport v4.3)

See merge request espressif/esp-idf!18770
2022-08-19 14:01:14 +08:00
d4d70c3fcd Merge branch 'bugfix/nvs_part_ptr_wrong_init_4.3' into 'release/v4.3'
bugfix (nvs_flash): Fix nvs_flash_init_partition_ptr (backport v4.3)

See merge request espressif/esp-idf!18674
2022-08-19 13:59:12 +08:00
4ed1729262 Merge branch 'refactor/flash_qio_overidable_v4.3' into 'release/v4.3'
spi_flash: refact that flash qio can be overidable(backport v4.3)

See merge request espressif/esp-idf!18037
2022-08-19 13:58:26 +08:00
29978c0f17 Merge branch 'bugfix/hfp_examples_not_work_with_default_sdkconfig_v4.3' into 'release/v4.3'
bugfix/set default number of sco connection to 1 (v4.3)

See merge request espressif/esp-idf!19590
2022-08-18 21:40:35 +08:00
c207d09250 Merge branch 'bugfix/combined_softap_pmf_fixes_v4.3' into 'release/v4.3'
Combined bugfixes for SoftAP and PMF (Backport v4.3)

See merge request espressif/esp-idf!19118
2022-08-18 17:54:13 +08:00
9faeca3d1c I2C: Fix SCL period timings on ESP targets
The output frequency is now more accurate as the SCL period timings have been fixed.
This fix applies for ESP32, ESP32S3, ESP32C3 and ESP32H2
2022-08-18 02:45:36 +00:00
4d7f007645 I2C: Fix a bug making the I2C task wait too long on an event
The I2C ISR will now notify the task waiting on an event. Thus, the task can stop waiting on the event queue as soon as possible.
2022-08-18 02:37:43 +00:00
b6bbb5e0a2 I2C: add conf_update for esp32c3 i2c 2022-08-18 02:37:43 +00:00
19205b0696 I2C: Fix i2c write fake timeout and WDT triggered 2022-08-18 02:37:43 +00:00
5e3ade893a esp_wifi: Update wifi libs
Update wifi libs with below fixes -
1. Improved error handling in SoftAP Rx path, fixed LoRa IE length
2. Handle low memory scenario, re-enabling PMF Capable flag in STA PMF
3. Release wifi lock in offchannel operation
2022-08-17 15:41:13 +05:30
843b870b20 Merge branch 'ci/support_nightly_build_keyword_in_ttfw_v4.3' into 'release/v4.3'
ci: support keyword `nightly_run` in ttfw_idf decorator (v4.3)

See merge request espressif/esp-idf!19133
2022-08-17 12:50:30 +08:00
49fba45156 Fixed the failure of 'connect audio' operation in HFP examples with default SDK configuration
Due to the lack of synchronized connections, the hf_client can not create audio_connection to
hf_ag. Set default number of synchronized connection to 1.

Closes https://github.com/espressif/esp-idf/issues/9537
2022-08-17 10:15:11 +08:00
d96dde38f9 Merge branch 'feature/oocd_ver_upgrade_v4.3' into 'release/v4.3'
tools: Updates OpenOCD version to 'v0.11.0-esp32-20220706' (v4.3)

See merge request espressif/esp-idf!19491
2022-08-16 23:20:12 +08:00
b3bdd6afc3 Merge branch 'fix/install.ps1.v4.4_v4.3' into 'release/v4.3'
Tools: Remove undefined variable from install.ps1 (v4.3)

See merge request espressif/esp-idf!19584
2022-08-16 22:19:54 +08:00
def78db543 tools: Updates OpenOCD version to 'v0.11.0-esp32-20220706' 2022-08-16 11:07:06 +00:00
5d1a51db65 Tools: Remove undefined variable from install.ps1
Closes https://github.com/espressif/esp-idf/issues/9556
2022-08-16 12:20:11 +02:00
2828e8fe2f Merge branch 'bugfix/wifi_bt_mac_bb_pd_light_sleep_v4.3' into 'release/v4.3'
backport v4.3: deep sleep does not need cpu and wifi/bt mac retention

See merge request espressif/esp-idf!19511
2022-08-16 17:09:25 +08:00
dbd6519948 ci: allow scheduled pipelines 2022-08-15 10:43:11 +00:00
d94dbdd1be ci: support keyword nightly_run in ttfw_idf decorator 2022-08-15 10:43:11 +00:00
19de572d45 Merge branch 'bugfix/bt_invalid_workqueue_num_v4.3' into 'release/v4.3'
Bluetooth: fixed the invalid workqueue number for BTU thread in Bluedroid(backport v4.3)

See merge request espressif/esp-idf!19509
2022-08-12 19:50:07 +08:00
f128f4f83e Merge branch 'bugfix/vendor_model_send_message_no_memory_forv4.3' into 'release/v4.3'
ble_mesh:example: free the memory of malloc (v4.3)

See merge request espressif/esp-idf!19186
2022-08-12 19:49:25 +08:00
190cd2f8cd ble_mesh:the memory requested by malloc has not benn released 2022-08-12 06:03:58 +00:00
c6f5e4f505 Merge branch 'bugfix/memory_region_define_rtc_fast_v4.3' into 'release/v4.3'
backport v4.3: substract rtc_iram_seg memory region size from ESP_BOOTLOADER_RESERVE_RTC

See merge request espressif/esp-idf!19424
2022-08-12 14:00:51 +08:00
a456819d78 Merge branch 'bugfix/fix_bt_sphinx_warnings_4.3' into 'release/v4.3'
components_bt: fix unstandard typedefs [backport v4.3]

See merge request espressif/esp-idf!19339
2022-08-12 14:00:35 +08:00
9a09a64e36 Merge branch 'bugfix/wifi_bt_use_same_clock_source_v4.3' into 'release/v4.3'
Fix Wi-Fi does not know that Bluetooth has modified the lpclk source (v4.3)

See merge request espressif/esp-idf!15733
2022-08-12 12:52:18 +08:00
d264f30e76 component_bt: Fix build doc errors of bt
1. bluedroid: use standard function pointer define.
   2. blufi: Change ESP_BD_ADDR_LEN into ESP_BLUFI_BD_ADDR_LEN
   3. doc/sphinx_known_warnings: Remove fixed parts.
2022-08-12 12:11:54 +08:00
460cfbd583 1. Wi-Fi: update tsf tick interval when lpclk is modified
2. Move register_lpclk_callback to coexistence
2022-08-11 20:21:59 +08:00
cfc5576b0d Power Management: fix the issue of sleeping time error beacause external 32kHz xtal does not exist 2022-08-11 20:17:39 +08:00
23e8e497da make bluetooth and wifi use the same low power clock 2022-08-11 20:17:39 +08:00
12ca203856 ESP32C3:bluetooth support use main XTAL in light sleep mode 2022-08-11 20:17:39 +08:00
a0a0b2b4f7 Merge branch 'bugfix/fix_some_wifi_bugs_0805_v4.3' into 'release/v4.3'
fix some wifi bugs 0805 (backport v4.3)

See merge request espressif/esp-idf!19412
2022-08-11 20:07:31 +08:00
26707c3f3b Merge branch 'bugfix/mesh_bqb_test_issues_v4.3' into 'release/v4.3'
ble_mesh: stack: Fix mesh v1.0 BQB test issues(v4.3)

See merge request espressif/esp-idf!19503
2022-08-11 20:07:10 +08:00
0d7b72e057 sleep: deep sleep does not need cpu and wifi/bt mac retention 2022-08-11 16:36:57 +08:00
73cc09b118 components/bt: fixed the invalid workqueue number for BTU thread in Bluedroid
There should be only one workqueue for BTU task. The queue length for the second workqueue of BTU can be uninitialized and caused memory overflow and corruption.

Closes https://github.com/espressif/esp-idf/issues/9507
2022-08-11 16:18:12 +08:00
8ba4dd328a Merge branch 'bugfix/docs_update_deep_sleep_note_v4.3' into 'release/v4.3'
backport v4.3: add a note for deep sleep crc check

See merge request espressif/esp-idf!19422
2022-08-11 15:45:39 +08:00
041784e653 ble_mesh: stack: Fix kr from non-primary subnet shouldn't ignore
For case MESH/NODE/KR/BV-02-C
2022-08-11 14:15:56 +08:00
bfb5e06df4 ble_mesh: stack: Add a check if the appkey is bound to the model.
For case MESH/NODE/CFG/MP/BI-03-C
2022-08-11 14:15:51 +08:00
2490d28cc6 ble_mesh: stack: the count_log field should be set to 0 when HBS is sent.
For MESH/NODE/CFG/HBS/BV-02-C
2022-08-11 14:15:46 +08:00
17372e5b3d ble_mesh: stack: The Heartbeat Publication Period Log value can set to 0x11, range: [0, 0x11] 2022-08-11 14:15:40 +08:00
7ce06c8c3b ble_mesh: stack: The value of expect_ack_for will be rewrited after send_pub_key().
For case MESH/PVNR/PROV/BV-04-C
2022-08-11 14:15:33 +08:00
ff8588ec46 ble_mesh: stack: Fix ignore connectable PB-ADV PDU containing a Link Open message.
For case MESH/NODE/PBADV/BI-04-C
2022-08-11 14:15:18 +08:00
a6e921684c ble_mesh: stack: Fix PB-GATT not check invalid link flag
For case MESH/NODE/PROV/BI-03-C
2022-08-11 14:15:12 +08:00
529f49db5b ble_mesh: stack: Fix invalid provisioning pdu type check
For case MESH/NODE/PROV/BI-15-C
2022-08-11 14:15:06 +08:00
a253cf8118 Merge branch 'opt/bluedroid_adv_report_datapath_v4.3' into 'release/v4.3'
Bluetooth/Bluedroid: optimize BLE adv report datapath and adv report flow control mechanism(backport v4.3)

See merge request espressif/esp-idf!19383
2022-08-11 10:57:03 +08:00
7c64c12b74 Merge branch 'contrib/github_pr_9498_backport4_3' into 'release/v4.3'
Bluetooth/Bluedroid: fix member typo(backport v4.3)

See merge request espressif/esp-idf!19459
2022-08-11 10:53:34 +08:00
ee973b0a2a Merge branch 'bugfix/friend_and_lpn_issues_v4.3' into 'release/v4.3'
ble_mesh: stack: Fix friend and lpn issues(v4.3)

See merge request espressif/esp-idf!19476
2022-08-10 13:50:44 +08:00
41b4ead681 ble_mesh: stack: Fix add continuously secure update into friend queue.
For MESH/NODE/FRND/FN/BV-20-C
2022-08-09 21:49:36 +08:00
71fc7b73f6 ble_mesh: stack: Fix friend relay lpn message when relay feature is disable
For MESH/NODE/FRND/FN/BV-23-C
2022-08-09 21:49:24 +08:00
6ad7114a45 Fixed union member access typo
Closes https://github.com/espressif/esp-idf/pull/9498
2022-08-09 13:23:18 +08:00
763f9c91a4 bt member typo
Terminate sec_event.cfm_req.bd_name string, not sec_event.pin_req.bd_name
2022-08-09 13:23:05 +08:00
77adeb15c6 Merge branch 'bugfix/restore_missing_ble_mesh_videos_v4.3' into 'release/v4.3'
ble_mesh: doc: Restore missing ble mesh videos(v4.3)

See merge request espressif/esp-idf!19404
2022-08-08 17:12:07 +08:00
2bf40e52c9 substract rtc_iram_seg memory region size from ESP_BOOTLOADER_RESERVE_RTC 2022-08-08 11:32:46 +08:00
d0f8a7c2bf docs: add a note for deep sleep crc check 2022-08-08 11:17:56 +08:00
3c59955135 update wifi lib:
1. Clear old keys before going for new connection
2. Fix deep sleep can't reconnect to ap when pmf enable
3. Fix some ap will ignore auth when rx deauth for some time
4. Support force ht40 for espnow & 80211_tx
5. WAPI: Key mgmt type compability issue
6. Update wifi header file
7. Fix espnow recv unencrypted packets issue
2022-08-05 16:20:48 +08:00
487ef592a2 esp_wifi: Clear old keys before going for new connection 2022-08-05 15:35:44 +08:00
c8814343dc esp_wifi: add ht40 support for 80211_tx & espnow 2022-08-05 15:35:39 +08:00
6648e0e541 modify API-reference using Sphinx directives 2022-08-05 15:16:27 +08:00
13da594657 update wifi api docs 2022-08-05 15:13:36 +08:00
158d69cb51 Merge branch 'bugfix/default_ssid_not_set_v4.3' into 'release/v4.3'
esp_wifi: Fix for default ssid not set.(4.3)

See merge request espressif/esp-idf!18247
2022-08-05 12:10:48 +08:00
bcf14175c4 ble_mesh: doc: Restore missing ble mesh videos 2022-08-05 11:55:22 +08:00
9027fef06f esp_wifi: Fix for default ssid not set. 2022-08-04 16:27:55 +05:30
7b3d4d5074 component/bt: use OSI utility "osi_event" for HCI downstream data processing 2022-08-04 14:27:34 +08:00
6ffe0a5262 component/bt: consider to handle HCI LE Direct Advertising Report 2022-08-04 14:27:33 +08:00
ca945e8211 component/bt: allocate and use one static buffer for HCI adv flow control command 2022-08-04 14:27:33 +08:00
20705588b2 component/bt: use fixed_pkt_queue instead of fixed_queue for hci commands
some fixes after modifications:
  1. removed the use of waiting_command_t
  2. fix assert for HCI write_eir command
  3. fixed the crash upon handling command status event when trying to free to the HCI command buffer
  4. fixed the issue in transmitting HCI vendor specific commands
  5. fixed the lost command complete callbacks for HCI commands LE_RAND and LE_ENCRYPT
2022-08-04 14:27:32 +08:00
dd02446224 component/bt: add a timer to monitor the adv flow control credits downwards procedure 2022-08-04 14:27:32 +08:00
2da8b2c78b component/bt: fix adv report flow control logic, give ADV report credits every 10 packets 2022-08-04 14:27:32 +08:00
64572b7ff2 component/bt: add simple ADV flow control mechanism -- drop the packets when the adv report queues are considered full 2022-08-04 14:27:31 +08:00
e406be3cf4 component/bt: use the OSI utility "osi_event" to handle adv report in btc_layer 2022-08-04 14:27:31 +08:00
f16e5df27f component/bt: use the OSI utility "pkt_queue" to store ADV report packet in btu layer
# Conflicts:
#	components/bt/host/bluedroid/hci/hci_hal_h4.c
2022-08-04 14:27:30 +08:00
09a79cf90a component/bt: use the OSI utility "osi_event" for hci_hal_h4 upstream data packets handling 2022-08-04 14:27:30 +08:00
622148d491 component/bt: use the OSI utility "osi_event" to handle A2DP source data Tx processing 2022-08-04 14:27:29 +08:00
ed509a8d52 component/bt: use the OSI utility "osi_event" to handle A2DP sink data Rx processing 2022-08-04 14:27:26 +08:00
fb01677372 component/bt: add new OSI utility "fixed_pkt_queue", which has same functionality with "fixed_queue" 2022-08-04 14:25:03 +08:00
3c14e739f0 component/bt: add new OSI utility "pkt_queue" which acts as a mutex-protected linked list, to be used as data queue between tasks 2022-08-04 14:25:03 +08:00
0f4c9a47f1 component/bt: add new OSI utility "osi_event" to support the scenario that event need only to be handle once. 2022-08-04 14:25:02 +08:00
26d2011442 component/bt: make OSI thread workqueue length configurable through API
reduce the length of workqueue1 for BTC and HCI task

# Conflicts:
#	components/bt/common/osi/thread.c
2022-08-04 14:25:02 +08:00
b1cded8e48 component/bt: modify the implementation of osi_thread using freeRTOS queue 2022-08-04 14:25:01 +08:00
bfb2fee42a Merge branch 'bugfix/wlan_fixes_backports_v4.3' into 'release/v4.3'
esp_wifi: Fix some wlan issues(backport v4.3)

See merge request espressif/esp-idf!19359
2022-08-03 21:16:39 +08:00
dc386c71b1 wpa_supplicant: Unicast key renew in TKIP mic failure
Currently we always request group key renew for during
TKIP mic failure. Add support for unicast/multicast
key renew as per packet.
2022-08-03 14:55:56 +05:30
77661ba436 esp_wifi: Add APIs to check BTM and RRM support of connected AP 2022-08-03 11:35:44 +05:30
3e789d4ed4 esp_wifi: Changes to not use pmkid caching when SSID is changed 2022-08-03 11:26:40 +05:30
eb448172e9 wpa_supplicant: Fix issues reported by coverity 2022-08-03 11:26:31 +05:30
7b10f3264a Merge branch 'bugfix/fix_esptouch_v2_found_none_issue_v4.3' into 'release/v4.3'
esp_wifi: fix the bug that check whether bssid is zero mac(Backport v4.3)

See merge request espressif/esp-idf!19281
2022-08-03 13:17:00 +08:00
5b2444695c Merge branch 'bugfix/corrected_typo_in_example_peripherals_usb_v4.3' into 'release/v4.3'
example: peripherals/usb: fix typo naming of local variables (backport v4.3)

See merge request espressif/esp-idf!19101
2022-08-03 11:33:38 +08:00
d8a6f77da8 Merge branch 'bugfix/fix_write_to_null_pointer_if_malloc_failed_issue_v4.3' into 'release/v4.3'
Bugfix/fix write to null pointer if malloc failed issue(Backport v4.3)

See merge request espressif/esp-idf!19351
2022-08-03 10:59:36 +08:00
829a81b37f fix possible memory leak if report level not set 2022-08-02 20:39:01 +08:00
d2397d42ca fix write to null pointer if malloc failed 2022-08-02 20:38:51 +08:00
7d383bb5fb Merge branch 'bugfix/systimer_counter_value_bit_field_v4.3' into 'release/v4.3'
HAL: Fix systimer counter value bit field (v4.3)

See merge request espressif/esp-idf!18253
2022-08-02 16:48:29 +08:00
5eb176082d Merge branch 'bugfix/memory_debug_not_work_v4.3' into 'release/v4.3'
bugfix/fix the dependency error of macro for memory debug (v4.3)

See merge request espressif/esp-idf!19236
2022-08-02 15:50:06 +08:00
658b4026c9 Merge branch 'bugfix/fix_legacy_pair_not_send_link_key_host_v4.3' into 'release/v4.3'
component_bt: fix legacy pair controller does not send the link key to the host (v4.3)

See merge request espressif/esp-idf!19321
2022-08-02 14:41:24 +08:00
3f88df5046 Merge branch 'bugfix/put_sempher_and_queue_used_in_isr_into_DRAM_v4.3' into 'release/v4.3'
Make sure semphr/queue used in interrupt is in DRAM

See merge request espressif/esp-idf!18989
2022-08-02 11:32:05 +08:00
588e9801a3 Merge branch 'bugfix/fix_ble_ke_mem_c_assert_on_c3_s3_v4.3' into 'release/v4.3'
Fixed BLE ke_mem.c assert on ESP32C3 for v4.3

See merge request espressif/esp-idf!18900
2022-08-01 21:10:59 +08:00
c6671788d2 fix legacy pair controller does not send the link key to the host
Closes https://github.com/espressif/esp-idf/issues/5850
2022-08-01 20:31:26 +08:00
69cc5c677d Merge branch 'fix/set_idf_component_manager_default_to_zero' into 'release/v4.3'
fix: set IDF_COMPONENT_MANAGER property to 0 as default

See merge request espressif/esp-idf!19309
2022-08-01 19:56:07 +08:00
896090ce12 Merge branch 'bugfix/fix_bluedroid_host_memory_overflow_v4.3' into 'release/v4.3'
Fixed bluedroid host memory overflow for v4.3

See merge request espressif/esp-idf!18904
2022-08-01 19:41:29 +08:00
69ac4dd716 Merge branch 'bugfix/qatest_spp_crash_v4.3' into 'release/v4.3'
bugfix/qatest spp crash (v4.3)

See merge request espressif/esp-idf!19239
2022-08-01 19:41:09 +08:00
3a88cf8b49 Merge branch 'bugfix/reserve_dma_ram_in_segments_v4.3' into 'release/v4.3'
psram: reserve dma pool in the step of heap max block (v4.3)

See merge request espressif/esp-idf!18859
2022-08-01 17:14:39 +08:00
da2e62270b fix: set IDF_COMPONENT_MANAGER property to 0 as default 2022-08-01 11:10:32 +08:00
224730ec25 Merge branch 'examples/tls_removed_deprecated_version' into 'release/v4.3'
test_apps: Removed verification of TLS v1.1 (v4.3)

See merge request espressif/esp-idf!19180
2022-07-29 13:46:50 +08:00
6c38c6b176 Merge branch 'bugfix/add_multiple_scan_mode_v4.3' into 'release/v4.3'
Bugfix: Connect example to add scan mode config

See merge request espressif/esp-idf!19124
2022-07-29 10:58:32 +08:00
eed82f378e esp_wifi: fix the bug that check whether bssid is zero mac 2022-07-28 21:53:30 +08:00
11508b6fbe Merge branch 'bufix/Backport_some_wifi_lwip_bugs_for_4.3_0719' into 'release/v4.3'
Backport some wifi&lwip bugs for 4.3 0719

See merge request espressif/esp-idf!19110
2022-07-28 16:03:49 +08:00
846b51fe15 param: fixed heap pool reservation for DMA/internal usage fail issue
As heap block may be allocated into multiple non-continuous chunks, to
reserve enough memory for dma/internal usage, we do the malloc in the
step of max available block.
2022-07-28 10:15:53 +08:00
af5b3e600e 1. add protect for bt_util_buf_env buffers when multi-access
2. ignore assert_err in em_bt_clkoff1_setf
2022-07-27 18:02:54 +08:00
7fd218dfa1 test_apps: tls removed version 1_1 2022-07-27 12:42:02 +04:00
949a6a8d3f Merge branch 'bugfix/freertos_event_group_unblock_race_condition_v4.3' into 'release/v4.3'
FreeRTOS: Fix event group task list race condition (v4.3)

See merge request espressif/esp-idf!19104
2022-07-27 12:25:39 +08:00
e7e962b8d0 lwip:add function for deinit lwip timers 2022-07-26 09:55:39 +00:00
bc61578d68 esp_wifi: backport some wifi fix
1 Bugfix for wrong config of static txbuf

     2 fix bug that qos data will update BA SSN

     3 reset beacon timeout timer

     4 Bugfix for close sniffer mode when wifi stop

     5 update wifi header files
2022-07-26 09:55:39 +00:00
61b1b2ac12 Icmp: get tos parameter in icmp reply
bugfix for add ttl for ping socket
2022-07-26 09:55:39 +00:00
55e69bf9cb add option to route LWIP logs through ESP_LOG interface
Signed-off-by: xueyunfei <xueyunfei@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/8785
Closes https://github.com/espressif/esp-idf/issues/8361
2022-07-26 09:55:39 +00:00
563639ba01 udp example:Optimization udp example with recv_msg 2022-07-26 09:55:39 +00:00
18ee6fdbd4 wifi example:optimization example of wifi station 2022-07-26 09:55:39 +00:00
63cb1da0b6 esp_wifi: update esp_wifi_internal_set_fix_rate usage 2022-07-26 09:55:39 +00:00
6e84f737a9 esp_wifi: update noise floor unit 2022-07-26 09:55:39 +00:00
aa13b48819 DOC:Correct IP_EVENT_STA_LOST_IP name
Fix the name of the IP_EVENT_STA_LOST_IP event (was IP_STA_LOST_IP)

Signed-off-by: xueyunfei <xueyunfei@espressif.com>

Closes https://github.com/espressif/esp-idf/pull/8347
2022-07-26 09:55:39 +00:00
5b614cd3e4 Doc:update wifi api docs
* Add documents related to espnow config rate

* Optimization set dns server api description
2022-07-26 09:55:39 +00:00
767088d877 docs: fix the format for DPP 2022-07-26 09:55:39 +00:00
96bd791c74 Merge branch 'bugfix/set_ipv6_dns_error_v4.3' into 'release/v4.3'
lw ip: Fixed that ipv6 dns cannot work (v4.3)

See merge request espressif/esp-idf!19063
2022-07-25 22:44:38 +08:00
8ac667b763 components/coex: Make sure sempher and queue used in isr is in DRAM
Closes https://github.com/espressif/esp-idf/issues/9032
Closes https://github.com/espressif/esp-idf/issues/8928
Closes https://github.com/espressif/esp-idf/issues/9129
2022-07-25 11:37:06 +08:00
f85c30a73c components/bt: Make sure sempher and queue used in isr is in DRAM 2022-07-25 11:35:44 +08:00
bfb4a0c9df freertos: Fix flakey event group unit test
The "FreeRTOS Event Groups" main task will only wait a single tick for the created
tasks to set their response bits. This short delay may not be sufficent if the tick
frequency is high.

This commit updates the test so that

- the main task waits indefinitely for all the response bits to be set.
- created tasks are cleaned up by the main task
2022-07-25 03:01:16 +00:00
ad39eaaeb0 freertos: Fix event group task list race condition
FreeRTOS synchronization primitives (e.g., queues, eventgroups) use various event lists (i.e., task lists) to track what
tasks are blocked on a current primitive. Usually these event lists are accessed via one of the event lists functions
(such as vTask[PlaceOn|RemoveFrom]UnorderedEventList()), which in turn ensure that the global task list spinlock
(xTaskQueueMutex) is taken when accessing these lists.

However, some functions in event_groups.c manually traverse their event lists. Thus if a tick interrupt occurs on
another core during traversal and that tick interrupt unblocks a task on the event list being traversed, the event list
will be corrupted.

This commit modifies the following event_groups.c functions so that they take the global task list lock before
traversing their event list.

- xEventGroupSetBits()
- vEventGroupDelete()
2022-07-25 03:01:16 +00:00
22d052fe7a hal: Fix systimer counter value bit field
This commit fixes the systimer_counter_value_t by adding a resreved field so that the
type fills 64-bits.

Without the reserved field, when compiling with -O0 optimization, the unoccupied high
bits would not be initalized by the compiler, leading to systimer_hal_get_counter_value()
returning a garbage value.
2022-07-24 16:34:24 +08:00
cd9541fdb4 Merge branch 'bugfix/fix_esp32_ci_v4.3' into 'release/v4.3'
unit_test: power on wifi or bt domain before phy enable(v4.3)

See merge request espressif/esp-idf!19176
2022-07-23 03:13:40 +08:00
561218ab8a Merge branch 'bugfix/schm_process_in_active_crash_v4.3' into 'release/v4.3'
Coex: fixed crash when calculating end transfer time(v4.3)

See merge request espressif/esp-idf!19190
2022-07-22 21:24:24 +08:00
e20fd0b4f1 fix the dependency error of macro for memory debug 2022-07-22 16:17:53 +08:00
178e97b152 coex: fixed crash when calculating end transfer time 2022-07-22 16:11:27 +08:00
zwj
0a2d924a19 Update ble lib:
Fixed BLE ke_mem.c assert
Fixed adv report duplicate check
2022-07-22 07:44:46 +00:00
cbeb9ae14b Merge branch 'bugfix/phy_init_failed_when_wifi_deinit_4.3' into 'release/v4.3'
esp_wifi:bugfix for phy init failed when wifi deinit(4.3)

See merge request espressif/esp-idf!19138
2022-07-22 12:01:06 +08:00
182af34da8 Merge branch 'bugfix/uart_isr_followup_v4.3' into 'release/v4.3'
UART: Fix custom ISR registration function (backport v4.3)

See merge request espressif/esp-idf!19053
2022-07-22 11:58:05 +08:00
f412bb1701 Merge branch 'bugfix/wifi_condition_linker_mapping_v4.3' into 'release/v4.3'
esp_wifi: Fix linking of WiFi functions dependent on PM_ENABLE (v4.3)

See merge request espressif/esp-idf!18799
2022-07-22 11:57:42 +08:00
c4aa7e2ebf Merge branch 'feat/make_property_idf_component_manager_root_level' into 'release/v4.3'
Feat/make property idf component manager root level

See merge request espressif/esp-idf!18707
2022-07-22 11:57:20 +08:00
927b402153 unit_test: power on wifi or bt domain before phy enable 2022-07-22 10:28:32 +08:00
197371d085 Fixed bluedroid host memory overflow 2022-07-20 09:12:46 +00:00
78ba8d406d bugfix for phy init failed when wifi deinit 2022-07-20 15:17:26 +08:00
c846ed9a58 Init phy data to default if invalid in flash partition to avoid bootloops
Signed-off-by: ronghulin <ronghulin@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/6610
2022-07-19 18:49:29 +08:00
a70b8e0fb8 Bugfix: Connect example to add scan mode config
Closes https://github.com/espressif/esp-idf/issues/6595
2022-07-19 15:43:35 +08:00
823e1da543 wifi: Fix linking of WiFi functions dependent on PM_ENABLE
The following functions are only defined when CONFIG_PM_ENABLE is defined:

- wifi_apb80m_request()
- wifi_apb80m_release()

This commit makes their linker script mapping statements also dependent on CONFIG_PM_ENABLE
thus fixing some linker errors when CONFIG_PM_ENABLE is disabled.
2022-07-19 12:41:58 +08:00
a7ce9ba63c example: peripherals/usb: fix typo naming of local variables 2022-07-19 11:05:40 +08:00
af928313ab Merge branch 'update_v4.3/mbedtls_v2.28.1' into 'release/v4.3'
mbedtls: Update to release v2.28.1 (v4.3)

See merge request espressif/esp-idf!19042
2022-07-18 18:49:01 +08:00
19ad4a8d51 ci: pip install idf-component-manager inside CI 2022-07-18 13:21:55 +08:00
aa2300c002 docs: Add IDF_COMPONENT_MANAGER build property 2022-07-18 13:21:41 +08:00
38aecb227e docs: Enable the component manager by default in CMake 2022-07-18 13:21:41 +08:00
12180aabfa build&config: lift property IDF_COMPONENT_MANAGER to root level 2022-07-18 13:21:41 +08:00
4f9f78da71 Merge branch 'bugfix/mqtt_read_neg_and_ping_v4.3' into 'release/v4.3'
mqtt: Fix incorrect reads on error (v4.3)

See merge request espressif/esp-idf!18178
2022-07-16 04:43:48 +08:00
ffc7057ae4 lwip: Fixed that ipv6 dns cannot work 2022-07-15 16:18:15 +08:00
0ab0ca5410 mqtt: Fix incorrect reads on error (idf_v4.x)
* Update submodule: git log --oneline 985078affa8a2d2b56b87c8e6455252850f895c6..27eb4726067465c5c67d4ecdca5ddccd26f02580

Detailed description of the changes:
* MQTT: Fix signature matching for integer values (Backport to idf_v4.x)
  - See merge request espressif/esp-mqtt!133
  - Closes https://github.com/espressif/esp-idf/issues/8482
  - MQTT: Fix signature matching for integer values (espressif/esp-mqtt@f162002)
* ci: Deploy idf_v4.x branch to GitHub (espressif/esp-mqtt@ee5ecad)
2022-07-15 06:16:40 +00:00
2c8420bbd5 Merge branch 'docs/update_wifi_multiple_antennas_doc_v4.3' into 'release/v4.3'
docs: update wifi multiple antennas docs (v4.3)

See merge request espressif/esp-idf!19047
2022-07-15 10:48:20 +08:00
99bfa32eb9 Merge branch 'bugfix/fix_blufi_example_softap_current_connection_equal_zero_issue_v4.3' into 'release/v4.3'
bluetooth: fix two blufi example bugs(Backport v4.3)

See merge request espressif/esp-idf!18771
2022-07-14 20:19:20 +08:00
432e6af7f6 Merge branch 'bugfix/reset_ble_hw_on_inititalization_v4.3' into 'release/v4.3'
[Bluetooth] reset Bluetooth hardware during controller inititalization on ESP32-C3(backport release/v4.3)

See merge request espressif/esp-idf!18965
2022-07-14 20:18:46 +08:00
60f585e4c6 Merge branch 'docs/update_wifi_beacon_timeout_doc_v4.3' into 'release/v4.3'
docs: update wifi beacon timeout docs (v4.3)

See merge request espressif/esp-idf!19045
2022-07-14 20:18:30 +08:00
9fa0c131a4 UART: Fix custom ISR registration function
* Closes https://github.com/espressif/esp-idf/issues/8491
2022-07-14 17:49:52 +08:00
c21962ea45 Merge branch 'bugfix/print_ready_after_init_transaction_forv4.3' into 'release/v4.3'
ble_mesh:change the location of print ready(v4.3)

See merge request espressif/esp-idf!19029
2022-07-14 17:28:11 +08:00
18b41408fe Apply 1 suggestion(s) to 1 file(s) 2022-07-14 16:48:59 +08:00
153271c3f1 Apply 1 suggestion(s) to 1 file(s) 2022-07-14 16:48:59 +08:00
a7177bc695 Apply 2 suggestions by Marius Vikhammer 2022-07-14 16:48:44 +08:00
f5bf1b502e docs: update wifi multiple antennas docs 2022-07-14 16:48:29 +08:00
0ec51f96d6 docs: add WIFI_EVENT_STA_BEACON_TIMEOUT event docs. 2022-07-14 15:43:15 +08:00
9ab491d055 docs: update wifi beacon timeout docs 2022-07-14 15:43:15 +08:00
7008e36ccb mbedtls: Update to release v2.28.1
- Changelog: https://github.com/Mbed-TLS/mbedtls/releases/tag/v2.28.1
2022-07-14 10:08:45 +05:30
ff77e2fa69 ble_mesh:change the location of print ready 2022-07-13 18:08:47 +08:00
1fce807796 bluetooth: fix two blufi example bugs
1. Softap mode do not assign ip issue
2. Softap current connection always show 0
2022-07-13 17:48:03 +08:00
a471f1e18e fix licence copyright for header file syscon_reg.h on ESP32C3 and ESP32S3
# Conflicts:
#	components/soc/esp32s3/include/soc/syscon_reg.h
2022-07-13 17:35:27 +08:00
580b57c8b1 component/bt: reset Bluetooth hardware during controller inititalization on ESP32-C3
1. Rename MACROs SYSTEM_WIFI_RST_EN register bit fields to be more recognizable
2. reset Bluetooth baseband and MAC bits to fix the issue of task watchdog triggered during controller initialization due to invalid hardware state
2022-07-13 17:35:22 +08:00
0dd9e338de Merge branch 'bugfix/fix_esp32_ke_mem_c_assert_v4.3' into 'release/v4.3'
fix esp32 BLE ke_mem.c assert for v4.3

See merge request espressif/esp-idf!19002
2022-07-13 15:40:34 +08:00
zwj
8769f62c3b fix esp32 BLE ke_mem.c assert 2022-07-13 03:08:36 +00:00
0326e5874f Merge branch 'bugfix/esp32s2_startup_garbled_output_v4.3' into 'release/v4.3'
esp_system: fix garbled UART output on startup on esp32s2 (v4.3)

See merge request espressif/esp-idf!18751
2022-07-13 11:01:33 +08:00
0df62cf49a Merge branch 'bugfix/ble_50_sync_periodic_adv_lost_data_v4.3' into 'release/v4.3'
components/bt: Fix ble sync periodic adv report will lost data(backport  release/v4.3)

See merge request espressif/esp-idf!18959
2022-07-13 11:01:05 +08:00
47c20c4294 Merge branch 'bugfix/wifi_sta_and_ble_disconnect_BCI-303_v4.3' into 'release/v4.3'
component_bt: Fix wifi is initialized before bluetooth initialization, bluetooth can't stay connected(v4.3)

See merge request espressif/esp-idf!19001
2022-07-13 11:00:23 +08:00
971e3b139b Merge branch 'bugfix/fix_docker_image_build_v4.3' into 'release/v4.3'
ci: Don't build docker image for linux-arm64

See merge request espressif/esp-idf!19013
2022-07-12 22:20:06 +08:00
d6a422b0a6 Merge branch 'bugfix/correct_blecmd_for_rf_path_v4.3' into 'release/v4.3'
Bluedroid: Fixed compilation error due to incorrect macro name (v4.3)

See merge request espressif/esp-idf!18995
2022-07-12 20:37:05 +08:00
923ab8aa06 Merge branch 'docs/404_tips_backport_v4.3' into 'release/v4.3'
docs: update 404.rst (backport v4.3)

See merge request espressif/esp-idf!18974
2022-07-12 19:53:07 +08:00
9600ba2e7e tools: Don't build docker image for linux-arm64 2022-07-12 13:16:29 +02:00
79765d12df Merge branch 'bugfix/wifi_bt_power_domain_leakage_current_v4.3' into 'release/v4.3'
Bugfix/wifi bt power domain leakage current v4.3

See merge request espressif/esp-idf!18901
2022-07-12 15:45:07 +08:00
5cf696a714 Fix wifi is initialized before bluetooth initialization, bluetooth can't stay connected 2022-07-12 14:44:46 +08:00
b6af8e08e8 Merge branch 'bugfix/s3_wakeup_light_sleep_rtc_wdt_timeout_v4.3' into 'release/v4.3'
component_bt: Fixed rtc watchdog timeout when waking up light sleep due to some functions not in IRAM(v4.3)

See merge request espressif/esp-idf!18873
2022-07-12 12:18:34 +08:00
e28ec880a3 Bluedroid: Fixed compilation error due to incorrect macro name 2022-07-12 09:44:23 +05:30
4e5162dd5c Merge branch 'bugfix/update_gpio_intr_enable_note_v4.3' into 'release/v4.3'
Update the note of the gpio_intr_enable function(v4.3)

See merge request espressif/esp-idf!18543
2022-07-12 12:00:09 +08:00
890e29fcac Merge branch 'bugfix/no_proxy_beacon_send_after_deinit_v4.3' into 'release/v4.3'
ble_mesh: stack: Bugfix for proxy beacon send after reinit mesh(v4.3)

See merge request espressif/esp-idf!18792
2022-07-12 10:42:22 +08:00
8d9b493120 Merge branch 'bugfix/enterprise_certs_ca_expired_v4.3' into 'release/v4.3'
esp_wifi: Fix issue of ca certificate expired.

See merge request espressif/esp-idf!18521
2022-07-12 10:37:57 +08:00
e66df0492e Merge branch 'bugfix/fix_ble_ext_adv_parameter_detection_v4.3' into 'release/v4.3'
component/bt: check the ble ext adv parameters (backport release/v4.3)

See merge request espressif/esp-idf!18490
2022-07-12 10:35:09 +08:00
fc14448654 Merge branch 'doc/ble_deinit_v4.3' into 'release/v4.3'
doc(bt): Add description for de-initialize bt controller(backport release/v4.3)

See merge request espressif/esp-idf!18929
2022-07-12 10:34:53 +08:00
7580de6be1 components/bt: Fix the issue caused by the power off the bt power domain 2022-07-11 21:16:42 +08:00
3cfda14ed4 fix the wifi scan fail issue caused by the power off the wifi power domain 2022-07-11 21:16:42 +08:00
94d1a1847e ci: replace old header with new SPDX header style 2022-07-11 21:15:16 +08:00
30b32fa45e esp_hw_support: force power down wifi and bt power domain when rtc module init 2022-07-11 21:15:16 +08:00
7f543bb3b4 Power Management: Initialize backup memory for MAC and Baseband power up/down 2022-07-11 21:15:16 +08:00
1e7bc626ee Power Management: power up/down BT power domain when BT init/deinit 2022-07-11 21:15:16 +08:00
a66b5bbda2 Power Management: power up or down wifi power domain when wifi init or deinit 2022-07-11 21:15:16 +08:00
e9514be5f8 Merge branch 'fix/tls-size-esp32c2_esp32c3_esp32h2_v4.3' into 'release/v4.3'
esp_system: Fix esp32c2/esp32c3/esp32h2 TLS size (v4.3)

See merge request espressif/esp-idf!18828
2022-07-11 18:44:45 +08:00
730094a3ef components/bt: Fix ble sync periodic adv report lost data issue 2022-07-11 16:49:26 +08:00
1970d887a3 Merge branch 'bugfix/do_not_allow_unauthenticated_encrypted_key_data_release_v4.3' into 'release/v4.3'
esp_wifi: Ignore unauthenticated encrypted EAPOL-Key data and fix

See merge request espressif/esp-idf!18315
2022-07-11 16:33:30 +08:00
ec9e44610e docs: update 404.rst 2022-07-11 15:56:08 +08:00
500df7bc1f Merge branch 'bugfix/fix_osi_men_dbg_xxx_not_defined_when_enable_mem_dbg_v4.3' into 'release/v4.3'
bugfix/fix the issue of functions not defined when enable memory debug (v4.3)

See merge request espressif/esp-idf!18816
2022-07-11 15:37:43 +08:00
8225ffcda3 Merge branch 'bugfix/install_key_refactor_v4.3' into 'release/v4.3'
esp_wifi: Refactor key install code(v4.3)

See merge request espressif/esp-idf!18599
2022-07-11 11:28:28 +08:00
5cc8262a09 Update the note of the gpio_intr_enable function 2022-07-11 02:45:01 +00:00
98245dabe0 component/bt: check the ble ext adv parameters 2022-07-11 02:44:30 +00:00
f2e96e85ff esp_wifi: Fix issue of ca certificate expired. 2022-07-11 02:42:38 +00:00
95dbc746ed esp_system: fix garbled UART output on startup on esp32s2
Closes https://github.com/espressif/esp-idf/issues/9168
2022-07-11 02:41:46 +00:00
7af06705d3 esp_wifi: Ignore unauthenticated encrypted EAPOL-Key data and fix handling of key RSC.
Closes https://github.com/espressif/esp-idf/issues/8401
2022-07-10 08:00:24 +00:00
a015532f66 Merge branch 'bugfix/mbedtls_free_keypair_v4.3' into 'release/v4.3'
Nimble: Fixed memory leak while generating keypair using embedtls v4.3

See merge request espressif/esp-idf!18719
2022-07-10 15:51:44 +08:00
5fe6852ed9 Merge branch 'bugfix/restore_edr_en_and_protect_for_vhci_env_v4.3' into 'release/v4.3'
bugfix/restore edr_en and add protect for vhci_env (v4.3)

See merge request espressif/esp-idf!18812
2022-07-10 15:49:48 +08:00
36875e1b78 Merge branch 'bugfix/lower_a2dp_appT_prio_v4.3' into 'release/v4.3'
bugfix/lower the priority of application task of a2dp demo (v4.3)

See merge request espressif/esp-idf!18820
2022-07-10 15:48:15 +08:00
aa81cebd82 Merge branch 'bugfix/resolve_redefinition_in_spp_and_hid_v4.3' into 'release/v4.3'
bugfix/resolve redefinition in btc_spp.h and btc_hd.h/btc_hh.h (v4.3)

See merge request espressif/esp-idf!18825
2022-07-10 15:47:16 +08:00
802c93b5f1 Merge branch 'bugfix/xtensa_sol_frame_saves_extra_registers_v4.3' into 'release/v4.3'
freertos: Xtensa solicited stack frame should save threadptr register (v4.3)

See merge request espressif/esp-idf!18854
2022-07-10 15:45:16 +08:00
09b05350b3 Merge branch 'bugfix/main_task_on_cpu1_startup_failure_v4.3' into 'release/v4.3'
freertos: Fix issue with bootup failure in ESP_MAIN_TASK_AFFINITY_CPU1 config (v4.3)

See merge request espressif/esp-idf!18936
2022-07-10 15:41:46 +08:00
0c6e436e15 Merge branch 'docs/update_wifi_csi_sub_carrier_index_doc_v4.3' into 'release/v4.3'
docs:update wifi sci subcarrier index docs (v4.3)

See merge request espressif/esp-idf!18942
2022-07-10 15:39:57 +08:00
d5728c4583 Merge branch 'bugfix/not_use_malloc_in_bluedroid_v4.3' into 'release/v4.3'
component/bt: use osi_malloc instead of malloc in bluedroid

See merge request espressif/esp-idf!18844
2022-07-08 16:48:30 +08:00
e268aec85c Merge branch 'bugfix/fix_some_memory_leak_in_phy_v4.3' into 'release/v4.3'
fix the bug that some memory leaked in phy after wifi/ble deinit

See merge request espressif/esp-idf!18550
2022-07-08 16:46:16 +08:00
44ef1f070e docs: modify some Chinese expressions related to CSI 2022-07-08 15:01:48 +08:00
b142e78363 docs:update wifi sci subcarrier index docs 2022-07-08 14:44:33 +08:00
4e7b2fedcd resolve redefinition in btc_spp.h and btc_hd.h/btc_hh.h
Closes https://github.com/espressif/esp-idf/issues/9199
2022-07-08 14:25:55 +08:00
21888edbf3 restore edr_en which wrongly cleared by rsw
add critical protection for vhci_env_p->vhci_intr_st
ignore max_page when handle remote features
2022-07-08 14:11:46 +08:00
dca3686f0a lower the priority of application task of a2dp demo 2022-07-08 13:08:23 +08:00
35f8df3995 freertos: Fix issue with bootup failure in ESP_MAIN_TASK_AFFINITY_CPU1 config
Idle tick hook that indicates completion of scheduler init must be launched
on other core than the one where main task runs. Earlier it was assumed that
main task shall always run on PRO cpu but that behavior can be changed with
ESP_MAIN_TASK_AFFINITY_CPU1 and hence this fix.

Closes https://github.com/espressif/esp-idf/issues/9247
Closes IDFGH-7705
2022-07-08 08:37:28 +05:30
ac3fbccbe1 doc(bt): Add description for de-initialize bt controller 2022-07-08 11:03:16 +08:00
5050625f9e fix the issue of functions not defined when enable memory debug 2022-07-08 11:02:04 +08:00
9bbe2fc041 Merge branch 'bugfix/efuse_esp_efuse_utility_burn_efuses' into 'release/v4.3'
efuse: Fix burn operation when data was written directly to regs

See merge request espressif/esp-idf!18886
2022-07-07 21:12:24 +08:00
937069dc6c esp_wifi: clear phy calibrated flag when phy pd memory deinit 2022-07-06 04:36:12 +00:00
9b0b046382 fix the bug that some memory leaked in phy after wifi/ble deinit 2022-07-06 04:36:12 +00:00
7841054063 efuse: Fix burn operation when data was written directly to regs
Closes https://github.com/espressif/esp-idf/issues/9290
2022-07-05 17:37:48 +08:00
aedf00cd78 Nimble: Added check to free keypair if already allocated to avoid memory leak.
Added an API that allows to free keypair
2022-07-05 10:53:21 +05:30
24e47c1def Fix rtc watchdog timeout when waking up light sleep because some functions are not in IRAM 2022-07-05 11:16:19 +08:00
5f50e835e6 freertos: Xtensa FreeRTOS saves threadptr in solicited stack frame
The Xtensa FreeRTOS port does not save the threadptr register when
doing a voluntary yield. This can result in a crash when multiple
tasks used the threadptr register and call "taskYIELD()".

This commit adds the threadptr register to the solicited stack frame.
2022-07-04 18:27:26 +08:00
565142e60c component/bt: use osi_malloc instead of malloc in bluedroid 2022-07-04 16:17:51 +08:00
0f98788d59 esp_system: Fix esp32c2/esp32c3/esp32h2 TLS size
The change fixes thread-local-storage size by removing .srodata section
from it. It initially was included in TLS section by mistake.
The issue was found when stack size increased after building applications
with GCC-11.1 compiler. Stack size became bigger because some new data
appeared in .srodata. See more details here:
adce62f53d
2022-07-01 16:08:04 +04:00
5747b35308 ble_mesh: stack: Bugfix for proxy beacon send after reinit mesh 2022-07-01 11:43:48 +08:00
228cbc4dae Merge branch 'bugfix/sync_host_nocp_cmd_v4.3' into 'release/v4.3'
Nimble: Add support for sync for Host NOCP command .

See merge request espressif/esp-idf!18609
2022-06-30 15:55:08 +08:00
e313ab14ec Merge branch 'bugfix/a_small_fix_for_multi_heap_backport_v4.3' into 'release/v4.3'
Heap: fix param passed to assert_valid_block, should be block not ptr(backport v4.3)

See merge request espressif/esp-idf!18675
2022-06-29 14:06:36 +08:00
473f637ca2 Merge branch 'bugfix/a2dp_source_not_stop_discovery_correctly_v4.3' into 'release/v4.3'
bugfix/avoid wrongly restart discovery in a2dp_source (v4.3)

See merge request espressif/esp-idf!18711
2022-06-29 13:52:05 +08:00
e448ba32d6 Merge branch 'bugfix/app_trace_iram_v4.3' into 'release/v4.3'
apptrace: move all apptrace related functions to IRAM (v4.3)

See merge request espressif/esp-idf!18729
2022-06-29 13:50:21 +08:00
85511fcafb apptrace: move all apptrace related functions to IRAM
Closes: https://github.com/espressif/esp-idf/issues/9131
2022-06-29 10:21:32 +08:00
5f93e3c702 Merge branch 'tools/csv_handling_overhaul_v4.3' into 'release/v4.3'
tools: Overhaul csv handling for mfg_gen and nvs_partition_gen (v4.3)

See merge request espressif/esp-idf!18568
2022-06-28 23:30:22 +08:00
464673fb10 avoid wrongly restart discovery 2022-06-28 13:05:13 +08:00
dd10afb18d tools: overhaul csv handling for mfg_gen and nvs_partition_gen
This fixes the issue where multiline strings and strings with delimiters inside the nvs input csv file were incorrectly parsed, and adds back the ability to add comment lines anywhere in the CSV file.

The issue stems from the move away from the python built in csv module to manual parsing, which was made after moving away from using the csv module to parse mfg data.

This reverts back to using the csv module for parsing and writing csv data in both mfg_gen and nvs_partition_gen, fixes the original issue in mfg_gen and improves code quality which makes the code more readable and maintainable.

Closes https://github.com/espressif/esp-idf/issues/7175
2022-06-24 22:18:00 +02:00
7988aec391 Merge branch 'feature/add_filter_seq_auth_config_v4.3' into 'release/v4.3'
ble_mesh: stack: Add filter old seq_auth packet menuconfig(v4.3)

See merge request espressif/esp-idf!18650
2022-06-24 11:15:45 +08:00
d762f2bd3f bugfix (nvs_flash): Fix nvs_flash_init_partition_ptr
Added unit test case.

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

Signed-off-by: Jakob Hasse <jakob.hasse@espressif.com>
2022-06-24 10:46:27 +08:00
b01797b87d fix param passed to assert_valid_block, should be block not ptr 2022-06-23 21:45:26 +08:00
b3f523b64b Merge branch 'feature/efuse_rst_is_treated_as_poweron_rst_v4.3' into 'release/v4.3'
reset_reasons: EFUSE_RST is treated as POWERON_RST + checks errors of eFuse BLOCK0 (v4.3)

See merge request espressif/esp-idf!14806
2022-06-23 17:06:27 +08:00
dd72d309b6 ble_mesh: stack: Add filter old seq_auth packet menuconfig 2022-06-23 16:19:15 +08:00
c8882c2ba5 Merge branch 'bugfix/vfs_sock_select_race_v4.3' into 'release/v4.3'
vfs: Fix potential select() race if both sock and other-fd trigger (v4.3)

See merge request espressif/esp-idf!18176
2022-06-22 22:56:39 +08:00
714bc66e0e efuse: Checks errors of 4x coding scheme for BLOCK0 if so then abort 2022-06-22 18:04:11 +08:00
0a71dce1ef reset_reasons: EFUSE_RST is treated as POWERON_RST
ESP32 does not have the EFUSE_RST, the rest chips has this reset reason.
2022-06-22 17:56:32 +08:00
0fc7bd6a37 Merge branch 'ci/fix_protobuf_error' into 'release/v4.3'
[ci] Fix protobuf-related error in assign_test stage

See merge request espressif/esp-idf!18570
2022-06-22 13:44:26 +08:00
a1c4397ce2 Merge branch 'bugfix/cpu_cycle_count_not_iram_v4.3' into 'release/v4.3'
HAL: place cpu_ll_get_cycle_count in IRAM (v4.3)

See merge request espressif/esp-idf!18294
2022-06-22 11:42:27 +08:00
b972b442e0 vfs: Fix potential select() race if both sock and other-fd trigger
This fixes a potential race condition in select() if both a socket-fd
and non-socket fd trigger simultaneously to unblock this select.
In case of both fds, we use lwip's local thread semaphore, so we only
have to try return it (if it was taken/triggered more than once) when
we exit select().

Closes https://github.com/espressif/esp-idf/issues/8896
2022-06-21 16:39:58 +00:00
578146ad5d Merge branch 'bugfix/avdtp_genreal_reject_format_error_v4.3' into 'release/v4.3'
component_bt: Fix AVDTP general reject format error(v4.3)

See merge request espressif/esp-idf!18557
2022-06-21 20:54:45 +08:00
7855067dc3 Merge branch 'feature/update_hfp_ag_version_v4.3' into 'release/v4.3'
component_bt: update hfp_ag version to 1.7.2(v4.3)

See merge request espressif/esp-idf!18604
2022-06-21 19:41:11 +08:00
57fd6c0e69 Nimble: Add support for sync for Host NOCP command . 2022-06-21 16:41:52 +05:30
b0b895cf00 Merge branch 'bugfix/rmt_register_file_v4.3' into 'release/v4.3'
rmt: fix error in rmt register file (v4.3)

See merge request espressif/esp-idf!18512
2022-06-21 17:45:50 +08:00
e1120e2554 update hfp_ag version to 1.7.2 2022-06-21 14:46:49 +08:00
b4d3ed9f10 esp_wifi: Refactor key install code 2022-06-21 11:23:46 +08:00
142d7d2bb2 Merge branch 'bugfix/adds_iram_attr_for_efuse_apis_v4.3' into 'release/v4.3'
bootloader_efuse: Adds IRAM_ATTR for efuse API (v4.3)

See merge request espressif/esp-idf!18562
2022-06-20 19:57:03 +08:00
fdc1aa147e Merge branch 'bugfix/light_sleep_when_rtc_is_used_for_gettimeofday_v4.3' into 'release/v4.3'
esp_hw_support: Fix time spent in light sleep when RTC is used for gettimeofday (v4.3)

See merge request espressif/esp-idf!18414
2022-06-19 23:17:43 +08:00
2e7cc4679d Merge branch 'feature/adds_check_32k_xtal_stopped_v4.3' into 'release/v4.3'
esp_hw_support: Adds a msg when 32k xtal was stopped (v4.3)

See merge request espressif/esp-idf!18412
2022-06-19 23:17:29 +08:00
79ae12203e Merge branch 'bugfix/ipc_blocking_v4.3' into 'release/v4.3'
esp_ipc: Fix a case when ipc_task() can wake up blocking task early (v4.3)

See merge request espressif/esp-idf!18416
2022-06-19 23:16:28 +08:00
7c9e19b9bb rmt: fix error in rmt register file
Closes https://github.com/espressif/esp-idf/issues/9100
2022-06-18 13:51:53 +00:00
75073353ed ci: Fix protobuf-related error in assign_test stage 2022-06-17 15:37:49 +05:30
d9610cfa0b Merge branch 'bugfix/esp_crt_bundle_build_issue_v4.3' into 'release/v4.3'
esp_crt_bundle: Fix build problems if MBEDTLS_CERTIFICATE_BUNDLE is disabled (v4.3)

See merge request espressif/esp-idf!18476
2022-06-17 14:15:44 +08:00
a4a7f1d8b7 bootloader_efuse: Adds IRAM_ATTR for efuse API
Fixes startup of app for case:
bootloader with 40Mhz and app with 80Mhz (ESPTOOLPY_FLASHFREQ)

Closes https://github.com/espressif/esp-idf/issues/9156
2022-06-17 13:53:35 +08:00
21fbc7355a Fix AVDTP general reject format error. 2022-06-17 10:21:10 +08:00
e2ebb90df3 Merge branch 'bugfix/eap_method_selection_release_v4.3' into 'release/v4.3'
esp_wifi: Fix the negotiation of method with eap server.

See merge request espressif/esp-idf!18508
2022-06-15 11:25:45 +08:00
a9432cd781 Merge branch 'bugfix/psram_startup_crash_v4.3' into 'release/v4.3'
psram: Fix startup crash when `CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=0` (v4.3)

See merge request espressif/esp-idf!18501
2022-06-15 11:10:32 +08:00
319ba4419d Merge branch 'bugfix/uninitialized-element_v4.3' into 'release/v4.3'
component_bt:initialize all elements of esp_bt_controller_config_t(v4.3)

See merge request espressif/esp-idf!18405
2022-06-15 11:06:56 +08:00
7ccd26eeaf esp_wifi: Fix the negotiation of method with eap server. 2022-06-14 12:34:18 +00:00
7c85d2c498 freertos: Indicate completed initialization for APP CPU with idle task hook
Co-authored-by: Mahavir Jain <mahavir@espressif.com>
2022-06-14 14:25:59 +05:30
2a4321223f Merge branch 'feature/add_esp32c3_hci_uart_example_v4.3' into 'release/v4.3'
Bluetooth: add hci uart example to ESP32-C3

See merge request espressif/esp-idf!18481
2022-06-14 16:24:38 +08:00
3a2f98613d modified README.md 2022-06-13 16:10:40 +08:00
3b3f9c1f49 add nvs initialize 2022-06-13 15:56:44 +08:00
1257bd453e example/controller_hci_uart_esp32c3: fixed the GPIO pin mask for input PINs of UART1 2022-06-13 15:56:44 +08:00
9e96538a86 Added example(ESP32-C3), to use Bluetooth Controller through HCI UART transport 2022-06-13 15:56:44 +08:00
9b593dcb67 test_apps: add build only test for !MBEDTLS_CERTIFICATE_BUNDLE 2022-06-13 11:49:04 +05:30
2cfae63c2b examples: add dependency on cert bundle configuration
Refactor examples to build with MBEDTLS_CERTIFICATE_BUNDLE disabled. Only examples
that can work with certificate bundle disabled have been modified here.
2022-06-13 11:49:00 +05:30
d8ffa6df04 esp_crt_bundle: Fix build problems if MBEDTLS_CERTIFICATE_BUNDLE is disabled
Exclude source and include file from build list if certificate bundle feature
is disabled.

Closes https://github.com/espressif/esp-idf/issues/8714
Closes IDFGH-7106
2022-06-13 11:24:00 +05:30
4a85b2256c Merge branch 'bugfix/esp_http_client_test_v4.3' into 'release/v4.3'
esp_http_client example: Fix CI failures (v4.3)

See merge request espressif/esp-idf!18465
2022-06-12 12:11:38 +08:00
fda52d581b esp_http_client example: Fix CI failures 2022-06-10 16:59:29 +05:30
c40400af8b Merge branch 'bugfix/c3_efuse_fail_bits_v4.3' into 'release/v4.3'
soc: Fix efuse fail bits (v4.3)

See merge request espressif/esp-idf!18418
2022-06-10 17:06:50 +08:00
c501448c13 Merge branch 'bugfix/fixed-unsatisfiable-condition_v4.3' into 'release/v4.3'
Fixed comparison with ESP_MONITOR_DECODE (v4.3)

See merge request espressif/esp-idf!18335
2022-06-10 10:47:26 +08:00
50606887b2 esp_hw_support: Fix time spent in light sleep when RTC is used for gettimeofday
The esp_timer was not advanced correctly.
2022-06-09 14:51:44 +00:00
8d022df00c esp_hw_support: Adds a msg when 32k xtal was stopped 2022-06-09 22:48:53 +08:00
ff4b6949cf esp_ipc: Fix a case when ipc_task() can wake up blocking task early
Closes https://github.com/espressif/esp-idf/issues/8559
2022-06-09 10:59:30 +00:00
4e0e261f4e soc: Fix description of efuse fail bits 2022-06-09 10:35:25 +00:00
c65f973e64 Merge branch 'bugfix/mbedtls_dynamic_buffer_crash_on_ssl_server_v4.3' into 'release/v4.3'
fix(mbedtls): fix ssl server memory leak when enable mbedtls dynamic buffer (backport v4.3)

See merge request espressif/esp-idf!17876
2022-06-09 17:26:16 +08:00
5494b483af Merge branch 'bugfix/pm_enabled_bt_build_fail_v4.3' into 'release/v4.3'
Bluetooth build fail when power management is enabled(v4.3)

See merge request espressif/esp-idf!18382
2022-06-09 17:25:51 +08:00
6524f136b9 Merge branch 'bugfix/mbedtls_dynamic_memory_crash_on_rsa_ciphers_v4.3' into 'release/v4.3'
mbedtls: fix ssl server crash when enable mbedtls dynamic buffer(backport v4.3)

See merge request espressif/esp-idf!18428
2022-06-09 16:25:58 +08:00
562e94be9e Merge branch 'fix/menuconfig_option_esp_cryptoauthlib_v4.3' into 'release/v4.3'
esp_tls_mbedtls.c: Fix esp-idf integration of esp-cryptoauthlib (v4.3)

See merge request espressif/esp-idf!18401
2022-06-09 16:08:14 +08:00
24feccbd80 mbedtls: fix ssl server crash when enable mbedtls dynamic buffer
Not free keycert until MBEDTLS_SSL_CLIENT_KEY_EXCHANGE for rsa key exchange methods, because keycert will be used to parse client key exchange.
2022-06-09 04:37:35 +00:00
49bfb8491f Merge branch 'bugfix/esp_http_client_example_v4.3' into 'release/v4.3'
esp_http_client example: Add cert for redirect to HTTPS example (v4.3)

See merge request espressif/esp-idf!18403
2022-06-09 12:35:48 +08:00
5be64c3111 Merge branch 'bugfix/backport_certificate_bundle_fixes_v4.3' into 'release/v4.3'
Certificate bundle fixes (v4.3)

See merge request espressif/esp-idf!18353
2022-06-09 11:13:41 +08:00
e04eaca191 Merge branch 'bugfix/enable_crt_bundle_v4.3' into 'release/v4.3'
esp_https_ota: Enable option of using global_ca_store and x509_crt_bundle

See merge request espressif/esp-idf!18344
2022-06-09 11:12:54 +08:00
64636e002c Merge branch 'bugfix/mkdfu_flash_parameters_v4.3' into 'release/v4.3'
mkdfu.py: Support setting flash parameters (backport v4.3)

See merge request espressif/esp-idf!18292
2022-06-09 11:12:28 +08:00
ae47e3f172 Merge branch 'bugfix/add_bda_to_read_rmt_name_param_v4.3' into 'release/v4.3'
Bugfix/add bda to read rmt name param v4.3

See merge request espressif/esp-idf!18281
2022-06-09 11:12:17 +08:00
b08c5b746d Merge branch 'bugfix/disable_extensions_idfpy_tests_v4.3' into 'release/v4.3'
Tools: Make idf.py tests independent on extra extensions (v4.3)

See merge request espressif/esp-idf!18278
2022-06-09 11:11:59 +08:00
947601a567 Merge branch 'fix/coap_client_example_v4.3' into 'release/v4.3'
Update the coap client example URL and README (v4.3)

See merge request espressif/esp-idf!18226
2022-06-09 11:11:26 +08:00
b1eb8ebe79 Merge branch 'bugfix/fix_cannot_lslp_again_after_ulp_wakeup_backport_v4.3' into 'release/v4.3'
sleep: ‎fix cannot lightsleep again after a wakeup from ULP(backport v4.3)

See merge request espressif/esp-idf!18217
2022-06-09 11:11:08 +08:00
1b40e6173e Merge branch 'bugfix/i2c_timeout_issue_v4.3' into 'release/v4.3'
I2C: patch for solving watchdog timeout issue(backport v4.3)

See merge request espressif/esp-idf!18132
2022-06-09 11:10:57 +08:00
fab70ef326 Merge branch 'bugfix/Fix_ios_ble_adv_rsp_v4.3' into 'release/v4.3'
Fix iOS advertisement response and simplify (v4.3)

See merge request espressif/esp-idf!18039
2022-06-09 11:10:12 +08:00
8a788526af Merge branch 'docs/update_cn_trans_partition-tables_4.3' into 'release/v4.3'
docs: Update cn trans for partition-tables.rst (v4.3)

See merge request espressif/esp-idf!18031
2022-06-09 11:09:51 +08:00
6bd2776a86 Merge branch 'feature/adds_efuses_to_table_v4.3' into 'release/v4.3'
efuse: Adds ERR_RST_ENABLE efuse for C3 (v4.3)

See merge request espressif/esp-idf!18420
2022-06-09 11:08:21 +08:00
4a203de329 efuse: Adds ERR_RST_ENABLE efuse for C3 and S3
Closes https://github.com/espressif/esp-idf/issues/8357
2022-06-07 22:12:20 +08:00
16e6f85ab6 initialize all elements of esp_bt_controller_config_t
Closes https://github.com/espressif/esp-idf/pull/9073
2022-06-07 17:38:51 +08:00
e4aa50aa87 esp_http_client example: Add cert for redirect to HTTPS example
esp_http_client_test.py: Add checks for missing example logs
2022-06-07 14:54:25 +05:30
3831ad2d47 esp_tls_mbedtls.c: Fix esp-idf integration of esp-cryptoauthlib
menuconfig option
2022-06-07 14:46:35 +05:30
b436ca17b7 Merge branch 'update/version_4_3_3' into 'release/v4.3'
Update version to 4.3.3

See merge request espressif/esp-idf!18368
2022-06-07 11:08:34 +08:00
222a3da891 Bluetooth build fail when power management is enabled
Closes https://github.com/espressif/esp-idf/issues/9081
2022-06-06 20:16:53 +08:00
d2c1c97755 Update esp_crt_bundle certificates 2022-06-06 11:22:07 +05:30
ac05c493b9 esp_crt_bundle: Add bounds checking for the "esp_crt_bundle_set" API.
Closes https://github.com/espressif/esp-idf/issues/8397
2022-06-06 11:22:02 +05:30
1735ebb320 Fixed comparsion of integer and string that evaluated always to False
Closes https://github.com/espressif/esp-idf/issues/9052
Closes IDFGH-7482
2022-06-03 21:19:15 +02:00
16d9971302 versions: Update version to 4.3.3 2022-06-02 23:41:07 +02:00
2e73c5ddec Merge branch 'feature/docker_build_gh_actions_v4.3' into 'release/v4.3'
ci: move Docker image builds to Github, plus other improvements (v4.3)

See merge request espressif/esp-idf!18288
2022-06-03 04:05:00 +08:00
5e32ecccba Tools: Make idf.py tests independent on extra extensions 2022-06-02 14:43:40 +02:00
a6fd8b0972 mbedtls: move locally managed root certificates to separate file
Purpose:
This will allow for easily automating periodic updates to
"cacrt_all.pem" file.

Note:
For now newly created "cacrt_local.pem" contains single "DST Root CA X3"
which we are keeping to manage compatibility with endpoints like
"howsmyssl.com". Please note this Root CA is expired and is not part of
Mozilla’s NSS root certificate store.
2022-06-02 11:07:37 +05:30
bc7cb7c947 esp_crt_bundle: Fix build error
- When `esp_crt_bundle.h` is included before any config,
  a build error (`esp_err_t` not defined) is observed

Closes https://github.com/espressif/esp-idf/issues/8606
2022-06-02 11:06:55 +05:30
d3f0969e4f ci: build and push Docker images in Github actions, add arm64 platform
Replaces the previously used Docker Hub autobuild infrastructure.
This allows for more flexible configuration of the build process,
at the expense of some extra maintenance of CI workflow files
required.
2022-06-01 16:22:15 +02:00
e52ef6c326 docs: document build arguments of the Docker image 2022-06-01 16:22:14 +02:00
b56a7524e3 tools/docker: add IDF_CLONE_SHALLOW and IDF_INSTALL_TARGETS arguments
These two arguments can be used to reduce the size of the Docker
image:

- Setting IDF_CLONE_SHALLOW enables shallow cloning.
- Setting IDF_INSTALL_TARGETS to the comma separated list of targets
  results in toolchains being installed only for these targets.
2022-06-01 16:22:14 +02:00
be783ae29b tcp_transport: Add option to enable crt_bundle for SSL connection 2022-06-01 14:39:01 +05:30
85ee22932a esp_http_client: Enable support of crt_bundle in esp_http_client 2022-06-01 14:38:51 +05:30
f496742ec8 esp_https_ota: Enable option of using global_ca_store and x509_crt_bundle
Closes https://github.com/espressif/esp-idf/issues/5504
2022-06-01 14:01:19 +05:30
0e3ec4fb99 Merge branch 'bugfix/update_efuse_name_v4.3' into 'release/v4.3'
efuse: update efuse name (backport v4.3)

See merge request espressif/esp-idf!18196
2022-05-31 14:42:05 +08:00
a0b1d016e4 efuse: update efuse name (backport v4.3) 2022-05-31 14:42:05 +08:00
8aa0f77863 assign value to uninitialized bt_addr field 2022-05-29 18:06:45 -07:00
71791a4706 add address field to read_rmt_name_param 2022-05-29 18:06:35 -07:00
ee3c14519b Merge branch 'bugfix/remove_gc_for_pmf' into 'release/v4.3'
esp_wifi: Remove group cipher check for PMF connection

See merge request espressif/esp-idf!18274
2022-05-29 00:19:26 +08:00
537f802260 HAL: place cpu_ll_get_cycle_count in IRAM
Closes https://github.com/espressif/esp-idf/issues/9008
2022-05-28 14:31:33 +08:00
d0e38f5a9f mkdfu.py: Support setting flash parameters 2022-05-27 16:34:42 +02:00
cba053da3d esp_wifi: Remove group cipher check for PMF connection 2022-05-27 14:01:28 +05:30
b806d19535 Update the coap client example URL and README
Closes https://github.com/espressif/esp-idf/issues/7219
2022-05-24 12:32:37 +05:30
da08dab9e5 remove wrong function rtc_cntl_ll_ulp_wakeup_enable for esp32s2 and esp32s3 2022-05-19 23:58:29 +08:00
8309e3e5ce esp_hw_‎support/sleep: ‎fix cannot lightsleep again after a wakeup from ULP
Since ulp wakeup signal are connected to ulp int raw(except esp32), we
need to clear ulp int raw before sleep when ulp wakeup enabled. Otherwise,
if the ulp int raw is already set, chip will not sleep properly.

Closes https://github.com/espressif/esp-idf/issues/6229
2022-05-19 23:54:29 +08:00
ffef57c580 fix(mbedtls): fix ssl server memory leak when enable mbedtls dynamic buffer function 2022-05-19 16:28:53 +08:00
b137ae4259 Merge branch 'bugfix/fix_wifi_pm_state_v4.3' into 'release/v4.3'
esp_wifi: fix no null data after WiFi waking up. (backport v4.3)

See merge request espressif/esp-idf!18144
2022-05-18 17:42:55 +08:00
2a83da379f Merge branch 'bugfix/disable_bt_pll_track_v4.3' into 'release/v4.3'
Bluetooth: disable PLL track function for ESP32-C3/ESP32-S3 as it introduced coexistence issues(bacport v4.3)

See merge request espressif/esp-idf!18140
2022-05-18 17:24:55 +08:00
61e1b81752 Merge branch 'bugfix/fix_memory_miss_bug_v4.3' into 'release/v4.3'
esp32c3: Fix cpu crash bug when wakeup from lightsleep for memory data miss (backport v4.3)

See merge request espressif/esp-idf!17825
2022-05-18 12:08:56 +08:00
a8489a7796 Merge branch 'docs/remove_bt_doc_fillers_v4.3' into 'release/v4.3'
docs: remove filler template content from BT docs (v4.3)

See merge request espressif/esp-idf!17948
2022-05-18 02:22:35 +08:00
34c9af3e2d Merge branch 'bugfix/driver_uart_fix_tx_bytes_rts_assert_failure_v43' into 'release/v4.3'
driver: fixes context switch while sending cause rts reset before send (backport v4.3)

See merge request espressif/esp-idf!17935
2022-05-18 02:22:17 +08:00
94c4c3186d driver: fixes context switch while sending cause rts reset before send (backport v4.3) 2022-05-18 02:22:17 +08:00
35ddb13090 Merge branch 'feature/check_block_after_burn_v4.3' into 'release/v4.3'
efuse: Validates data after burning and re-burnes it if necessary (v4.3)

See merge request espressif/esp-idf!17703
2022-05-18 02:21:20 +08:00
fd551af189 Merge branch 'feature/modbus_master_fix_check_uart_set_pin_v43' into 'release/v4.3'
example/modbus_master: fix the assert for uart_set_pin (backport v4.3)

See merge request espressif/esp-idf!17625
2022-05-18 02:20:39 +08:00
f60bbf5172 Merge branch 'feature/esp32c3_apptrace_v4.3' into 'release/v4.3'
apptrace: refactoring & esp32c3 support (v4.3)

See merge request espressif/esp-idf!17878
2022-05-18 02:09:44 +08:00
30013ca66f Merge branch 'bugfix/idle_task_skipped_light_sleep_backport_v4.3' into 'release/v4.3'
pm_impl: fix neither enter light sleep nor enter waiti state in idle task(backport v4.3)

See merge request espressif/esp-idf!17848
2022-05-18 02:08:29 +08:00
692265302e esp_wifi: fix no null data after WiFi waking up. (backport v4.3) 2022-05-17 23:32:33 +08:00
cd43531831 components/bt: disable Bluetooth PLL track function for ESP32-C3/ESP32-S3 as it introduced coexistence issuescomponents/bt: disable Bluetooth PLL track function for ESP32-C3 as it introduced coexistence issues 2022-05-17 20:58:31 +08:00
75f6279c22 I2C: patch for solving watchdog timeout issue 2022-05-17 16:56:58 +08:00
6042412a35 Merge branch 'feature/optimize_wifi_provisioning_memory_v4.3' into 'release/v4.3'
feat(wifi_provisioning): Optimize memory for wifi scan ap number (backport v4.3)

See merge request espressif/esp-idf!18114
2022-05-17 14:13:23 +08:00
e69bae62b2 docs:update cn trans for partition-tables.rst 2022-05-17 02:25:53 +00:00
908192f504 solve memory error bug when in lightsleep mode 2022-05-16 19:42:56 +08:00
5fe7d538a5 Merge branch 'bugfix/fix_esp32c3_brownout_bug_after_deepsleep_v4.3' into 'release/v4.3'
rtc: fix c3 brownout bug after deepsleep (backport v4.3)

See merge request espressif/esp-idf!17959
2022-05-16 16:10:52 +08:00
3fa2d25983 Merge branch 'bugfix/fix_websocket_server_v4.3' into 'release/v4.3'
fix(server): Fix websocket server not support handle multiple connections when client send CLOSE frame (backport v4.3)

See merge request espressif/esp-idf!18019
2022-05-16 16:10:32 +08:00
3a532ecb5c feat(wifi_provisioning): Optimize memory for wifi scan ap number 2022-05-16 14:14:23 +08:00
721a59dd31 Fix iOS advertisement response and simplify 2022-05-16 04:08:12 +00:00
d06fac5c8b apptrace: Adds ESP32-C3 support 2022-05-13 16:23:46 +03:00
58f378602f Merge branch 'feature/usb_serial_default_option_v4.3' into 'release/v4.3'
vfs_usb_serial: set secondary selection for making usb port can output under default menu (backport v4.3)

See merge request espressif/esp-idf!18062
2022-05-13 17:24:33 +08:00
fa6655cbcf apptrace: Refactors apptrace for better support various tracing HW 2022-05-13 08:45:31 +00:00
440c4a28d7 hal/esp32c3: Avoid entering WFI mode under debugger 2022-05-13 08:45:31 +00:00
91f679bdb3 Merge branch 'bugfix/fix_disable_bt_log_ci_fail_v4.3' into 'release/v4.3'
component_bt: Fix CI failure when disable bluetooth debug log(v4.3)

See merge request espressif/esp-idf!17906
2022-05-13 15:22:16 +08:00
181b75e152 Merge branch 'bugfix/fix_phy_tx_power_limit_v4.3' into 'release/v4.3'
esp_wifi: fix phy limit tx power for s2/c3

See merge request espressif/esp-idf!17907
2022-05-13 15:21:50 +08:00
c9ff4822c5 Merge branch 'bugfix/spp_crash_after_call_spp_deinit_v4.3' into 'release/v4.3'
Component_bt/Fix spp crash after call esp_spp_deinit(v4.3)

See merge request espressif/esp-idf!17931
2022-05-13 15:21:07 +08:00
7df94ffb2e Merge branch 'contrib/github_pr_8779_v4.3' into 'release/v4.3'
esp_wifi: fix clearing default wifi netif procedure(v4.3)

See merge request espressif/esp-idf!17939
2022-05-13 15:20:12 +08:00
3207993eb7 Merge branch 'bugfix/_rtc_slow_length_incorrectly_optimized_backport_v4.3' into 'release/v4.3'
sleep_power_domain: fix _rtc_slow_length being incorrectly optimized by compiler(backport v4.3)

See merge request espressif/esp-idf!17975
2022-05-13 15:19:50 +08:00
71fdd0e146 Merge branch 'bufix/esp32c3_s3_build_err_v4.3' into 'release/v4.3'
component_bt: Fix ESP32C3 build error after enable light sleep(v4.3)

See merge request espressif/esp-idf!17996
2022-05-13 15:19:38 +08:00
0f2aa2eae4 vfs_usb_serial: set secondary selection for making usb port can output under default menu 2022-05-12 12:23:35 +08:00
4db597a728 spi_flash: refact that flash qio can be overidable 2022-05-09 11:27:19 +08:00
15090af9d1 fix(server): Fix websocket server not support handle multiple connections when client send CLOSE frame 2022-05-06 17:58:52 +08:00
d6f857a2f0 Fix ESP32C3 build error after enable light sleep 2022-05-05 10:50:33 +08:00
92ccc5fa95 fix _rtc_slow_length being incorrectly optimized by compiler 2022-05-01 23:22:05 +08:00
0d5f7b5521 fix c3 brownout bug after deepsleep 2022-04-28 18:20:25 +08:00
28e50c1180 efuse: fix 2022-04-28 09:29:10 +00:00
4be976e40d efuse: Fix 3/4 coding scheme UTs 2022-04-28 09:29:10 +00:00
adc9261443 efuse: Improve messages during burn operation 2022-04-28 09:29:10 +00:00
2e9e5d6e7c efuse: Burn func can return an error
esp_efuse_utility_burn_chip()
2022-04-28 09:29:10 +00:00
2ba9cd6c54 efuse: Validates data after burning and re-burnes it if necessary
It checks the content of the written data and encoding errors.
2022-04-28 09:29:10 +00:00
656ea5c664 docs: remove filler template content from BT docs 2022-04-27 17:54:13 +08:00
e0cf810bab Fix spp initialization failure without free mutex 2022-04-27 14:25:45 +08:00
a9b515d0d1 Fix spp crash after calling esp_spp_deinit 2022-04-27 14:25:38 +08:00
068221cb33 esp_wifi: fix clearing default wifi netif procedure
Prior to this change "esp_wifi_clear_default_wifi_driver_and_handlers"
will not remove netif pointer from table when both AP and STA interfaces were
created and destroying default wifi interfaces is done in unfortunate
order. As a result there is dangling pointer left and it may cause crash in
later code (i.e. when esp_wifi_stop() is called).
2022-04-26 22:51:28 -04:00
b4ef1b80a2 Merge branch 'bugfix/oversized_SegN_as_valid_v4.3' into 'release/v4.3'
ble_mesh: stack: Bugfix for oversized SegN as valid(v4.3)

See merge request espressif/esp-idf!17775
2022-04-26 20:14:19 +08:00
94bac458bf esp_wifi: fix phy limit tx power for s2/c3 2022-04-26 03:26:10 -04:00
30b2cad3b7 Fix CI failure when disable bluetooth debug log 2022-04-26 15:14:26 +08:00
c4f39a5d91 ble_mesh: stack: Bugfix for oversized SegN as valid 2022-04-25 11:52:30 +08:00
588436db47 Merge branch 'feature/touch_sense_test_case_v4.3' into 'release/v4.3'
touch_element: add unit test for Touch Element lib (backport v4.3)

See merge request espressif/esp-idf!15084
2022-04-23 15:22:27 +08:00
df8ebc9bba Merge branch 'bugfix/fix_build_warring_v4.3' into 'release/v4.3'
esp_wifi: fix build warning(v4.3)

See merge request espressif/esp-idf!17839
2022-04-23 15:21:56 +08:00
e48cf0c188 Merge branch 'bugfix/interrupted_thread_gdb_bt_v4.3' into 'release/v4.3'
riscv: Fixes GDB backtrace of interrupted threads (v4.3)

See merge request espressif/esp-idf!17722
2022-04-23 13:56:51 +08:00
3477c342e2 Merge branch 'bugfix/rrm_dpp_task_delete_v4.3' into 'release/v4.3'
wpa_supplicant: backport WLAN fixes (release v4.3)

See merge request espressif/esp-idf!17656
2022-04-23 13:50:57 +08:00
ffd68203f6 fix build error 2022-04-22 21:52:42 +08:00
e1d3993309 RISC-V: Fix vectors.S assembly file indentation and macro usage
The file is now more consistent as the macros have been fixed, more comments
have been added and the indentation is now using spaces only.
2022-04-22 13:17:59 +03:00
dfd3a9c3bc riscv: Use semihosting to set breakpoint and watchpoint when running under debugger 2022-04-22 13:17:54 +03:00
4edc903bb3 riscv: Adds support for returning from exception handler 2022-04-22 12:38:16 +03:00
e688645ff9 riscv: Fixes GDB backtrace end function to point to prvTaskExitError 2022-04-22 12:38:16 +03:00
f8a0279e5d riscv: Fixes GDB backtrace of interrupted threads
Save missed SP value on stack
2022-04-22 12:38:16 +03:00
81d1226f53 ESP_WIFI: Remove static analysis warnings 2022-04-22 17:17:48 +08:00
846cbf14dc Merge branch 'bugfix/spiffs_check_part_alignment_v4.3' into 'release/v4.3'
spiffs: add init checks for partition alignment and data types (v4.3)

See merge request espressif/esp-idf!17836
2022-04-22 13:07:03 +08:00
a818e9ca91 Merge branch 'bugfix/fix_adc_digital_not_reset_issue_v4.3' into 'release/v4.3'
adc: fix adc digital not reset issue (v4.3)

See merge request espressif/esp-idf!17427
2022-04-22 12:43:44 +08:00
a37e9318ef touch_element: add unit test for Touch Element lib 2022-04-22 03:13:25 +00:00
1ad55d707b Merge branch 'origin/bugfix/i2c_iram_placement_fix_v4.3' into 'release/v4.3'
i2c: Correct hal functions iram placement and remove IRAM_ATTR for i2c_hw_fsm_reset (backport v4.3)

See merge request espressif/esp-idf!17805
2022-04-22 11:08:17 +08:00
1d72f077c5 Merge branch 'bugfix/scan_mixed_keymgmt_issue_v4.3' into 'release/v4.3'
Combined fix for scan issue and PMF disable API  (Backport v4.3)

See merge request espressif/esp-idf!17749
2022-04-22 10:58:47 +08:00
6d3dc2e616 wpa_supplicant: Remove scan done event in task 2022-04-22 02:40:15 +00:00
8ef2842074 wpa_supplicant: static analysis fixes 2022-04-22 02:40:15 +00:00
bf4f9b9e41 wpa_supplicant: Add BTM security checks 2022-04-22 02:40:15 +00:00
b1f7ad6983 esp_example: Enable MbedTLS for DPP enrollee by default 2022-04-22 02:40:15 +00:00
fdbb3da1b4 wpa_supplicant: Correct task deletion for RRM and DPP tasks
Closes https://github.com/espressif/esp-idf/issues/7409
2022-04-22 02:40:15 +00:00
9532e1ccc6 Merge branch 'bugfix/vfs_fat_(p)write_on_diskfull_v4.3' into 'release/v4.3'
vfs: bugfix vfs_fat_write/pwrite upon disk-full (v4.3)

See merge request espressif/esp-idf!17650
2022-04-21 23:12:44 +08:00
f8c098658c adc: fix adc digital not reset issue 2022-04-21 19:29:15 +08:00
21daee7dce Merge branch 'bugfix/wrong_gpio_is_deep_sleep_wakeup_valid_gpio_v4.3' into 'release/v4.3'
gpio: fix wrong GPIO_IS_DEEP_SLEEP_WAKEUP_VALID_GPIO macro (backport v4.3)

See merge request espressif/esp-idf!17806
2022-04-21 18:17:20 +08:00
436be30045 esp_wifi: Update wifi lib
1. In scan, correctly identify AP's with mixed key mgmt
2. Add API to disable PMF configuration
2022-04-21 14:40:21 +05:30
4ef87d2505 Merge branch 'update/c3_s3_phy_lib_20220419_v4.3' into 'release/v4.3'
Update/c3 s3 phy lib aa05aec  (backport v4.3)

See merge request espressif/esp-idf!17816
2022-04-21 16:04:49 +08:00
d04a94320a Merge branch 'bugfix/fix_adc_calibration_light_sleep_issue_v4.3' into 'release/v4.3'
adc: fix calibration error when waking up from light sleep (v4.3)

See merge request espressif/esp-idf!16929
2022-04-21 15:56:10 +08:00
8b1826f86e Merge branch 'bugfix/spi_slave_intr_iram_v4.3' into 'release/v4.3'
driver: spi_slave: make sure CS helpers are in IRAM if the ISR is (v4.3)

See merge request espressif/esp-idf!17832
2022-04-21 15:50:03 +08:00
b1b92d46e5 pm_impl: fix neither enter light sleep nor enter waiti state in idle task 2022-04-21 14:38:17 +08:00
20106fc141 Merge branch 'bugfix/fix_phy_i2c_crash_v4.3' into 'release/v4.3'
esp_phy: Add IRAM_ATTR for phy i2c spinlock (v4.3)

See merge request espressif/esp-idf!17843
2022-04-21 11:38:57 +08:00
9b0e8266c8 Update esp c3 phy lib (aa05aec) 2022-04-21 11:08:30 +08:00
f4e5ba7d9f esp_phy: Add IRAM_ATTR for phy i2c spinlock 2022-04-21 02:56:30 +08:00
54d9f265dc Merge branch 'bugfix/linenoise_unint_buffer_and_color_v4.3' into 'release/v4.3'
console: linenoise: fix usage of an uninitialized buffer, fix no-color output (v4.3)

See merge request espressif/esp-idf!17830
2022-04-20 21:01:16 +08:00
51af60adf0 spiffs: add init checks for partition alignment and data types
Closes https://github.com/espressif/esp-idf/issues/8593
2022-04-20 12:53:57 +02:00
e0f7d6834d driver: spi_slave: make sure CS helpers are in IRAM if the ISR is
Closes https://github.com/espressif/esp-idf/issues/3870
2022-04-20 12:50:14 +02:00
5628f1f21d console: linenoise: fix usage of an uninitialized buffer
Reported in https://github.com/espressif/esp-idf/issues/6440

The issue could occur if esp_console_config_t::hint_color
was set to -1.
2022-04-20 16:03:23 +05:30
be564ffd28 console: disable colored hints if CONFIG_LOG_COLORS is not set 2022-04-20 16:03:22 +05:30
2d7ae879f1 esp_wifi: fix build warning 2022-04-20 05:25:29 -04:00
1ffc02dfaf Merge branch 'feature/esp32c3_usbjtag_console_blocking_v4.3' into 'release/v4.3'
usb_serial_jtag: Add blocking driver to support vfs (backport v4.3).

See merge request espressif/esp-idf!17330
2022-04-20 16:30:12 +08:00
0c7d32bcdb Merge branch 'bugfix/fatfs_warning_fix_v4.3' into 'release/v4.3'
fatfs: Fix putc_bfd compilation warning (v4.3)

See merge request espressif/esp-idf!17523
2022-04-20 16:20:52 +08:00
671303bbd5 usb_serial_jtag: Add blocking driver to support vfs. 2022-04-19 16:21:20 +08:00
62cc246d5f Merge branch 'bugfix/fix_spp_initiator_connect_failed_v4.3' into 'release/v4.3'
Component_bt/Fix SPP initiator can not free resource when connection is failed[backport 4.3]

See merge request espressif/esp-idf!17745
2022-04-19 15:49:32 +08:00
d6c2bae1bc gpio: fix wrong GPIO_IS_DEEP_SLEEP_WAKEUP_VALID_GPIO macro
Closes https://github.com/espressif/esp-idf/issues/8733

(cherry picked from commit 0d52cb04dc)
2022-04-18 22:29:52 +08:00
37ec8e835b Merge branch 'bugfix/fix_heap_free_memory_v4.3' into 'release/v4.3'
Heap: fix free bytes calculation for TLSF heap (backport v4.3)

See merge request espressif/esp-idf!17689
2022-04-18 21:43:07 +08:00
a7935539b5 i2c: Correct hal functions iram placement and remove IRAM_ATTR for i2c_hw_fsm_reset
Closes https://github.com/espressif/esp-idf/issues/8422
Closes https://github.com/espressif/esp-idf/issues/7249

(cherry picked from commit 1ceb7c8cd6)
2022-04-18 21:07:52 +08:00
6c27359d13 Merge branch 'bugfix/smtp_client_v4.3' into 'release/v4.3'
smtp_client: Fix heap leakage (v4.3)

See merge request espressif/esp-idf!17795
2022-04-18 14:37:01 +08:00
6217fb46db Merge branch 'bugfix/fix_variable_on_stack_bug_in_seg_slave_example_v4.3' into 'release/v4.3'
spi_slave_hd: fix stack variable bug in seg_slave example (v4.3)

See merge request espressif/esp-idf!16389
2022-04-18 13:10:34 +08:00
99339caedc Merge branch 'bugfix/spi_master_clear_error_fifo_status_v4.3' into 'release/v4.3'
spi_master: clear error fifo status before transaction starts (v4.3)

See merge request espressif/esp-idf!16207
2022-04-18 13:10:14 +08:00
638a1b9bf3 smtp_client: Fixed garbage characters being printed
- The R/W buffers were not cleared before reading/writing
  anything new
2022-04-18 10:33:14 +05:30
df294b7b69 smtp_client: Fix heap leakage
- Freed all allocated resources by Mbed TLS at the end of routine
2022-04-18 10:33:14 +05:30
6808bbc26c Merge branch 'feature/esp32c3_eco4_v4.3' into 'release/v4.3'
esp32c3: Adds ECO4 revision (v4.3)

See merge request espressif/esp-idf!17718
2022-04-18 13:00:14 +08:00
5025931e7c Merge branch 'bugfix/nvs_coverity_issues_4.3' into 'release/v4.3'
bugfix (nvs): Fixed issues found by Coverity (backport 4.3)

See merge request espressif/esp-idf!17763
2022-04-15 04:48:50 +08:00
d1bb7cfb3f fatfs: Fix putc_bfd compilation warning
Fixed FatFs\ff.c: warning: argument of type "TCHAR **" is incompatible with parameter of type "const TCHAR **"

Closes https://github.com/espressif/esp-idf/issues/5870
2022-04-14 11:55:33 +02:00
e414dce1ff bugfix (nvs): Fixed issues found by Coverity
*  Fixed potential memory leak
*  Fixed wrong strncpy usage
*  Fixed potential out of bounds access
2022-04-14 08:30:03 +00:00
9c35eeecbd Merge branch 'fix/revert_latest_git-v4.3' into 'release/v4.3'
Revert latest git (release v4.3)

See merge request espressif/esp-idf!17766
2022-04-14 00:19:39 +08:00
86ec13eb21 Revert latest git 2022-04-13 13:51:22 +02:00
2cc879120b Heap: fix typos in test and component 2022-04-13 14:23:51 +08:00
2a712fccd4 add missing unlock in btc_spp_cb_handler of BTA_JV_RFCOMM_WRITE_EVT 2022-04-13 10:44:11 +08:00
0269d062d0 fix SPP initiator can not free resource when connection is failed 2022-04-13 10:44:11 +08:00
9ab1c4c9e0 Merge branch 'bugfix/gdbgui_deps_4.4_v4.3' into 'release/v4.3'
Tools: Fix incompatible package dependencies of gdbgui (v4.3)

See merge request espressif/esp-idf!17750
2022-04-13 01:41:16 +08:00
351a209540 Merge branch 'bugfix/python_env_not_installed_by_install.ps1_v4.3' into 'release/v4.3'
tools: fix python-env install by install.ps1 (v4.3)

See merge request espressif/esp-idf!17752
2022-04-12 23:23:55 +08:00
a7c99f4eae tools: fix python-env install by install.ps1
Closes https://github.com/espressif/esp-idf/issues/8647
2022-04-12 15:51:07 +02:00
2ddb34c3c0 Tools: Fix incompatible package dependencies of gdbgui
Closes https://github.com/espressif/esp-idf/issues/8760
2022-04-12 14:50:47 +02:00
9cb98bf6da Merge branch 'bugfix/http_code_v4.3' into 'release/v4.3'
esp_http_client, esp_https_ota: Handle HTTP 303 status code (v4.3)

See merge request espressif/esp-idf!17733
2022-04-11 19:29:29 +08:00
217d2d0775 example/modbus_master: fix the assert for uart_set_pin
Signed-off-by: aleks <aleks@espressif.com>

Closes https://github.com/espressif/esp-idf/pull/8607
2022-04-11 11:28:09 +00:00
47424affaf Merge branch 'contrib/github_pr_8564_v4.3' into 'release/v4.3'
Fix nested redirect (GitHub PR) (v4.3)

See merge request espressif/esp-idf!17735
2022-04-11 18:33:47 +08:00
3842d27be3 advanced_https_ota/example_test.py: Update redirect URL test to include two redirects 2022-04-11 09:48:31 +05:30
68f206959b esp_http_client: Add comment for clearing location field in esp_http_client_prepare 2022-04-11 09:48:31 +05:30
3a69b1d94f esp_http_client: fix redirect by resetting location before parsing
Closes #8563.

Signed-off-by: Nicklas Frahm <nicklas.frahm@gmail.com>
2022-04-11 09:48:31 +05:30
342f566002 esp_https_ota: Add check for 303 and 308 status code
Closes https://github.com/espressif/esp-idf/issues/8581
2022-04-11 09:44:14 +05:30
983547290b esp_http_client: Add new status code 303 and 308 2022-04-11 09:44:14 +05:30
9bec068e52 Merge branch 'bugfix/bt_add_some_debug_log_v4.3' into 'release/v4.3'
component_bt: Add some bluetooth debug log(v4.3)

See merge request espressif/esp-idf!17615
2022-04-11 10:53:47 +08:00
edde9c7892 esp32c3: Adds ECO4 revision 2022-04-08 18:25:16 +08:00
912f2ea76c Merge branch 'bugfix/phy_regi2c_critical_section_v4.3' into 'release/v4.3'
esp_phy: use spinlock to avoid regi2c access conflicts (v4.3)

See merge request espressif/esp-idf!17692
2022-04-07 20:19:28 +08:00
d9be879a76 Merge branch 'feature/add_component_manager_python_dependency_v4.3' into 'release/v4.3'
Build System: Add idf-component-manager python dependency (v4.3)

See merge request espressif/esp-idf!15663
2022-04-06 16:29:42 +08:00
75c720bcd3 esp_phy: use spinlock to avoid regi2c access conflicts 2022-04-06 14:46:10 +08:00
92d6c4a502 regi2c: use safe version of spinlock, instead of ISR ver 2022-04-06 12:19:51 +08:00
d7f614d58a Heap: fix free bytes calculation for TLSF heap
* Closes https://github.com/espressif/esp-idf/issues/8270
2022-04-06 10:23:11 +08:00
d75674579e Merge branch 'bugfix/websocket_example_echo_server_v4.3' into 'release/v4.3'
websocket: Updated Kconfig to use 'echo.websocket.events' echo server(v4.3)

See merge request espressif/esp-idf!17605
2022-04-04 18:59:38 +08:00
4efc516c1a Merge branch 'feature/docker_image_latest_git' into 'release/v4.3'
Install always latest version of git (release-v4.3)

See merge request espressif/esp-idf!17651
2022-03-31 22:14:24 +08:00
2ffd558153 Install always latest version of git
Closes https://github.com/espressif/esp-idf/issues/8673
2022-03-31 12:27:21 +02:00
52de71c60e Merge branch 'Fix/update_reset_reason_v4.3' into 'release/v4.3'
update reset reason for c3/s3/h2 (v4.3)

See merge request espressif/esp-idf!17597
2022-03-30 17:54:22 +08:00
39b6a3fcbf vfs: bugfix vfs_fat_write/pwrite upon disk-full
Closes https://github.com/espressif/esp-idf/issues/5027
2022-03-30 09:56:15 +02:00
f789336ab9 Merge branch 'bugfix/wifi_prov_mgr_conn_issue_v4.3' into 'release/v4.3'
Wifi_prov_mgr: Fix for device disconnection after pairing (v4.3)

See merge request espressif/esp-idf!17621
2022-03-29 17:30:12 +08:00
1ef989a1b5 update reset reason for c3/s3/h2 2022-03-29 10:03:27 +08:00
06ce378142 Merge branch 'bugfix/spi_free_crash_uninitialized_v4.3' into 'release/v4.3'
spi: fixed crash when calling spi_bus_free when not initialized (v4.3)

See merge request espressif/esp-idf!17609
2022-03-28 18:22:51 +08:00
6a92fb2d76 Merge branch 'bugfix/wifi_prov_mgr_conn_issue' into 'release/v4.3'
NimBLE: Fixed device disconnection issue of wifi prov mgr

Closes IDF-4655

See merge request espressif/esp-idf!17621
2022-03-28 12:51:36 +05:30
b729bf804d Add some bluetooth debug log 2022-03-28 11:13:10 +08:00
eca8b7ca41 spi: fixed crash when calling spi_bus_free when not initialized
introduced in 49a48644e4

Closes: https://github.com/espressif/esp-idf/issues/8642
2022-03-27 02:33:41 +08:00
eeea576409 Merge branch 'bugfix/gpio_example_config_struct_zero_init_v4.3' into 'release/v4.3'
example: fixed the issue that config struct is not properly initialized (v4.3)

See merge request espressif/esp-idf!17588
2022-03-27 02:30:36 +08:00
1457686a94 websocket: Updated Kconfig to use 'echo.websocket.events' echo server
Updated README to show how to run websocket echo server using Flask

Merges https://github.com/espressif/esp-idf/pull/8262
2022-03-25 16:28:29 +04:00
0393a5647a example: fixed the issue that config struct is not properly initialized 2022-03-25 01:08:21 +08:00
673d0371ba Merge branch 'bugfix/typo_in_i2c_macro_v4.3' into 'release/v4.3'
I2C: Fix typo in I2C_TIMING_VAL_ERR_STR macro name (backport v4.3)

See merge request espressif/esp-idf!17117
2022-03-24 11:17:46 +08:00
361a604276 Merge branch 'bugfix/esp_flash_erase_0_v4.3' into 'release/v4.3'
esp_flash: fix esp_flash_erase_region over-erase with 0 length (Github PR) (v4.3)

See merge request espressif/esp-idf!16805
2022-03-22 12:01:40 +08:00
f4852bc055 rom, spi_flash: add a patch for esp_flash_erase_region for C3, S3
Submitted in https://github.com/espressif/esp-idf/pull/7314
Closes https://github.com/espressif/esp-idf/issues/7272
2022-03-16 11:52:14 +01:00
1d933ad02c spi_flash: add test case for esp_flash_erase_region with 0 size 2022-03-16 11:48:59 +01:00
ab0eac5508 esp_flash_api fixes 2022-03-16 11:48:58 +01:00
8ffddf53bc Merge branch 'bugfix/btdm_link_error_of_kconfig_v4.3' into 'release/v4.3'
Bugfix/btdm link error of kconfig v4.3

See merge request espressif/esp-idf!15466
2022-03-16 16:25:15 +08:00
cd598bd7c0 Merge branch 'bugfix/inline_intrmask_from_isr_v4.3' into 'release/v4.3'
freertos: always inline xPortSetInterruptMaskFromISR and vPortClearInterruptMaskFromISR (v4.3)

See merge request espressif/esp-idf!17326
2022-03-16 13:45:32 +08:00
70c737af4d Merge branch 'bugfix/repeated_ftm_failures_issue_v4.3' into 'release/v4.3'
Combined bugfixes related to FTM and PMF (Backport v4.3)

See merge request espressif/esp-idf!16129
2022-03-16 11:00:24 +08:00
c6a96e9a57 Merge branch 'doc/update_document_of_demo_bt_discovery_v4.3' into 'release/v4.3'
Doc/update document of demo bt discovery v4.3

See merge request espressif/esp-idf!16576
2022-03-16 10:23:47 +08:00
0f1db7fd9c Merge branch 'update/mqtt_refs_v4.3' into 'release/v4.3'
mqtt: Fix sending log data; dup flag after queue (v4.3)

See merge request espressif/esp-idf!17404
2022-03-16 10:22:47 +08:00
300b881428 Merge branch 'bugfix/hfp_disc_audio_err_v4.3' into 'release/v4.3'
bugfix/fix_err_when_ag_disc_audio_v4.3

See merge request espressif/esp-idf!17474
2022-03-16 10:22:08 +08:00
b668c0cc4d Merge branch 'bugfix/crash_when_reconnect_to_sink_v4.3' into 'release/v4.3'
bugfix/fix the failure of reconnect to sink (v4.3)

See merge request espressif/esp-idf!17477
2022-03-16 10:21:37 +08:00
cbca71a4e7 Merge branch 'bugfix/uart_custom_isr_broken_v4.3' into 'release/v4.3'
UART: fix a bug preventing the user from freeing a previously registered ISR

See merge request espressif/esp-idf!17217
2022-03-15 14:37:11 +08:00
7eaeaaa784 Merge branch 'docs/add_note_for_malloc_cap_dma_backport_v4.3' into 'release/v4.3'
docs: add note for MALLOC_CAP_DMA for ESP32-S2 according to customer feedback (backport v4.3)

See merge request espressif/esp-idf!17341
2022-03-14 18:24:03 +08:00
b752da1a01 Merge branch 'bugfix/idfpy_erase_otadata_v4.3' into 'release/v4.3'
tools: set baudrate and port with otatool. (v4.3)

See merge request espressif/esp-idf!17468
2022-03-14 17:37:54 +08:00
2ef0e2d126 fix the failure of reconnect to sink 2022-03-14 11:33:38 +08:00
1dca246310 correct the rate of data-producing
Closes https://github.com/espressif/esp-idf/issues/7911
2022-03-14 10:45:10 +08:00
79c9a043f2 Merge branch 'bugfix/flash_from_monitor_on_windows_v4.3' into 'release/v4.3'
Tools: IDF Monitor should flash with the unmodified port (v4.3)

See merge request espressif/esp-idf!17258
2022-03-12 23:18:41 +08:00
e583dd0cfa Merge branch 'bugfix/security_update_pppos_crash_v4.3' into 'release/v4.3'
lw-ip: Apply security fixes from upstream; Fix PPPoS and NAPT ip-forward (v4.3)

See merge request espressif/esp-idf!17421
2022-03-12 01:59:57 +08:00
330db29120 tools: set baudrate and port with otatool.
Bugfix: Allow setting options port -p and baudrate -b, with idf.py otatool commands.

Closes https://github.com/espressif/esp-idf/issues/8317
2022-03-11 15:47:42 +01:00
053a59a0b1 components/bt: Fix build-doc error 2022-03-11 10:48:21 +00:00
99adcfbda0 components/bt: move config BT_RESERVE_DRAM from bluedroid to ESP32 controller 2022-03-11 10:48:21 +00:00
4b0c1d6f71 Fix bt init error with psram 2022-03-11 10:48:21 +00:00
2f8b58d88f components/bt: Combine 3 Bluetooth controller menu 2022-03-11 10:48:21 +00:00
6f86e1bb63 components/bt: Fix link error of Kconfig 2022-03-11 10:48:21 +00:00
491b95925e spi flash: fix cache accessed while disabled issues at -O0
mask_get_id and gpio_hal_iomux_func_sel were called while cache
is disabled, but were not inlined as expected at -0O.
Force these functions to always be inlined.
2022-03-11 09:39:50 +08:00
0997c6df99 Merge branch 'feature/update_hfp_hf_version_v4.3' into 'release/v4.3'
component_bt: Update HFP_HF version to 1.7.2(v4.3)

See merge request espressif/esp-idf!17392
2022-03-10 20:20:12 +08:00
6fd6a8b40b esp_wifi: Always connect Station in PMF mode if possible
While using esp_wifi_set_config, flag pmf_capable defaults to 0.
Users may not bother to enable it, which prevents connection to a
WPA3 AP. Or the AP may reset into WPA3 mode failing the re-connection.
To ensure better security, deprecate the pmf_capable flag and set it to
true internally.
2022-03-10 17:16:32 +05:30
47ccdef8c1 esp_wifi: Miscellaneous FTM bugfixes
1. Update wifi libs with bugfixes for corner cases
2. Avoid ASSERT for scan failure in FTM example
2022-03-10 17:15:04 +05:30
3d0076a31f esp_wifi: Update wifi lib
Update wifi lib with below fixes -
1. In FTM Responder, add session timer for cleanup, also remove
   unnecessary mutex locks
2. In FTM Responder, fix incorrect print in case of failure
   while setting up the SofTAP
2. In FTM Initiator, increase FTM Request response timeout to
   avoid failures in noisy environments
3. In FTM Initiator, abort for high start delta time, also fix
   timeout issue in ASAP mode
2022-03-10 17:13:41 +05:30
6e13fc803a esp_wifi: Reset event bits in ftm example to avoid repeated failures 2022-03-10 16:51:02 +05:30
16c14a196b Merge branch 'bugfix/update_esp32_phy_max_tx_power_v4.3' into 'release/v4.3'
esp_phy: update esp32 phy max tx power(v4.3)

See merge request espressif/esp-idf!17413
2022-03-10 17:38:10 +08:00
004d8e9450 Merge branch 'docs/add_an_example_list_for_esp32-wrover-kit_v4.3' into 'release/v4.3'
docs: add an example list for esp-wrover-kit (v4.3)

See merge request espressif/esp-idf!16692
2022-03-09 19:09:01 +08:00
a20b6c4d95 Merge branch 'bugfix/fix_rx_fragment_error_issue_v4.3' into 'release/v4.3'
esp_wifi: fix fragment issue and PMF compatible for faulty APs(Backport v4.3)

See merge request espressif/esp-idf!16395
2022-03-09 18:45:42 +08:00
e00a689a77 lwip: Security fixes; PPPoS null-deref; NAPT ip-forward
* Cherry-pick important fixes to 2.1.2-esp
  - CVE-2020-22283: Attacker could craft a packet that would disclose 8 bytes of some heap memory:
    - icmp6: Don't copy too much data
    - icmp6: Fix copying of chained pbuf in reply
    - icmp6: keep to the RFC and send as much as possible with icmp6 error messages
  - CVE-2020-22284: ZEP - ZigBee Encapsulation Protocol/6LoWPAN is not supported in IDF,
    the netif module (zepif.c) is not included in the build, but users can still inject
    the file into compilation process, implement IO interface and use this.
    - zepif: Copy possibly chained output pbuf properly
    - Add #define for minimum IPv6 MTU length
    - pbuf: Add pbuf_copy_partial_pbuf library function
* PPPoS: Fix null-deref when processing double break packet
  - pppos: fix in_tail null (espressif/esp-lwip@537c69d5)
  - PPP: Add test exhibiting empty packet null-deref (espressif/esp-lwip@202a07da)
* NAPT: Fix PBUF_REF type to clone the pbuf before forwarding
  - IP-FORWARD: If packet-type is PBUF_REF clone it before forwarding
  - Add NAPT unit test to exercise NAT feature for both RAM and REF pbuf types
* version: Update version numbers to match 2.1.2-esp
* Minor fixes listed below: Fix client receive KOD, NAPT fixes, restore
  dhcp_cb, sntp docs, vendor class id (disabled)

* Update submodule: 2195f7416f...76303df238

Detailed description of the changes:
  - test/napt: Add unit test for IP forward with PBUF_REF (espressif/esp-lwip@76303df2)
  - napt: Fix PBUF_REF type to clone the pbuf before forwarding (espressif/esp-lwip@39068263)
  - version: Update version numbers to match 2.1.2-esp (espressif/esp-lwip@2b922919)
  - pppos: fix in_tail null (espressif/esp-lwip@537c69d5)
  - PPP: Add test exhibiting empty packet null-deref (espressif/esp-lwip@202a07da)
  - pbuf: Add pbuf_copy_partial_pbuf library function (espressif/esp-lwip@1c9cd9c1)
  - Add #define for minimum IPv6 MTU length (espressif/esp-lwip@d2dc577b)
  - zepif: Copy possibly chained output pbuf properly (espressif/esp-lwip@64ab7f2a)
  - icmp6: Don't copy too much data (espressif/esp-lwip@4a64731b)
  - icmp6: Fix copying of chained pbuf in reply (espressif/esp-lwip@7c822ff4)
  - icmp6: keep to the RFC and send as much as possible with icmp6 error messages (espressif/esp-lwip@29100ab6)
  - dns: Add API to clear dns cache (espressif/esp-lwip@ee59f77d)
  - CI: Fixed adding gitlab key (espressif/esp-lwip@5a2bdba7)
  - test case: modify test case test_tcp_new_max_num_remove_FIN_WAIT_1 (espressif/esp-lwip@6b090f7d)
  - add function for deinit lwip timers (espressif/esp-lwip@2749568f)
  - dhcp: Fix build issue that set ESP_DHCP_DISABLE_VENDOR_CLASS_IDENTIFIER to true will build fail (espressif/esp-lwip@d827dbf7)
  - Document that sntp_setservername doesn't copy the string (espressif/esp-lwip@54acdb59) #6786
  - lwip/dhcp: add 60 option for vendor class identify (espressif/esp-lwip@ae7edc2a) espressif/esp-lwip#32
  - dhcp: Restore dhcp_cb on restart after dhcp_release_and_stop() (espressif/esp-lwip@55ea9d9c) #7217
  - napt: Fix disbale IPv6 and enable NAPT will build error (espressif/esp-lwip@74cf7f9f)
  - napt: fix checksum of UDP (espressif/esp-lwip@bb63eed1)
  - sntp: Fix client receive KOD packet that make pool MEMP_SYS_TIMEOUT not be freed (espressif/esp-lwip@1c1642fe)
  - test case: add tcp state and reset test cases. (espressif/esp-lwip@67deb805)

Closes https://github.com/espressif/esp-idf/issues/8300
Closes https://github.com/espressif/esp-idf/issues/8451
2022-03-09 10:33:31 +01:00
828f9920c3 allow for minimal scope of wifi_init_config_t
With this change one can use the default config as a variable with minimal scope: esp_wifi_init(&(wifi_init_config_t)WIFI_INIT_CONFIG_DEFAULT())
2022-03-09 14:54:31 +08:00
d30480c113 docs: Update miswritten and abbreviated words and syntax errors for initialize WiFi section in esp_wifi.h header file 2022-03-09 14:54:06 +08:00
9b3ce4b15f esp_wifi: fix fragment issue and PMF compatible for faulty APs
1. fix(pp): fix fragment plt loss when 2td pn compare with 1th pn
2. pmf allow keyindex in big endian format to workaround faulty APs
3. docs: update miswritten and abbreviated words and syntax errors for initialize WiFi section in esp_wifi.h header file
4. allow for minimal scope of wifi_init_config_t
5.compute packet length use lldesc length instead rx_ctl sig_len for sniffer
2022-03-09 14:48:49 +08:00
112bfbe465 I2C: Fix typo in I2C_TIMING_VAL_ERR_STR macro name
* Closes https://github.com/espressif/esp-idf/pull/8012
2022-03-09 06:29:14 +00:00
02fe2fa96f esp_phy: update esp32 phy max tx power 2022-03-09 14:02:53 +08:00
65cfc9e656 UART: Fix custom ISR unit test
On ESP32, UART_INTR_BRK_DET may be triggered after setting the new ISR handler.
Disable these interrrupts.
2022-03-09 04:34:00 +00:00
5f27ec9157 UART: fix a bug preventing the user from freeing a previously registered ISR
* Closes https://github.com/espressif/esp-idf/issues/8150
2022-03-09 04:34:00 +00:00
79cdc465fd Merge branch 'bugfix/modbus_fix_start_after_destroy_issues_v43' into 'release/v4.3'
modbus: fix tcp slave destroy issues (backport v4.3)

See merge request espressif/esp-idf!17403
2022-03-09 09:46:07 +08:00
2d7f61758b Merge branch 'bugfix/add_pll_track_feature_4.3' into 'release/v4.3'
Add pll track feature

See merge request espressif/esp-idf!17287
2022-03-08 16:52:32 +08:00
9e15d184d1 mqtt: Fix sending log data; dup flag after queue
* Fix sending mqtt message longer than Tx buffer size
* Fix enqueue API to send data with correct dup flag
* Update submodule: git log --oneline b86d42c130ac64a916ce6cf299d99f9756692394..985078affa8a2d2b56b87c8e6455252850f895c6

Detailed description of the changes:
* Isolate IDF env for v4.4 and v5.0(master)
  - See merge request espressif/esp-mqtt!111
  - ci: Isolate IDF env for v4.4 and v5.0(master) (espressif/esp-mqtt@4c5a65c)
* Client: Remove usage of legacy FreeRTOS types
  - See merge request espressif/esp-mqtt!120
  - ci: Fix build issues with IDF-4.4 against master (espressif/esp-mqtt@c28a56d)
  - See commit https://github.com/espressif/esp-mqtt/commit/6ef98d6
* mqtt_client: Fix mqtt send long data error
  - See merge request espressif/esp-mqtt!117
  - Closes https://github.com/espressif/esp-mqtt/issues/214
  - See commit https://github.com/espressif/esp-mqtt/commit/372b323
* Client: Fix use esp_mqtt_client_enqueue API to send data, data dup flag will be set 1
  - See merge request espressif/esp-mqtt!116
  - See commit https://github.com/espressif/esp-mqtt/commit/df8dc92
2022-03-08 09:49:50 +01:00
f11e17f886 freemodbus: fix port enable disable sequence for tcp master and slave 2022-03-08 09:40:08 +01:00
22e630b145 Merge branch 'bugfix/esp_eth_start_tx_buff_v4.3' into 'release/v4.3'
Fixed ESP32 EMAC driver `insufficient TX buffer size` (v4.3)

See merge request espressif/esp-idf!16665
2022-03-08 16:38:18 +08:00
106fcdcc1c modbus: fix tcp slave destroy issues
Closes https://github.com/espressif/esp-idf/issues/8211
2022-03-08 09:30:59 +01:00
9338d1d121 Merge branch 'bugfix/http_client_body_v4.3' into 'release/v4.3'
esp_http_client: Fix data corruption in http_on_body callback (v4.3)

See merge request espressif/esp-idf!17315
2022-03-08 12:56:21 +08:00
7cb6468fff Update HFP_HF version to 1.7.2 2022-03-08 11:01:40 +08:00
c399f5d1e7 Update ESP32-C3 bt lib and phy lib
Add the pll track feature to keep the ble connection stable when the environment
temprature increase form 0 to 74.
2022-03-08 01:45:06 +00:00
0b8d52a926 Merge branch 'bugfix/add-resolution-suggestion-for-coredump_v4.3' into 'release/v4.3'
idf_monitor.py: Remove line finalization when coredump is in progress to avoid coredump failure (v4.3)

See merge request espressif/esp-idf!17365
2022-03-08 04:03:54 +08:00
df29179a56 Merge branch 'bugfix/idf_size_assertions_v4.3' into 'release/v4.3'
tools: Fix assertion messages and fix some of them in idf_size.py (v4.3)

See merge request espressif/esp-idf!17350
2022-03-08 02:58:23 +08:00
46c5ad2292 Merge branch 'bugfix/tools_fix_gdb_2021r2_patch3_v4.3' into 'release/v4.3'
tools: update esp-2021r2-patch3 toolchain for fixing GDB (v4.3)

See merge request espressif/esp-idf!17246
2022-03-07 23:37:18 +08:00
a7b249b182 Remove line finalization when coredump is active to avoid coredump failure
Closes https://github.com/espressif/esp-idf/issues/8099
2022-03-07 15:25:24 +01:00
fe5a5284ba sleep: restore analog calibration registers after waking up from light sleep
Closes https://github.com/espressif/esp-idf/issues/8287
Closes https://github.com/espressif/esp-idf/issues/7921
2022-03-07 21:58:42 +08:00
8f1f424390 esp_eth: EMAC start/stop optimization 2022-03-07 14:54:55 +01:00
3c8bab0285 Fixed ESP32 EMAC driver insufficient TX buffer size which could followed esp_eth_stop and esp_eth_start sequence 2022-03-07 14:54:33 +01:00
6b9381f754 esp_http_client: Cache received data in http_on_body callback.
This change fixes issue with data loss when multiple body chunks are
received after calling esp_http_client_fetch_headers.
2022-03-07 06:16:56 +00:00
55da7a2f2e Merge branch 'feature/add_proxy_conn_and_disconn_event_v4.3' into 'release/v4.3'
ble_mesh: stack: Add proxy server connect and disconnect event (v4.3)

See merge request espressif/esp-idf!16994
2022-03-06 14:10:33 +08:00
8cf5786444 ble_mesh: stack: Bugfix the proxy client abnormal disconnection 2022-03-05 11:14:57 +00:00
d975bb0086 ble_mesh: stack: Add proxy server connect and disconnect event 2022-03-05 11:14:57 +00:00
e4e76aedc4 Merge branch 'bugfix/assoc_comeback_fail_issue_v4.3' into 'release/v4.3'
Fix assoc comeback causing invalid state & FTM cleanup (Backport v4.3)

See merge request espressif/esp-idf!17171
2022-03-04 20:11:27 +08:00
a469559e1a docs: add an example list for esp-wrover-kit 2022-03-04 07:01:02 +00:00
028f1d9345 Merge branch 'feature/websocket_server_support_close_handle_v4.3' into 'release/v4.3'
esp_http_server: Websocket CLOSE frame can support callback function (backport v4.3)

See merge request espressif/esp-idf!17340
2022-03-04 13:37:52 +08:00
0aa2b4eaec Merge branch 'bugfix/http_client_ci_v4.3' into 'release/v4.3'
esp_http_client example: Use dl.espressif.com URL for performing request with Range header (v4.3)

See merge request espressif/esp-idf!17317
2022-03-04 11:10:10 +08:00
0f2003cd79 Merge branch 'bugfix/a2dp_sniff_v4.3' into 'release/v4.3'
fix crash when host exits sniff mode(V4.3)

See merge request espressif/esp-idf!14457
2022-03-04 00:27:58 +08:00
769335dae3 Tools/idf_size.py: Support .noinit sections
Closes https://github.com/espressif/esp-idf/issues/8428
2022-03-03 15:06:29 +01:00
6fe0f873c2 tools/idf_size.py: Identify objects without extension in MAP files 2022-03-03 14:52:54 +01:00
3f728f68c7 examples/esp_http_client: Use dl.espressif.com URL for performing request with Range header
esp_http_client_test.py: Add check for range request log
2022-03-03 17:52:21 +05:30
ae84265128 Merge branch 'bugfix/dual_core_pm_lock_issue_backport_v4.3' into 'release/v4.3'
System: fix pm lock issue in dual core mode(backport v4.3)

See merge request espressif/esp-idf!17262
2022-03-03 18:40:40 +08:00
1955dcda69 Merge branch 'bugfix/bootloader_uart_custom_gpio_v4.3' into 'release/v4.3'
bootloader: fixed the issue custom_uart_gpio doesn't take effect (v4.3)

See merge request espressif/esp-idf!17308
2022-03-03 16:49:49 +08:00
81ac6fb7f0 docs: add note for MALLOC_CAP_DMA for ESP32-S2 according to customer feedback 2022-03-03 16:40:34 +08:00
e98d72ee76 Fix crash when host exit sniff mode 2022-03-03 16:20:13 +08:00
29f5f119b2 esp_http_server: Websocket CLOSE frame can support callback function
Closes https://github.com/espressif/esp-idf/issues/7493
2022-03-03 15:48:07 +08:00
bfbe5dcbbe Merge branch 'docs/dynamic_copyright_date_v4.3' into 'release/v4.3'
docs: update copyright date for docs automatically (v4.3)

See merge request espressif/esp-idf!17328
2022-03-03 12:38:45 +08:00
cf3413384a Merge branch 'bugfix/remove_c_series_chips_unsupported_efuse_field_backport_v4.3' into 'release/v4.3'
efuse: free esp32c3 unused efuse field (backport v4.3)

See merge request espressif/esp-idf!17293
2022-03-03 11:07:16 +08:00
4bc28054ee Merge branch 'demo/opt_a2dp_demo_doc_v4.3' into 'release/v4.3'
demo/optimize a2dp demo documents (v4.3)

See merge request espressif/esp-idf!16588
2022-03-03 11:07:02 +08:00
b31f974b99 docs: update copyright date for docs automatically 2022-03-03 10:38:26 +08:00
b30ff28034 freertos: always inline xPortSetInterruptMaskFromISR and vPortClearInterruptMaskFromISR
These were called from IRAM context where the caller expect them to be inlined
and accessible when cache is disabled. This was not the case when compiled with -O0.

Closes https://github.com/espressif/esp-idf/issues/8301
2022-03-03 10:09:33 +08:00
f02c6037d4 Merge branch 'bugfix/spiffs_example_test_v4.3' into 'release/v4.3'
examples/spiffs: increase test timeout (v4.3)

See merge request espressif/esp-idf!17266
2022-03-02 17:14:18 +08:00
ad94b8b9dc Merge branch 'bugfix/touch_ll_get_sleep_time_v4.3' into 'release/v4.3'
Fixed error in "touch_ll_get_sleep_time" function for ESP32 (v4.3)

See merge request espressif/esp-idf!16248
2022-03-02 12:11:04 +08:00
7a14739e71 Merge branch 'bugfix/gpio_intr_on_core1_s3_v4.3' into 'release/v4.3'
gpio: Fix the bug that gpio interrupt cannot be triggered on app cpu on ESP32S3 (backport v4.3)

See merge request espressif/esp-idf!16596
2022-03-02 11:23:42 +08:00
1bcb419fd2 uart: fixed reset logic on ESP32-S3 2022-03-02 02:56:23 +08:00
5f3f615ff1 uart: fixed incorrect channel number on ESP32S2, S3 and C3 2022-03-02 02:56:23 +08:00
24fa86f270 bootloader: fixed the issue custom_uart_gpio doesn't take effect 2022-03-02 02:56:17 +08:00
047adc5ebc Merge branch 'bugfix/ble_mesh_console_correct_repl_config_prompt_forv4.3' into 'release/v4.3'
ble mesh:example:correct repl config prompt in ble mesh console(v4.3)

See merge request espressif/esp-idf!17184
2022-03-01 13:51:02 +08:00
ad71c0031c remove in esptool 2022-02-28 19:24:59 +08:00
b8bd3ada55 remove esp32c3 unsupported efuse field 2022-02-28 18:58:12 +08:00
3f49170ab1 Fixed error in "touch_ll_get_sleep_time" function for ESP32
Merges https://github.com/espressif/esp-idf/pull/6895
2022-02-28 09:45:43 +00:00
f5f7a77895 gpio: Fix the bug that gpio interrupt cannot be triggered on app cpu on ESP32S3
Closes https://github.com/espressif/esp-idf/issues/7885

(cherry picked from commit 91f1159f9c)
2022-02-28 16:10:37 +08:00
f817722109 gpio: Bugfix - Move esp_intr_free() out of the critical section in gpio_uninstall_isr_service()
Closes https://github.com/espressif/esp-idf/issues/5571

Fix the bug that if the API was called from one core to free the interrupt source on the other core, it would trigger interrupt watchdog.

(cherry picked from commit 0e8286c57b)
2022-02-28 15:50:40 +08:00
077c5fb0b8 coredump: backport the coredump test data from v4.4 2022-02-28 12:29:08 +07:00
040ae4ac72 Merge branch 'feat/support_mxic_unlock_v4.3' into 'release/v4.3'
spi_flash: support unlock MXIC flash chips (v4.3)

See merge request espressif/esp-idf!16481
2022-02-25 14:57:16 +00:00
731cb09ab4 bootloader: support unlock MXIC flash chips 2022-02-25 08:20:07 +00:00
c735cbde58 Merge branch 'bugfix/mitigate_test_time_adjustment_happens_linearly_v4.3' into 'release/v4.3'
newlib: Mitigate UT - time adjustment happens linearly v4.3

See merge request espressif/esp-idf!17252
2022-02-24 08:38:30 +00:00
002a16c367 examples/spiffs: increase test timeout
This is to address frequent CI test failure where test most likely
timeouts during SPIFFS formatting operation.
2022-02-24 09:20:07 +05:30
496f2a5741 fix pm lock issue in dual core mode 2022-02-23 21:50:37 +08:00
74b912f494 Tools: IDF Monitor should flash with the unmodified port
Closes https://github.com/espressif/esp-idf/issues/8432
2022-02-23 13:41:46 +01:00
ace832abf5 newlib: Mitigate UT - time adjustment happens linearly 2022-02-23 16:51:28 +08:00
fb8ce7d010 Merge branch 'bugfix/check_chip_id_at_start_ota_v4.3' into 'release/v4.3'
esp_https_ota: fix for checking chip id at start of OTA (v4.3)

See merge request espressif/esp-idf!17221
2022-02-23 04:30:18 +00:00
adebd5c5c3 test_apps/panic: GDB in esp-2021r2-patch3 toolchain doesn't contain the fix for interrupted backtraced
Revert "test_apps/panic: remove workaround for incorrect GDB backtrace"

This reverts commit c0e96ceb34.
2022-02-23 10:54:18 +07:00
6f99b8da73 Merge branch 'bugfix/gpio_pin_num_fix_v4.3' into 'release/v4.3'
gpio: Fix some gpio pin num errors on esp32s2 and esp32c3 (backport v4.3)

See merge request espressif/esp-idf!17109
2022-02-23 03:28:15 +00:00
115663df95 tools: update esp-2021r2-patch3 toolchain for fixing GDB
Closes https://github.com/espressif/esp-idf/issues/8065
    Closes https://github.com/espressif/esp-idf/issues/8342
    Closes https://github.com/espressif/openocd-esp32/issues/210
2022-02-23 09:25:23 +07:00
1674c63f82 Merge branch 'bugfix/update_stack_init_check_v4.3' into 'release/v4.3'
Nimble: Remove stack initialization status from unwanted functions (v4.3)

See merge request espressif/esp-idf!17235
2022-02-22 08:14:24 +00:00
dd59c5d5c5 Merge branch 'docs/update_sdmmc_vfs_cn_trans_4.3' into 'release/v4.3'
docs: update sdmmc and vfs cn trans (v4.3)

See merge request espressif/esp-idf!17196
2022-02-22 06:48:29 +00:00
74845d89cb esp_https_ota: fix for checking chip id at start of OTA 2022-02-22 11:05:19 +05:30
4ddd1f9d11 Nimble: Check stack initialization status before executing stack command
Previous commit added checks in some functions that can be called
    without stack initalization. Corrected such instances.
2022-02-22 10:26:54 +05:30
dd9aa85ca9 Merge branch 'bugfix/rom_time_t_size_deps_v4.3' into 'release/v4.3'
esp_rom: remove functions which depend on sizeof(struct stat) and all their callers (v4.3)

See merge request espressif/esp-idf!17041
2022-02-22 03:24:49 +00:00
615e67bd6b docs: update sdmmc and vfs cn trans 2022-02-22 11:07:16 +08:00
c166160f64 Merge branch 'bugfix/rtcio_increase_size_v4.3' into 'release/v4.3'
sleep: fixed ext1 cannot wakeup via RTCIO >= 18 issue (v4.3)

See merge request espressif/esp-idf!17202
2022-02-21 20:13:34 +00:00
91ed14b50f Merge branch 'bugfix/idf_tools_python_env_v4.3' into 'release/v4.3'
tools: improve virtualenv diagnostics, set python path explicitly (v4.3)

See merge request espressif/esp-idf!16808
2022-02-21 11:52:26 +00:00
4670bcf40e Merge branch 'task/esp_core_dump_get_summary_v4.3' into 'release/v4.3'
espcoredump: esp_core_dump_get_summary API (v4.3)

See merge request espressif/esp-idf!17012
2022-02-21 11:19:39 +00:00
63f6fe34ac Merge branch 'fix/prod_mode_in_configure_ds_script_v4.3' into 'release/v4.3'
configure_ds.py: Fix the error for prod mode. They script now only verifies... (v4.3)

See merge request espressif/esp-idf!17210
2022-02-21 04:23:51 +00:00
74fc0578f5 configure_ds.py: Fix the error for prod mode. They script now only verifies the purpose in the prod mode.
Closes https://github.com/espressif/esp-idf/issues/8285
2022-02-21 01:33:39 +05:30
724032022c tools: improve virtualenv diagnostics, set python path explicitly
- Check if pip is installed for sys.executable before attempting to
  create the virtual environment, bail out with an error if not.
- Don't pass --seeder argument to virtualenv if its version is
  too old. For example, on Ubuntu 18.04, virtualenv 15.1.0 doesn't
  support this argument.
- Pass --python argument to virtualenv to request specific interpreter
  to be used.

Closes https://github.com/espressif/esp-idf/issues/8045
2022-02-20 14:48:28 +03:00
d3df24d950 Merge branch 'bugfix/ledc_consecutive_fade_v4.3' into 'release/v4.3'
ledc: Bugfixes for issues related to fade protection (backport v4.3)

See merge request espressif/esp-idf!16661
2022-02-19 17:38:15 +00:00
fc36f08d3f Merge branch 'bugfix/enterprise_certs_weak_md_v4.3' into 'release/v4.3'
esp_wifi: Fixed issue of weak md for certificates in wifi_enterprise example.(v4.3)

See merge request espressif/esp-idf!16989
2022-02-18 06:03:59 +00:00
5c78283f6e Merge branch 'bugfix/modbus_allow_address_gaps_in_master_data_dict_v43' into 'release/v4.3'
freemodbus: allow address gaps in master data dictionary (support of UID field in MBAP) (backport v4.3)

See merge request espressif/esp-idf!16898
2022-02-18 05:40:50 +00:00
073da59d27 freemodbus: allow address gaps in master data dictionary (support of UID field in MBAP) (backport v4.3) 2022-02-18 05:40:49 +00:00
d501fd4b96 Merge branch 'fix/sdio_slave_recv_intr_unhandled_v4.3' into 'release/v4.3'
sdio_slave: fixed the issue that interrupt may be cleared with finished trans unhandled (v4.3)

See merge request espressif/esp-idf!17149
2022-02-18 05:40:33 +00:00
ef356e464d Merge branch 'bugfix/pppos_client_docs_power_v4.3' into 'release/v4.3'
Examples/PPPoS: Add troubleshooting to correctly power modem (v4.3)

See merge request espressif/esp-idf!17008
2022-02-18 05:39:00 +00:00
8ff2ce6852 soc: updated soc_caps about rtc_io and the format 2022-02-18 11:11:24 +08:00
f8e45766b5 sleep: fixed ext1 cannot wakeup via RTCIO >= 18 issue 2022-02-18 11:10:49 +08:00
501d67fdc5 Merge branch 'bugfix/sdio_slave_dma_desc_int_v4.3' into 'release/v4.3'
sdio_slave: Fixed the issue that DMA descriptors allocated to non-DMA capable area (v4.3)

See merge request espressif/esp-idf!17138
2022-02-18 01:24:42 +00:00
30a17ea53d Merge branch 'feature/support_new_psram_v4.3' into 'release/v4.3'
psram: add ESP32-D0WD-R2-V3 support(backport v4.3)

See merge request espressif/esp-idf!16707
2022-02-18 01:21:37 +00:00
9e9fb39a07 Merge branch 'flash/add_th_support_v4.3' into 'release/v4.3'
spi_flash: add support for th 1M flash(backport v4.3)

See merge request espressif/esp-idf!16716
2022-02-18 01:20:28 +00:00
b1f93150f9 Merge branch 'bugfix/fix_ble_adv_underrun_error_v4.3' into 'release/v4.3'
components/bt: Fix ble adv_underrun issue(backport v4.3)

See merge request espressif/esp-idf!17165
2022-02-17 09:56:06 +00:00
40c0c33ae0 Merge branch 'bugfix/wifi_netif_on_off_cycle_race_v4.3' into 'release/v4.3'
wifi: Fix race conditon invoking invalid callback on deinit (v4.3)

See merge request espressif/esp-idf!16622
2022-02-17 04:18:18 +00:00
726ceb4fed Merge branch 'ci/add_esp32c3_integration_test' into 'release/v4.3'
CI: support integration c3 test (4.3)

See merge request espressif/esp-idf!17108
2022-02-16 09:25:29 +00:00
9a09f24572 esp_wifi: Update wifi lib
1. Fix assoc comeback causing invalid state
2. Better cleanup in some FTM failure cases
2022-02-16 12:54:08 +05:30
ab375388ef ble mesh:example:correct the output log level 2022-02-16 15:18:06 +08:00
47bd9d4171 ble mesh:example:delete unused tag 2022-02-16 15:17:57 +08:00
69b9ad27c3 ble mesh:example:response for checking restart in auto_test 2022-02-16 15:17:48 +08:00
432e9b6293 ble mesh:example:correct repl config prompt 2022-02-16 15:17:35 +08:00
c831d1f1e0 Merge branch 'feature/adc_calibration_version_2_on_c3_v4.3' into 'release/v4.3'
adc: upgrade adc calibration algorithm to version 2 on c3 (v4.3)

See merge request espressif/esp-idf!17050
2022-02-16 07:02:07 +00:00
f75ed7c7cc Merge branch 'bugfix/mdns_null_deref_fuzzer_v4.3' into 'release/v4.3'
mdns: Fix potential null deref reported by fuzzer test(v4.3)

See merge request espressif/esp-idf!17146
2022-02-16 06:27:25 +00:00
df7cfa025c Merge branch 'bugfix/fix_esp_restart_does_not_reset_timer_groups_periph_v43' into 'release/v4.3'
modbus: fix esp restart does not reset timer groups periph (backport v4.3)

See merge request espressif/esp-idf!15501
2022-02-16 04:05:38 +00:00
e48f87468e modbus: fix esp restart does not reset timer groups periph (backport v4.3) 2022-02-16 04:05:37 +00:00
acc55cae88 Merge branch 'fix/gitlab_404_local_mirror_v4.3' into 'release/v4.3'
Handle gitlab 404 error (v4.3)

See merge request espressif/esp-idf!16959
2022-02-16 04:05:21 +00:00
8fa37107be Merge branch 'bugfix/usb_default_print_wifi_v4.3' into 'release/v4.3'
esp_phy: enable usb under default(without choosing USB_SERIAL_JTAG) (backport v4.3)

See merge request espressif/esp-idf!17078
2022-02-16 04:04:38 +00:00
ad2238d7fb Merge branch 'bugfix/eap_client_crash_v4.3' into 'release/v4.3'
wpa_supplicant: Fix memory corruption (v4.3)

See merge request espressif/esp-idf!17129
2022-02-16 04:03:49 +00:00
87c2352a1e Merge branch 'bugfix/support_esp32s2_eco1_v4.3' into 'release/v4.3'
esp_phy: Update ESP32S2 phy lib to support eco1 chip(v4.3)

See merge request espressif/esp-idf!16723
2022-02-16 03:29:22 +00:00
e4743e7d79 Merge branch 'docs/fix_broken_links_4.3' into 'release/v4.3'
docs: fix broken links in queue.h file (v4.3)

See merge request espressif/esp-idf!17162
2022-02-16 02:40:32 +00:00
2d65703547 components/bt: Fix ble adv_underrun issue
components/bt: Fix LLCP collision for channel map update
2022-02-16 00:37:38 +08:00
be19818db7 Merge branch 'contrib/github_pr_8402' into 'release/v4.3'
secure boot:  add missing `#include "esp_flash_encrypt.h"`

See merge request espressif/esp-idf!17159
2022-02-15 10:42:43 +00:00
bcb8d87108 adc: upgrade adc calibration algorithm to version 2 on c3 2022-02-15 15:27:25 +08:00
22e741a281 esp_adc_cal: move esp_adc_cal_get_voltage into common source file 2022-02-15 15:27:25 +08:00
b075101316 esp_adc_cal: simplify CMakeLists.txt 2022-02-15 15:27:25 +08:00
5e4ec25ace esp_phy: Update ESP32S2 phy lib to support eco1 chip 2022-02-15 14:58:04 +08:00
a8736a9b66 docs:fix broken links 2022-02-15 14:28:59 +08:00
ad6095ad80 CI: optimize integration test workflow 2022-02-15 13:23:15 +08:00
7fecad1473 CI: support integration c3 test 2022-02-15 13:23:15 +08:00
230861e80f ci: increase target-test.yml UT_T1_1 job to support newly added LEDC fade ut tests 2022-02-15 11:29:33 +08:00
7b70f6e135 ledc: Fix FADE_NO_WAIT mode concurrency problem.
Add test cases for fade concurrency issue and fade timing check.

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

(cherry picked from commit be2ab09832)
2022-02-15 11:29:33 +08:00
ad3b9a8002 ledc: bugfix - Simplify the procedure to perform a one-time duty update
Avoid adding one extra fade cycle when performing a one-time duty update.
Add some notes to ledc_get_duty and ledc_update_duty APIs, so that users
are aware of when the new duty will be effective.

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

(cherry picked from commit e175086226)
2022-02-15 11:29:33 +08:00
25b1c57121 sdio_slave: fixed the issue that interrupt may be cleared with finished trans unhandled 2022-02-15 00:01:33 +08:00
7d65b17898 Merge branch 'bugfix/alarm_update_invalid_v4.3' into 'release/v4.3'
timer: stop alarm if alarm value doesn't change in ISR callback (v4.3)

See merge request espressif/esp-idf!16533
2022-02-14 15:38:14 +00:00
03f9eedc27 mdns: Fix potential null deref reported by fuzzer test 2022-02-14 22:49:34 +08:00
8d5316ceb8 Merge branch 'bugfix/wps_scan_resumption_v4.3' into 'release/v4.3'
wpa_supplicant: Scan resumption in PBC mode(backport v4.3)

See merge request espressif/esp-idf!17063
2022-02-14 13:05:28 +00:00
9ff972046b Merge branch 'bugfix/fix_smartconfig_setopt_fail_v4.3' into 'release/v4.3'
smartconfig: Fix smartconfig set socket option fail(backport v4.3)

See merge request espressif/esp-idf!16771
2022-02-14 13:03:35 +00:00
d3f5fd6eb6 spi_flash: add support for th 1M flash 2022-02-14 16:01:43 +08:00
b1d6217f5c Merge branch 'bugfix/usb_no_rom_log_v4.3' into 'release/v4.3'
USB_SERIAL_JTAG: Fix the issue that there is no rom log when restarting(backport v4.3)

See merge request espressif/esp-idf!17074
2022-02-14 07:34:24 +00:00
81948262c8 sdio_slave: fixed the issue DMA desc not capable 2022-02-14 12:55:56 +08:00
06d7fd95d4 secure_boot.c add missing '#include "esp_flash_encrypt.h"' 2022-02-13 19:51:55 +01:00
1f980ae982 psram: add ESP32-D0WD-R2-V3 support 2022-02-13 22:31:24 +08:00
8504a878f3 Merge branch 'bugfix/fix_esp_http_client_example_v4.3' into 'release/v4.3'
esp_http_client: Fix memory leak in esp_http_client_example (backport v4.3)

See merge request espressif/esp-idf!17094
2022-02-13 13:26:25 +00:00
d04dacdaa1 Merge branch 'bugfix/usb_device_struct_cleanup_v4.3' into 'release/v4.3'
USB: Cleanup device side struct and fix incorrect DM pulldown configuration (v4.3)

See merge request espressif/esp-idf!17103
2022-02-12 20:53:02 +00:00
7df150b3de wpa_supplicant: Fix invalid memory dereference 2022-02-12 10:32:53 +05:30
f527010044 esp_rom: remove functions which depend on sizeof(struct stat)
...and all their callers.

With the upcoming switch from sizeof(time_t)==4 to sizeof(time_t)==8,
sizeof(struct stat) is also increasing.

A few newlib functions present in ROM allocate 'struct stat' on the
stack and call _fstat_r on this structure. The implementation of
fstat is provided in ESP-IDF. This implementation will often do
memset(st, 0, sizeof(*st)), where st is 'struct stat*', before setting
some fields of this structure. If IDF is built with sizeof(st)
different from sizeof(st) which ROM was built with, this will lead
to an out-of-bounds write and a stack corruption.

This commit removes problematic ROM functions from the linker script.
Here are the functions which allocate 'struct stat':
* _isatty_r (in ROM)
* __swhatbuf_r, called by __smakebuf_r, called by __swsetup_r and
  __srefill_r (in ROM)
* _fseeko_r (not in ROM)
* glob2 (not in ROM)
* _gettemp (not in ROM)

As a result, these functions are used from libc.a, and use correct
size of 'stat' structure.

Closes https://github.com/espressif/esp-idf/issues/7980
2022-02-11 07:07:12 +00:00
d359f88054 examples: Add the component manager example 2022-02-10 13:17:29 +00:00
917510ea96 docs: Add component manager documentation 2022-02-10 13:17:29 +00:00
611c5a2496 Build System: Don't track dependencies.lock 2022-02-10 13:17:29 +00:00
69e784d07e Add idf-component-manager python dependency 2022-02-10 13:17:29 +00:00
b1017de2e6 gpio: Fix some gpio pin num errors on esp32s2 and esp32c3 2022-02-10 20:27:43 +08:00
dcfd5187ac Merge branch 'bugfix/fix_spi_cs_hold_time_issue_v4.3' into 'release/v4.3'
spi_master: fix spi cs_ena_posttrans issue (v4.3)

See merge request espressif/esp-idf!16687
2022-02-10 09:36:50 +00:00
7f51eb7e7c Fix incorrect D- pulldown and cleanup USB device struct
This commit fixes the incorrect setting of the D- pulldown resistor in the USB LL.
The usb_struct.h used by USB device mode has also been cleaned up.
2022-02-10 17:20:39 +08:00
b979547b06 Merge branch 'bugfix/rmt_s2_doesnt_support_rx_wrap_v4.3' into 'release/v4.3'
rmt: do not support rx wrap on esp32s2 (v4.3)

See merge request espressif/esp-idf!17080
2022-02-10 09:12:04 +00:00
94e58eac30 esp_http_client: Fix memory leak in esp_http_client_example
Closes https://github.com/espressif/esp-idf/issues/8346
2022-02-10 14:35:49 +08:00
9c4b96d63b USB_SERIAL_JTAG: Fix the issue that there is no rom log when restarting 2022-02-10 10:33:40 +08:00
4a14745b28 Merge branch 'docs/update_wifi_cn_trans_4.3' into 'release/v4.3'
Docs: update wifi.rst and nvs_flash.rst docs (Backport 4.3)

See merge request espressif/esp-idf!16899
2022-02-09 14:09:34 +00:00
119ae77993 Merge branch 'bugfix/a2dp_source_congest_v4.3' into 'release/v4.3'
component_bt: Fixed a2dp source audio data packet congestion causing choppy audio in a2dp sink (v4.3)

See merge request espressif/esp-idf!16735
2022-02-09 11:34:21 +00:00
ab099369c8 Merge branch 'bugfix/config_parse_crash_after_flash_erase_v4.3' into 'release/v4.3'
component_bt: fixed config parse crash after flash_erase(v4.3)

See merge request espressif/esp-idf!16731
2022-02-09 11:15:52 +00:00
3a628eb470 usb_serial_jtag: remove the strict condition check in esp_phy 2022-02-09 19:02:36 +08:00
81e3035f4d rmt: do not support rx wrap on esp32s2
Closes https://github.com/espressif/esp-idf/issues/8354
2022-02-09 18:23:44 +08:00
c7fd71a893 docs: update wifi and nvs cn trans 2022-02-09 17:52:55 +08:00
d64553797c usb_serial_jtag: can print when wifi enabled by default
Closes https://github.com/espressif/esp-idf/issues/8131
2022-02-09 17:36:04 +08:00
5c72bbcb3d Merge branch 'bugfix/uart_no_int_after_flush_v4.3' into 'release/v4.3'
UART: RX interrupts are now properly restored after a flush (backport v4.3)

See merge request espressif/esp-idf!16928
2022-02-09 06:51:43 +00:00
7bb51e9a67 Merge branch 'bugfix/win_rename_delay_v4.3' into 'release/v4.3'
Tools: Use delay between rename attempts on Windows in the installer (v4.3)

See merge request espressif/esp-idf!17057
2022-02-08 18:24:10 +00:00
5bcb77fdca Merge branch 'bugfix/vfs_open_errno_v4.3' into 'release/v4.3'
vfs: don't overwrite errno by a hard coded ENOENT (Github PR) (v4.3)

See merge request espressif/esp-idf!17045
2022-02-08 14:37:45 +00:00
b19424d67e wpa_supplicant: Scan resumption in PBC mode 2022-02-08 17:16:29 +05:30
93a3a47440 Merge branch 'bugfix/fix_common_clock_bug_v4.3' into 'release/v4.3'
esp_wifi: fix common clock bug (backport v4.3)

See merge request espressif/esp-idf!16969
2022-02-08 11:28:02 +00:00
422892d7b4 Tools: Use delay between rename attempts on Windows in the installer 2022-02-08 11:08:27 +01:00
489fcf1b6c vfs: add test for errno value after 'open' 2022-02-07 11:36:21 +01:00
d8c3b4d646 vfs: don't overwrite errno by a hard coded ENOENT
Calling "open" in CHECK_AND_CALL sets a perfectly correct errno.
There is no need to overwrite that with a value of ENOENT, since doing
so hides lower level errors like EIO.

Closes https://github.com/espressif/esp-idf/pull/8036
2022-02-07 11:36:20 +01:00
b3c51e74c8 spi_master: fix spi cs_ena_posttrans issue 2022-02-07 12:22:15 +08:00
8a4bcdb563 Merge branch 'bugfix/nimble_spp_v4.3' into 'release/v4.3'
NimBLE :  SPP example fails to build on Windows (v4.3)

See merge request espressif/esp-idf!17014
2022-02-07 02:35:24 +00:00
187c5b893d Merge branch 'feature/adds_tips_to_run_ci_example_tests_v4.3' into 'release/v4.3'
examples: Adds a note on how to meet requirements to run the example_test.py (v4.3)

See merge request espressif/esp-idf!16945
2022-02-06 09:25:14 +00:00
17f9c7aaef Examples/PPPoS: Add troubleshooting to correctly power modem
Closes https://github.com/espressif/esp-idf/issues/7807
2022-02-04 17:07:37 +08:00
fea5bdce86 Merge branch 'feature/mbedtls-2.28.0_v4.3' into 'release/v4.3'
mbedtls: Upgrading to v2.28.0 (v4.3)

See merge request espressif/esp-idf!17005
2022-02-03 04:12:10 +00:00
1a3f5accda Merge branch 'bugfix/nimble_spp' into 'release/v4.3'
NimBLE : Fixed BLE SPP build fail on Windows

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

See merge request espressif/esp-idf!17014
2022-02-02 15:18:09 +05:30
bdd329ff02 ci: Fix issues for build stage
- Fixed logs expecting different format specifier
- Updated ignore list for check_public_header test
- Updated functions ported from mbedTLS
- Fix for make-system build errors
2022-02-02 15:07:50 +05:30
df9f101792 mbedtls: Added option MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
- Removed code regarding MBEDTLS_DYNAMIC_FREE_PEER_CERT
  (config was kept for backward compatibility)
- Combined mbedTLS v2.28.x related options under a separate Kconfig menu
2022-02-02 11:00:32 +05:30
6957b4815a protocomm: Updated function for constant time buffer comparison
- mbedtls_ssl_safer_memcmp() -> mbedtls_ct_memcmp()
2022-02-02 11:00:32 +05:30
46388a0741 wpa_supplicant: Saved message-type digest used in handshake for PRF operations 2022-02-02 11:00:32 +05:30
92c0c09514 mbedtls: Moved mbedtls_mpi_mul_int to port layer 2022-02-02 11:00:32 +05:30
29b6d229c1 mbedtls: Added config options for v2.28.0 upgrade 2022-02-02 11:00:32 +05:30
021627754c mbedtls: Upgrade to v2.28.0 2022-02-02 11:00:27 +05:30
aa89d67923 espcoredump: Parse bt for instruction fetch prohibited cause 2022-02-01 18:28:30 +05:30
e0fc13b23d coredump: Parse backtrace info for RISCV
For RISCV, backtrace generation on device is not possible without
including and parsing DWARF sections. We extract the crash task stack
and let the host generate the backtrace
2022-02-01 17:52:13 +05:30
8536cf46a5 espcoredump: Fix string truncation build failure 2022-02-01 17:51:55 +05:30
9928f44894 espcoredump: On device core dump parsing to generate summary 2022-02-01 15:24:16 +05:30
c6278acdf2 Merge branch 'bugfix/provisioning_not_stopping_v4.3' into 'release/v4.3'
wifi_prov_mgr: Fix provisioning not stopping in release mode (v4.3)

See merge request espressif/esp-idf!17003
2022-02-01 07:29:51 +00:00
d29ab82bc9 wifi_prov_mgr: Fix provisioning not stopping in release mode
- For the wifi_prov_mgr example in release mode (with NDEBUG defined -
  assertions disabled), the task to stop provisioning is never started
  as it is voided by the assert function it is called in.

Closes https://github.com/espressif/esp-idf/issues/8309
2022-02-01 09:50:45 +05:30
ab8b292407 Merge branch 'feature/upgrade_expat_component_v4.3' into 'release/v4.3'
expat: upgrade to v2.4.3 release

See merge request espressif/esp-idf!16980
2022-01-31 06:54:24 +00:00
5b36459611 expat: upgrade to v2.4.3 release
Detailed changelog: https://github.com/libexpat/libexpat/blob/R_2_4_3/expat/Changes
2022-01-31 11:15:29 +05:30
dfaf73c197 Merge branch 'provisioning/update_readme_v4.3' into 'release/v4.3'
provisioning: Remove legacy examples reference (v4.3)

See merge request espressif/esp-idf!16988
2022-01-31 04:36:40 +00:00
dd7826d456 Merge branch 'bugfix/rm_copyright_ignore_list_v4.3' into 'release/v4.3'
CI: Remove unused copyright ignore list (v4.3)

See merge request espressif/esp-idf!16966
2022-01-28 11:02:02 +00:00
8fee811d55 esp_wifi: Fixed issue of weak md for certificates in wifi_enterprise example. 2022-01-28 16:14:05 +05:30
f178727aae esp_prov.py: Replaced deprecated function for loading modules 2022-01-28 15:51:50 +05:30
5fc51252e9 Merge branch 'bugfix/add_dummy_to_total_size_v4.3' into 'release/v4.3'
Tools: fix bug with total size calculation issue (v4.3)

See merge request espressif/esp-idf!16861
2022-01-27 18:28:36 +00:00
22cd519375 add test for checking memory segments with esptool.py 2022-01-27 17:21:17 +01:00
72e4b5ac5b esp_wifi: fix common clock bug (backport v4.3) 2022-01-27 20:20:31 +08:00
6357a37846 CI: Remove unused copyright ignore list 2022-01-27 12:50:23 +01:00
65cb65df1a Handle gitlab 404 error
ci: do not retry on 404 when LOCAL_GITLAB_HTTPS_HOST not set
2022-01-27 11:19:22 +01:00
78f4405c7c Merge branch 'docs/update_c3_ledc_cn_trans' into 'release/v4.3'
Docs: update ledc.rst cn translation for C3 (backport v4.3)

See merge request espressif/esp-idf!16846
2022-01-27 08:27:47 +00:00
87514f4a2b examples: Adds a note on how to meet requirements to run the example_test.py
export PYTHONPATH="$IDF_PATH/tools:$IDF_PATH/tools/ci/python_packages"
python -m pip install -r $IDF_PATH/tools/ci/python_packages/ttfw_idf/requirements.txt

It helps to fix the ModuleNotFoundError issue with ttfw_idf and tiny_test_fw modules.

Closes https://github.com/espressif/esp-idf/issues/7815
2022-01-27 14:40:29 +08:00
84149f0974 Merge branch 'fix/http2_request_example_v4.3' into 'release/v4.3'
http2_request_example: Change the target http2 server to http2.github.io (v4.3)

See merge request espressif/esp-idf!16671
2022-01-27 06:39:45 +00:00
a5a4718600 UART: RX interrupts are now properly restored after a flush
Added a unit test to make sure the expected behavior happens
2022-01-27 10:53:41 +08:00
f1adc8efbe Merge branch 'bugfix/wpa3_memory_leak_v4.3' into 'release/v4.3'
esp_wifi: Fixes memory leak in wpa3 connection.(v4.3)

See merge request espressif/esp-idf!16562
2022-01-26 14:29:15 +00:00
aa044f4a63 esp_wifi: Fixes memory leak in wpa3 connection. 2022-01-26 17:33:20 +08:00
51e196ac93 smartconfig: Fix smartconfig set socket option fail 2022-01-26 11:09:22 +08:00
87f8a0d5f1 Merge branch 'bugfix/efuse_timesettigs_in_burn_op_v4.3' into 'release/v4.3'
efuse: Fixes eFuse timesettings issue on esp32c3 (v4.3)

See merge request espressif/esp-idf!16922
2022-01-26 00:48:52 +00:00
df3e1405d5 Merge branch 'bugfix/bootloader_common_get_sha256_of_partition_when_image_invalid_v4.3' into 'release/v4.3'
bootloader: Fixes bootloader_common_get_sha256_of_partition. Adds hash check. (v4.3)

See merge request espressif/esp-idf!16924
2022-01-26 00:48:22 +00:00
8374e3b0ee bootloader: Fixes bootloader_common_get_sha256_of_partition. Adds hash check.
Closes https://github.com/espressif/esp-idf/issues/8274
2022-01-25 20:01:00 +08:00
5ebbe6aea7 efuse: Fixes eFuse timesettings issue on esp32c3 2022-01-25 19:16:16 +08:00
2216d4d8f7 docs: update c3 ledc cn trans 2022-01-25 17:32:18 +08:00
436eb37a8b Merge branch 'feature/support_eap_fast_on_release_v4.3' into 'release/v4.3'
Feature/support eap fast on release v4.3

See merge request espressif/esp-idf!16852
2022-01-25 08:13:24 +00:00
3829ee1889 Merge branch 'bugfix/filter_repeated_packages_forv4.3' into 'release/v4.3'
filter repeated packages then send response(v4.3)

See merge request espressif/esp-idf!16819
2022-01-25 06:39:59 +00:00
117b23a82a filter repeated packages then send response(v4.3) 2022-01-25 06:39:59 +00:00
df62fbb6d0 optmize a2dp demo document 2022-01-25 13:33:12 +08:00
a985402da1 tools/idf_size: Fixed bug with wrong memory calculation 2022-01-24 16:05:14 +01:00
5bad27d0d5 Merge branch 'feature/pro_recv_hb_forv4.3' into 'release/v4.3'
provisioner receive heartbeat message(v4.3)

See merge request espressif/esp-idf!16639
2022-01-24 07:54:41 +00:00
58bd27b713 btc_a2dp_control_set_datachnl_stat is only used by a2dp sink 2022-01-24 14:39:33 +08:00
a0f69c3499 remove btc_a2dp_dispatch_datapath_evt and event 2022-01-24 14:39:33 +08:00
8368bf3760 Fixed the crash caused by calling esp_a2d_media_ctrl(ESP_A2D_MEDIA_CTRL_START) after stream started 2022-01-24 14:39:31 +08:00
c56cf9d6fd Fixed a2dp source audio data packet congestion causing choppy audio in a2dp sink 2022-01-24 14:39:28 +08:00
49bd3f0795 esp_wifi: Add an example for EAP-FAST. 2022-01-24 14:24:14 +08:00
e8196c0ff2 esp_wifi: Add support for EAP-FAST authentication method 2022-01-24 14:24:14 +08:00
ab6b4a13db Merge branch 'bugfix/rd_rem_ext_feats_delayed_cs_v4.3' into 'release/v4.3'
bugfix/fix cs event for rd_rem_ext_feats delayed issue (v4.3)

See merge request espressif/esp-idf!16814
2022-01-24 06:02:47 +00:00
947e7909b9 fixed config parse crash after flash_erase
Closes https://github.com/espressif/esp-idf/issues/6170
2022-01-24 14:02:01 +08:00
f77e018256 Merge branch 'Doc/optimize_spp_doc_v4.3' into 'release/v4.3'
Doc/Optimize SPP Document[backport 4.3]

See merge request espressif/esp-idf!16604
2022-01-24 05:59:54 +00:00
53f20589a4 fix cs event for rd_rem_ext_feats delayed issue 2022-01-24 10:31:27 +08:00
0b7ed763e4 http2_request_example: Change the target http2 server to http2.github.io and perform only a GET request 2022-01-21 13:11:48 +05:30
045b38857d http2_request/sh2lib: Modified the "sh2lib_connect" API to take in a new
defined `struct sh2lib_config_t` which contains required config options.

Modified the http2_request_example with the required changes.
2022-01-21 09:39:34 +05:30
b9a96186fd Merge branch 'feature/espcoredump_py_riscv_support_v4.3' into 'release/v4.3'
feature: espcoredump py riscv support (v4.3)

See merge request espressif/esp-idf!16840
2022-01-20 01:16:04 +00:00
9aa263c103 Merge branch 'test/remove_spi_flash_perf_thr_v4.3' into 'release/v4.3'
spi_flash_test: remove threshold from unit test (v4.3)

See merge request espressif/esp-idf!16822
2022-01-18 11:51:26 +00:00
3afc31c0de ci: improve test_coredump workflow
use commit sha to let it pass in MRs' CI pipelines
2022-01-18 18:03:44 +08:00
b865a84661 test(coredump): refactor coredump test and add esp32s2/esp32c3 tests 2022-01-18 18:03:44 +08:00
4dc1801c7a ci: install CMake version from tools.json in espcoredump test
To help achieve reproducible builds.
2022-01-18 17:48:41 +08:00
677d6a8625 cmake: sort lists obtained from file(GLOB)
CMake sorts result of file(GLOB) command since version 3.6.0:
https://gitlab.kitware.com/cmake/cmake/-/commit/edcccde7d

Since ESP-IDF sets cmake_minimum_required version to 3.5, and version
3.5.1 is used in CI, sort file lists obtained from file(GLOB)
manually.

This helps obtain reproducible order of libraries passed to the linker
and to ldgen.
2022-01-18 17:48:41 +08:00
54b50ab4ac docs(coredump): update coredump documentation 2022-01-18 17:48:41 +08:00
fbfef19982 feat(coredump): add esp32s2 and esp32c3 support 2022-01-18 17:48:41 +08:00
cc2c92a7ab spi_flash_test: remove threshold from unit test 2022-01-18 15:40:00 +08:00
39f39ac53d test_utils: allow printint multiple argument in the performance log 2022-01-18 15:40:00 +08:00
cc3aeeb279 Merge branch 'ci/fix_wpa_supplicant_exclude_release_v4.3' into 'release/v4.3'
ci: bypass wpa_supplicant upstream codes

See merge request espressif/esp-idf!16358
2022-01-18 06:41:44 +00:00
f9cf648afd fix(coredump): pr_status pid padding should be uint16 2022-01-18 13:50:10 +08:00
fffc5ac658 Merge branch 'docs/update_user_guides_cn_trans' into 'release/v4.3'
docs: update cn trans for esp32-devkitc and esp32-s2-kaluga-1-kit user guides (backport v4.3)

See merge request espressif/esp-idf!16724
2022-01-18 03:40:26 +00:00
c761f44d94 ci: bypass wpa_supplicant upstream codes 2022-01-18 02:07:47 +00:00
2cf554df6e docs: update user guides cn trans 2022-01-17 19:17:15 +08:00
0786d1a337 Merge branch 'bugfix/task_wdt_timeout_uint32_overflow_v4.3' into 'release/v4.3'
Task WDT: Fix overflow issue during timeout calculation

See merge request espressif/esp-idf!16809
2022-01-17 08:38:35 +00:00
8a5c51d05b Merge branch 'feature/update_mqtt_test_url_v4.3' into 'release/v4.3'
mqtt: Update mqtt test url and doc(backport v4.3)

See merge request espressif/esp-idf!16415
2022-01-17 08:36:16 +00:00
3bad4e3ca4 Task WDT: Fix overflow issue during timeout calculation
Closes https://github.com/espressif/esp-idf/issues/8239
2022-01-17 10:06:38 +08:00
71f63df9d5 Merge branch 'feature/oocd_ver_upgrade_v4.3' into 'release/v4.3'
tools: Updates OpenOCD version to 'v0.11.0-esp32-20211220' (v4.3)

See merge request espressif/esp-idf!16766
2022-01-14 12:04:33 +00:00
260bf53b52 tools: Updates OpenOCD version to 'v0.11.0-esp32-20211220' 2022-01-13 16:59:29 +00:00
fbc8ad0417 Merge branch 'docs/update_ws_server_example_readme_v4.3' into 'release/v4.3'
docs: Add user-friendly guide about how to use ws_server_example_test.py (backport v4.3)

See merge request espressif/esp-idf!16784
2022-01-13 10:11:06 +00:00
8a5f624801 Merge branch 'bugfix/invalid_url_cause_to_crash_v4.3' into 'release/v4.3'
http: Fix parsing invalid url cause to crash (v4.3)

See merge request espressif/esp-idf!16479
2022-01-13 06:39:28 +00:00
9760352810 Merge branch 'bugfix/fix_esp_https_ota_v4.3' into 'release/v4.3'
esp_https_ota: Fix esp_https_ota_begin may exist memory leak (backport v4.3)

See merge request espressif/esp-idf!16778
2022-01-13 05:00:59 +00:00
4bdcb9f5a9 docs: Add user-friendly guide about how to use ws_server_example_test.py 2022-01-13 10:50:38 +08:00
be89be5a3f esp_https_ota: Fix esp_https_ota_begin may exist memory leak 2022-01-12 19:57:43 +08:00
c6c7068776 Merge branch 'bugfix/app_compatible_with_3_1_bootloader_v4.3' into 'release/v4.3'
esp_system: Fix RTC_WDT protection in esp_restart_noos (v4.3)

See merge request espressif/esp-idf!16741
2022-01-12 08:39:02 +00:00
7f1ab6d8d1 http: Fix parsing invalid url cause to crash
Reason:
For example, if an url is lack of leading 'http:' by mistake, it causes to http_parser_parse_url() cannot parse http host item,
and then pass the null host pointer to _get_host_header(), crash happens.

Fix:
http added null pointer check now.

Closes https://jira.espressif.com:8443/browse/ESPAT-953
2022-01-12 16:17:20 +08:00
5548b3b71c Merge branch 'docs/fixed_typos_in_esp32-s2-saola-1_user_guide_v4.3' into 'release/v4.3'
Docs: Fixed typos in ESP32-S2-Saola-1 user guide (backport v4.3)

See merge request espressif/esp-idf!16734
2022-01-12 07:57:56 +00:00
f68da60831 Merge branch 'bugfix/fix_bluedroid_compile_issue_v4.3' into 'release/v4.3'
components/bt: Fix bluedroid compile issue(backport release/v4.3)

See merge request espressif/esp-idf!16593
2022-01-11 09:52:16 +00:00
f295efce12 esp_system: Fix RTC_WDT protection in esp_restart_noos
Fixed issue - v4.3 app not compatible with 3.1 bootloader
2022-01-10 21:57:46 +08:00
33190700aa docs/fixed_typos_in_esp32-s2-saola-1_user_guide 2022-01-10 19:26:32 +08:00
00c0c1fd45 Merge branch 'docs/update_esp32-s2_devkit_user_guides_backport_v4.3' into 'release/v4.3'
Docs/Update two ESP32-S2 devkit user guides (backport v4.3)

See merge request espressif/esp-idf!15307
2022-01-10 11:16:42 +00:00
b0060dc0a3 Merge branch 'bugfix/mqtt_update_refs_v4.3' into 'release/v4.3'
MQTT: Fix build if CONFIG_WS_TRANSPORT is not set and client cleanups (v4.3)

See merge request espressif/esp-idf!15627
2022-01-10 10:25:06 +00:00
06f2f1c6b2 Merge branch 'bugfix/fix_null_pointer_deference_issue_4.3_mr' into 'release/v4.3'
Fix the null pointer deference issue via Reconnection Spamming

See merge request espressif/esp-idf!16638
2022-01-10 08:44:25 +00:00
62c10b2a05 Merge branch 'bugfix/PRs_on_esp_hid_v4.3' into 'release/v4.3'
bugfix/handle_3_esp_hid_PRs (v4.3)

See merge request espressif/esp-idf!16591
2022-01-10 03:21:32 +00:00
308b3e31a3 MQTT: Fix build if CONFIG_WS_TRANSPORT is not set and client cleanups
Updated MQTT submodule: git log --oneline f10321a53b53a146ee299cfecc320b89c0cf6611...89894bd0c611b1392967fe90bb49682eba858383
* Fix build issue if cert bundle disabled
* Fix build issue if ws transport disabled
* Add config to set retransmission interval

Detailed description of the changes (f10321a53b...89894bd0c6):
* Added config option to configure custom retransmission interval
    - See merge request espressif/esp-mqtt!110
    - esp_mqtt commit 1b009c840b
    - Related https://github.com/espressif/esp-mqtt/pull/199
* Configuration conflicts were verified, logged but not reported to the user.
    - See merge request espressif/esp-mqtt!102
    - esp_mqtt commit 88f4b8ed50
* Fixed build issue if cert bundle disabled
    - See merge request espressif/esp-mqtt!109
    - esp_mqtt commit 4a89bff610
    - esp_mqtt commit 1b71980575
    - esp_mqtt commit 5b3c81ee48
    - Related https://github.com/espressif/esp-mqtt/pull/198
    - Related https://github.com/espressif/esp-idf/issues/7535
* Removes unnecessary outbox_cleanup
    - This function were used on old version to handle QoS 2 messages. It's no longer necessary in current implementation.
    - See merge request espressif/esp-mqtt!108
    - esp_mqtt commit ebef896b00
* Fixed return an error when fail to enqueue
    - The functions that enqueue messages didn't had a return for the handler, with this the error was only logged instead of returned whichmay cause the user to have an ID for a message that was not published.
    - See merge request espressif/esp-mqtt!103
    - esp_mqtt commit 7471177fe7
* CI: Use qemu image based on esp-env:v4.4-1
    - Replaced the temporary qemu image with the official qemu:v4.4-1-20210517 derived from the esp-env:v4.4-1 test environment
    - See merge request espressif/esp-mqtt!107
    - esp_mqtt commit 231b274962

Closes https://github.com/espressif/esp-idf/issues/7535
2022-01-07 15:07:27 +00:00
6dce875bf9 Merge branch 'bugfix/freertos_pd_ticks_to_ms_precision_v4.3' into 'release/v4.3'
Freertos: Fix loss of precision in pdTICKS_TO_MS (v4.3)

See merge request espressif/esp-idf!16675
2022-01-07 14:32:13 +00:00
f7bb64e896 docs/update_esp32-s2_devkit_user_guides 2022-01-07 16:47:56 +08:00
9138b9aff5 Merge branch 'bugfix/crypto_allocate_lldesc_v4.3' into 'release/v4.3'
crypto: dont create DMA descriptors on the stack (v4.3)

See merge request espressif/esp-idf!16342
2022-01-07 08:45:43 +00:00
aabac43480 add cmd to publish and recv heartbeat message 2022-01-07 15:03:58 +08:00
ade22c9072 Merge branch 'bugfix/fix_heap_memory_corruption_v4.3' into 'release/v4.3'
Heap: Fix a possible bug in the TLSF allocator (backport v4.3)

See merge request espressif/esp-idf!16508
2022-01-06 11:36:47 +00:00
d300a9cfe3 Heap: Fix a possible bug in the TLSF allocator (backport v4.3) 2022-01-06 11:36:46 +00:00
e383693ac2 Merge branch 'bugfix/set_authmode_by_switching_number_to_string_v4.3' into 'release/v4.3'
CI: change ap authmode from number to string (backport v4.3)

See merge request espressif/esp-idf!16554
2022-01-06 10:10:03 +00:00
3764b03734 freertos: Fix loss of precision in pdTICKS_TO_MS
Closes https://github.com/espressif/esp-idf/pull/7856
Closes https://github.com/espressif/esp-idf/issues/7853

[darian@espressif.com: Updated commit message]
Signed-off-by: Darian Leung <darian@espressif.com>
2022-01-06 15:54:01 +08:00
b9c5ef1717 Merge branch 'bugfix/fix_spp_open_err_bda_v4.3' into 'release/v4.3'
Component_bt/Fix SPP acceptor open with wrong remote address[backport 4.3]

See merge request espressif/esp-idf!16614
2022-01-06 04:06:42 +00:00
d6b5b0ab00 Merge branch 'bugfix/pthread_destructor_sequencing_v4.3' into 'release/v4.3'
pthread: Fix behaviour when pthread destructor calls pthread_getspecific/pthread_setspecific (v4.3)

See merge request espressif/esp-idf!14828
2022-01-06 00:38:14 +00:00
6e9d90d6e1 soc: Added support for specify the maximum descriptor length when setting up the DMA descriptor link 2022-01-06 08:11:57 +08:00
2a28ec3522 crypto: also apply cache writeback/invalidate for SPIRAM_USE_MEMMAP
Closes https://github.com/espressif/esp-idf/issues/7944
2022-01-06 08:11:57 +08:00
b957692888 crypto: allocate all DMA descriptors to DMA capable memory.
These were previously placed on the stack, but the stack could be placed in
RTC RAM which is not DMA capable.
2022-01-06 08:11:57 +08:00
c2f14e192e Merge branch 'bugfix/ci-increase-number-of-parallel' into 'release/v4.3'
ci: increase number of parallel jobs

See merge request espressif/esp-idf!16652
2022-01-06 00:07:23 +00:00
a28f9a6770 ci: increase number of parallel jobs 2022-01-05 12:42:57 +08:00
606d7e48d2 Fixed left right key confusion in comments.
"Left" and "Right" were swapped in some comments.
2022-01-05 10:47:56 +08:00
0bc2cb89e5 Merge branch 'bugfix/rtc_section_alignment_v4.3_2' into 'release/v4.3'
System: fix RTCFAST section alignment (v4.3)

See merge request espressif/esp-idf!16518
2022-01-04 12:34:12 +00:00
6993fbdbe8 Merge branch 'bugfix/idf_tools_test_without_versions_v4.3' into 'release/v4.3'
Tools: Load tool versions automatically for IDF Tools tests (v4.3)

See merge request espressif/esp-idf!16511
2022-01-04 09:49:17 +00:00
74f4d07c3b There is an issue that if the the btm_cb.p_sec_dev_rec_list is full,but at the same
time we can't find old device to be replaced,then this can cause crash. So we need
to change the way to malloc the new device or replace the old in the list.
2022-01-04 11:09:44 +08:00
5965ad859d Merge branch 'bugfix/ringbuf_read_pointer_wrap_v4.3' into 'release/v4.3'
ringbuf: Fix bug where comparision between a signed and unsigned operand resulted in incorrect free size for no-split/allow-split buffers (v4.3)

See merge request espressif/esp-idf!15882
2022-01-04 02:31:48 +00:00
f8d60e2008 Merge branch 'bugfix/dm9051_tx_throughput_rate_optimization_v4.3' into 'release/v4.3'
esp_eth: optimize dm9051 Tx throughput(v4.3)

See merge request espressif/esp-idf!15886
2022-01-03 12:42:54 +00:00
d34f2e407b wifi: Fix race conditon invoking invalid callback on deinit
Closes https://github.com/espressif/esp-idf/issues/7579
2022-01-03 11:04:17 +01:00
1dfe3570b4 Merge branch 'bugfix/psram_fix_bootloader_v4.3' into 'release/v4.3'
bootloader: disable psram cache bug fix for bootloader (v4.3)

See merge request espressif/esp-idf!15805
2022-01-02 06:14:08 +00:00
9eba0ff6a6 tools: Update mqtt open source test server address 2021-12-31 15:31:15 +08:00
3eceea7f5d doc: Update mqtt open source test server address 2021-12-31 15:31:15 +08:00
2d1e1c50e8 examples: Update mqtt open source test server address 2021-12-31 15:31:15 +08:00
78e8702963 fix typos and format 2021-12-31 11:25:28 +08:00
aef7850157 Merge branch 'bugfix/freertos_round_robin_scheduling_retain_skip_v4.3' into 'release/v4.3'
freertos: Implement best effort round robin scheduling (v4.3)

See merge request espressif/esp-idf!16542
2021-12-31 02:58:53 +00:00
04d2887493 Merge branch 'bugfix/spi_slave_test_non_dma_v4.3' into 'release/v4.3'
spi-slave: fix single-board: hd test failing due to DMA buffers ending up in PSRAM (v4.3)

See merge request espressif/esp-idf!16306
2021-12-31 02:57:25 +00:00
9b2f6a2a77 Merge branch 'bugfix/fix_bluedroid_ble50_adv_data_length_issue_v4.3' into 'release/v4.3'
components/bt: Fix bluedroid ble50 adv data length issue(backport release/v4.3)

See merge request espressif/esp-idf!16580
2021-12-31 00:40:11 +00:00
04bea91b38 fix SPP open with wrong remote bd_addr 2021-12-30 16:36:51 +08:00
2b186e04d0 optimize SPP documents 2021-12-30 16:14:57 +08:00
abacbb1d12 components/bt: Fix bluedroid compile issue 2021-12-30 11:58:21 +08:00
0818a8b4f1 spacing styling correction 2021-12-30 10:57:30 +08:00
f61b57e5e5 minor styling changes 2021-12-30 10:57:30 +08:00
837d4637f5 esp_hid: fix output report char declaration
Current issue: output reports sent by Windows not received.
The report characteristic declaration should also support write without
response as specified by HIDS profile:
See https://www.bluetooth.com/specifications/GATT/ (page 14)
2021-12-30 10:57:30 +08:00
154f54253c Merge branch 'wifi_prov_mgr/service_key_check_v4.3' into 'release/v4.3'
wifi_prov_mgr: Added check for passphrase length in softAP scheme (v4.3)

See merge request espressif/esp-idf!16570
2021-12-29 13:18:23 +00:00
aaeecdf0e7 component/bt: Support set HW CCA threshold value 2021-12-29 15:40:26 +08:00
ab2148a390 component/bt: fix periodic adv parameters detection issue 2021-12-29 15:03:28 +08:00
ecfa3c96ba components/bt: modify name of file 2021-12-29 14:39:23 +08:00
918d8fabcf components/bt: Update the document of demo bt discovery 2021-12-29 14:39:18 +08:00
d5a20a5a4f components/bt: Modify demo bt_discovery 2021-12-29 14:39:10 +08:00
b0133c72a0 Merge branch 'doc/optimize_hfp_doc_4_3' into 'release/v4.3'
Doc/optimize hfp doc [release/v4.3]

See merge request espressif/esp-idf!16450
2021-12-29 02:47:54 +00:00
cc5e2107bb wifi_prov_mgr: Added check for passphrase length in softAP scheme
Closes https://github.com/espressif/esp-idf/issues/8063
2021-12-28 18:13:51 +05:30
7467c68a17 Merge branch 'bugfix/xStreamBufferReset_crashing_v4.3' into 'release/v4.3'
FreeRTOS: Fix xStreamBufferReset function always crashing (backport v4.3)

See merge request espressif/esp-idf!16171
2021-12-27 14:25:01 +00:00
143fb842a5 CI: change ap authmode from number to string (backport v4.3) 2021-12-27 19:59:11 +08:00
1738b905a7 Merge branch 'ci/upload_build_example_for_release_test_4.3' into 'release/v4.3'
ci: preserve artifacts for local test apps (4.3)

See merge request espressif/esp-idf!16292
2021-12-27 11:50:18 +00:00
df5f73e165 Merge branch 'bugfix/modbus_port_fix_lgpl_licensed_files_v43' into 'release/v4.3'
freemodbus: fix port contains lgpl licensed files (backport v4.3)

See merge request espressif/esp-idf!16183
2021-12-27 10:02:21 +00:00
6dde759a99 Merge branch 'docs/update_CN_trans_console_ota_v4.3' into 'release/v4.3'
update CN trans for console and ota for v4.3

See merge request espressif/esp-idf!16022
2021-12-27 08:17:36 +00:00
7c0d99e68d ringbuf: Fix bug where comparision between a signed and unsigned operand resulted in incorrect free size for no-split/allow-split buffers
This commit fixes a bug in no-split and allow-split ring buffers free buffer size calculation.
When the free size available in the buffers less than the size of one item header,
the function prvGetCurMaxSizeNoSplit/AllowSplit() incorrectly returned the maxItemSize instead of 0.
This is due to the comparision between a negative and a positive value
where both operands are treated as unsigned during the comparision operation,
thereby treating the negative operand as a large integer.

Also added new unit tests to test buffer-full and almost-full conditions
where this scenario is likely to be hit.

Closes https://github.com/espressif/esp-idf/issues/7344
Closes https://github.com/espressif/esp-idf/pull/7371
2021-12-27 15:02:27 +08:00
8a7b2f326b Merge branch 'bugfix/freertos_prvTaskIsTaskSuspended_v4.3' into 'release/v4.3'
freertos: Fix prvTaskIsTaskSuspended check (v4.3)

See merge request espressif/esp-idf!16540
2021-12-27 03:56:22 +00:00
6585626b62 Merge branch 'bugfix/fix_phy_enable_watchdog_timeout_issue_4.3' into 'release/v4.3'
Fix the ble task watchdog timeout issue

See merge request espressif/esp-idf!16289
2021-12-27 03:54:57 +00:00
e9cbf56d36 freertos: Fix SMP round robin scheduling
The previous SMP freertos round robin would skip over tasks when
time slicing. This commit implements a Best Effort Round Robin
where selected tasks are put to the back of the list, thus
makes the time slicing more fair.

- Documentation has been updated accordingly.
- Tidy up vTaskSwitchContext() to match v10.4.3 more
- Increased esp_ipc task stack size to avoid overflow

Closes https://github.com/espressif/esp-idf/issues/7256
2021-12-27 11:52:11 +08:00
c33b260e7a freertos: Fix prvTaskIsTaskSuspended check
This commit fixes prvTaskIsTaskSuspended(). Both pending ready lists
should be checked to confirm that is truly suspended.

Closes https://github.com/espressif/esp-idf/issues/7564
2021-12-24 21:08:56 +08:00
19ddefeb5c timer: stop alarm if alarm value doesn't change in ISR handler
Alarm will be disabled by hardware when alarm event happend.
In the ISR, if auto-reload is enabled, we should re-enable the alarm.
If the alarm target value is changed in user's callback,
the alarm will be reenabled as well.

Closes https://github.com/espressif/esp-idf/issues/7001
Closes https://github.com/espressif/esp-idf/issues/8095
2021-12-24 12:28:45 +08:00
65edf90e93 Update esp32c3 phy lib and bb lib
Fix the ble task watchdog timeout issue caused by phy enable when exit modem sleep.
2021-12-23 20:30:12 +08:00
da6c5be6c1 Merge branch 'feature/mbedtls_dynamic_memory_v4.3' into 'release/v4.3'
fix(mbedtls): fix compiling error when open MBEDTLS_SSL_PROTO_DTLS and disable...(backport v4.3)

See merge request espressif/esp-idf!16521
2021-12-23 11:43:45 +00:00
f8ee842e8c Merge branch 'bugfix/ringbuf_send_semaphore_release_order_v4.3' into 'release/v4.3'
esp_ringbuf: Fix order of semaphore release in xRingbufferSend (v4.3)

See merge request espressif/esp-idf!16230
2021-12-23 07:51:39 +00:00
e3b39381fd fix(mbedtls): fix compiling error when open MBEDTLS_SSL_PROTO_DTLS and disable MBEDTLS_DYNAMIC_BUFFER feature when MBEDTLS_SSL_PROTO_DTLS is selected 2021-12-23 15:34:18 +08:00
5e805d58a8 FreeRTOS: Fix xStreamBufferReset function always crashing
This function resets the spinlock given as a parameter after taking it
(when entering the critical section). This then results in a panic once
it tries to exit the same critical section.

* Closes https://github.com/espressif/esp-idf/issues/7725
2021-12-23 06:15:50 +00:00
57efd94fea Merge branch 'bugfix/scannable_adv_duration_estimation_v4.3' into 'release/v4.3'
[Coexistence]: fixed BLE scannable extended adv performance issue in case of Wi-Fi coexistence(backport v4.3)

See merge request espressif/esp-idf!16477
2021-12-23 04:21:37 +00:00
9abfa2c645 Merge branch 'fix/remove_deprecated_macro_SPI_TRANS_SET_CD' into 'release/v4.3'
Remove a deprecated macro: SPI_TRANS_SET_CD

See merge request espressif/esp-idf!16494
2021-12-23 02:21:11 +00:00
d581312451 System: fix RTCFAST section alignment
This bugfix contains 3 fixes:
1. .rtc_dummy section is removed (not needed for C3)
2. .rtc_text section is padded with 16B for possible CPU prefetch
3. .rtc_text section is aligned to 4B boundary to comply with PMS Memprot requirements
2021-12-23 02:09:46 +01:00
7a4ed65769 Merge branch 'bugifx/nimble_timer_memory_leak_v4.3' into 'release/v4.3'
[NimBLE]: Fixed memory leak of timer during NimBLE Host start-stop process(backport v4.3)

See merge request espressif/esp-idf!16446
2021-12-22 13:34:03 +00:00
31d1156c6d Merge branch 'bugfix/fix_can_not_find_mac_addr_error_mr_4.3' into 'release/v4.3'
fix can not find mac addr error

See merge request espressif/esp-idf!16146
2021-12-22 13:33:29 +00:00
25c047d2fa Merge branch 'bugfix/wpa_supplicant_logs_release_v4.3' into 'release/v4.3'
esp_wifi: Change the verbosity of wpa_supplicant logs. (Backport v4.3)

See merge request espressif/esp-idf!16348
2021-12-22 13:32:58 +00:00
0fed811a46 Merge branch 'feature/mbedtls-2.16.12-integration_v4.3' into 'release/v4.3'
mbedtls: upgrade to release v2.16.12 (v4.3)

See merge request espressif/esp-idf!16484
2021-12-22 13:32:30 +00:00
bd5176f108 Merge branch 'bugfix/vfs_io_disabled_console_v4.3' into 'release/v4.3'
Fix console output flushing when CONFIG_VFS_SUPPORT_IO is disabled (v4.3)

See merge request espressif/esp-idf!15653
2021-12-22 13:12:21 +00:00
39ab27d0cf Merge branch 'bugfix/wps_fixes_v4.3' into 'release/v4.3'
wpa_supplicant: Add WPS Fixes (backport V4.3)

See merge request espressif/esp-idf!16151
2021-12-22 12:20:46 +00:00
2787237d38 Tools: Load tool versions automatically for IDF Tools tests 2021-12-22 12:06:22 +01:00
7c9ef7466f Merge branch 'bugfix/riscv_fix_vector_mcause_v4.3' into 'release/v4.3'
RISC-V: fix usage of special register when interrupts are enabled (backport v4.3)

See merge request espressif/esp-idf!16188
2021-12-22 10:09:55 +00:00
97f8f1b0d6 Merge branch 'feature/mbedtls_dynamic_memory_v4.3' into 'release/v4.3'
feat(mbedtls): modify __wrap_mbedtls_ssl_setup to decrease SSL peak heap cost(backport v4.3)

See merge request espressif/esp-idf!16274
2021-12-22 08:21:43 +00:00
eef3c878aa Merge branch 'bugfix/fix_select_timeout_v4.3' into 'release/v4.3'
VFS: `select` function's timeout is now POSIX compliant (backport v4.3)

See merge request espressif/esp-idf!16190
2021-12-22 05:49:13 +00:00
ad2652c1f4 Merge branch 'bugfix/stdatomic_sync_op_and_fetch_v4.3' into 'release/v4.3'
newlib: stdatomic: implement missing "op_fetch", "nand" builtins (v4.3)

See merge request espressif/esp-idf!16466
2021-12-22 04:14:53 +00:00
f00a1bf164 Merge branch 'bugfix/fix_esp32h2_efuse_get_ext_mac_v4.3' into 'release/v4.3'
efuse_table_gen: Fixes wrong joining fields with omitted names (v4.3)

See merge request espressif/esp-idf!15738
2021-12-22 02:17:47 +00:00
e0777cbbd4 Merge branch 'bugfix/freertos_linker_lf_fixes_v4.3' into 'release/v4.3'
freertos: linker.lf rules fixes (v4.3)

See merge request espressif/esp-idf!14042
2021-12-22 00:17:22 +00:00
71f7d9a8f4 Merge branch 'bugfix/ldgen_plus_in_archive_name_v4.3' into 'release/v4.3'
ldgen: allow + sign in archive names (v4.3)

See merge request espressif/esp-idf!16468
2021-12-21 17:52:21 +00:00
57d90c5cd6 Merge branch 'mesh/bugfix_fix_no_ip_issue_v4.3' into 'release/v4.3'
esp_wifi_mesh: fix the device can not receive IP_EVENT_STA_GOT_IP when the router restarted(backport_v4.3)

See merge request espressif/esp-idf!16344
2021-12-21 12:51:37 +00:00
641e86c1dc fix: remove a deprecated macro: SPI_TRANS_SET_CD 2021-12-21 17:44:15 +08:00
9d0fca67a9 Merge branch 'bugfix/remove_PIP_USER_v4.3' into 'release/v4.3'
tools: Add check for PIP_USER variable (backport v4.3)

See merge request espressif/esp-idf!16337
2021-12-21 08:38:42 +00:00
0fd5c562bf mbedtls: upgrade to release v2.16.12
For release notes, please refer to:
https://github.com/ARMmbed/mbedtls/releases/tag/v2.16.12
2021-12-21 14:04:31 +05:30
9d79b70acf mbedtls: small documentation update 2021-12-21 14:04:12 +05:30
32e29580de feat(mbedtls): modify __wrap_mbedtls_ssl_setup to decrease SSL peak heap cost 2021-12-21 15:19:29 +08:00
3f63a4caee component/bt: fixed coexistence scannable extended adv performance issue 2021-12-21 12:55:13 +08:00
450b05a64a Merge branch 'bugfix/fix_spp_listen_err_v4.3' into 'release/v4.3'
Component_bt/Fix SPP cannot malloc slot bugs[backport v4.3]

See merge request espressif/esp-idf!16384
2021-12-21 04:35:07 +00:00
9844845214 Merge branch 'bugfix/address_already_used_exception_in_ota_tests_v4.3' into 'release/v4.3'
Fix 'address already in use' exception in OTA tests (v4.3)

See merge request espressif/esp-idf!16417
2021-12-21 04:34:57 +00:00
778faeb7dd Merge branch 'fix/remove_warning_when_disabling_rom_dl_mode_v4.3' into 'release/v4.3'
secure_boot: Fix warning when UART ROM DL mode is disabled (v4.3)

See merge request espressif/esp-idf!16238
2021-12-21 03:54:33 +00:00
e9f47296a8 Merge branch 'reduce_bootup_time_when_using_usb-serial-jtag_v4.3' into 'release/v4.3'
rtc_clk: reduce bootup time when using usb-serial-jtag(backport v4.3)

See merge request espressif/esp-idf!16261
2021-12-21 03:52:39 +00:00
7dbfd01520 Merge branch 'bugfix/hardware_mpi_fallback_issue_v4.3' into 'release/v4.3'
mbedtls: fix hardware MPI (bignum) related regression (v4.3)

See merge request espressif/esp-idf!16237
2021-12-21 03:49:11 +00:00
6c38e7c5de Merge branch 'bugfix/esptool_bump_v4.3' into 'release/v4.3'
bugfix: ESP32 rev0/1 connection in release/v4.3

See merge request espressif/esp-idf!16218
2021-12-21 03:47:24 +00:00
201ae7e0e7 Merge branch 'bugfix/avoid-exception-messages-while-export_v4.3' into 'release/v4.3'
Avoid exception messages while autocomplete initialization in export.sh (v4.3)

See merge request espressif/esp-idf!16200
2021-12-21 03:46:12 +00:00
4ab1fb9b2a Merge branch 'bugfix/bootloader_debug_buffers_v4.3' into 'release/v4.3'
bootloader_support: Fix and re-enable bootloader_debug_buffer function (v4.3)

See merge request espressif/esp-idf!16074
2021-12-21 03:45:32 +00:00
683a98fbe3 Merge branch 'feature/adds_fault_injection_protection_for_check_anti_rollback_v4.3' into 'release/v4.3'
bootloader_support: Adds fault injection protection for check_anti_rollback (v4.3)

See merge request espressif/esp-idf!16180
2021-12-21 03:44:41 +00:00
0193aeffd6 Merge branch 'feature/add_dhcp_option_v4.3' into 'release/v4.3'
lw-ip: Add macro to disable vendor class option(backport v4.3)

See merge request espressif/esp-idf!15983
2021-12-21 03:44:09 +00:00
9dac6b0643 Merge branch 'docs/examples_bluedroid_ble50_v4.3' into 'release/v4.3'
Readme for the bluedroid ble50 example with tutorial of walkthrough example (v4.3)

See merge request espressif/esp-idf!16100
2021-12-21 03:43:50 +00:00
9a0a697b27 Merge branch 'bugfix/mdns_non_standard_domains_v4.3' into 'release/v4.3'
mdns: Fix parsing non-standard queries (v4.3)

See merge request espressif/esp-idf!16060
2021-12-21 03:43:18 +00:00
3eb854c3ea Merge branch 'bugfix/LAN8720_reset_assertion_v4.3' into 'release/v4.3'
Increased LAN8720 ETH-PHY reset assertion time (v4.3)

See merge request espressif/esp-idf!15826
2021-12-21 03:42:37 +00:00
e7db515b35 Merge branch 'bugfix/link_spi_flash_rom_func_in_bootloader_stage_v4.3' into 'release/v4.3'
esp_rom: link rom spi flash functions in bootloader stage (v4.3)

See merge request espressif/esp-idf!15257
2021-12-21 03:42:15 +00:00
4d2674a7f4 Merge branch 'docs/wifi_security_and_dpp_v4.3' into 'release/v4.3'
docs: Separate Doc on WiFi security, added DPP Doc (Backport v4.3)

See merge request espressif/esp-idf!14834
2021-12-21 03:40:23 +00:00
37591f6a85 Merge branch 'nimble/add_throughput_example_v4.3' into 'release/v4.3'
NimBLE: Add NimBLE throughput demo examples (v4.3)

See merge request espressif/esp-idf!16124
2021-12-21 03:38:39 +00:00
b62308c363 Merge branch 'nimble_spp_v4.3' into 'release/v4.3'
NimBLE: BLE example for SPP service (v4.3)

See merge request espressif/esp-idf!16123
2021-12-21 03:34:21 +00:00
04f69192d2 Merge branch 'bugfix/fix_blufi_encryption_fail_v4.3' into 'release/v4.3'
components/bt: fix blufi encryption fail(backport release/v4.3)

See merge request espressif/esp-idf!16315
2021-12-21 03:30:02 +00:00
91d7557579 Merge branch 'feature/support_ble_direct_ind_low_adv_v4.3' into 'release/v4.3'
components/bt: Support low duty cycle directed advertising(backport release/v4.3)

See merge request espressif/esp-idf!16378
2021-12-21 03:27:09 +00:00
564229c9a6 pthread: Fix behaviour when pthread destructor calls pthread_getspecific/pthread_setspecific
Update as per specification at https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_key_create.html

Specifically:

- Before a destructor is called then the value for the corresponding key is
  already set to NULL.

- If a destructor calls pthread_setspecific() to assign a non-NULL value then
  this destructor is called again, after all existing non-NULL values have been
  called.

Adds a test for this relatively complex behaviour.

Closes https://github.com/espressif/esp-idf/issues/6643
2021-12-21 01:27:49 +00:00
e26a2250a5 freertos: linker.lf rules fixes
1. Add conditions based on Kconfig options for functions which are
   compiled based on those options.
2. Static allocation is always enabled, move corresponding functions
   into the common list.
2021-12-21 01:26:44 +00:00
8e7b11f6d1 newlib: set errno in the explicitly provided reent structure
Since these functions receive the pointer to reent structure, they
should set errno in it rather than using thread-local errno.

This didn't cause practical issues because console functions in IDF
are only called from threads, and in that case 'r' is a pointer to
the thread-local structure, so &errno is the same thing as
&__errno_r(r). Still, fixing this for consistency.
2021-12-21 01:25:49 +00:00
3d91e6d993 newlib: implement _fstat_r stub for console
When CONFIG_VFS_SUPPORT_IO is disabled, _read_r and _write_r
implementations in syscalls.c are used to provide console I/O via
esp_rom_uart_tx_one_char/esp_rom_uart_rx_one_char.

When newlib opens a (FILE*) stream, it calls fstat to check if the
underlying file is character-oriented. In this case, it configures the
stream to use line buffering. Otherwise (or if fstat fails) the stream
is opened as block buffered.

Since fstat wasn't provided, stdin/stdout/stderr streams got opened in
block buffered mode. For console, we need line buffered output so that
the stream buffer is flushed each time a complete line (ending with
'\n') is sent to stdout or stderr.

Fix by implementing _fstat_r stub, setting st->st_mdoe=S_IFCHR.
2021-12-21 01:25:49 +00:00
f976bb0ef8 ldgen: allow + sign in archive names
Closes https://github.com/espressif/esp-idf/issues/8073
2021-12-21 02:17:43 +01:00
bd598e36ea newlib: stdatomic: implement missing "op_fetch", "nand" builtins
* Adds implementations of __{atomic,sync}_nand_fetch_n. These builtins
  were implemented for other operations but were not defined for NAND.
* Adds implementation of __atomic_OP_fetch_n for all OPs.
* Adds implementation of __sync_OP_and_fetch_n for all OPs.

Reported in https://github.com/espressif/arduino-esp32/issues/5948
2021-12-21 02:16:02 +01:00
824552e9b4 RISC-V: fix usage of special register when interrupts are enabled 2021-12-21 01:06:11 +00:00
3c0d892d43 Merge branch 'bugfix/missing-atomic-definitions' into 'release/v4.3'
newlib: missing atomic definitions (v4.3)

See merge request espressif/esp-idf!15610
2021-12-21 01:03:24 +00:00
6217ebd865 Merge branch 'feature/remove_component_manager_tests_v4.3' into 'release/v4.3'
ci: Remove component manager test from build system tests (v4.3)

See merge request espressif/esp-idf!16107
2021-12-21 01:02:40 +00:00
5ec8dcf937 Merge branch 'bugfix/scheduler_state_query_thread_safety_v4.3' into 'release/v4.3'
freertos: fix thread safety for checking scheduler state (v4.3)

See merge request espressif/esp-idf!16131
2021-12-21 01:02:12 +00:00
c72c3fdb3c Merge branch 'update/version_4_3_2' into 'release/v4.3'
Update version to 4.3.2

See merge request espressif/esp-idf!16462
2021-12-21 00:56:13 +00:00
8bf14a9238 versions: Update version to 4.3.2 2021-12-20 19:02:41 +01:00
92331a8c62 wpa_supplicant: Add WPS Fixes
Add following bugfixes

1. Station not able to connect when WPS pin is pressed first on AP.
2. PBC overlap getting detected for selected registrar PIN APs.
3. Station not considering authorised MACs for PIN method.
4. For PIN methodm If no AP is found, station will loop through
   APs in its vicinity and try to do WPS with them one by one till
   WPS timeout occurs. This is for some APs which do not set
   selected registrar correctly.
2021-12-20 22:02:53 +05:30
bb9a13e328 Fix Typos 2021-12-20 17:03:14 +08:00
b34c461d35 Optimize HFP Documents 2021-12-20 17:03:02 +08:00
971d9b9436 component/bt/host/nimble: fixed memory leak due to timer not destroyed during NimBLE host start-stop 2021-12-20 15:55:47 +08:00
6a2f9b21ec esp_wifi_mesh: fix the device can not receive IP_EVENT_STA_GOT_IP when the router restarted 2021-12-16 17:27:24 +08:00
3a55b28ba9 Fix for advanced_ota_redirect_url example failure in CI 2021-12-16 12:18:00 +05:30
c9940a3eed Fix 'address already in use' exception in OTA tests
We will stop the server instance at the end of each test case. This will solve the "address already in use" exception
2021-12-16 10:16:32 +05:30
b812712757 spi_slave_hd: fix stack variable bug in seg_slave example
Closes https://github.com/espressif/esp-idf/issues/7163
2021-12-14 12:40:38 +08:00
a269df84e9 fix SPP server bugs when the BTC layer can not allocate a slot for the listen port 2021-12-14 11:07:29 +08:00
a7900f871f components/bt: Fix high duty cycle directed advertising will not be stopped when timeout 2021-12-14 09:33:24 +08:00
d4cc192782 components/bt: Support low duty cycle directed advertising 2021-12-14 09:33:17 +08:00
8409e3bcbe components/bt: fix blufi encryption fail 2021-12-13 09:55:00 +08:00
d3b88a13e1 esp_wifi: Change the verbosity of wpa_supplicant logs. 2021-12-09 12:41:36 +05:30
255da2605b tools: Add check for PIP_USER variable
Closes https://github.com/espressif/esp-idf/issues/7910
2021-12-08 16:23:50 +01:00
1c18f28a4a ci: preserve artifacts for local test apps
build ble_mesh_console example on c3 as well
add test dir examples/bluetooth/esp_ble_mesh/ble_mesh_console
add test dir examples/bluetooth/hci/controller_hci_uart_esp32
2021-12-08 16:31:21 +08:00
44af11f38c spi-slave: fix single-board: hd test failing due to DMA buffers ending up in PSRAM 2021-12-08 12:17:06 +08:00
4b73610eea reduce bootup time when using usb-serial-jtag 2021-12-03 20:55:52 +08:00
2305b5f474 esp_ringbuf: Fix assertion xQueueGenericSend queue.c:818
The release of the semaphore indicating the item was successfully sent must be the last semaphore released.  The receiver may be in another task and may delete the Ringbuffer (such as with a return code across tasks design pattern) if they are through with the Ringbuffer.

The function xRingbufferSendAcquire followed by xRingbufferSendComplete had the semaphores released in the proper order and that same pattern should have been used in xRingbufferSend and xRingbufferSendFromISR.  This commit fixes this order.

Issue (IDFGH-6030) #7716 describes the problem in more detail.

Closes IDFGH-6030, https://github.com/espressif/esp-idf/issues/7716
Closes IDFGH-6036, https://github.com/espressif/esp-idf/pull/7721
2021-12-03 09:34:15 +05:30
70936f4c92 mbedtls: remove wrap from component.mk as well
Note: This was not required in original MR, as master branch does
not support GNU Make.
2021-12-02 17:15:42 +05:30
9fb61791fe secure_boot: Fix warning when UART ROM DL mode is disabled
*Additionally use updated calls to enable rom secure download mode
2021-12-02 15:17:56 +05:30
7a8c8f8576 esp_bignum: move check for supported MPI bits at start of API
This can allow hardware MPI API to return as soon as it identifies
that it can handle require bitlength operation.
2021-12-02 15:08:42 +05:30
1cae1fc18e mbedtls: update mbedtls submodule pointer for MPI API change 2021-12-02 15:08:41 +05:30
0befb28237 mbedtls: fix hardware MPI (bignum) related regression
In commit de22f3a4e5, combination of
hardware and software MPI (bignum) related approach was used to
work around chip (e.g. ESP32-C3) limitation of max 3072 bits support.

This was done using linker "--wrap" flag but since the relevant API is
being used in same translation (compilation unit), hardware mode was not
getting used in some cases (e.g., RSA key generation).

This commit modified internal mbedTLS API and makes software+hardware
combination deterministic.
2021-12-02 15:08:37 +05:30
f864e1ddbb mbedtls: update kconfig help to correct on supported MPI bits 2021-12-02 15:07:37 +05:30
6ebd748c75 ci: Fix build system tests to clean the dir 2021-12-01 18:25:10 +01:00
4f19ef06fb esptool: Bump version, fix esp32r0/1 connection
Closes https://github.com/espressif/esptool/issues/698
2021-12-01 12:43:50 +01:00
4fe9b8c40f docs: update CN translation for oat.rst and console.rst for v4.3 2021-12-01 17:22:39 +08:00
c38215cb2c spi_master: correctly reset spi afifos before DMA transaction starts 2021-12-01 11:48:05 +08:00
f34a85dc31 bootloader_support: Fix and re-enable bootloader_debug_buffer function
The body of the bootloader_debug_buffer function was conditioned to
macros that were never defined, resulting in deactivated code.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-11-30 21:01:55 +08:00
a93e3dff25 Avoid exception messages while autocomplete initialization in export.sh 2021-11-30 12:58:14 +01:00
f2d6cb7298 Add the feature that switch random address to origin mac addr in the ADV
report data.
2021-11-30 14:27:32 +08:00
2ccf84cedf VFS: select function's timeout is now POSIX compliant
`select` function will now round up the timeout passed as a parameter (if any).
It  makes it POSIX compliant.

* Closes https://github.com/espressif/esp-idf/issues/7514
2021-11-30 12:05:34 +08:00
0855521014 bootloader: add anti-FI checks around secure version in anti-rollback scheme 2021-11-29 18:49:36 +05:30
9204605d98 freemodbus: fix port contains lgpl licensed files
Initial version of freemodbus master port files have been added to ESP-IDF based on https://github.com/armink/FreeModbus_Slave-Master-RTT-STM32.
The overall repository license, at the time of adding these files, has been BSD 3-clause. However at that time, several port files carried LGPL license headers. As the author of these files confirmed in https://github.com/armink/FreeModbus_Slave-Master-RTT-STM32/issues/61#issuecomment-977828450, this wasn't intentional. ESP-IDF version of modbus master port has been rewritten to target FreeRTOS instead of RT-Thread, but the license headers remained from the original version. This commit corrects this, replacing the license of these files with BSD 3-clause.
2021-11-29 14:15:23 +01:00
fcd5e502a7 Merge branch 'nimble/add_throughput_example_v4.3' into 'release/v4.3'
NimBLE throughput example: Changed write api to write without response

See merge request espressif/esp-idf!16124
2021-11-26 11:21:15 +05:30
25c61606a1 Merge branch 'nimble_spp' of ssh://gitlab.espressif.cn:27227/espressif/esp-idf into 'release/v4.3'
Nimble: Added BLE SPP Service

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

See merge request espressif/esp-idf!16123
2021-11-26 09:55:47 +05:30
a8260c9c77 freertos: fix thread safety for checking scheduler state
This issue was earlier fixed in commit 79e74e5d5f
but during migration to newer FreeRTOS release, it got introduced again.

This commit fixes thread safety issues with configASSERT() calls
regarding the value of uxSchedulerSuspended. A false negative
occurs if a context switch to the opposite core occurs in between
the getting the core ID and the assesment.

Relevant https://github.com/espressif/esp-idf/issues/4230
Closes https://github.com/espressif/esp-idf/issues/7726
Closes IDFGH-6041
2021-11-25 19:32:19 +05:30
ff42b70176 docs: Separate Doc on WiFi security, added DPP Doc
1. Add new Doc on WiFi security
2. Add DPP related Doc under WiFi
3. Add Supplicant public headers in Doxyfile
2021-11-25 21:01:29 +08:00
233dc30fb1 Merge branch 'bugfix/pppos_event_deinit_exit_ppp_v4.3' into 'release/v4.3'
Examples/PPPoS: Minor fixes related to init/deinit cycling (v4.3)

See merge request espressif/esp-idf!16062
2021-11-25 11:46:10 +00:00
d95accbda9 Merge branch 'bugfix/multi_heap_get_info_impl_backport_v4.3' into 'release/v4.3'
heap: fix multi_heap_get_info_impl (backport v4.3)

See merge request espressif/esp-idf!16118
2021-11-25 11:45:31 +00:00
d16584c313 Merge branch 'bugfix/spi_slave_wrong_miso_mosi_v4.3' into 'release/v4.3'
spi_slave: Fix MOSI/MISO inconsistent references on the SPI Slave drivers. (v4.3)

See merge request espressif/esp-idf!14405
2021-11-25 09:36:55 +00:00
0c77b89e13 Merge branch 'feature/add_coex_hci_command_v4.3' into 'release/v4.3'
Add hci command to set coexistence status (4.3)

See merge request espressif/esp-idf!16054
2021-11-25 08:02:14 +00:00
55e415377d Merge branch 'docs/update_the_assignment_type_in_i2s_programming_example' into 'release/v4.3'
docs: update assignment type for .bit_per_sample (v4.3)

See merge request espressif/esp-idf!15494
2021-11-25 06:20:02 +00:00
6f9e611725 NimBLE throughput example: Add espressif license 2021-11-25 11:06:40 +05:30
cd0a66e0d9 NimBLE throughput example: make multi target support readable 2021-11-25 11:06:40 +05:30
c86c83ca4d NimBLE: Add throughput demo examples
- Added blecent_throughput(client) and bleprph_throughput(server) examples to
  demonstrate application throughput.
2021-11-25 11:06:40 +05:30
8892b4c008 Merge branch 'bugfix/i2c_cmd_not_initailized' into 'release/v4.3'
i2c: fixed i2c_cmd_t not initialized properly issue (v4.3)

See merge request espressif/esp-idf!16096
2021-11-25 04:16:52 +00:00
f055fbb713 i2c: fixed i2c_cmd_t not initialized properly issue 2021-11-25 04:16:51 +00:00
b1ca6be111 Merge branch 'bugfix/modbus_fix_invalid_error_handling_for_duplicate_param_key_v43' into 'release/v4.3'
freemodbus: fix invalid error handling for duplicate param key (backport v4.3)

See merge request espressif/esp-idf!14788
2021-11-25 04:15:33 +00:00
de7d86b8a1 driver: Refactor and clean up SPI Slave test 2021-11-25 12:03:55 +08:00
7b587bf1d7 driver: Create TX/RX-only test cases for SPI Slave 2021-11-25 12:03:55 +08:00
880e96d7bb spi: Ensure DMA In-Link EOF is generated by trans_done on SPI Slave 2021-11-25 12:03:55 +08:00
2bc4a0836f spi: Remove Slave TX/RX set bitlen not effective for ESP32-S2/C3/S3
Furthermore, RX_EOF_EN should only be set when SPI Slave is configured
for segment transfer mode and the "ms_data_bitlen" field is configured
to control the "IN_SUC_EOF" interrupt. Since "ms_data_bitlen" is not
set anymore for S2, C3 and S3, "RX_EOF_EN" should be cleared.
2021-11-25 12:03:54 +08:00
6fb126657a spi: Fix SPI Slave TX/RX bitlen configuring wrong registers
The maximum input length for the SPI Slave should be applied to the read
buffer configuration, not for the write buffer. Similarly, the output
configuration should also target the write buffer.
2021-11-25 12:03:54 +08:00
74f010ddfd spi_slave: Fix MOSI/MISO enable on transaction preparation
MOSI and MISO enablement were conditioned to the existence of TX
and RX buffers, respectively. This is valid for the SPI Master,
but for the SPI Slave the opposite is expected.
2021-11-25 12:03:54 +08:00
920e7796b4 Merge branch 'feature/docker_build_use_git_mirror_v4.3' into 'release/v4.3'
ci: use LOCAL_GIT_MIRROR in docker build job, if set (v4.3)

See merge request espressif/esp-idf!16111
2021-11-25 02:53:20 +00:00
30fe11b932 Merge branch 'feature/ci_runner_failure_retries_v4.3' into 'release/v4.3'
ci: runner system failure retries (v4.3)

See merge request espressif/esp-idf!15723
2021-11-25 02:51:53 +00:00
61d300f055 heap: fix multi_heap_get_info_impl 2021-11-25 10:22:41 +08:00
28792cdfea Merge branch 'bugfix/gdbstub_includes' into 'release/v4.3'
[gdbstub]: fixed includes of component.mk (v4.3)

See merge request espressif/esp-idf!15870
2021-11-25 01:51:12 +00:00
158384043d freemodbus: fix invalid error handling for duplicate param_key 2021-11-25 01:16:10 +08:00
ab5c956bdf Merge branch 'bugfix/esp_timer_before_init_v4.3' into 'release/v4.3'
esp_timer: allow querying the timer before esp_timer_init is called (backport v4.3)

See merge request espressif/esp-idf!15772
2021-11-24 16:44:56 +00:00
23d6e460d9 Merge branch 'bugfix/backport_wifi_fix_1123_v4.3' into 'release/v4.3'
esp_wifi: backport some wifi fix(v4.3)

See merge request espressif/esp-idf!16070
2021-11-24 15:26:43 +00:00
f298fca893 ci: use LOCAL_GIT_MIRROR in docker build job, if set
When the build runner has a local git mirror configured via
LOCAL_GIT_MIRROR variable, use that mirror when cloning IDF insider
the docker build job. Follows similar logic for
LOCAL_GITLAB_HTTPS_HOST, which is used for geo nodes.
2021-11-24 15:43:01 +01:00
48997e82c0 Merge branch 'bugfix/modbus_fix_compiler_err_when_tcp_is_disabled_v43' into 'release/v4.3'
freemodbus: fix compiler err when tcp is disabled (backport v4.3)

See merge request espressif/esp-idf!14789
2021-11-24 14:13:04 +00:00
de7f5305a7 freemodbus: fix compiler err when tcp is disabled (backport v4.3) 2021-11-24 14:13:03 +00:00
6ed81a632c ci: Remove component manager test from build system tests
Component manager itself has a set of integration tests
that run against different ESP-IDF versions
2021-11-24 15:12:29 +01:00
c00c3f74ae Readme for the bluedroid ble50 example with tutorial of walkthrough example. 2021-11-24 14:57:05 +05:30
7cf7bec582 Merge branch 'feature/json_schema_for_idf_size_v4.3' into 'release/v4.3'
tools: add json schema for idf_size (v4.3)

See merge request espressif/esp-idf!15960
2021-11-24 08:58:02 +00:00
daf9cbbb01 Merge branch 'doc/make_classic_bt_API_ref_only_for_esp32_4.3' into 'release/v4.3'
Doc/make classic bt api ref only for esp32 [backport v4.3]

See merge request espressif/esp-idf!15726
2021-11-24 02:54:02 +00:00
050fd07486 Merge branch 'bugfix/fix_crash_when_shutdown_bt_v4.3' into 'release/v4.3'
component/bt: fix crash when shutdown bt(backport v4.3)

See merge request espressif/esp-idf!15709
2021-11-24 02:53:21 +00:00
6f21f1e6cf Merge branch 'feature/lwip_ipv6_automatic_coap_asio_v4.3' into 'release/v4.3'
asio coap: If LWIP IPV6 is disabled, automatically don't build asio & coap (v4.3)

See merge request espressif/esp-idf!15782
2021-11-24 00:30:23 +00:00
9aca518ccc Merge branch 'feature/oocd_ver_upgrade_v4.3' into 'release/v4.3'
tools: Updates OpenOCD version to 'v0.10.0-esp32-20211111' (v4.3)

See merge request espressif/esp-idf!16000
2021-11-23 18:06:09 +00:00
9d72bdda58 asio coap: If LWIP IPV6 is disabled, automatically don't build asio & coap
- Removes need to manually exclude these components as shown at
  https://github.com/espressif/esp-idf/issues/3781#issuecomment-825742378

- Hide the config for these components if IPV6 is disabled

- The components are still included in the build, but with no source
  files

Backport of e305f29382

Closes https://github.com/espressif/esp-idf/issues/7816
2021-11-23 22:39:58 +08:00
76ddca045e Merge branch 'bugfix/sleep_wrong_log_lvl_v4.3' into 'release/v4.3'
Sleep: fix wrong debug level (backport v4.3)

See merge request espressif/esp-idf!16037
2021-11-23 14:31:30 +00:00
f9c1ecba70 tools: add json schema for idf_size 2021-11-23 14:31:30 +01:00
b946d30602 Merge branch 'docs/update_esp32-c3_devkit_user_guide_backport_v4.3' into 'release/v4.3'
Docs/Update two ESP32-C3 devkit user guides (backport v4.3)

See merge request espressif/esp-idf!15303
2021-11-23 13:19:04 +00:00
4cb5d9a5c8 Merge branch 'bugfix/protocomm_nimble_allocation_v4.3' into 'release/v4.3'
Fix for potential allocation bug in protocomm_nimble.c (v4.3)

See merge request espressif/esp-idf!15997
2021-11-23 13:17:12 +00:00
5788bd02c6 esp_wifi: Modify Mexico channel refer to FCC
esp_coex: fix wrong alloctation for coex_funcs_t
2021-11-23 21:13:26 +08:00
793b814789 Merge branch 'mesh/bugfix_fix_layer2_node_connection_issue_v4.3' into 'release/v4.3'
mesh: fix the issue that layer2 node connect to lower-layer node when FIXED-ROOT root disappeared(backport_v4.3)

See merge request espressif/esp-idf!15660
2021-11-23 12:40:52 +00:00
1fbf3bcfef component/bt: fix crash when shutdown bt 2021-11-23 20:01:16 +08:00
a8fd3ef48e lwip: Add macro to disable vendor class option 2021-11-23 19:42:47 +08:00
2e8b419b7a Examples/PPPoS: Add mandatory delay after +++ command
Switching back from data (PPP) mode to command mode must be done is the following sequence:
* No characters entered for T1 time (1 second)
* "+++" characters entered with no characters in between (1 second)
* No characters entered for T1 timer (1 second)
(per specification of SIM800 SIM800_Series_AT_Command_Manual_V1.09.pdf)

Related https://github.com/espressif/esp-idf/issues/7608
2021-11-23 09:59:52 +01:00
f129871b72 Examples/PPPoS: Fixed missed NETIF_PPP_STATUS event unregister
NETIF_PPP_STATUS is registerd while modem gets attached to the related netif.
we don't have any network detach functionality in the modem component, so we
unregister the event during esp_modem_netif_clear_default_handlers().

Related https://esp32.com/viewtopic.php?f=13&t=23632
Related https://github.com/espressif/esp-idf/issues/7469
2021-11-23 09:59:52 +01:00
12509dd0c1 mdns: Fix parsing non-standard queries
Fix for packets containing unexpected domains, such as openthread.thread.home.arpa.
If we find this packet we set the name entry as invalid, but continue with parsing as the packet might contain related queries for us.

Closes https://github.com/espressif/esp-idf/issues/7694
2021-11-23 09:10:27 +01:00
633266105a Merge branch 'bugfix/doskey_v4.3' into 'release/v4.3'
tools: fix export.bat /tools/idf.py not found issue (v4.3)

See merge request espressif/esp-idf!16049
2021-11-23 07:38:45 +00:00
82144c913c Merge branch 'bugfix/archive_details_always_run_like_diff_v4.3' into 'release/v4.3'
tools: fix bug with idf_size argument archive_details (v4.3)

See merge request espressif/esp-idf!15775
2021-11-23 07:30:54 +00:00
88f671b54e Merge branch 'bugfix/create_dir_idf_env_v4.3' into 'release/v4.3'
tools: Create the ".espressif" directory on the first run on clean system (v4.3)

See merge request espressif/esp-idf!15856
2021-11-23 07:25:51 +00:00
43edf01b47 Merge branch 'bugfix/ps_export_prs_v4.3' into 'release/v4.3'
Tools: PowerShell export script improvements from PRs (v4.3)

See merge request espressif/esp-idf!15924
2021-11-23 07:25:45 +00:00
9a9afed5f1 Merge branch 'bugfix/tools_fix_win_gdb_dlls_v4.3' into 'release/v4.3'
tools: Fix missed DLLs in GDB for Windows (v4.3)

See merge request espressif/esp-idf!15895
2021-11-23 07:20:06 +00:00
d39bf64e17 Merge branch 'test/update_ble_mesh_console_files_for4.3' into 'release/v4.3'
test: fix ble mesh send problem (v4.3)

See merge request espressif/esp-idf!14489
2021-11-23 07:11:34 +00:00
0315383d92 test: fix ble mesh send problem (v4.3) 2021-11-23 07:11:34 +00:00
daaa29a439 Merge branch 'bugfix/simplify_codeowners_v4.3' into 'release/v4.3'
gitlab: simplify approvals for backports (v4.3)

See merge request espressif/esp-idf!15864
2021-11-23 07:10:23 +00:00
b1290591df Merge branch 'bugfix/register_non_32bit_access_v4.3' into 'release/v4.3'
hal: avoid non-32bit access to registers (v4.3)

See merge request espressif/esp-idf!15616
2021-11-23 07:09:41 +00:00
5934660e46 Merge branch 'bugfix/hfp_demo_audio_not_sine_v4.3' into 'release/v4.3'
fix hfp_ag demo audio not sine_v4.3

See merge request espressif/esp-idf!15747
2021-11-23 06:53:34 +00:00
9e37f39441 Merge branch 'bugfix/fix_ble_prefered_ext_conn_parameter_detection_v4.3' into 'release/v4.3'
component/bt: check the ble ext conn parameter(backport v4.3)

See merge request espressif/esp-idf!15769
2021-11-23 06:53:16 +00:00
5e179b19a3 Merge branch 'ci/fix_deploy_docs_preview_url_v4.3' into 'release/v4.3'
ci: update docs preview url (v4.3)

See merge request espressif/esp-idf!15508
2021-11-23 06:52:42 +00:00
e1aaa31140 docs/update_two_esp32-c3_devkit_user_guides 2021-11-23 14:46:19 +08:00
d1107db72d Merge branch 'bugfix/simple_sniffer_example_v4.3' into 'release/v4.3'
examples/simple_sniffer: only enable apptrace if JTAG is selected (backport v4.3)

See merge request espressif/esp-idf!13269
2021-11-23 06:41:04 +00:00
96b284bcd3 Merge branch 'bugfix/fix_static_check_error_mr_4.3' into 'release/v4.3'
Fix the high-impact issues from the code analysis report from customer.

See merge request espressif/esp-idf!16045
2021-11-23 06:36:23 +00:00
254b78d449 Merge branch 'bugfix/leedarson_v4.3' into 'release/v4.3'
component_bt: Fix some code logic errors (v4.3)

See merge request espressif/esp-idf!16026
2021-11-23 06:34:33 +00:00
e8153a3cd5 Merge branch 'bugfix/sig_ble_mesh_errata_e16350_v4.3' into 'release/v4.3'
ble_mesh: stack: Apply the errata E16350 from Bluetooth SIG (v4.3)

See merge request espressif/esp-idf!15784
2021-11-23 06:30:46 +00:00
07daa951b6 Merge branch 'bugfix/ble_mesh_host_init_v4.3' into 'release/v4.3'
ble_mesh: nimble: return error if init host twice (v4.3)

See merge request espressif/esp-idf!15788
2021-11-23 06:30:28 +00:00
a657543989 Merge branch 'bugfix/nimble_dirty_timer_handle_after_deinit_v4.3' into 'release/v4.3'
[NimBLE]: clear timer handler during de-initialization(backport v4.3)

See merge request espressif/esp-idf!16029
2021-11-23 06:24:11 +00:00
1e9872bd6a Merge branch 'bugfix/11kv_scan_event_removal_v4.3' into 'release/v4.3'
esp_wifi: Fixes related to 802.11kv (v4.3)

See merge request espressif/esp-idf!16038
2021-11-23 06:23:52 +00:00
b57fff983f Merge branch 'bugfix/fix_memory_leak_controller_deinit_v4.3' into 'release/v4.3'
ESP32: Fix memory leak in controller deinit function v4.3

See merge request espressif/esp-idf!15969
2021-11-23 06:19:52 +00:00
8a9ca26d61 Add hci command to set coexistence status 2021-11-23 11:40:17 +08:00
7092d7eff5 tools: {install, export}.bat: fix path quoting
Also includes fix for DOSKEY definitions.
Closes https://github.com/espressif/esp-idf/issues/7605
Closes https://github.com/espressif/esp-idf/issues/7927
2021-11-22 22:56:01 +01:00
911847e3ea Fix the high-impact issues from the code analysis report from customer.
For the CID10564,10384,10280,10098,10038,The memory was released in other place.
For the CID10365,it release the memory in the function when sent successfully.
For the CID10268,10011, we need not change the code.
2021-11-22 19:46:14 +08:00
a63084ae3f esp_wifi: Remove scan done event for supplicant scans
Closes https://github.com/espressif/esp-idf/issues/7423
2021-11-22 14:48:32 +05:30
9d174e7944 wpa_supplicant: Optimize BTM request scan 2021-11-22 14:45:58 +05:30
e615a9546b Sleep: fix wrong debug level
Fix usage of ESP_LOGD in sleep_modes.c which triggers a panic when
used in debug log level.

* Closes https://github.com/espressif/esp-idf/issues/7942
2021-11-22 16:42:48 +08:00
0c8fb540b2 Merge branch 'bugfix/fix_modem_sleep_hw_error_mr_4.3' into 'release/v4.3'
fix modem sleep hw error

See merge request espressif/esp-idf!16018
2021-11-22 06:34:33 +00:00
21666192d5 [nimble]: clear timer handler during de-initialization 2021-11-22 10:59:21 +08:00
92a4cdd7fd Missing break in switch 2021-11-22 10:47:28 +08:00
97e728a9aa Dereference null return value 2021-11-22 10:47:23 +08:00
a977434855 already defined in bt_target.h 2021-11-22 10:47:12 +08:00
50f34eb553 Dereference after null check 2021-11-22 10:47:07 +08:00
a7f26d24d9 Dereference before null check 2021-11-22 10:47:01 +08:00
6576cee0e8 Logically dead code 2021-11-22 10:46:55 +08:00
5a7ae2d8c8 1.It is abnormal when getting the deep sleep state bit. So we need to check
the state again and run the "ble_master_soft_rst()" if neesed.
2.fix HCI_Read_Clock error
3.fix HCI_Create_Connection_Cancel error
4.fix ASSERT_WARN during epr
2021-11-19 16:50:30 +08:00
fb4fc7ab48 idf_tools: Adds 'linux-armhf' platform support 2021-11-19 11:25:00 +03:00
db501ea0f2 tools: Updates OpenOCD version to 'v0.10.0-esp32-20211111' 2021-11-19 11:24:48 +03:00
ea3a586709 Fix the issue of device name len limited 2021-11-19 16:06:03 +08:00
e241ee32e7 Merge branch 'bugfix/fix_ota_crash_backport_v4.3' into 'release/v4.3'
spi_flash: fix app crash when OTA because the OTA task's stack is in rtc fast memory(backport v4.3)

See merge request espressif/esp-idf!15858
2021-11-19 04:54:25 +00:00
d47c54e706 Merge branch 'bugfix/protocomm_nimble_allocation' into 'master'
NimBLE: Fixed potential allocation bug in protocomm_nimble.c

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

See merge request espressif/esp-idf!15669
2021-11-18 14:16:25 +05:30
2406153a25 Merge branch 'add_agressive_revoke_v4.3' into 'release/v4.3'
secure_boot: Added Kconfig option for aggressive key revoke (v4.3)

See merge request espressif/esp-idf!15851
2021-11-18 02:58:48 +00:00
017f7a241a secure_boot: Do not allow key revocation in bootloader 2021-11-17 12:35:06 +05:30
812a92c703 secure_boot: Added Kconfig option for aggressive key revoke
Applicable to S2, C3, and S3
2021-11-17 12:35:06 +05:30
d49917edeb Merge branch 'bugfix/aes_unaligned_access_v4.3' into 'release/v4.3'
aes: fix unaligned access (v4.3)

See merge request espressif/esp-idf!15802
2021-11-17 03:57:14 +00:00
a397a70373 Merge branch 'bugfix/nvs_partition_encrypted_flag_compatibility_v4.3' into 'release/v4.3'
nvs: add config to ignore "encrypted" flag of nvs partitions (v4.3)

See merge request espressif/esp-idf!15921
2021-11-17 03:56:42 +00:00
fa640fef3e Merge branch 'bugfix/efuse_stdbool_v4.3' into 'release/v4.3'
efuse: Add missing stdbool.h include file (v4.3)

See merge request espressif/esp-idf!15936
2021-11-16 15:14:26 +00:00
b6806002df Merge branch 'bugfix/fix_http_head_request_v4.3' into 'release/v4.3'
esp_http_client: Fix HEAD request will affect the all next HTTP requests unless we close the HTTP request(backport v4.3)

See merge request espressif/esp-idf!15714
2021-11-16 15:13:09 +00:00
4841480a52 Merge branch 'bugfix/define__DOXYGEN___v4.3' into 'release/v4.3'
docs: define __DOXYGEN__ for doxygen builds (v4.3)

See merge request espressif/esp-idf!15680
2021-11-16 15:12:27 +00:00
38be4eef46 Merge branch 'bugfix/select_boot_app_v4.3' into 'release/v4.3'
partition_table: Fix case when a few similar to otadata partitions in the table (v4.3)

See merge request espressif/esp-idf!15647
2021-11-16 15:11:51 +00:00
0f96ebce13 ESP32: Fix memory leak in controller deinit function
Added change to dealloc s_pm_lock in controller deinit as it gets allocated
during init procedure.

Closes https://github.com/espressif/esp-idf/issues/7653
2021-11-16 10:43:38 +05:30
728c391766 efuse: Enable C++ linkage for the include headers on esp_efuse.h
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-11-12 13:30:11 -03:00
985ca0bcf2 efuse: Add missing stdbool.h include file
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-11-12 13:30:10 -03:00
896f6f2dfc Tools: Make clear the used platform in the PowerShell export script 2021-11-12 07:52:19 +01:00
ddf79c2be9 Define $IsWindows if not defined.
The `$IsWindows` PowerShell variable was added in PowerShell Core 6 and
PowerShell 7, and is not present in earlier PowerShell versions. Set to
true if undefined. This fixes https://github.com/espressif/esp-idf/issues/7820.

The first version to run on non-Windows platforms was PowerShell Core
6.0[^1] which means that IsWindows is guaranteed to be defined on all
non-Windows systems. So, if undefined this indicates a Windows platform.

[^1]: https://docs.microsoft.com/en-us/powershell/scripting/install/powershell-support-lifecycle?view=powershell-7.2#release-history

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

Closes https://github.com/espressif/esp-idf/issues/7820
2021-11-12 07:52:18 +01:00
35a949ea66 Initialize $envvars_array to an empty list.
With strict debugging, i.e. `Set-PSDebug -strict`, execution of export.ps1 will
report the following error:

```
The variable '$envars_array' cannot be retrieved because it has not been set.
At C:\path\to\export.ps1:15 char:1
+ $envars_array # will be filled like:
+ ~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (envars_array:String) [], RuntimeException
    + FullyQualifiedErrorId : VariableIsUndefined
```

Closes https://github.com/espressif/esp-idf/pull/7819
2021-11-12 07:52:17 +01:00
2b4604ce8e spi_flash: minor cleanup, use type/subtype from esp_partition.h 2021-11-12 09:44:04 +05:30
893342794f nvs: add config to ignore "encrypted" flag of nvs partitions
This is to allow having pre IDF v4.3 behavior where "encrypted"
flag was not being checked for NVS partitions.

It is recommended to enable this new config only if you have
production devices where NVS partition was being set with "encrypted"
flag by mistake.

Please see commit aca9ec28b3 which
introduced check to not allow NVS partitions with "encrypted" flag set.

More discussion on this at:
https://github.com/espressif/esp-idf/issues/5747#issuecomment-956223024
https://github.com/espressif/esp-idf/issues/7839#issuecomment-961477667

Closes https://github.com/espressif/esp-idf/issues/7839
Closes IDFGH-6162
2021-11-12 09:44:04 +05:30
8999626545 esp_eth: optimize dm9051 Tx throughput 2021-11-11 14:41:58 +08:00
9102574a9d tools: Fix missed DLLs in GDB for Windows 2021-11-10 17:08:05 +07:00
6085518bcb fix (gdbstub): added xtensa, esp32 as public includes in component.mk
Closes https://github.com/espressif/esp-idf/issues/7846
2021-11-10 13:45:05 +08:00
0261b78c0c gitlab: simplify approvals for backports (v4.3) 2021-11-09 18:36:33 +01:00
49add90a1b change --archive_details output 2021-11-09 14:43:26 +01:00
04ac2b319a fix: app crash when OTA because the OTA task's stack is in rtc fast memory 2021-11-09 19:51:35 +08:00
c652c1de0c tools: Create the ".espressif" directory on the first run on clean system
Closes https://github.com/espressif/esp-idf/issues/7848
2021-11-09 12:03:08 +01:00
22fad5110c fix bootloader build with rom flash driver
Closes https://github.com/espressif/esp-idf/pull/7508
Closes https://github.com/espressif/esp-idf/issues/6849
2021-11-08 14:14:53 +08:00
08aacb02f7 Increased LAN8720 ETH-PHY reset assertion time (IDFGH-6018)
Increase reset assertion time from 100µs (as specified minimum in the datasheet) to 150µs.
Some specimen of the LAN8720 need the reset signal asserted longer than 100µs to initialise properly. Otherwise they are in a zombie state where they are establishing and loosing an Ethernet link once in a seconds interval.
2021-11-05 11:46:58 +01:00
b0c1ceca06 spi_flash: No CPU release time for an erase operation when OS is not running
During the early start, the virtual eFuse mode can call erase operations when OS is not yet running.

Possible workaround: CONFIG_SPI_FLASH_YIELD_DURING_ERASE=n

Fixed for the legacy flash driver as well.
2021-11-04 15:18:44 +08:00
b1d346f682 bootloader: disable psram cache bug fix for bootloader
The psram cache bug fix was also being applied to the bootloader binary (for cmake),
which doesnt do any psram access.

Applying this fix would increase the binary size, as much as 300 bytes in worst case scenarios
2021-11-04 11:32:07 +08:00
1c9f018891 aes: fix potential unaligned access in aes-gcm 2021-11-04 10:59:53 +08:00
b57a1d7f48 ci: update docs preview url 2021-11-04 02:41:56 +00:00
79b59947d8 aes: fix potential unaligned access of buffers
https://github.com/espressif/esp-idf/issues/7236
2021-11-04 10:35:55 +08:00
519f17f831 docs: define __DOXYGEN__ for doxygen builds
Some docs depended on __DOXYGEN__ but this was never defined anywhere.
2021-11-04 10:14:49 +08:00
lly
fe9efd2770 ble_mesh: nimble: return error if init host twice 2021-11-03 19:22:25 +08:00
lly
aab04816f9 ble_mesh: stack: Apply the errata E16350 from Bluetooth SIG 2021-11-03 19:05:14 +08:00
6a57c4d5d5 newlib: fix clang atomics
Correction of the SYNC_LOCK_* macros in stdatomic
2021-11-02 16:24:18 +01:00
710c1f2fad remove __clang ifdef around atomic emulation
* CI errors led me to believe these were needed, but as it turns out the
load/store intrinsics are required even when idf is built by gcc when
linking to a clang based project.
* remove ... postfix inside `SYNC_LOCK_TEST_AND_SET` expansion
2021-11-02 16:24:18 +01:00
b01c197505 newlib: provide missing atomic libcalls
Provide emulated atomic load & store libcalls for u8, u16 & u32 integer
types. This is required when building with Clang as llvm does not lower
these operations to native load / stores, where as gcc does.

Provide `sync_lock_test_and_set` atomic implementations for all
supported integer types.

Closes https://github.com/espressif/esp-idf/issues/7591.
Closes https://github.com/espressif/esp-idf/issues/7592.
2021-11-02 16:24:18 +01:00
de5e0fa3bd newlib,clang: implement __sync_* atomics for clang/llvm toolchain. 2021-11-02 16:24:18 +01:00
d4f2e03e4a newlib: stdatomic: emulate 64-bit atomics on 32-bit SMP SoCs
Closes https://github.com/espressif/esp-idf/issues/3163
2021-11-02 16:24:18 +01:00
be520f975a newlib: stdatomic: fix prototypes, don't disable compiler warnings 2021-11-02 16:24:18 +01:00
2250da111e stdatomic: Implemented legacy __sync APIs and __atomic_exchange_n
These APIs are used when the architecture doesn't have atomic
instruction support

Closes https://github.com/espressif/esp-idf/issues/6463
2021-11-02 16:24:18 +01:00
5f2fabb2b1 arch: move stdatomic 2021-11-02 16:24:18 +01:00
d4ea7df9b5 tools: fix bug with idf_size argument archive_details 2021-11-02 14:17:23 +01:00
173f7e87aa esp_timer: init rtc timer and system timer in early init 2021-11-02 17:33:31 +08:00
b5fe84a250 esp_timer: allow querying the timer before esp_timer_init is called 2021-11-02 17:33:07 +08:00
5ff15a3895 component/bt: check the ble ext conn parameter 2021-11-02 15:32:13 +08:00
cbfffc7269 esp_http_client: Fix HEAD request will affect the all next HTTP requests unless we close the HTTP request
Closes https://github.com/espressif/esp-idf/issues/7777
2021-11-01 17:21:21 +08:00
ec43017afe fix hfp_ag demo audio not sine_v4.3 2021-11-01 11:23:24 +08:00
e335a16356 efuse_table_gen: Fixes wrong joining fields with omitted names
The issue is related to the non-sequential way of description when
such fields going together sequential.

Related to esp32h2 chip for eFuses: MAC_FACTORY and MAC_EXT.
The issue is in wrong indexes of MAC_EXT.
MAC_EXT got indexes like it is joined to MAC_FACTORY.

const esp_efuse_desc_t* ESP_EFUSE_MAC_FACTORY[] = {
    &MAC_FACTORY[0],
    &MAC_FACTORY[1],
    &MAC_FACTORY[2],
    &MAC_FACTORY[3],
    &MAC_FACTORY[4],
    &MAC_FACTORY[5],
    NULL
};

const esp_efuse_desc_t* ESP_EFUSE_MAC_EXT[] = {
    &MAC_EXT[6],
    &MAC_EXT[7],
    NULL
};

This commit fixed it to:

const esp_efuse_desc_t* ESP_EFUSE_MAC_EXT[] = {
    &MAC_EXT[0],
    &MAC_EXT[1],
    NULL
};
2021-10-29 19:36:26 +08:00
57131eff89 mesh: fix the issue that layer2 node connect to lower-layer node when FIXED-ROOT root disappeared 2021-10-29 16:43:22 +08:00
d85b0b869b ci: Add retries on runner system failures 2021-10-29 13:50:38 +07:00
b2fba50e78 Remove dummy defines of Classic BT 2021-10-29 14:37:23 +08:00
98d34e5f6d Merge branch 'wifi_prov_mgr_fix_v4.3' into 'release/v4.3'
Wifi_prov_mgr: Fix for ios device needs to do forget device (v4.3)

See merge request espressif/esp-idf!15484
2021-10-29 06:30:25 +00:00
f765b7acb6 Make ESP32 Bluetooth stack architecture Doc only visible for ESP32 2021-10-29 14:26:25 +08:00
58ff27cc03 Make Classic BT related document links only visible for ESP32 2021-10-29 14:25:31 +08:00
3f752f7e0d Merge branch 'bugfix/fix_phy_usb_issue_v4.3' into 'release/v4.3'
esp_phy: fix esp32c3 phy USB & RSSI issue(V4.3)

See merge request espressif/esp-idf!15648
2021-10-29 03:13:02 +00:00
2acbecbb40 Merge branch 'bugfix/sync_rtc_and_esp_timer_before_reboot_v4.3' into 'release/v4.3'
esp_system: Adds sync of FRC & RTC counters in esp_restart (v4.3)

See merge request espressif/esp-idf!15655
2021-10-28 17:33:47 +00:00
8140b10a16 esp_system: Adds sync of FRC & RTC counters in esp_restart (v4.3) 2021-10-28 17:33:46 +00:00
33a616d6a0 esp_phy: fix esp32c3 phy USB & RSSI issue 2021-10-28 17:52:01 +08:00
534ca101e4 Merge branch 'refactor/systimer_reset_alternative_v4.3' into 'release/v4.3'
Systimer reset alternative on S2 (and others) (v4.3)

See merge request espressif/esp-idf!15652
2021-10-28 08:00:29 +00:00
fa85714845 Systimer reset alternative on S2 (and others) (v4.3) 2021-10-28 08:00:28 +00:00
181e51a596 Merge branch 'bugfix/eap_client_iot_issues_v4.3' into 'release/v4.3'
ESP_WiFi: Fix some wpa enterprise issue (backport v4.3)

See merge request espressif/esp-idf!15567
2021-10-28 05:59:09 +00:00
6c1c6a3e37 Merge branch 'bugfix/modbus_allow_master_slave_work_simultaneously_v43' into 'release/v4.3'
freemodbus: fix issues when modbus master and slave work simultaneously (backport v4.3)

See merge request espressif/esp-idf!14930
2021-10-28 03:08:12 +00:00
4f716817e0 freemodbus: fix issues when modbus master and slave work simultaneously (backport v4.3) 2021-10-28 03:08:12 +00:00
6acb4620b4 wpa_supplicant: Add missing cflag for legacy makefile 2021-10-28 11:07:05 +08:00
e78d06beb2 wpa_supplicant: Update internal tls client with sha384/sha512 support
Add support for validating certificates with SHA384 and SHA512 hashes.
2021-10-28 11:07:05 +08:00
d680db8ed3 esp_wifi: Fix interoperability issue with windows 2008 2021-10-28 11:07:05 +08:00
8165bbca55 Merge branch 'bugfix/heartbeat_filter_with_acceptlist_v4.3' into 'release/v4.3'
ble_mesh: stack: Fix heartbeat filter with accept list (v4.3)

See merge request espressif/esp-idf!15676
2021-10-28 02:58:25 +00:00
8051d60d0b Merge branch 'bugfix/examples_connect_openeth_v4.3' into 'release/v4.3'
examples/protocols: fix compilation when CONFIG_EXAMPLE_USE_OPENETH=y (v4.3)

See merge request espressif/esp-idf!15654
2021-10-28 02:05:29 +00:00
0b6fc0b7e8 Merge branch 'bugfix/ci_fix_test_build_system_cmake_v4.3' into 'release/v4.3'
ci: Fix concurrency issues for macOS build system tests (v4.3)

See merge request espressif/esp-idf!14398
2021-10-27 20:59:25 +00:00
befd021767 Merge branch 'bugfix/gdbstub_4_c3_v4.3' into 'release/v4.3'
bugfix/esp-gdbstrub: add missing function for esp32c3 (backport v4.3)

See merge request espressif/esp-idf!15665
2021-10-27 09:49:35 +00:00
3139ef5ab6 ble_mesh: stack: Fix heartbeat filter with accept list 2021-10-27 16:32:17 +08:00
c11d71f06f Merge branch 'bugfix/remove_assert_when_inq_done_4.3' into 'release/v4.3'
component_bt: fix crash after inquiry has finished (v4.3)

See merge request espressif/esp-idf!15666
2021-10-27 08:29:05 +00:00
25a7cdcbd3 Remove assert when inq done
Closes https://github.com/espressif/esp-idf/issues/6759
2021-10-27 11:34:51 +08:00
8cb6baac6c bugfix/esp-gdbstrub: add missing function for esp32c3/esp32h2. 2021-10-27 11:03:35 +08:00
44c701abb6 Merge branch 'feature/toolchain_2021r2_v4.3' into 'release/v4.3'
Update toolchains to esp-2021r2 (v4.3)

See merge request espressif/esp-idf!15638
2021-10-26 20:13:28 +00:00
fd9bfb42a1 ci: Fix concurrency issues for macos buildsystem tests 2021-10-26 22:07:53 +08:00
feaf29a340 examples/protocols: fix compilation when CONFIG_EXAMPLE_USE_OPENETH=y
The code checked CONFIG_ETH_USE_SPI_ETHERNET (which is usually set),
but CONFIG_EXAMPLE_ETH_SPI_xxx_GPIO options are only defined if
CONFIG_EXAMPLE_USE_SPI_ETHERNET is set. Fix the ifdef accordingly.
Regression from aea901f0.
2021-10-26 12:39:46 +02:00
208b41975b partition_table: Fix case when a few similar to otadata partitions in the table
It was when in the partition table there is a partition with type="data" and suptype=""(empty),
in this case type=1, suptype=0. It is similar to otadata partition.

This commit fixes it, now it will handle it as type=1, suptype=6 (ESP_PARTITION_SUBTYPE_DATA_UNDEFINED).
2021-10-26 16:07:31 +08:00
54b25318cd Merge branch 'bugfix/remove_dis_rtc_ram_boot_efuse_bit_backport_v4.3' into 'release/v4.3'
efuse: remove DIS_RTC_RAM_BOOT efuse bit (backport v4.3)

See merge request espressif/esp-idf!15233
2021-10-26 03:59:46 +00:00
034dd2da18 docs: update assignment type for .bit_per_sample 2021-10-26 11:33:53 +08:00
798b52af1d Update toolchains to esp-2021r2
Updated GDB to 9.2 version for xtensa chips
    Fixed coredump work for xtensa chips
    Fixed backtrace for xtensa chips
    Fixed multilib for riscv32 chips
    Fixed running GDB on some RaspberryPi configuration for riscv32 chip
    Fixed support of fnmatch(), iconv() and some other posix functions in stdlib

    Closes https://github.com/espressif/esp-idf/issues/6124
    Closes https://github.com/espressif/esp-idf/issues/2484
    Closes https://github.com/espressif/esp-idf/issues/3264
    Closes https://github.com/espressif/crosstool-NG/issues/13
    Closes https://github.com/espressif/crosstool-NG/pull/16
2021-10-25 20:19:55 +07:00
c0e96ceb34 test_apps/panic: remove workaround for incorrect GDB backtrace 2021-10-25 20:19:55 +07:00
6e48d5bd6b coredump: update test data for toolchain 2021r2 2021-10-25 20:19:52 +07:00
a3ff680dff Merge branch 'bugfix/tools_fix_win_c3_gdb_v4.3' into 'release/v4.3'
tools: Update ESP32-C3 toolchain for Windows, added some missed DLLs for GDB (backport v4.3)

See merge request espressif/esp-idf!14298
2021-10-25 13:07:29 +00:00
dfe5f7432f Merge branch 'bugfix/fix_ble_scan_failed_issue_master_4.3' into 'release/v4.3'
Fix the ble scan failed issue

See merge request espressif/esp-idf!15588
2021-10-25 07:53:16 +00:00
717627ad1a Merge branch 'feature/add_README_for_controller_hci_uart_demo_v4.3' into 'release/v4.3'
feature/add README.md for demo controller_hci_uart_demo_4.3

See merge request espressif/esp-idf!15569
2021-10-25 07:36:53 +00:00
62bd98158f hal: avoid non-32bit access to registers 2021-10-25 11:33:50 +08:00
b5936c8323 Merge branch 'bugfix/i2c_cxx_warning_4.3' into 'release/v4.3'
[cxx]: Added virtual desctructor in I2C class (backport 4.3)

See merge request espressif/esp-idf!15465
2021-10-22 14:41:53 +00:00
81047b02d0 Merge branch 'bugfix/support_py34-35_cffi' into 'release/v4.3'
Tools: Constrain the cffi package for older pythons

See merge request espressif/esp-idf!15598
2021-10-22 13:52:24 +00:00
e4995581dc Merge branch 'bugfix/esp32_app_cpu_core_cache_access_err' into 'release/v4.3'
esp32: fix cache access error exception for APP CPU core

See merge request espressif/esp-idf!15586
2021-10-22 09:10:22 +00:00
9a59b6379c Merge branch 'ci/update_esp_eth_cert_v4.3' into 'release/v4.3'
ci: update cert used for esp_eth test (v4.3)

See merge request espressif/esp-idf!15584
2021-10-22 06:54:59 +00:00
498c159b55 Merge branch 'bugfix/fix_efuse_err_address_backport4.3' into 'release/v4.3'
fix efuse err address in block0 (backport v4.3)

See merge request espressif/esp-idf!14814
2021-10-22 05:06:41 +00:00
e5bd4427e3 fix efuse err address in block0 (backport v4.3) 2021-10-22 13:06:40 +08:00
49a5cd23a4 Merge branch 'bugfix/fix_stuck_in_rtc_clk_calibration_backport_v4.3' into 'release/v4.3'
[bugfix] Fix stuck in rtc clk calibration (backport v4.3)

See merge request espressif/esp-idf!15526
2021-10-22 03:03:54 +00:00
7c52647243 fix stuck in rtc_clk_cal 2021-10-21 21:54:04 +08:00
fd5a63f31e modify csv & generate
update efuse_reg.h & efuse_struct.h & references in rst file
2021-10-21 19:24:12 +08:00
2dec9fadf9 Tools: Constrain the cffi package for older pythons 2021-10-21 11:43:19 +02:00
7a0a6879e3 Wifi_prov_mgr:Fix for ios device needs to do forget device 2021-10-21 10:11:58 +05:30
625bd4f767 Merge branch 'bugfix/btdm_fix_some_bluedroid_issues_v4.3' into 'release/v4.3'
Fix some bluedroid issues(backport v4.3)

See merge request espressif/esp-idf!15230
2021-10-21 03:49:20 +00:00
521c0ef956 1.Fix the ble scan failed issue, this may happen in coexit environment
2.Fix connection failed with LG 5.0 phone
3.Check only for same X component of public key in BR/EDR
2021-10-21 10:45:25 +08:00
28f8ac5f12 cpu_start: rename function to add core prefix for more clarity 2021-10-21 08:09:14 +05:30
76e606ab32 cpu_start: let individual core clear its interrupt matrix
There was race condition where interrupt entries set by APP cpu core
could have been cleared during PRO cpu startup.

This was causing "cache access error" not being detected for ESP32 APP
CPU core.

This fix allows to NOT modify or clear any entries set by other core
(APP or PRO) and thus avoiding any race conditions during startup code.
2021-10-21 08:03:55 +05:30
1eab7a033b ci: update cert used for esp_eth test 2021-10-21 10:06:03 +08:00
75d98216a2 add README.md for demo controller_hci_uart_demo 2021-10-19 21:57:45 +08:00
eef5add97e Merge branch 'bugfix/fix_esp32s2_deep_sleep_timer_wake_up_fail_backport_v4.3' into 'release/v4.3'
rtc: fix esp32s2 fall into sleep forever when deep-sleep time is set to 0(backport v4.3)

See merge request espressif/esp-idf!13560
2021-10-19 04:44:47 +00:00
43d2a6eeed Merge branch 'bugfix/modbus_add_task_affinity_and_callbacks_v43' into 'release/v4.3'
freemodbus: add affinity option for modbus stack tasks (backport v4.3)

See merge request espressif/esp-idf!14540
2021-10-19 04:11:51 +00:00
2318522f04 Merge branch 'feature/support_ota_multi_phy_v4.3' into 'release/v4.3'
esp_wifi: support multi phy init data bin embedded(v4.3)

See merge request espressif/esp-idf!13868
2021-10-18 13:47:28 +00:00
d474c76556 Merge branch 'bugfix/btdm_ble_data_length_update_fail_v4.3' into 'release/v4.3'
Fix data length update failed(release v4.3)

See merge request espressif/esp-idf!15502
2021-10-18 03:07:14 +00:00
5a0b570702 Merge branch 'bugfix/modbus_fix_stack_reinitialization_sequence_v43' into 'release/v4.3'
modbus: fix stack reinitialization sequence (backport v4.3)

See merge request espressif/esp-idf!15402
2021-10-18 01:45:12 +00:00
2e8abdb814 Merge branch 'bugfix/fix_touch_sensor_measure_start_wait_time_backport_v4.3' into 'release/v4.3'
Bugfix(Touch): fix the touch sensor wait cycle after wakeup from sleep (backport v4.3)

See merge request espressif/esp-idf!13640
2021-10-18 01:42:41 +00:00
14977d7561 Merge branch 'bugfix/spi_ll_intr_bits_v4.3' into 'release/v4.3'
spi: Fix wrong target register for interrupt disable (v4.3)

See merge request espressif/esp-idf!14404
2021-10-16 16:18:10 +00:00
8732cc6c6b Merge branch 'bugfix/timer_example_crashed_not_calling_timer_group_set_alarm_value_in_isr_v4.3' into 'release/v4.3'
driver/timer: fixed auto reload problem in default isr callback (backport to 4.3)

See merge request espressif/esp-idf!13529
2021-10-16 15:59:26 +00:00
60ad592a23 Merge branch 'bugfix/retry_download_submodule_v4.3' into 'release/v4.3'
ci: retry download from Gitlab on error 500 (v4.3)

See merge request espressif/esp-idf!15532
2021-10-15 17:01:28 +00:00
61bd1eb225 Merge branch 'bugfix/xmc_overerase_v4.3' into 'release/v4.3'
bootloader: add xmc spi_flash startup flow to improve reliability (v4.3)

See merge request espressif/esp-idf!14768
2021-10-15 16:52:25 +00:00
9e0c9be1d4 Merge branch 'feature/essp_spi_driver_v4.3' into 'release/v4.3'
essl: add essl spi support to communicate with spi slave hd mode (v4.3)

See merge request espressif/esp-idf!14702
2021-10-15 11:23:36 +00:00
9645d8d015 ci: increase the job number of ESP32 unit test 2021-10-15 17:21:41 +08:00
f7d023383b ci: revert type annotations in gitlab_api.py to python2 compatible 2021-10-15 10:57:08 +02:00
5b52358092 freemodbus: check/fix reinitialization issues (tcp master and slave examples) 2021-10-15 16:50:33 +08:00
52a8f6cdd5 essl: add essl spi support to communicate with spi slave hd mode 2021-10-15 16:50:24 +08:00
98c1974fb5 Merge branch 'bugfix/stack_init_check_v4.3' into 'release/v4.3'
Nimble: Check stack status before executing stack command (v4.3)

See merge request espressif/esp-idf!15321
2021-10-15 07:53:32 +00:00
dacd74cd0f Merge branch 'bugfix/mdns_remove_service4.3' into 'release/v4.3'
mdns: fix memory free issue when repeating the query in reply (v4.3)

See merge request espressif/esp-idf!13516
2021-10-15 05:03:50 +00:00
81e1277559 ci: retry Gitlab operations on error 500 2021-10-15 09:32:24 +07:00
39528b1783 ci: retry download artifacts 2021-10-15 09:32:11 +07:00
fa0dc23a71 Merge branch 'flash/support_gd_32Mb' into 'release/v4.3'
spi_flash: support 32Mb-addess flash(backport v4.3)

See merge request espressif/esp-idf!13654
2021-10-15 01:48:59 +00:00
d5699b08cc Merge branch 'backport/v4.3/dockerfile_multiarch' into 'release/v4.3'
Dockerfile working on x64/ARM (v4.3)

See merge request espressif/esp-idf!15521
2021-10-14 21:14:48 +00:00
d4fd54f8ce spi_flash: fix the corruption of ROM after calling bootloader_execute_flash_command
The user register, especially dummy related ones, needs to be restored, otherwise the ROM function will not work.

Introduced in dd40123129.
2021-10-15 02:18:03 +08:00
e00f6cbde9 bootloader: add xmc spi_flash startup flow to improve reliability 2021-10-15 01:49:46 +08:00
5875b03266 Merge branch 'bugfix/fix_bit_error_in_ledc_struct_backport_v4.3' into 'release/v4.3'
LEDC: fix bit error in ledc_struct.h(backport v4.3)

See merge request espressif/esp-idf!14162
2021-10-14 17:41:00 +00:00
0b556de95c mdns: fix memory free issue when repeating the query in reply
The repeated query will be copied in the next event loop while the
memory is freed instantly. Delay the free to fix this issue.
2021-10-14 17:31:01 +02:00
b4b57a25b8 esp_wifi: backport some wifi fix
1.support multi phy init data bin embedded
2.fix not tx 9M rate issue
2021-10-14 21:37:57 +08:00
e1353a1a0e Dockerfile working on x64/ARM 2021-10-14 13:03:35 +02:00
ce9e615679 Merge branch 'feature/esp32c3_usbjtagserial_v4.3' into 'release/v4.3'
usb_serial_jtag: support usb_serial_jtag on esp32c3(backport v4.3)

See merge request espressif/esp-idf!15319
2021-10-14 10:38:02 +00:00
1ea757c0f1 component/bt: Modify the bluetooth device name length limits 2021-10-14 18:24:17 +08:00
8ab23d4395 Driver(Touch sensor): fix the touch sensor wait cycle after wakeup from sleep 2021-10-14 17:17:45 +08:00
1cddcd010c Merge branch 'bugfix/fix_cplusplus_miss_in_dhcp_v4.3' into 'release/v4.3'
dhcpserver: support cplusplus (backport v4.3)

See merge request espressif/esp-idf!15448
2021-10-14 09:12:02 +00:00
1b75fb5622 Merge branch 'bugfix/spi_master_crash_cache_disabled_v4.3' into 'release/v4.3'
spi_master: fix the crash when using interrupt mode when cache is disabled (v4.3)

See merge request espressif/esp-idf!14681
2021-10-14 07:15:54 +00:00
340a4a95ee Merge branch 'bugfix/i2s_write_failed_in_32bit_slave_mode' into 'release/v4.3'
i2s: fix write failure issue in slave mode (backport v4.3)

See merge request espressif/esp-idf!15081
2021-10-14 01:46:57 +00:00
82927f768b Merge branch 'feat/lock_ldgen_order' into 'release/v4.3'
feature: lock ldgen entries order

See merge request espressif/esp-idf!15137
2021-10-13 16:04:39 +00:00
594f604e7d component/bt: fix data length update failed 2021-10-13 19:55:43 +08:00
75916a8758 Merge branch 'bugfix/cpu_reset_perip_clk_disable_v4.3' into 'release/v4.3'
esp_system: Peripheral clocks faulty become disabled during cpu reset

See merge request espressif/esp-idf!15482
2021-10-13 10:04:13 +00:00
404ee09181 feat: ldgen generate ld files with fixed order of entries
the frozenset order inside could be different
2021-10-13 17:40:55 +08:00
d480469aa3 Merge branch 'feature/windows_installer_moved_to_github_backport_4.3' into 'release/v4.3'
tools: Windows Installer project moved to github.com/espressif/idf-installer - backport v4.3

See merge request espressif/esp-idf!15474
2021-10-13 09:00:55 +00:00
faa44d5843 Merge branch 'backport/v4.3/8_16bits_periph_access' into 'release/v4.3'
bugfix/driver: fix and cleanup soc/ll stuffs (backport v4.3)

See merge request espressif/esp-idf!15204
2021-10-13 08:30:51 +00:00
6c01cdc38f Merge branch 'feature/add_official_support_for_gd_v4.3' into 'release/v4.3'
spi_flash(bootloader): adjust unlock patch from rom patch into bootloader, and add support for GD chips (backport v4.3)

See merge request espressif/esp-idf!14605
2021-10-13 08:28:10 +00:00
07410a1381 i2s: fix write failure issue in slave mode 2021-10-13 10:22:26 +08:00
33fe673e85 freemodbus: add affinity option for modbus stack tasks 2021-10-12 17:38:39 +08:00
72cbfbf26a ci: Remove public headers check exceptions for dhcp 2021-10-12 14:25:38 +08:00
6e182d7ed3 dhcpserver: support cplusplus
Closes https://github.com/espressif/esp-idf/issues/7494

Merges https://github.com/espressif/esp-idf/pull/7526
2021-10-12 14:25:38 +08:00
023bbe5cb1 esp_system: fix the bug that some peripheral clocks are being disabled during cpu reset for esp32s2, c3, s3 2021-10-12 11:37:17 +08:00
e226a65a1f spi_flash: add support for 32Mbit address GD flash, for GD25Q256 2021-10-12 10:53:07 +08:00
91fa868bd6 twai: update register struct file 2021-10-12 10:42:04 +08:00
29accf2533 soc/ll: workaround compiler bug that generate 8/16 bits inst instead of 32 bits one
Note: on ESP32 UART rxfifo seems to be read as u8 instead of u32 to make it work
2021-10-12 10:42:04 +08:00
50b5ff058c [cxx]: Added virtual desctructor in I2C class
Closes https://github.com/espressif/esp-idf/issues/7435
2021-10-12 10:21:26 +08:00
157c27e8cf tools: remove dependency on Windows installer - backport 2021-10-11 12:18:16 +02:00
f49d6bf061 usb_serial_jtag: fix the bug that cannot write with usb_jtag 2021-10-11 17:34:24 +08:00
d6cdb3e0ae usb_serial_jtag: support usb_serial_jtag on esp32c3
USB serial/jtag controller: Add vfs (logging/printf), panic handler, gdb support.

See merge request espressif/esp-idf!12925
2021-10-11 17:34:24 +08:00
ba15ac8634 Merge branch 'fix/update_https_example_root_certificate_v4.3' into 'release/v4.3'
Updated the root certificate of https examples (v4.3)

See merge request espressif/esp-idf!15437
2021-10-11 04:00:38 +00:00
e1b9532848 Merge branch 'bugfix/memprot_wrong_fi_check_v4.3' into 'release/v4.3'
System/Memprot: Fixed voltage glitching detection logic (v4.3)

See merge request espressif/esp-idf!15412
2021-10-11 03:02:51 +00:00
ea06ee1ad6 spi_flash: move the unlock patch to bootloader and add support for GD 2021-10-11 10:52:52 +08:00
a05d4e9e86 Merge branch 'bugfix/bugfix/gpio_cant_hold_v4.3' into 'release/v4.3'
gpio: fix issue that gpio cannot hold during deep-sleep on c3 (backport v4.3)

See merge request espressif/esp-idf!15358
2021-10-11 02:30:22 +00:00
64fe41a7dc Merge branch 'bugfix/constrain_cryptography' into 'release/v4.3'
Tools: Constrain the cryptography package version in order to avoid breaking changes

See merge request espressif/esp-idf!15410
2021-10-10 17:18:49 +00:00
c990c8f752 Merge branch 'bugfix/memprot_bad_esp_restart_check_v4.3_3' into 'release/v4.3'
System/Security: wrong check of the Memprot feature in esp_restart()/panic_restart() (v4.3)

See merge request espressif/esp-idf!15424
2021-10-10 13:01:23 +00:00
d3ec2dc904 Merge branch 'feature/github-7632_v4.3' into 'release/v4.3'
esp_crt_bundle: remove EC-ACC certificate (v4.3)

See merge request espressif/esp-idf!15434
2021-10-10 11:25:48 +00:00
e7cc27417f Merge branch 'feature/support_sdspi_on_s2_c3-backport_v4.3' into 'release/v4.3'
example: support sdspi on s2 c3 (backports v4.3)

See merge request espressif/esp-idf!15426
2021-10-09 09:57:21 +00:00
3bcc85d96d Merge branch 'bugfix/enable_gpio_20_v4.3' into 'release/v4.3'
gpio: Enable IO20 on ESP32 (backport v4.3)

See merge request espressif/esp-idf!15022
2021-10-09 08:44:17 +00:00
0e0e298322 Merge branch 'feature/ledc_use_rtc8m_or_xtal_lightsleep_v4.3' into 'release/v4.3'
backport v4.3: support RTC8M and XTAL power domain in light sleep mode

See merge request espressif/esp-idf!15362
2021-10-09 07:28:39 +00:00
cbfa3eb350 gpio: fix issue that gpio cannot hold during deep-sleep on c3, Closes https://github.com/espressif/esp-idf/issues/7455 2021-10-08 19:56:14 +08:00
e8394e801f Merge branch 'bugfix/ping_iface_v4.3' into 'release/v4.3'
lw ip: Fix ICMP Ping on specific iface (GitHub PR) (v4.3)

See merge request espressif/esp-idf!15145
2021-10-08 06:10:12 +00:00
166790d354 Merge branch 'bugfix/a2dp_no_audio_transmitted_v4.3' into 'release/v4.3'
bugfix/fix wrong clock_id in function `time_now_us` (v4.3)

See merge request espressif/esp-idf!15316
2021-10-08 06:01:22 +00:00
5a26d7008d component/bt: set ext adv param failed when stop ext adv 2021-10-08 11:58:15 +08:00
c0695e4216 example/storage: fix incorrect SDSPI DMA setting on c3
Closes https://github.com/espressif/esp-idf/issues/7389
2021-10-08 11:53:18 +08:00
222f48367f Update example test for esp_http_client 2021-10-07 17:47:12 +05:30
ee409e042a Updated the root certificate of https examples 2021-10-07 17:46:02 +05:30
caafeff63f esp_crt_bundle: remove EC-ACC certificate
Fixes bug #7631
2021-10-07 13:13:52 +05:30
ec6745a137 System/Security: wrong check of the Memprot feature in esp_restart()/panic_restart()
esp_restart()/panic_restart() never resets the Digital system (so far required only by the Memprot feature) as there's a typo in the corresponding #define:
it checks CONFIG_ESP_SYSTEM_CONFIG_MEMPROT_FEATURE instead of CONFIG_ESP_SYSTEM_MEMPROT_FEATURE.
Issue fixed.

IDF-4094
2021-10-05 11:58:31 +02:00
86b7acc932 Merge branch 'bugfix/freemodbus_change_max_task_prio_v43' into 'release/v4.3'
Bugfix/freemodbus change max task prio (backport v4.3)

See merge request espressif/esp-idf!13732
2021-10-05 07:47:21 +00:00
98733692c9 lwip: Fix ICMP Ping on specific iface
Fix broken parentheses in setsockopt call

Merges https://github.com/espressif/esp-idf/pull/7397
2021-10-05 13:12:01 +08:00
7689a801d4 System/Memprot: fixed voltage glitching detection logic
When the application is being debugged it should check the call result (esp_cpu_in_ocd_debug_mode())
is not given volt.glitch attack - so the result is triple-checked by ESP_FAULT_ASSERT macro. In case
the check fails, the system is reset immediately

IDF-4014
2021-10-04 19:25:32 +02:00
9944c8acbe Tools: Constrain the cryptography package for avoiding breaking changes
The cryptography 35 release causes breaking changes. Some of
certificates are rendered invalid and the package cannot be build
without rust. See
https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst#3500---2021-09-29
for more details.
2021-10-04 16:51:46 +02:00
3a925002a7 Merge branch 'bugfix/esp_sntp_declare_v4.3' into 'release/v4.3'
lw-ip: Fix sntp custom options if sntp_get_system_time used (v4.3)

See merge request espressif/esp-idf!15142
2021-10-04 04:45:08 +00:00
1e8c0b7956 Merge branch 'feature/esp32c3_eco3_default_v4.3' into 'release/v4.3'
example_tests: Deletes usage esp32c3 ECO0 in CI (by default ECO3) (v4.3)

See merge request espressif/esp-idf!15341
2021-09-30 05:20:27 +00:00
28b768807e Merge branch 'bugfix/bt_legacy_paring_wrong_pin_code_err_v4.3' into 'release/v4.3'
bugfix/fix the crash when using legacy paring with wrong pin code (v4.3)

See merge request espressif/esp-idf!15298
2021-09-30 01:12:54 +00:00
b10888a591 Merge branch 'bugfix/fix_macro_conversion_v4.3' into 'release/v4.3'
Nimble: Fix logging level mismatch (v4.3)

See merge request espressif/esp-idf!15331
2021-09-30 01:09:56 +00:00
8aa9103307 Merge branch 'feature/sync_bt_lib_with_hli_v4.3' into 'release/v4.3'
components/bt: Sync bt lib with the high level interrupt version

See merge request espressif/esp-idf!15327
2021-09-30 01:07:45 +00:00
4f71b49aa6 esp_hw_support: keep external 40 MHz xtal related analog circuit power on during sleep 2021-09-28 11:21:33 +08:00
aac59ed5ec Power Management: add XTAL power domain to control whether external 40MHz xtal is powered down during sleep 2021-09-28 11:21:31 +08:00
4f4254537c esp_hw_support: No voltage drop during light sleep to ensure stable output clock of rtc8m oscillator 2021-09-28 11:20:00 +08:00
4ef6e37fcb Power Management: add RTC8M power domain to control whether internal 8m oscillator is powered down during sleep 2021-09-28 11:19:57 +08:00
2ccc45dd11 Merge branch 'bugfix/idf_size_nan_in_json_v4.3' into 'release/v4.3'
Tools: fix appearing NaN value when calling idf_size.py --json (v4.3)

See merge request espressif/esp-idf!15352
2021-09-27 12:36:57 +00:00
e47549e9e7 Merge branch 'bugfix/idf_tools_virtualenv_seeder_v4.3' into 'release/v4.3'
tools/idf_tools.py: Changed default AppData seeder to seeder pip (backport v4.3)

See merge request espressif/esp-idf!15349
2021-09-27 12:33:25 +00:00
70c29f9575 Tools: fix appearing NaN value when calling idf_size.py --json 2021-09-24 18:09:10 +02:00
6a125fbafa tools/idf_tools.py: Changed default AppData seeder to seeder pip 2021-09-24 14:21:34 +02:00
2a635b6c63 unit-test-app/configs(esp32c3): CI sill uses ECO2 for flash_encryption tests 2021-09-24 17:49:30 +08:00
2cc8fc907c example_tests: Deletes usage esp32c3 ECO0 in CI (by default ECO3) 2021-09-24 17:49:30 +08:00
d2fa3fd234 Merge branch 'feature/local_control_sec1_v4.3' into 'release/v4.3'
Added support for security1 in local control (backport v4.3)

See merge request espressif/esp-idf!15281
2021-09-24 08:51:39 +00:00
d5fb9c8cc1 Merge branch 'bugfix/wavegen_disable_iram_isr_backport4.3' into 'release/v4.3'
Bugfix/wavegen disable iram isr (backport v4.3)

See merge request espressif/esp-idf!15334
2021-09-24 07:02:17 +00:00
bb0eecee0e lwip: Fix sntp custom options if sntp_get_system_time used 2021-09-24 14:49:15 +08:00
0e956b5977 Merge branch 'bugfix/eth_dm9051_not_responding_v4.3' into 'release/v4.3'
esp_eth: Fix dm9051 Rx interrupt processing (v4.3)

See merge request espressif/esp-idf!15284
2021-09-24 06:45:49 +00:00
0021be424f Merge branch 'fix/no_stub_secure_boot_v4.3' into 'release/v4.3'
secure_boot: Enable --no-stub if secure boot enabled (v4.3)

See merge request espressif/esp-idf!15320
2021-09-24 04:17:36 +00:00
5ab3dd40ba Merge branch 'feature/secure_boot_key_check_before_revoke_v4.3' into 'release/v4.3'
Check if the running app is signed by a valid key before revocation (v4.3)

See merge request espressif/esp-idf!15293
2021-09-24 04:03:40 +00:00
b36bc02ef1 Merge branch 'bugfix/uart_driver_obj_into_sram_v4.3' into 'release/v4.3'
uart: put driver object into sram(v4.3)

See merge request espressif/esp-idf!14745
2021-09-24 03:12:28 +00:00
6d09d5e2f7 Merge branch 'docs/update_CN_trans_getstarted_V4.3' into 'release/v4.3'
docs: update CN translation and keep line number consistent for all documents...

See merge request espressif/esp-idf!15309
2021-09-24 03:09:52 +00:00
3f25d48520 bugfix by disabling IRAM attr on ISR 2021-09-24 10:53:05 +08:00
9abe6da406 app_update: Check if the running app is signed by a valid key before revocation 2021-09-23 21:06:44 +08:00
b49a979a51 Removed Critical debug level from menuconfig, since it internally maps
to level Error.
2021-09-23 18:07:25 +05:30
0e18b8b4cb components/bt: Sync bt lib with the high level interrupt version 2021-09-23 16:58:37 +08:00
1c1572ed51 Merge branch 'bugfix/fix_blufi_init_crash_c3_v4.3' into 'release/v4.3'
Blufi [Nimble] Add fix to crash while running blufi on ESP32C3 (v4.3)

See merge request espressif/esp-idf!15219
2021-09-23 07:44:12 +00:00
2a359c3ee4 Nimble: Check stack status before executing stack command 2021-09-23 13:02:52 +05:30
1f5473dd1a secure_boot: Enable --no-stub if secure boot enabled
ROM code doesn't allow loader stub to be executed in case secure boot in
enabled. Providing --no-stub flag to esptool allows user to flash new
firmware, given download mode hasn't been disabled
2021-09-23 12:50:45 +05:30
2e8f0a47ff fix wrong clock_id in function time_now_us
Close https://github.com/espressif/esp-idf/issues/7561
2021-09-23 10:02:12 +08:00
5da482e871 docs: update CN translation and keep line number consistent for all documents in get-started section 2021-09-22 19:12:32 +08:00
bbc33583ad Merge branch 'docs/backport_translation' into 'release/v4.3'
Docs: backport translation for api-guides/jtag-debugging/index.rst to V4.3

See merge request espressif/esp-idf!15166
2021-09-22 09:27:22 +00:00
ec177e963f docs: backport translation for jtag-debugging/index.rst and fix link
errors in examples/bluetooth/hci/README.md
2021-09-22 15:02:33 +08:00
e08f69aaff bugfix/fix the crash when using legacy paring with wrong pin code
Close https://github.com/espressif/esp-idf/issues/7556
2021-09-22 14:55:53 +08:00
7851240037 Merge branch 'bluedriod_esp32c3_v4.3' into 'release/v4.3'
ESP32C3: Fix for provisioning failure with ble transport mode and bluedriod stack for v4.3

See merge request espressif/esp-idf!14490
2021-09-22 04:30:10 +00:00
73c5a68c6f uart: support alloc driver object in SRAM
If CONFIG_UART_ISR_IN_IRAM is on, which means user hope the uart
interrupt can still be serviced even when cache is diabled (e.g.
writing to flash). In that case, the driver should make sure to
put the all related objects into SRAM, avoid putting them in the PSRAM.

Closes https://github.com/espressif/esp-idf/issues/7044
Closes https://github.com/espressif/esp-idf/pull/7355
2021-09-22 11:46:42 +08:00
f4ccb8e766 uart: format driver code by astyle 2021-09-22 11:46:42 +08:00
c50b102787 Merge branch 'docs/google_analytics_fix' into 'release/v4.3'
docs: fix docs not being able to be built locally due to missing env variable.

See merge request espressif/esp-idf!15192
2021-09-22 01:16:11 +00:00
e4063e4aa2 Merge branch 'feature/run_idf_size_with_overflow_v4.3' into 'release/v4.3'
Tools: make idf_size work with overflow (v4.3)

See merge request espressif/esp-idf!15243
2021-09-21 16:59:03 +00:00
7249a022e5 Tools: make idf_size work with overflow
Closes https://github.com/espressif/esp-idf/issues/6914
closes https://github.com/espressif/esp-idf/issues/4234
2021-09-21 18:03:32 +02:00
a30195d87b ESP32C3: Fix for provisioning failure with ble transport mode and bluedriod stack for v4.3 2021-09-21 19:34:13 +05:30
05bdb58297 Merge branch 'fix/esp_mbedtls_write_api_v4.3' into 'release/v4.3'
Fix esp_mbedtls_write API (v4.3)

See merge request espressif/esp-idf!15214
2021-09-21 12:42:43 +00:00
b8ab11b1c7 Merge branch 'bugfix/http_client_eagain_v4.3' into 'release/v4.3'
esp_http_client: Fixed handling of EAGAIN return (backport v4.3)

See merge request espressif/esp-idf!15273
2021-09-21 11:51:05 +00:00
5eae543571 Merge branch 'bugfix/fix_SD_card_tests_timeout_v4.3' into 'release/v4.3'
vfs/fatfs: fix failed tests by increasing timeout (v4.3)

See merge request espressif/esp-idf!15283
2021-09-21 11:25:29 +00:00
609f5ef9a0 esp_eth: Fix dm9051 Rx interrupt processing
* Disable Tx interrupts to fix race condition of missing Rx interrupt
* Check if GPIO interrupt is asserted periodically if the ISR event missed

Closes https://github.com/espressif/esp-idf/issues/6414
2021-09-21 11:10:19 +02:00
c62682cd07 Fix esp_mbedtls_write API
Fix esp_wolfssl_write API
Closes https://github.com/espressif/esp-idf/issues/7461
2021-09-21 16:31:21 +08:00
3926b436b5 vfs/fatfs: fix failed tests by increasing timeout
Default 30s timeout is too low for a case when SD card formatting is triggered,
which could lead to tests failure. Timeout of tests is now set to 60s.

JIRA IDFCI-742
2021-09-21 08:53:18 +02:00
effc809cfb esp_local_ctrl: Added documentation to chose protocom security
Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2021-09-21 09:21:19 +05:30
9e00034ec7 Added support for security1 in local control
1. Added config options to chose from protocom security.
    It can be chosen 0/1 or custom.
    Possible to set POP as well

2. Added support in `esp_local_ctrl.py` test script for sec_ver selection

Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2021-09-21 09:21:18 +05:30
70db0406fc esp_http_client: Fixed handling of EAGAIN return
For https connection `ESP_TLS_ERR_SSL_WANT_READ` of esp_transport_read was getting treated as error.
Treated this as a timeout to fix connection abort issue!

Also handled http connection EAGAIN with `errno == EAGAIN` check.

Signed-off-by: Vikram Dattu <vikram.dattu@espressif.com>
2021-09-20 17:10:44 +05:30
9e24590d9b Merge branch 'bugfix/fix_nvstool_readme_v4.3' into 'release/v4.3'
Update Readme with supports of multiline strings and comments in the CSV file (v4.3)

See merge request espressif/esp-idf!15223
2021-09-20 10:44:30 +00:00
c6b756b2d7 Blufi [Nimble] Add fix to crash while running blufi on ESP32C3
A race condition is occuring while creating task on ESP32C3. Task is
getting created, but the function returns with a delay. Since task was
created, events start getting posted, but existing application
initializes certain threads / callbacks after stack initialization.

The same application works in different ways for bluedroid and nimble.
Hence modified the order during initialization accordingly.
2021-09-20 17:46:57 +08:00
4ad49c4ae7 Merge branch 'bugfix/coap_with_cxx' into 'release/v4.3'
coap : fix for coap implementation with cxx

See merge request espressif/esp-idf!15220
2021-09-20 09:45:21 +00:00
956f6c6e3b Merge branch 'feature/gcov_dump_in_thread_v4.3' into 'release/v4.3'
backport/gcov dump in thread to v4.3

See merge request espressif/esp-idf!15205
2021-09-20 09:36:25 +00:00
c33ac6d1a9 Merge branch 'feature/clock_glitch_enable_v4.3' into 'release/v4.3'
bootloader: Enable clock glitch detection (v4.3)

See merge request espressif/esp-idf!15225
2021-09-20 09:35:42 +00:00
4b89915e41 Merge branch 'feature/esp_http_client_client_key_password_v4.3' into 'release/v4.3'
esp_http_client: Support client key password for HTTPS connections. (v4.3)

See merge request espressif/esp-idf!15226
2021-09-20 08:22:33 +00:00
4a21a9e341 nvs_tool: Update Readme with supports of multiline strings and comments in the CSV file
Closes https://github.com/espressif/esp-idf/issues/7175
2021-09-20 14:12:13 +08:00
57042ab56c esp_http_client: Support client key password for HTTPS connections.
Closes https://github.com/espressif/esp-idf/pull/7420
Closes https://github.com/espressif/esp-idf/issues/7418

Signed-off-by: Aditya Patwardhan <aditya.patwardhan@espressif.com>
2021-09-19 21:12:35 +08:00
75a7abe946 Merge branch 'bugfix/btdm_ble_event_mask_default_value_v4.3' into 'release/v4.3'
[BLE] Fixed default LE Event Mask(backport v4.3)

See merge request espressif/esp-idf!15242
2021-09-18 08:27:23 +00:00
72f87748e8 Merge branch 'bugfix/esp32s3_lightsleep_psram_leakage_current_v4.3' into 'release/v4.3'
backport v4.3: fix SPIRAM leakage when its CS pin has no hardware pullup

See merge request espressif/esp-idf!15224
2021-09-18 04:37:56 +00:00
d6ed894113 esp_ipc: fix race condition in ipc task 2021-09-17 23:19:27 +03:00
804a99790a gcov: enable single core tests 2021-09-17 23:19:27 +03:00
89a6a7fc30 ipc: enable ipc task at single core for gcov dump 2021-09-17 23:19:27 +03:00
bea97c8e91 gcov: add stub table size entry 2021-09-17 23:19:27 +03:00
f5b297a654 gcov: add gcov callback into the ipc task 2021-09-17 23:19:27 +03:00
8bb7427775 gcov: readme update for ESP32-S2 2021-09-17 23:19:27 +03:00
93259b9508 gcov: dump in a special thread 2021-09-17 23:19:27 +03:00
81956c63c8 gcov: added dbg stub capabilites and magic number entry to keep backward compatible 2021-09-17 23:19:27 +03:00
371e1bb4c9 component/bt: Fixed default LE Event Mask(release v4.3) 2021-09-17 17:53:02 +08:00
be1539f926 Merge branch 'bugfix/rotary_encoder_v4.3' into 'release/v4.3'
bugfix:rotary encoder example isr service install(backport v4.3)

See merge request espressif/esp-idf!14351
2021-09-17 08:57:05 +00:00
3f17cc2ab8 light sleep: fix Flash leakage when its CS pin has no hardware pullup 2021-09-17 16:28:47 +08:00
acdf49a5ac light sleep: fix SPIRAM leakage when its CS pin has no hardware pullup 2021-09-17 16:28:47 +08:00
42039cde0a add flash and PSRAM CS IO acquire function 2021-09-17 16:28:47 +08:00
d43bb775a5 coap: Fix coap implentation with cxx
Closes https://github.com/espressif/esp-idf/issues/6804
2021-09-17 16:26:29 +08:00
26563474d6 bootloader: Enable clock glitch detection
Reset the device when clock glitch detected. Clock glitch detection is
only active in bootloader
2021-09-17 13:32:34 +05:30
872c42ecf7 Fixed GLITCH_RTC_RST for esp32-c3 revision 3
* Issue: https://github.com/espressif/esp-idf/issues/7082

Signed-off-by: Yuriy Shestakov <yshestakov@gmail.com>

Closes https://github.com/espressif/esp-idf/issues/7082
Closes https://github.com/espressif/esp-idf/pull/7441
2021-09-17 13:32:34 +05:30
5fd169059d Merge branch 'bugfix/pr_ksz8041' into 'release/v4.3'
esp_eth: fix ksz8041 driver issue (PR)

See merge request espressif/esp-idf!15227
2021-09-17 06:39:52 +00:00
eaebc58e61 ci: bump up s2 ut parallels 2021-09-17 11:18:18 +08:00
3bd69d296d esp_eth: adapt ksz8041.c to changes from commit 03a6c49
Closes https://github.com/espressif/esp-idf/issues/7570
Merges https://github.com/espressif/esp-idf/pull/7573
2021-09-16 21:39:23 +08:00
316674a096 Merge branch 'feature/hmac_downstream_jtag_v4.3' into 'release/v4.3'
hmac: Added Downstream JTAG enable mode for esp32c3 (v4.3)

See merge request espressif/esp-idf!15203
2021-09-16 04:20:14 +00:00
3908360e46 Merge branch 'feature/support_bss_in_psram_for_esp32s2_v4.3' into 'release/v4.3'
[system] Allow .bss segment placed in external memory for ESP32-S2 ( backport v4.3)

See merge request espressif/esp-idf!14946
2021-09-15 08:09:42 +00:00
4fd6d3deae Adjust the variable name &
Add mapping support for different sizes of spi ram
2021-09-15 16:09:33 +08:00
f83699a67f Merge branch 'cherry-pick-e8360fe0-4' into 'release/v4.3'
wpa_supplicant: clean tls client state machine (backport v4.3)

See merge request espressif/esp-idf!15040
2021-09-15 08:06:00 +00:00
2006d66aee Merge branch 'docs/add_a_note_and_module_variants_to_esp32-devkitm-1_pico-devkitm-02u_v4.3' into 'release/v4.3'
Add a note to ESP32-DevKitM-1 User Guide, to enable single core mode (v4.3)

See merge request espressif/esp-idf!15186
2021-09-15 07:43:30 +00:00
94c9e5299a esp32s2/hmac: Release HMAC lock in downstream mode incase of failure 2021-09-14 17:05:28 +05:30
c215bb04f6 hmac: Added Downstream JTAG enable mode for esp32c3
If JTAG is disabled temporarily by burning SOFT_DIS_JTAG, it can be
re-enabled temporarily through esp_hmac_jtag_enable API
2021-09-14 17:05:01 +05:30
bf89a900a3 docs: fix docs not being able to be built locally due to missing env variable. 2021-09-14 18:02:19 +08:00
b501ebe138 Merge branch 'docs/fix_adc_pad_typo_MOSI_typo_and_broken_link_v4.3' into 'release/v4.3'
Fix ADC pad and MOSI typo, update esp32c3 rom elf link (v4.3)

See merge request espressif/esp-idf!15187
2021-09-14 08:45:11 +00:00
96b204bc9e Merge branch 'bugfix/efuse_table_for_c3_v4.3' into 'release/v4.3'
efuse: Fix len of SOFT_DIS_JTAG for esp32c3(v4.3)

See merge request espressif/esp-idf!14637
2021-09-14 05:22:14 +00:00
0d16e61d96 efuse: Fix len of SOFT_DIS_JTAG for esp32c3(v4.3) 2021-09-14 13:22:08 +08:00
ba31aab2f4 Add a note to ESP32-DevKtiM-1 User Guide, to enable single core mode
Add new module variants for ESP32-DevKitM-1 and ESP32-PICO-DevKitM-02 boards
Replace Ordering Information globally
2021-09-14 12:08:35 +08:00
6c14a4b9f1 docs: Fix ADC pad and MOSI typo, update esp32c3 rom elf link 2021-09-14 11:20:48 +08:00
6b0cbe54e6 Merge branch 'bugfix/add_critical_section_in_uart_driver_v4.3' into 'release/v4.3'
UART: add missing critical section wrappers around rx_buffered_len (backport v4.3)

See merge request espressif/esp-idf!14774
2021-09-13 15:18:32 +00:00
6c363a4075 uart: Add missing critical section wrappers around rx_buffered_len
The missing barriers caused uart_get_buffered_data_len() to (very rarely)
return a garbage value. When used in MicroPython, though, this caused
select() to return and a subsequent read() to stall indefinitely until
a char was actually available.

Signed-off-by: Chen Yi Qun <chenyiqun@espressif.com>

Closes https://github.com/espressif/esp-idf/issues/6397
Merges https://github.com/espressif/esp-idf/pull/6396
2021-09-13 23:18:25 +08:00
80cfaeb7cc Merge branch 'bugfix/nvs_host_test_missing_struct' into 'release/v4.3'
[nvs] Add page host test to CI (backport 4.3)

See merge request espressif/esp-idf!15010
2021-09-13 13:11:56 +00:00
3e94cd5888 Merge branch 'bugfix/i2c_cxx_timeout_4.3' into 'release/v4.3'
[cxx]: fixed I2C master timeout (backport 4.3)

See merge request espressif/esp-idf!14415
2021-09-13 13:10:15 +00:00
cfeca10c06 Merge branch 'bugfix/repl_on_another_uart_v4.3' into 'release/v4.3'
console: fix a bug preventing us from starting a CLI on non-default UART (backport v4.3)

See merge request espressif/esp-idf!14628
2021-09-13 10:33:29 +00:00
0d0bec6c31 console: fix a bug preventing us from starting a CLI on non-default UART
It is now possible to start a REPL CLI on another UART than the default
one.

Closes https://github.com/espressif/esp-idf/issues/6897
2021-09-13 14:10:19 +08:00
8bb5d87f0c Merge branch 'bugfix/freertos_ut_suspend_v4.3' into 'release/v4.3'
freertos: Increases delta for UT - Test suspend-resume CPU. The number of... (v4.3)

See merge request espressif/esp-idf!14630
2021-09-13 04:14:14 +00:00
de48a67083 Merge branch 'bugfix/btdm_ble_connection_will_crash_durning_erase_flash_v4.3' into 'release/v4.3'
[BLE] Fixed ble conn will crash during erasing flash(backport v4.3)

See merge request espressif/esp-idf!14795
2021-09-13 01:50:09 +00:00
d5e5f44d36 Merge branch 'bugfix/btdm_fix_some_Document_Description_Error_v4.3' into 'release/v4.3'
component/bt: fix some ble document description error(backport v4.3)

See merge request espressif/esp-idf!14823
2021-09-13 01:49:49 +00:00
2777ff73f4 Merge branch 'bugfix/btdm_auto_update_PPCP_attribute_value_v4.3' into 'release/v4.3'
component/bt: fix bluedroid host auto update PPCP attribute value(backport v4.3)

See merge request espressif/esp-idf!14748
2021-09-13 01:49:01 +00:00
e0c2bf1d0a Merge branch 'feature/regi2c_add_lock_v4.3' into 'release/v4.3'
regi2c: add a spinlock for accessing (reg)I2C devices (backport v4.3)

See merge request espressif/esp-idf!13690
2021-09-11 01:07:10 +00:00
1ab4819b74 Merge branch 'bugfix/esp_event_any_id_unregister_4.3' into 'release/v4.3'
ESP Event: fix unregister documentation (backport 4.3)

See merge request espressif/esp-idf!14431
2021-09-10 11:52:44 +00:00
173e001680 regi2c: add a spinlock for accessing (reg)I2C devices
When not compiling bootloader, a spinlock will be used for reading or writing
I2C internal devices/registers.
When compiling for bootloader, no need to use any lock.
2021-09-10 18:50:16 +08:00
b22f9d2d42 Merge branch 'docs/bump_sphinx_version_v4.3' into 'release/v4.3'
docs: bump idf_sphinx_theme version

See merge request espressif/esp-idf!13771
2021-09-10 08:17:26 +00:00
eebf301acc [cxx]: fixed I2C master timeout 2021-09-10 13:03:03 +08:00
a6371d2a97 [nvs] nvs page host runs in CI, fix build failure
* nvs host page unit test now runs in ci
* fixed nvs host page unit test build failure
2021-09-10 13:02:51 +08:00
fdf4070cdc doc:updated cn translation for language.rst and version.rst to provide new layout for version/target select 2021-09-10 12:53:54 +08:00
539f7edbb3 Docs: build doc with new layout for target and version select 2021-09-10 12:53:54 +08:00
eeab4e4469 docs: add google analytics tracking 2021-09-10 12:53:50 +08:00
d13b69558a docs: add warning for outdated versions 2021-09-10 12:53:50 +08:00
1546c28a5f Merge branch 'bugfix/spi_example_gdma_v4.3' into 'release/v4.3'
spi: update examples to use the new GDMA driver (v4.3)

See merge request espressif/esp-idf!14460
2021-09-10 04:31:38 +00:00
55dfd61796 Merge branch 'bugfix/uart_sw_sw_flow_error_typo_v4.3' into 'release/v4.3'
uart: fix typo in error message (v4.3)

See merge request espressif/esp-idf!14613
2021-09-10 04:30:37 +00:00
121910b939 Merge branch 'ci/change_perf_key_v4.3' into 'release/v4.3'
ci: update performance test key to db compatible format (v4.3)

See merge request espressif/esp-idf!14654
2021-09-10 04:23:09 +00:00
1f0d8585ca Merge branch 'feature/update_efuses_for_esp32s2_v4.3' into 'release/v4.3'
efuse(esp32s2): Added flash_ver, psram_ver, pkg_ver efuses (v4.3)

See merge request espressif/esp-idf!14770
2021-09-10 04:21:54 +00:00
dfa2a980d7 [esp_event]: fixed and improved docs
* Description of unregistering was incorrect
* Made clear that event loop arg mustn't be NULL
* Added parameter check in create function

Closes https://github.com/espressif/esp-idf/issues/6761
Closes IDFGH-4969
2021-09-10 10:12:39 +08:00
9805fc85ee Merge branch 'feature/doc_sbv2_key_not_read_protected_v4.3' into 'release/v4.3'
secure_boot_v2(doc): secure_boot_v2 key/s must be readable (v4.3)

See merge request espressif/esp-idf!14671
2021-09-09 19:37:52 +00:00
746f2e2d49 Merge branch 'bugfix/newlib_dirent_decls_4.3' into 'release/v4.3'
newlib: add C++ guards to the platform-specific dirent.h  (backport 4.3)

See merge request espressif/esp-idf!14621
2021-09-09 18:46:58 +00:00
94667365d3 Merge branch 'esp32c3/override_assert_v4.3' into 'release/v4.3'
newlib: Override __assert and __assert_func (v4.3)

See merge request espressif/esp-idf!14685
2021-09-09 13:24:01 +00:00
51f1bc3ced Merge branch 'bugfix/cmake_compiler_warn_write_string_v4.3' into 'release/v4.3'
Build: Fix CMake to pass -Wwrite-string compiler flag if enabled (v4.3)

See merge request espressif/esp-idf!14426
2021-09-09 09:49:33 +00:00
4c400e9311 Merge branch 'bugfix/wifi_ap_handler_docs_v4.3' into 'release/v4.3'
wifi/netif: Fix wifi_ap_handlers comments to relate to AP (v4.3)

See merge request espressif/esp-idf!15147
2021-09-09 09:40:32 +00:00
943c9cc560 Merge branch 'bugfix/config_data_interface_early_v4.3' into 'release/v4.3'
initialize data interface early (v4.3)

See merge request espressif/esp-idf!15087
2021-09-09 08:45:22 +00:00
f47085ac70 Merge branch 'feature/oocd_ver_upgrade_v4.3' into 'release/v4.3'
tools: Updates OpenOCD version to 'v0.10.0-esp32-20210902' (v4.3)

See merge request espressif/esp-idf!15132
2021-09-09 07:44:04 +00:00
eea13b76a1 Merge branch 'bugfix/mcpwm-deadtime-preset-config-backport_v4.3' into 'release/v4.3'
MCPWM/deadtime: fix and sync preset deadtime modes with well-known definition (backport v4.3)

See merge request espressif/esp-idf!14622
2021-09-09 07:29:11 +00:00
9ac4c49553 Merge branch 'fixes/secure_boot_v4.3' into 'release/v4.3'
secure_boot/esp32(s2,c3): Disable read protecting of efuses (v4.3)

See merge request espressif/esp-idf!14960
2021-09-09 07:16:54 +00:00
1d866dc4a0 Merge branch 'bugfix/uninitialized_tasknumber_v4.3' into 'release/v4.3'
fix(FreeRTOS): Initialize uxTaskNumber at task initialization (v4.3)

See merge request espressif/esp-idf!14669
2021-09-09 07:01:01 +00:00
2429a578ad Merge branch 'bugfix/fix_ping_sock_return_error_v4.3' into 'release/v4.3'
ping_sock: Fix esp_ping_new_session may return ESP_OK when the error occured(backport v4.3)

See merge request espressif/esp-idf!14847
2021-09-09 06:20:56 +00:00
801c3a4c60 wifi/netif: Fix wifi_ap_handlers comments to relate to AP 2021-09-09 07:53:35 +02:00
7fa47e87dd Merge branch 'bugfix/fix_ws_handle_big_messages_v4.3' into 'release/v4.3'
esp_http_server: Fix ws server handle length over 1440(MTU) messages incorrectly(backport v4.3)

See merge request espressif/esp-idf!15015
2021-09-09 04:13:02 +00:00
d121672808 CI: Fix idf_tools.py tests with the updated openocd version 2021-09-08 20:53:42 +03:00
9177682a7e CI: Check the number of detected cores of apptrace 2021-09-08 20:51:41 +03:00
fcbcdf32d8 tools: Updates OpenOCD version to 'v0.10.0-esp32-20210902' 2021-09-08 20:51:41 +03:00
b76369ddb6 eth: dont warn nego timeout if link is down 2021-09-08 20:52:26 +08:00
b829fcff3e emac: configure data interface early 2021-09-08 20:52:26 +08:00
5e7d08d083 Merge branch 'bugfix/build_warning_unused_variable' into 'release/v4.3'
bugfix/remove unused variable which caused to build warnings

See merge request espressif/esp-idf!15105
2021-09-08 11:56:04 +00:00
3a9a208edc Merge branch 'bugfix/freemodbus_fix_zero_based_reg_address_in_iterator_v43' into 'release/v4.3'
freemodbus: fix mb zero based reg address in the iterator (backport v4.3)

See merge request espressif/esp-idf!14551
2021-09-08 09:48:21 +00:00
d6b1a9909f Merge branch 'docfix/eth_events_4.3' into 'release/v4.3'
Added warning when to init user Eth handlers (release/v4.3)

See merge request espressif/esp-idf!14953
2021-09-08 09:37:23 +00:00
a6b632661c Merge branch 'feature/update_expat_v4.3' into 'release/v4.3'
expat: Update library from 2.2.9 to 2.4.1(backport v4.3)

See merge request espressif/esp-idf!15071
2021-09-08 09:17:25 +00:00
9032828325 Merge branch 'bugfix/idf_size_wrong_memory_calculations_v4.3' into 'release/v4.3'
Tools: Fix memory calculations of idf_size.py (v4.3)

See merge request espressif/esp-idf!14933
2021-09-08 09:11:57 +00:00
d1ce75b018 Merge branch 'bugfix/ulp_overflow_rtc_mem_v4.3' into 'release/v4.3'
ulp: ULP_COPROC_RESERVE_MEM limitation (v4.3)

See merge request espressif/esp-idf!14375
2021-09-08 09:05:46 +00:00
e741161b2e Merge branch 'bugfix/renable_unit_tests_v4.3' into 'release/v4.3'
ci: enable previously disabled unit tests (v4.3)

See merge request espressif/esp-idf!13775
2021-09-08 09:03:32 +00:00
f5731c832f Merge branch 'bugfix/rename_newlib_header_v4.3' into 'release/v4.3'
esp_rom: remove "newlib.h" header (v4.3)

See merge request espressif/esp-idf!15012
2021-09-08 09:01:30 +00:00
ab111b7f79 Merge branch 'bugfix/ulp_riscv_cocpu_trap_v4.3' into 'release/v4.3'
ulp riscv: force cocpu clock on to prevent spurious cocpu trap resets (v4.3)

See merge request espressif/esp-idf!14317
2021-09-08 08:59:42 +00:00
0f7dd04a83 Merge branch 'bugfix/crypto_gdma_v4.3' into 'release/v4.3'
aes/sha: fixed driver reseting the wrong GDMA channel (v4.3)

See merge request espressif/esp-idf!15002
2021-09-08 08:58:24 +00:00
26315f1c84 Merge branch 'feature/installing_tools_for_IDF_TARGET_v4.3' into 'release/v4.3'
tools: Installing tools for given IDF_TARGET (v4.3)

See merge request espressif/esp-idf!14708
2021-09-08 08:52:42 +00:00
c2f015ace1 secure_boot/esp32(s2,c3): Disable read protecting of efuses
When secure boot is enabled, disable the ability to read protect
efuses that contain the digest.
2021-09-08 16:42:54 +08:00
49fcfafed3 Merge branch 'bugfix/core_dump_image_erase_with_encryption_v4.3' into 'release/v4.3'
Fix a bug in `core_dump_image_erase` when flash encryption is enabled (backport v4.3)

See merge request espressif/esp-idf!14618
2021-09-08 08:42:44 +00:00
7808bccfb9 fix(FreeRTOS): Initialize uxTaskNumber at task initialization
Signed-off-by: Laukik Hase <laukik.hase@espressif.com>

Closes https://github.com/espressif/esp-idf/pull/4025
2021-09-08 16:42:30 +08:00
e493a4c30e Merge branch 'bugfix/xtensa_extra_info_register_values_v4.3' into 'release/v4.3'
espcoredump.py: Parse EPS and EPC register values using register index (v4.3)

See merge request espressif/esp-idf!14563
2021-09-08 08:36:09 +00:00
cc9d354ba8 Update tests for assert and abort
- Place panic_abort in IRAM
- Added abort, assert test case in case of cache disabled
- Expect assert instead of abort in a freertos_mutex test
2021-09-08 16:32:09 +08:00
659cfcb1f6 newlib: Override __assert and __assert_func
Default assert implementation calls fiprintf, which tries to acquire a
lock and fails if it is executing in critical section or ISR
2021-09-08 16:32:09 +08:00
15439631a4 Merge branch 'bugfix/check_spi_master_cmd_test_fail_v4.3' into 'release/v4.3'
spi_master: fix cmd test ringbufferReturn issue (4.3)

See merge request espressif/esp-idf!13656
2021-09-08 08:25:56 +00:00
77965b01ca Merge branch 'feature/update_cjson_submodule_v4.3' into 'release/v4.3'
cJSON: Update submodule to v1.7.15 (v4.3)

See merge request espressif/esp-idf!14999
2021-09-08 08:19:50 +00:00
4fe718dd0b Merge branch 'fix/warning_in_wifi_prov_mgr_v4.3' into 'release/v4.3'
provisioning: fix wifi warning in wifi_prov_mgr application (v4.3)

See merge request espressif/esp-idf!14763
2021-09-08 08:19:40 +00:00
e34a6591fa Merge branch 'docs/add_ESP32-S2-DevKitC-1_user_guide_backport_v4.3' into 'release/v4.3'
Docs: Add ESP32-S2-DevKitC-1 user guide (backport v4.3)

See merge request espressif/esp-idf!14877
2021-09-08 08:17:20 +00:00
90ef051d16 Merge branch 'bugfix/controller_hci_uart_sdkconfig_v4.3' into 'release/v4.3'
Bugfix/controller hci uart sdkconfig(backport v4.3)

See merge request espressif/esp-idf!14807
2021-09-08 06:23:17 +00:00
fbd128af6f Merge branch 'bugfix/spp_memory_leak_v4.3' into 'release/v4.3'
Fix spp memory leak(v4.3)

See merge request espressif/esp-idf!14525
2021-09-08 02:47:51 +00:00
57c4316855 Merge branch 'component_bt/add_spp_faq_v4.3' into 'release/v4.3'
Component_bt/Add FAQ in SPP Demo README[backport v4.3]

See merge request espressif/esp-idf!14793
2021-09-08 02:47:28 +00:00
5eee25aea5 Merge branch 'bugfix/bt_spp_timer_collision_v4.3' into 'release/v4.3'
Fix timer collision in role switch(v4.3)

See merge request espressif/esp-idf!14815
2021-09-08 02:46:55 +00:00
d4a86ab4fe Merge branch 'bugfix/a2dp_deint_crash_v4.3' into 'release/v4.3'
component_bt: fix a2dp deinit crash(v4.3)

See merge request espressif/esp-idf!14416
2021-09-08 02:46:24 +00:00
5348c30141 Merge branch 'bugfix/hf_disc_acl_no_disc_v4.3' into 'release/v4.3'
bugfix/acl can't disconnect when hfp_client disconnect [release/v4.3]

See merge request espressif/esp-idf!15056
2021-09-08 02:46:06 +00:00
665b221b6b Merge branch 'docs/spi_max_transfer_sz_limit_v4.3' into 'release/v4.3'
spi_docs: Fixed the default value of max_transfer_sz_limit (backport v4.3)

See merge request espressif/esp-idf!14249
2021-09-08 02:34:43 +00:00
96d498a7b5 Merge branch 'update/version_4_3_1' into 'release/v4.3'
Update version to 4.3.1

See merge request espressif/esp-idf!15032
2021-09-08 00:09:01 +00:00
2845b70f83 remove unused variable which caused to build warning 2021-09-07 19:15:36 +08:00
6ad84919ad expat: Update library from 2.2.9 to 2.4.1 2021-09-03 19:36:56 +08:00
b7a1a53629 fix acl can not disconnect when hf_client disconnenct 2021-09-03 10:56:25 +08:00
2e74914051 versions: Update version to 4.3.1 2021-09-02 17:15:36 +08:00
f2490688dc ci: temp disable code_quality_report job 2021-09-02 17:15:36 +08:00
34ab97f081 Tools: Fix memory calculations of idf_size.py 2021-09-01 16:36:48 +02:00
706a17bdf1 openthread: enable ot_cli on esp32h2 2021-09-01 16:36:47 +02:00
7716134457 idf_size.py: fixed diram counted twice issue, and improve display
Currently static RAM usage are listed under corresponding physical
memory.

ld: fix linker script for C3 and S3
2021-09-01 16:36:47 +02:00
508b033cc0 component/bt: fix some ble document description error 2021-09-01 20:42:44 +08:00
c110c31957 Merge branch 'bugfix/eap_client_windows' into 'master'
wpa_supplicant: clean tls client state machine

Closes IDFGH-5702, IDFGH-5662, and IDFGH-119

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

See merge request espressif/esp-idf!14968

(cherry picked from commit e8360fe075)

d3a42d78 wpa_supplicant: clean tls client state machine
2021-09-01 19:17:53 +08:00
68f8b999bb Enable IO20 on ESP32
Some newer ESP32 variants (like ESP32-PICO-V3 and ESP32-PICO-MINI-02)
do implement this pin and it can be used as a normal GPIO.

Fixes #6016
Fixes #6837

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

(cherry picked from commit 6deaefde69)
2021-08-31 20:11:00 +08:00
f728202ee9 esp_http_server: Fix ws server handle length over 1440(MTU) messages incorrectly.
Closes https://github.com/espressif/esp-idf/issues/7457
2021-08-31 14:08:42 +08:00
3938792732 Revert "Merge branch 'bugfix/fix_ws_handle_big_messages_error_v4.3' into 'release/v4.3'"
This reverts commit de8c6aaa8d, reversing
changes made to ab452839ed.
2021-08-31 14:07:59 +08:00
4446e2f632 esp_rom: remove "newlib.h" header
We found conflict in "sizeof(time_t)" due to inclusion of this
header over toolchain specific "newlib.h".

Moreover, there are no users for this header and implementation
for API is also not available in ROM. Hence removing it.
2021-08-31 10:32:34 +05:30
d5d126b73e aes/sha: fixed driver reseting the wrong GDMA channel
Driver was using the channel ID from tx when reseting rx.
But since rx and tx is not necessarily from the same pair this could lead
to the driver reseting the wrong DMA channel.
2021-08-30 17:06:13 +08:00
7059591d92 cJSON: Update submodule to latest release.
This update fixes NULL pointer dereference issues in previous release

Closes https://github.com/espressif/esp-idf/issues/7317
2021-08-30 13:16:55 +05:30
f80c0e8d31 Merge branch 'bugfix/sdcard_example_format_timeout' into 'release/v4.3'
CI: [Examples/Storage] provide sufficient timeout for SD card formatting

See merge request espressif/esp-idf!14883
2021-08-27 12:51:22 +00:00
605c1b16f0 Merge branch 'bugfix/fix_esp32c3_auto_adjust_volt_v4.3' into 'release/v4.3'
fix_esp32c3_auto_adjust_volt_v4.3

See merge request espressif/esp-idf!14954
2021-08-26 10:07:57 +00:00
0c0b503f04 Merge branch 'bugfix/remove_bt_get_mac_v4.3' into 'release/v4.3'
bt: Remove unused function esp_bt_get_mac. (v4.3)

See merge request espressif/esp-idf!14835
2021-08-26 02:50:28 +00:00
b368fa45d1 Merge branch 'bugfix/fix_airkiss_esptouch_find_channel_crash_issue_v4.3' into 'release/v4.3'
esp_wifi:fix airkiss and esptouch find channel crash issue(backport v4.3)

See merge request espressif/esp-idf!14931
2021-08-26 02:49:33 +00:00
sly
517dd5c5d5 fix_esp32c3_auto_adjust_volt 2021-08-25 21:31:07 +08:00
95f454b510 Added warning when to init user Eth handlers 2021-08-25 12:45:06 +02:00
4b95b8a5c4 esp_wifi:fix airkiss and esptouch find channel crash issue(backport v4.3) 2021-08-25 15:55:07 +08:00
75e099129e secure_boot_v2(doc): secure_boot_v2 key/s must be readable 2021-08-23 12:28:32 +05:00
93c639872b Merge branch 'doc/fix_secure_boot_v4.3' into 'release/v4.3'
doc/secure_boot_v2: Fix the steps mentioned for enabling secure boot (v4.3)

See merge request espressif/esp-idf!14588
2021-08-20 09:35:48 +00:00
5fa8c0c088 Merge branch 'bugfix/libsodium_build_with_gnu_make_v4.3' into 'release/v4.3'
libsodium: fix build issues with GNU Make (v4.3)

See merge request espressif/esp-idf!14757
2021-08-20 09:34:34 +00:00
8787f15a2d Merge branch 'bugfix/memprot_bypass_v4.3' into 'release/v4.3'
System/Security: Memprot bypassing mitigation (v4.3)

See merge request espressif/esp-idf!14607
2021-08-20 09:33:47 +00:00
4cf9aecfe9 docs/add_esp32-s2-devkitc-1_user_guide 2021-08-20 12:15:47 +08:00
56cb3429ac Examples/Storage: provide sufficient timeout for SD card formatting
Large SD cards (16GB+) require significant amount of time for FS formatting.
Added FS mount checkpoint in example test python, timeout set to 60 sec

Closes IDFCI-706
2021-08-19 23:36:41 +02:00
25ebb55908 Merge branch 'bugfix/esp32c3_check_if_allow_light_sleep_v4.3' into 'release/v4.3'
Fix that when EXT CRYS is configured but not detected, light sleep is still allowed to be used(v4.3)

See merge request espressif/esp-idf!14818
2021-08-19 03:32:45 +00:00
7d0b387bea Not initialized or in the process of de-initialization, calling API will return ERR 2021-08-19 11:10:31 +08:00
a5fb684908 fix a2dp deinit crash 2021-08-19 11:10:31 +08:00
92b98b475d Merge branch 'bugfix/ble_mesh_cve_recommendation_v4.3' into 'release/v4.3'
ble_mesh: Update the SIG recommendations for CVE issues (v4.3)

See merge request espressif/esp-idf!14841
2021-08-19 02:56:34 +00:00
7f8d47203e ci/test: Fix esp_http_client const char* correction 2021-08-18 15:28:08 +02:00
dd1de21216 panic/memprot: Fix minor const string correction on panic print 2021-08-18 19:29:44 +08:00
e7500c711d rtc: Fix minor const char* correction issue 2021-08-18 19:29:44 +08:00
c805a5cff8 wpa_supplicant: Temporarily disable write-string warning
Since some assignment of a string literal to `char *` variables were
added and not caught by the CI.
2021-08-18 19:29:44 +08:00
64eb3a28b6 Build: Fix CMake to pass -Wwrite-string compiler flag if enabled 2021-08-18 19:29:44 +08:00
fb345ecc2e provisioning: fix wifi warning in wifi_prov_mgr application
Scan configuration parameters should not modify in co-existence mode.
2021-08-18 18:30:18 +08:00
25a6744ff7 ping_sock: Fix esp_ping_new_session may return ESP_OK when the error occured
Closes https://github.com/espressif/esp-idf/issues/7363
2021-08-18 11:33:36 +08:00
lly
58b289a22c ble_mesh: Update the SIG recommendations for CVE issues 2021-08-18 10:57:33 +08:00
69845456dc bt: Remove unused function esp_bt_get_mac.
Closes https://github.com/espressif/esp-idf/issues/7410
2021-08-17 18:46:04 +05:30
dc13a3d161 Fix that when EXT CRYS is configured but not detected, light sleep is still allowed to be used 2021-08-17 17:18:33 +08:00
30660bd6e0 fix timer collision in role switch
Closes https://github.com/espressif/esp-idf/issues/7203
2021-08-17 10:55:25 +08:00
0f15c28a84 Fix install.fish
install.fish script didn't catch error exit code from idf_tools.py. Now it does.

Signed-off-by: Marek Fiala <marek.fiala@espressif.com>

Closes: https://github.com/espressif/esp-idf/pull/7325
2021-08-16 16:16:32 +02:00
5639b6888d tools: Installing tools for given IDF_TARGET
Allow user to select specific ESP_TARGET while setting up ESD_IDF.
Only necessary tools for given target will be downloaded and installed.

Closes https://github.com/espressif/esp-idf/issues/5113
2021-08-16 16:16:31 +02:00
194b510125 controller_hci_uart: rename the example with suffix "_esp32" 2021-08-16 11:46:19 +08:00
8d06c987d2 controller_hci_uart: fixed the deprecated Kconfig options in the example 2021-08-16 11:45:54 +08:00
fb53ea7d22 add FAQ in SPP demo README 2021-08-16 09:18:12 +08:00
82f094669a component/bt: Fixed ble conn will crash durning erase flash 2021-08-13 18:08:22 +08:00
b7237ff0e6 efuse(esp32s2): Added flash_ver, psram_ver, pkg_ver efuses 2021-08-12 18:25:07 +05:00
48ae2309fd Merge branch 'bugfix/bugfix/wpa_supplicant_fixes_v4.3' into 'release/v4.3'
Merge wpa_supplicant github PRs (V4.3)

See merge request espressif/esp-idf!14751
2021-08-12 09:02:42 +00:00
6a13a9d0c4 Merge branch 'bugfix/pmf_bcast_deauth_fix_v4.3' into 'release/v4.3'
Fix some PMF and FTM issues (Backport v4.3)

See merge request espressif/esp-idf!14690
2021-08-12 09:02:09 +00:00
496f749f63 libsodium: fix source directory names to address build issues with Make 2021-08-12 08:43:35 +05:30
f06307c08d tools/unit_test_app: fixes to build this application with Make build 2021-08-12 08:43:35 +05:30
b5262e9980 Merge branch 'bugfix/fix_deep_sleep_miss_bug_mr_4.3' into 'release/v4.3'
Fixed missing the sleep time

See merge request espressif/esp-idf!14591
2021-08-11 12:38:16 +00:00
af03dcb037 wpa_supplicant: Trivial typo fix for setting spp_sup.require
No functional change since both SPP_AMSDU_CAP_ENABLE and SPP_AMSDU_REQ_ENABLE
are defined as 1.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Sagar Bijwe <sagar@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/7366
2021-08-11 16:43:35 +05:30
3e1b174c53 esp_supplicant: Make esp_rrm_send_neighbor_rep_request return proper error
Current code always return 0 even though wpas_rrm_send_neighbor_rep_request()
fails. Return proper error so the caller can know what's wrong.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Sagar Bijwe <sagar@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/7233
2021-08-11 16:43:23 +05:30
c56aa5f34d wpa_supplicant: Fix clear WLAN_FC_STYPE_ACTION bit in esp_register_action_frame
It should clear WLAN_FC_STYPE_ACTION bit intead of WLAN_FC_STYPE_ACTION.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Sagar Bijwe <sagar@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/7252
2021-08-11 16:41:21 +05:30
30d6c8401c wpa_supplicant: Fix memory leak in esp_issue_scan error paths
Fix memory leak when allocate memory for params->ssid / params->bssid fails.

Fixes: 27101f9454 ("wpa_supplicant: Add initial roaming support")
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Sagar Bijwe <sagar@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/7240
2021-08-11 16:40:57 +05:30
84cb47d7e0 component/bt: fix bluedroid host auto update PPCP attribute value 2021-08-11 17:49:31 +08:00
edcb5942ba The controller may miss the sleep time caculated before. So it will stuck
in the loop to get the deep sleep HW flag. Then the watchdog issue happen.
2021-08-11 14:07:00 +08:00
9b8cdf9e87 Merge branch 'feature/btdm_esp32_add_local_irk_to_controller_v4.3' into 'release/v4.3'
component/bt: add local irk to controller

See merge request espressif/esp-idf!14667
2021-08-10 03:49:11 +00:00
913b31c13f esp_wifi: Fix PMF and FTM issues
1. Update wifi lib with fix for dropping bcast PMF deauths/disassocs
   with certain reason codes
2. Fix FTM not working in connected state and some other FTM bugs
2021-08-09 18:54:07 +05:30
032f6d34d1 component/bt: add local irk to controller 2021-08-06 18:19:25 +08:00
e3954297bb spi_master: fix the crash when using interrupt mode when cache is disabled
Closes https://github.com/espressif/esp-idf/issues/6529
Closes https://github.com/espressif/esp-idf/issues/6781
Closes https://github.com/espressif/esp-idf/issues/7368
2021-08-06 12:20:23 +08:00
2231d6b158 ci: update performance test key to db compatible format 2021-08-04 12:22:25 +08:00
0cd1bc6753 freertos: Increases delta for UT - Test suspend-resume CPU. The number of tick_hook should be the same for both CPUs 2021-08-03 12:50:15 +05:00
7de5c312a3 Update components/hal/include/hal/mcpwm_types.h 2021-08-03 15:20:47 +08:00
f23acef8eb MCPWM/deadtime: fix and sync preset deadtime modes with well-known definition
Closes https://github.com/espressif/esp-idf/issues/7321
2021-08-03 14:27:34 +08:00
03109eb013 newlib: add C++ guards to the platform-specific dirent.h
Before newlib 3.3.0, <dirent.h> bundled in newlib did not include any
function declarations. Instead, the file included the platform-
specific <sys/dirent.h>. This inclusion was inside a C++ guard block.
ESP-IDF provided sys/dirent.h inside newlib component, and this file
contained all the necessary function and structure declarations.

Since da418955f5,
common function declarations have been added to <dirent.h> in newlib.
However, the inclusion of sys/dirent.h has been moved out of the C++
guard block. However we didn't notice this change and did not update
sys/dirent.h in ESP-IDF newlib component to and the now-required
C++ guards there.

This commit adds the missing C++ guards to the platform-specific
sys/dirent.h.

The declarations of common dirent.h functions are now present both in
<dirent.h> (provided by newlib) and in sys/dirent.h (provided by IDF).
We keep the declarations in sys/dirent.h for compatibility, since some
ESP-IDF files and applications may include <sys/dirent.h> directly,
rather than <dirent.h>.

Closes https://github.com/espressif/esp-idf/issues/7204
2021-08-03 13:53:34 +08:00
c8e5b0611a coredump: simplify the implementation of esp_core_dump_image_erase function
Closes https://github.com/espressif/esp-idf/pull/6949
2021-08-03 11:48:39 +08:00
035c1ac901 Fixed esp_core_dump_image_erase() for flash encryption with 16byte long write buffer 2021-08-03 11:48:39 +08:00
f550724055 uart: fix typo in error message
Closes https://github.com/espressif/esp-idf/issues/7360
2021-08-03 09:27:10 +08:00
b04705cfe2 system/security: Memprot bypassing mitigation
Check Memprot lock bit(s) during the system startup, abort/reset on any Memprot parts found locked during this phase.
There is no legal reason to disallow the Memprot configuration by the system, so it's either a critical bug in the
application or an malicious attempt to bypass the system security.
Error message is printed before digital system reset.

Closes IDF-2700
2021-08-02 12:18:46 +02:00
0423027d5d Merge branch 'bugfix/fix_some_wifi_bugs_0728_v4.3' into 'release/v4.3'
bugfix fix some wifi bugs for 4.3

See merge request espressif/esp-idf!14577
2021-07-31 15:43:25 +00:00
1fd8fdcf7d bugfix fix some wifi bugs for 4.3
1. sync idf menuconfig nvs status to lib
2. disable ampdu+amsdu bit
3. fix 80211 tx crash issue
4. supoort config 80211 tx rate
2021-07-31 21:46:14 +08:00
78392f0e84 ULP: reduce max possible memory reserved for ULP coprocessor
Some RTC slow memory is reserved by IDF, reduce CONFIG_TARGET_ULP_COPROC_RESERVE_MEM
range to reflect this.

Closes https://github.com/espressif/esp-idf/issues/7073
2021-07-31 14:10:57 +08:00
ee54dbfaab bootloader: fix verify_load_addresses wrongly reporting "bad load address range"
verify_load_addresses would check if load_end was in a certain member range,
but should verify (load_end - 1) which is the actual last byte.
2021-07-31 14:10:57 +08:00
135b46a078 Merge branch 'mesh/non_mesh_connections_access_v4.3' into 'release/v4.3'
esp_wifi_mesh: add non mesh connections access(backport_v4.3)

See merge request espressif/esp-idf!14241
2021-07-31 02:52:11 +00:00
1537cff293 Merge branch 'bugfix/btdm_esp32_ble_white_list_connection_fail_v4.3' into 'release/v4.3'
Fixed ESP32 BLE can't resolve the peer address when enable white list(release v4.3)

See merge request espressif/esp-idf!14558
2021-07-30 23:58:22 +00:00
9f1854533e doc/secure_boot_v2: Fix the steps mentioned for enabling secure boot 2021-07-30 19:16:46 +05:30
b5b49eba82 spi: update examples to use the new GDMA driver 2021-07-30 17:59:52 +08:00
353f493f22 Merge branch 'bugfix/btdm_enable_gattc_cache_will_crash_v4.3' into 'release/v4.3'
component/bt: fix enable gattc nvs cache lead to crash

See merge request espressif/esp-idf!13888
2021-07-30 07:39:50 +00:00
68095b46c4 espcoredump.py: Parse EPS and EPC register values using register index 2021-07-30 15:35:02 +08:00
192aa18c31 Fixed ESP32 BLE can't resolve the peer address when enable white list 2021-07-30 15:09:00 +08:00
983e0c7fb2 Merge branch 'bugfix/ttfw_fix_flush_index_error_v4.3' into 'release/v4.3'
test: TTFW fix flush index error (v4.3)

See merge request espressif/esp-idf!14260
2021-07-30 06:36:20 +00:00
217c023a44 esp_wifi_mesh: add non mesh connections access 2021-07-30 14:32:48 +08:00
95c572c0d2 Merge branch 'bugfix/fix_uart_reset_issue_on_esp32c3_backport_v4.3' into 'release/v4.3'
bugfix(uart): reset uart0 core before uart apb reset(backport v4.3)

See merge request espressif/esp-idf!14462
2021-07-30 06:27:22 +00:00
de1a4f0c0d spi: Fix wrong target register for interrupt disable 2021-07-30 13:55:08 +08:00
9d4af47fa7 Merge branch 'bugfix/fix_eth2ap_example_crash_v4.3' into 'release/v4.3'
eth2ap: Fix eth2ap example crash issue (backport v4.3)

See merge request espressif/esp-idf!14562
2021-07-30 05:16:26 +00:00
36130916f0 Merge branch 'docs/fix_readme_links_v4.3' into 'release/v4.3'
docs: fixed dead readme links (v4.3)

See merge request espressif/esp-idf!14464
2021-07-30 03:04:44 +00:00
ea06260ec9 Merge branch 'docs/wifi_table_not_showing_v4.3' into 'release/v4.3'
docs: fix table in WifI guide not being rendered (v4.3)

See merge request espressif/esp-idf!14376
2021-07-30 03:04:26 +00:00
953e9a78e2 Merge branch 'bugfix/panic_handler_disable_wdts_early_v4.3' into 'release/v4.3'
esp_system: Reconfigure the WDTs at the start of the panic handler (v4.3)

See merge request espressif/esp-idf!14225
2021-07-30 03:03:09 +00:00
716efae251 Merge branch 'bugfix/esp32s2_disable_bss_extram_v4.3' into 'release/v4.3'
esp32s2: disable bss extram option, clean up spiram init code a bit (v4.3)

See merge request espressif/esp-idf!13733
2021-07-30 03:01:57 +00:00
b07276265a esp32s2: reset systimer clk on startup 2021-07-30 10:13:46 +08:00
cebab7fa7f newlib: init microseconds offset 2021-07-30 10:13:41 +08:00
c169788dac Merge branch 'bugfix/ci_move_udp_socket_tests_to_eth_runners_v4.3' into 'release/v4.3'
CI: Adjust UDP socket tests to be more reliable (v4.3)

See merge request espressif/esp-idf!14420
2021-07-29 18:56:38 +00:00
4c09277b27 Merge branch 'bugfix/workaround-bash-lang-issue_v4.3' into 'release/v4.3'
Bugfix: Set LANG to en code to avoid RuntimeError during autocompletion activation & Replaced broken link to shell autocompletion (v4.3)

See merge request espressif/esp-idf!14122
2021-07-29 13:31:53 +00:00
d33824ac4d Merge branch 'bugfix/fix_connect_fail_cause_by_sleep_v4.3' into 'release/v4.3'
Fix connection failure caused by sleep (backport v4.3)

See merge request espressif/esp-idf!14272
2021-07-29 12:38:48 +00:00
2333795d52 Merge branch 'doc/update_gpio_c3_v4.3' into 'release/v4.3'
doc: update gpio api guide reference on c3(backport v4.3)

See merge request espressif/esp-idf!13784
2021-07-29 07:10:46 +00:00
002e6b8cec freemodbus: increase max priority of modbus tasks
allows to avoid issues with modbus processing when higher priority tasks are used in user application
2021-07-29 14:27:04 +08:00
8bda396582 doc: update gpio api guide reference on c3 2021-07-29 11:24:26 +08:00
19f96b0e4f eth2ap: Fix eth2ap example crash issue
Closes https://github.com/espressif/esp-idf/issues/7260
2021-07-29 10:44:06 +08:00
00c304535f system: enable C3 light sleep related example tests 2021-07-29 09:29:29 +08:00
0b8ed8d76e ci: enable previously disabled unit tests 2021-07-29 09:29:29 +08:00
617da9f403 Merge branch 'bugfix/twai_low_speed_bit_rates_v4.3' into 'release/v4.3'
TWAI: Fix incorrect configuration initializers for low speed bit rates (backport v4.3)

See merge request espressif/esp-idf!14412
2021-07-28 11:23:08 +00:00
0e6f4ba2cf Merge branch 'bugfix/uart_race_condition_v4.3' into 'release/v4.3'
Fix couple of UART issues (backport v4.3)

See merge request espressif/esp-idf!14207
2021-07-28 11:22:18 +00:00
5adb8bd0d7 Merge branch 'bugfix/missing_extern_c_4.3' into 'release/v4.3'
[test_utils]: added extern C decl to ccomp (backport 4.3)

See merge request espressif/esp-idf!14326
2021-07-28 11:21:42 +00:00
b667770cc6 ulp riscv: force cocpu clock on to prevent spurious cocpu trap resets
Closes https://github.com/espressif/esp-idf/issues/7224
2021-07-28 18:15:38 +08:00
878e3f8468 Merge branch 'docs/windows_installer_2.9_backport_4.3' into 'release/v4.3'
docs: update Windows Tools 2.9 installation

See merge request espressif/esp-idf!14097
2021-07-28 09:34:33 +00:00
0d0f4adbf8 freemodbus: fix mb zero based reg address in the iterator
Fixes https://github.com/espressif/esp-idf/issues/6571
2021-07-28 11:34:19 +02:00
ed21dd43de Merge branch 'bugfix/ci_debug_gdb_issues_v4.3' into 'release/v4.3'
CI: Wait for the GDB process to start and print more debugging information (v4.3)

See merge request espressif/esp-idf!14535
2021-07-28 08:49:29 +00:00
47b96db12d Merge branch 'feature/prov_mgr_reset_state_v4.3' into 'release/v4.3'
wifi_provisioning: Add API to erase credentials and reset provisioning state (v4.3)

See merge request espressif/esp-idf!14531
2021-07-28 08:46:32 +00:00
82b868a4b2 Merge branch 'bugfix/esp32c3_wrong_iram_alignment_v4.3_2' into 'release/v4.3'
System/memprot: ESP32C3 IRAM section alignment fix (v4.3)

See merge request espressif/esp-idf!14506
2021-07-28 03:34:08 +00:00
89486da74e CI: Debug GDB issues 2021-07-27 20:03:57 +02:00
7793f58e71 wifi_provisioning: Add check for WIFI_REASON_MIC_FAILURE error code in wifi_prov_mgr_event_handler_internal 2021-07-27 15:11:26 +05:30
f56cd8fb29 wifi_prov_mgr: Add Kconfig option to restart provisioning 2021-07-27 15:11:23 +05:30
f93fdda2ff wifi_provisioning: Add API to reset state if provisioning fails 2021-07-27 15:09:51 +05:30
59af9606e6 Merge branch 'bugfix/fix_scan_timeout_mr_4.3' into 'release/v4.3'
Fix the scan timeout report

See merge request espressif/esp-idf!14445
2021-07-27 07:42:37 +00:00
a60a2892fb components/bt: fix spp memory leak
Closes https://github.com/espressif/esp-idf/issues/7238
2021-07-27 14:26:22 +08:00
b5b629c584 Fix couple of UART issues
- there was a small race in `uart_pattern_link_free`:
  `rx_pattern_pos.data` was accessed for reading outside spinlock
- `uart_flush_input` enabled
  `UART_INTR_RXFIFO_FULL|UART_INTR_RXFIFO_TOUT` intr mask on exit even
  if these flags weren't set when function was called

Closes https://github.com/espressif/esp-idf/pull/7023
2021-07-27 10:50:05 +08:00
96de941a6e spi_master: fix cmd test ci failure 2021-07-27 10:28:13 +08:00
7dc2e5e545 Merge branch 'bugfix/rtos_systick_cycle_time_error_dfs_v4.3' into 'release/v4.3'
backport v4.3: fix RTOS SysTick cycle time error caused by DFS

See merge request espressif/esp-idf!14494
2021-07-26 21:38:16 +00:00
4fd1479dc6 Merge branch 'bugfix/remove_unstable_network_tests_v4.3' into 'release/v4.3'
CI: Move mqtt publish tests from regular pipeline to weekend tests (v4.3)

See merge request espressif/esp-idf!14425
2021-07-26 17:02:51 +00:00
ebf1d15e54 Merge branch 'bugfix/esp_netif_dhcps_state_v4.3' into 'release/v4.3'
esp_netif: Fix dhcps state transitions (v4.3)

See merge request espressif/esp-idf!14423
2021-07-26 17:00:43 +00:00
27e3447eea Merge branch 'bugfix/read_ota_partition_required_output_arg_v4.3' into 'release/v4.3'
otatool: Fixes read_ota_partition cmd, required output arg (v4.3)

See merge request espressif/esp-idf!13672
2021-07-26 11:34:19 +00:00
47ec40c44f Merge branch 'fix/memory_leaks_identified_by_cppcheck_v4.3' into 'release/v4.3'
Fix/memory leaks identified by cppcheck (v4.3)

See merge request espressif/esp-idf!14501
2021-07-26 10:25:16 +00:00
35f79460a5 docs: update Windows Tools 2.9 installation 2021-07-26 12:18:23 +02:00
e9dc39730f System/memprot: ESP32C3 IRAM section alignment fix (LD)
IRAM section didn't contain sufficient padding for possible CPU instruction prefetch,
ie instruction fetch could happen in DRAM section which is prohibited by the Memprot module.
This is fixed by adding 16B to the end of IRAM section in LD script (C3 CPU prefetch buffer depth is 4 words)

Closes IDF-3554
2021-07-25 12:39:48 +02:00
0cb48f2f2e Fix memory leak on error path in register_select
And remove dead error handling code from unregister_select.

Closes https://github.com/espressif/esp-idf/pull/7296
2021-07-25 07:42:15 +05:30
afd3fc6d16 Fix memory leak on error path in http_header_set_format 2021-07-25 07:42:14 +05:30
e634a00ef8 Fix memory leak on error path in md5_printf 2021-07-25 07:42:13 +05:30
de49ec5a46 Fix memory leak on error path in esp_ds_start_sign 2021-07-25 07:42:13 +05:30
1772277e98 fix RTOS SysTick cycle time error caused by DFS 2021-07-23 19:15:28 +08:00
75940e9364 Merge branch 'docs/fix_UART_default_pin_error_and_provide_a_link_to_ESP_PROG_v4.3' into 'release/v4.3'
docs: fix uart default pin error and provide more information about ESP-Prog board (v4.3)

See merge request espressif/esp-idf!13968
2021-07-23 11:15:24 +00:00
5ab8799f09 Merge branch 'docs/provide_link_to_pcb_layout_for_ethernet_board_v4.3' into 'release/v4.3'
docs: provide the link to pcb layout for ethernet board v1.2 and fix a typo in freetos/task (v4.3)

See merge request espressif/esp-idf!13966
2021-07-23 10:57:37 +00:00
ecd2c51e64 Merge branch 'ci/rename_test_log_path_v4.3' into 'release/v4.3'
CI: rename log path of IT jobs (v4.3)

See merge request espressif/esp-idf!14452
2021-07-22 13:20:52 +00:00
de8c6aaa8d Merge branch 'bugfix/fix_ws_handle_big_messages_error_v4.3' into 'release/v4.3'
esp_http_server: Fix ws server handle length over 1440(MTU) messages incorrectly(backport v4.3).

See merge request espressif/esp-idf!14344
2021-07-22 04:20:26 +00:00
ab452839ed Merge branch 'feature/upgrade_mbedtls_to_v4.3' into 'release/v4.3'
mbedtls: upgrade to release v2.16.11 (v4.3)

See merge request espressif/esp-idf!14437
2021-07-21 12:17:00 +00:00
965423d532 CI: Prepare mqtt app test for QEMU tests
Adds qemu configuration
Generalize the get_dut() to enable choosing DUT class per configuration
2021-07-21 11:48:27 +02:00
de30298223 mdns: Fix crashes reported by the fuzzer 2021-07-21 11:48:27 +02:00
355e152082 mdns: Minor correction of the test code 2021-07-21 11:48:27 +02:00
0d3c3a9173 mdns: Fix fuzzer from miss-interpreting adding services as timeouts 2021-07-21 11:48:27 +02:00
91c93611e1 CI: Enable publish tests only when started from weekend pipeline 2021-07-21 11:48:27 +02:00
4373a89237 CI: Removed weekend network tests
Temporarily, before getting reworked and stable for running in the CI
2021-07-21 11:48:27 +02:00
6adaf783aa CI/mqtt: Execute mqtt weekend tests from test apps 2021-07-21 11:48:20 +02:00
ae7197e882 docs: fixed dead readme links 2021-07-21 17:48:11 +08:00
3d7666562b Merge branch 'ci/reduce_checK_docs_gh_link_v4.3' into 'release/v4.3'
ci: only run check_docs_gh_links job once per pipeline (v4.3)

See merge request espressif/esp-idf!14200
2021-07-21 08:33:35 +00:00
427fe1bcde uart: fix esp32c3 uart output garbage value after resetting 2021-07-21 15:31:50 +08:00
cba6f1ae66 Merge branch 'bugfix/docs_c3_jtag_v4.3' into 'release/v4.3'
docs: Improve the ESP32-C3 JTAG guide (v4.3)

See merge request espressif/esp-idf!13532
2021-07-21 06:45:04 +00:00
be3b44c92d Merge branch 'bugfix/idf_tools_not_found_issue_v4.3' into 'release/v4.3'
tools: Catch OSError which is raised when the tool is not available (v4.3)

See merge request espressif/esp-idf!14133
2021-07-21 06:40:11 +00:00
8f75f93c14 Merge branch 'bugfix/fix_truncated_headers_for_esp_http_client_v4.3' into 'release/v4.3'
esp_http_client: Fix header truncated when responded header length over buffer_size (backport v4.3)

See merge request espressif/esp-idf!14383
2021-07-21 05:31:26 +00:00
3222f0a811 Merge branch 'feature/protocomm_mfg_data_v4.3' into 'release/v4.3'
Provisioning BLE: Add API to set manufacturer data in advertisement (scan response) packets (v4.3)

See merge request espressif/esp-idf!14366
2021-07-21 05:24:25 +00:00
1d4eb835d0 Merge branch 'bugfix/otatool_imported_as_lib_v4.3' into 'release/v4.3'
otatool: Fix a crash when imported as external python lib (v4.3)

See merge request espressif/esp-idf!13666
2021-07-21 05:23:12 +00:00
60ef790969 Merge branch 'cherry-pick-76bd33e9' into 'release/v4.3'
MbedTLS: Add config option for key elements and key element extension for SSL connection (backport v4.3)

See merge request espressif/esp-idf!14361
2021-07-21 05:22:05 +00:00
bd4d591b79 CI: rename log path of IT jobs 2021-07-21 10:17:45 +08:00
658aaa4f93 This is to fix the hardware bug. The device may report scan event timeout
when scaning.If check this error,then reset the rwble core.
2021-07-20 20:02:14 +08:00
f817971f68 mbedtls: fix crt_bundle test to ensure proper server start event
This fixes occasional test failure that was observed due to
client task getting started before server was up.
2021-07-20 14:15:59 +05:30
4333e618b5 mbedtls: upgrade to release v2.16.11
For detailed release notes please refer to:
https://github.com/ARMmbed/mbedtls/releases/tag/v2.16.11
2021-07-20 14:15:59 +05:30
eb01aaacc7 fix esp32s2 fall into sleep forever when deep-sleep time is set to 0
(backport v4.3)
2021-07-19 21:11:04 +08:00
f7169ed063 mqtt: Moved weekend tests to test apps 2021-07-19 15:05:58 +02:00
acf5333b1e esp_netif: Fix dhcps state transitions
When the DHCP server is stopped before starting the netif,
it should remain stopped -- as per compatibility with previous tcpip_adapter behavior
2021-07-19 15:00:37 +02:00
fa55d3722c CI/socket examples: Add UDP operation retries, wait until server is up 2021-07-19 14:54:42 +02:00
4b47e7e643 Merge branch 'fix/esp32c3_memprot_split_line_v4.3' into 'release/v4.3'
esp32c3/memprot: Fix incorrect calculations and register access (v4.3)

See merge request espressif/esp-idf!14372
2021-07-19 11:28:55 +00:00
e701c98e27 TWAI: Fix incorrect configuration initializers for low speed bit rates
This commit fixes the timing configuration initializers for the
1K, 5K, and 10K bit rates.
2021-07-19 17:13:34 +08:00
42376de238 Merge branch 'bugfix/SCO_connect_fail_after_peer_not_accept_sniff_v4.3' into 'release/v4.3'
Add remove sniff when peer not accepted sniff mode(v4.3)

See merge request espressif/esp-idf!14395
2021-07-19 07:31:37 +00:00
c9ebba355f otatool: Fix a crash when imported as external python lib
Closes: https://github.com/espressif/esp-idf/issues/6733
2021-07-19 12:41:51 +08:00
6785534f63 otatool: Fixes read_ota_partition cmd, required output arg
Closes: https://github.com/espressif/esp-idf/issues/6559
2021-07-19 12:41:00 +08:00
1f7172dbf9 Merge branch 'bugfix/secure_boot_sig_verify_v4.3' into 'release/v4.3'
secure boot: Fix incorrect handling of mbedtls_ctr_drbg_seed() failure in signature verification (v4.3)

See merge request espressif/esp-idf!14390
2021-07-16 10:54:13 +00:00
bc3f0c7cdd Add remove sniff when peer not accepted sniff mode 2021-07-16 17:55:10 +08:00
ee8a78025c bt/controller: Fix for BLE ACL tx flush issue during reset. 2021-07-16 17:54:27 +08:00
9c8dfa4ba4 Merge branch 'bugfix/fix_timer_delete_crash_v4.3' into 'release/v4.3'
Nimble: Add fix for crash in esp_timer deletion (v4.3)

See merge request espressif/esp-idf!14364
2021-07-16 08:20:14 +00:00
33f1ad2106 Merge branch 'bugfix/update_ota_cert_v4.3' into 'release/v4.3'
OTA examples: Update server certificate (v4.3)

See merge request espressif/esp-idf!14354
2021-07-16 08:17:49 +00:00
07465563c5 secure boot: Fix incorrect handling of mbedtls_ctr_drbg_seed() failure in signature verification
Increase the test app optimization level to one that would find this issue.
2021-07-16 11:03:21 +05:30
7c55633bfb esp_common: Correctly disable ".bss segment placed in external memory" for ESP32-S2 & ESP32-S3
Support for this feature is still pending.

As reported by https://github.com/espressif/esp-idf/issues/6162
2021-07-16 11:39:09 +10:00
3c13a480d7 esp32s2: Simplify the code for adding spiram to heap 2021-07-15 21:22:33 +10:00
d5d20920bb esp32s2: Remove unused option CONFIG_SPIRAM_USE_AHB_DBUS3 2021-07-15 21:22:33 +10:00
b7791c171d esp_http_client: Optimize code structure 2021-07-15 16:17:51 +08:00
d25b354cfc esp_http_client: fix truncated headers
Signed-off-by: yuanjm <yuanjianmin@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/6370
2021-07-15 16:17:36 +08:00
0347b5d043 docs: fix table in WifI guide not being rendered 2021-07-15 14:57:15 +08:00
47c728adf0 esp32c3/memprot: Correct the split line address calculation 2021-07-15 10:57:18 +05:30
65b9f87998 esp32c3/memprot: Fix incorrect access to DRAM0 split line registers
memprot_ll_set_dram0_split_line_* and memprot_ll_get_dram0_split_line_* APIs were accessing
incorrect configuration register
2021-07-15 10:57:18 +05:30
6a9a962083 Provisioning BLE: Add API to set manufacturer data in scan response
- Add `wifi_prov_scheme_ble_set_mfg_data` API to set custom manufacturer data
  in BLE advertisements.
- Run format.sh script on modified files.
- Fix few typos in `protocomm_nimble.c`.

- Incorporate suggestion to remove extra check on protocomm_ble_mfg_data_len

- Remove few unnecessary comments.
2021-07-14 18:22:40 +05:30
758fc73efe system : Add defination of ESP_ERROR_CHECK_WITHOUT_ABORT under CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT flag 2021-07-14 16:02:33 +05:30
2dc4961063 Nimble: Add fix for crash in esp_timer deletion
Added change in nimble submodule to handle crash in case of non-started
timer is attempted to be deleted.
2021-07-14 16:02:32 +05:30
dd12e9f8cd Merge branch 'cert/skipping_keyelements_validation' into 'master'
MbedTLS: Add config option for key elements and key element extension for SSL connection

See merge request espressif/esp-idf!12898

(cherry picked from commit 76bd33e9a4)

38d67725 mbedtls: Add config option key element and key element ext
2021-07-14 16:43:58 +08:00
49a99fee56 OTA examples: Updated server certificate 2021-07-14 12:44:18 +05:30
835d1b0bac bugfix:rotary encoder example isr service install
Fix the issue mentioned when using two or more encoders. Modify PCNT_CTRL_GND_IO
to avoid the affect of USB JTAG(origin pin 19 is used for USB D-). Update esp32c3.
peripherals.ld and docs for esp32s3.

Closes https://github.com/espressif/esp-idf/issues/6889
2021-07-14 10:13:21 +08:00
8b2331a810 driver/timer: only re-enable alarm in callback when auto reload is true
closes https://github.com/espressif/esp-idf/issues/7001
2021-07-13 17:22:33 +08:00
1214944e78 esp_http_server: Fix ws server handle length over 1440(MTU) messages incorrectly.
Closes https://github.com/espressif/esp-idf/issues/7202
2021-07-13 17:05:24 +08:00
fe485a1ea0 docs: Suggest how to use JTAG for ESP32-C3 on Windows 2021-07-12 17:32:34 +02:00
a2a7ea7012 [test_utils]: added extern C decl to ccomp
Closes https://github.com/espressif/esp-idf/issues/7121
2021-07-12 14:26:22 +08:00
7443d7d274 tools: Update ESP32-C3 toolchain for Windows - add some missed DLLs for GDB 2021-07-08 13:00:55 +07:00
96122d6f28 Fix connection failure caused by sleep 2021-07-06 10:49:10 +08:00
1fc288556c esp_system: Reconfigure the WDTs at the start of the panic handler
This is mostly important on ESP32 ECO3 with the
ESP32_ECO3_CACHE_LOCK_FIX, because when we stall the other CPU core
before we disable the TG1 WDT then the first CPU can get stuck
in WDT ISR handle_livelock_int routine waiting for the other CPU.
2021-07-06 09:59:39 +08:00
8807d8a5d8 Merge branch 'bugfix/revert_default_country_v4.3' into 'release/v4.3'
esp_wifi: Revert default country to China (backport v4.3)

See merge request espressif/esp-idf!14250
2021-07-05 14:02:36 +00:00
b8ca42400b ttfw: fix incorrect length when flush data cache after expect:
data cache is unicode. while we use bytes in RegEx expect. The index of
matched pattern is calculated with bytes, could be different from
unicode. Now we fix this issue by using unicode in expect.
2021-07-05 19:43:15 +08:00
ce279af00d ttfw: full_stdout should not return data after pattern in expect 2021-07-05 19:43:14 +08:00
b47e8123ca esp_wifi: Revert default country to China 2021-07-05 12:40:47 +05:30
596d17a6cc spi_docs: Fixed the default value of max_transfer_sz.
(cherry picked from commit e89fabb963)
2021-07-05 11:47:27 +08:00
4d53269a6d Merge branch 'feature/regdomain_support_v4.3' into 'release/v4.3'
esp_wifi: Add support for regdomain db (backport v4.3)

See merge request espressif/esp-idf!13609
2021-07-02 17:22:09 +00:00
4b24d3d464 Merge branch 'bugfix/tls_alignment_v4.3' into 'release/v4.3'
esp32[s2,s3]: fix _flash_rodata_align value in the linker scripts (v4.3)

See merge request espressif/esp-idf!14233
2021-07-02 11:00:50 +00:00
2ac59cc885 Merge branch 'bugfix/delete_i2c_cmd_mux_semaphore_more_cleanly_v4.3' into 'release/v4.3'
driver/i2c: delete i2c cmd_mux semaphore more cleanly (backport 4.3)

See merge request espressif/esp-idf!13400
2021-07-02 10:58:38 +00:00
6e05a56713 Merge branch 'bugfix/i2s_apll_disable_issue_v4.3' into 'release/v4.3'
i2s: fix driver uninstall issue (backport v4.3)

See merge request espressif/esp-idf!13998
2021-07-02 10:56:17 +00:00
ff75da76e4 Merge branch 'feature/add-nimble-host-to-blufi_v4.3' into 'release/v4.3'
Add support of NimBLE host to Blufi (v4.3)

See merge request espressif/esp-idf!14198
2021-07-02 09:29:31 +00:00
64dc45a2e6 Merge branch 'bugfix/rrm_caps_for_open_ap_v4.3' into 'release/v4.3'
wpa_supplicant: Fix some issues in 11kv (backport v4.3)

See merge request espressif/esp-idf!13695
2021-07-02 09:23:19 +00:00
cf44123da5 esp_wifi: Add support for regdomain database 2021-07-02 14:29:45 +05:30
64057d302a esp32[s2,s3]: fix _flash_rodata_align value in the linker scripts
Regression from 4702feeee. The TLS segment is located inside
.flash.rodata, so we need to get the alignment of that section, not
.flash.rodata_noload.
2021-07-02 08:37:47 +02:00
69a48e431e wpa_supplicant: Fix some issues in 11kv
1. RRM capability addition for open AP
2. Crash during scan flush
3. Station not able to connect if disassoc timer is present in BTM request
4. Memory leaks during wifi init/deinit.
2021-07-02 10:28:57 +05:30
8080c8d343 Merge branch 'bugfix/ftm_lock_free_issue_v4.3' into 'release/v4.3'
esp_wifi: Update wifi lib with lock free issue fix

See merge request espressif/esp-idf!14215
2021-07-01 17:38:39 +00:00
e280541892 esp_wifi: Update wifi lib with lock free issue fix 2021-07-01 14:14:42 +05:30
ea9dc928ee Merge branch 'feature/optimize_wifi_log_by_linker_script_v4.3' into 'release/v4.3'
esp_wifi: move unused WiFi log to noload section to save binary size(backport v4.3)

See merge request espressif/esp-idf!14167
2021-07-01 08:40:11 +00:00
5e600d5b31 esp_wifi: move unused WiFi log to noload section to save binary size 2021-07-01 14:11:38 +08:00
e4ada333cc Merge branch 'release/v4.3' into 'feature/add-nimble-host-to-blufi_v4.3'
# Conflicts:
#   components/bt/host/nimble/Kconfig.in
2021-07-01 11:47:03 +08:00
00b9df2937 Add support of NimBLE host to Blufi
Merges https://github.com/espressif/esp-idf/pull/6904
2021-07-01 09:06:15 +05:30
91430c8674 Merge branch 'bugfix/add_esp_timer_helper_function_v4.3' into 'release/v4.3'
Add esp timer helper function (v4.3)

See merge request espressif/esp-idf!14202
2021-07-01 03:01:02 +00:00
4de35f8e1e ci: only run check_docs_gh_links job once per pipeline
Job simply walks all .rst files and check links. No need to
run for multiple targets/languages
2021-07-01 09:55:30 +08:00
df99c92193 Merge branch 'feature/ftm_support_stage2_v4.3' into 'release/v4.3'
wifi/ftm: Additional FTM features implementation (Backport v4.3)

See merge request espressif/esp-idf!14157
2021-06-30 15:20:01 +00:00
eb78648fa6 Merge branch 'bugfix/esp_https_ota_v4.3' into 'release/v4.3'
esp_https_ota: Add  check for HTTP error codes and documentation updates (v4.3)

See merge request espressif/esp-idf!14206
2021-06-30 14:55:36 +00:00
c1d5eafd16 wifi/ftm: Additional FTM features implementation
Update wifi lib with below features -
1. ASAP mode for both Initiator and Responder
2. Offchannel FTM while connected to AP (ASAP only)
3. Support up to 3 Initiators simultaneously
4. Session termination, failure support etc
5. Mem-zero AP scan buffer in get_records API
2021-06-30 17:49:28 +05:30
3a0b4628ce Merge branch 'feature/crypto_porting_v4.3' into 'release/v4.3'
wpa_supplicant: Rewrite Crypto APIs based on MbedTLS (backport V4.3)

See merge request espressif/esp-idf!14181
2021-06-30 11:46:03 +00:00
01f05da3ae esp_https_ota: Add check for HTTP error codes and corresponding error logs
Closes: https://github.com/espressif/esp-idf/issues/7058
2021-06-30 15:59:10 +05:30
82c6e0628a Merge branch 'test/flash_perf_thr_update_by_grafana_avg_v4.3' into 'release/v4.3'
ci: adjust spi_flash performance value according to more test data (v4.3)

See merge request espressif/esp-idf!14116
2021-06-30 10:06:10 +00:00
f1adfaaced Add esp_timer_is_active function for Nimble stack to use esp_timer instead of FreeRTOS timer 2021-06-30 14:53:06 +05:30
c836cef1a5 Merge branch 'bugfix/add_exception_emergency_pool_again_4.3' into 'release/v4.3'
[esp_system]: added __cxx_eh_arena_size_get again (backport 4.3)

See merge request espressif/esp-idf!14132
2021-06-30 07:30:39 +00:00
689fad7372 ci: adjust spi_flash performance value according to more test data
After we have the performance dashboard, we have more data and no longer depend on the threshold to ensure performance.
Set looser performance thresholds to avoid CI failure.
2021-06-30 08:52:03 +08:00
df0ed79cd5 Merge branch 'bugfix/deep_sleep_rtcwdt_rst_issue_v4.3' into 'release/v4.3'
backport v4.3: clear wakeup and reject int raw signal before entry sleep

See merge request espressif/esp-idf!13999
2021-06-29 14:05:06 +00:00
32e8a809f6 Merge branch 'bugfix/correct_gatt_max_macro_name_v4.3' into 'release/v4.3'
Bluedroid: Fixed issue of option not being set due to incorrect macro (v4.3)

See merge request espressif/esp-idf!14180
2021-06-29 09:25:12 +00:00
073b45a8aa wpa_supplicant: Fix crypto related bugs
1. Fix aes_unwrap functionality when hardware acceleration is disabled
2. Fix compilation errors when mbedTLS is disabled.
3. Disable WPA3 when mbedTLS is disabled.
2021-06-29 14:34:48 +08:00
ae35d70359 wpa_supplicant: Write Crypto API based on mbedtls
This commit add following crypto changes

1. Update current crypto code with upstream supplicant code
2. Add a proper porting layer to use mbedtls APIs for all the crypto
   operations used by supplicant.

Internal crypto will be used when USE_MBEDLTS flag is disabled
in supplicant's menuconfig.

This commit also removes the clutter in crypto files due to partial
porting of some APIs to mbedtls, all the code from those files have
been removed and rewritten in a generic way, this is inspired from
current upstream code.

This also reduces the lib size significantly, supplicant's lib
size reduces around ~567kb after this change(NB: lib size doesn't
indicate reduction in final bin size).
2021-06-29 14:34:48 +08:00
9c8b2b92ad Bluedroid: Fixed issue of option not being set due to incorrect macro
name.
2021-06-29 09:53:35 +05:30
a060ee8e9c Merge branch 'bugfix/wifi_mac_sleep_issue_v4.3' into 'release/v4.3'
backport v4.3: fix wifi mac sleep bug when wifi is initialized multiple times

See merge request espressif/esp-idf!13669
2021-06-29 04:22:59 +00:00
de92d7e15f Merge branch 'mesh/bugfix_fix_esp_mesh_send_block_issue_v4.3' into 'release/v4.3'
mesh/ps: esp_mesh_send is blocked in nodes(layer>=3), when a FIXED-ROOT root is duty master(backport_v4.3)

See merge request espressif/esp-idf!14085
2021-06-29 03:01:22 +00:00
139afb094e fix wifi mac sleep bug when wifi is initialized multiple times 2021-06-29 10:26:02 +08:00
5b5e46971a Merge branch 'feature/ssl_components_optimize_v4.3' into 'release/v4.3'
tls: Modify tls optimize both mbedtls and wolfssl(backport v4.3)

See merge request espressif/esp-idf!14160
2021-06-28 21:00:34 +00:00
6a1938384a tls: Modify tls optimize both mbedtls and wolfssl 2021-06-29 00:19:03 +08:00
84a0c67a8c Merge branch 'feature/toolchain_2021r1_v4.3' into 'release/v4.3'
Bring 2021r1 toolchains (backport v4.3)

See merge request espressif/esp-idf!13996
2021-06-28 16:15:05 +00:00
f022863c35 Merge branch 'feature/update_mqtt_submodule_v4.3' into 'release/v4.3'
MQTT: Support for certificate bundle; Client clean-up (v4.3)

See merge request espressif/esp-idf!14159
2021-06-28 14:35:17 +00:00
7339b019f1 Merge branch 'bugfix/wps_wfa_cert_fixes_v4.3' into 'release/v4.3'
wpa_supplicant: Add WPS strict in config option(backport v4.3)

See merge request espressif/esp-idf!13547
2021-06-28 13:28:21 +00:00
b9b7750b78 Merge branch 'feature/sperate_esp_netif_component_v4.3' into 'release/v4.3'
esp_netif: Add CONFIG_PPP_SUPPORT and CONFIG_LWIP_SLIP_SUPPORT to sperate the code(backport v4.3)

See merge request espressif/esp-idf!14158
2021-06-28 09:15:41 +00:00
17f30a4aec Merge branch 'feature/parametrize_core_dump_check_v4.3' into 'release/v4.3'
coredump: core dump data check can now be parametrized (v4.3)

See merge request espressif/esp-idf!13773
2021-06-28 07:03:50 +00:00
62cc976e0e mesh/ps: esp_mesh_send is blocked in nodes(layer>=3), when a FIXED-ROOT root is duty master 2021-06-28 11:57:10 +08:00
95ddb84df1 Merge branch 'bugfix/fix_c3_some_bugs_06_15_v4.3' into 'release/v4.3'
Bugfix/fix c3 some bugs 06 15 v4.3

See merge request espressif/esp-idf!14017
2021-06-28 00:00:06 +00:00
c42ee1b790 Merge branch 'bugfix/spi_flash_cs_setup_v4.3' into 'release/v4.3'
spi_flash: fix cs line setup to make the flash driver more stable(backport v4.3)

See merge request espressif/esp-idf!13967
2021-06-27 14:37:08 +00:00
4cf65c3533 Merge branch 'feature/lwip_icmp_v4.3' into 'release/v4.3'
lw-ip: Add CONFIG_LWIP_ICMP and CONFIG_LWIP_ICMP6 to sperate the code(backport v4.3)

See merge request espressif/esp-idf!14110
2021-06-25 18:01:40 +00:00
d4d308d580 LEDC: fix bit error in ledc_struct.h(backport v4.3) 2021-06-25 20:43:36 +08:00
9de41781d5 MQTT: Support for certificate bundle; Client clean-up
* Closes https://github.com/espressif/esp-idf/issues/7040
* Merges https://github.com/espressif/esp-idf/pull/7041
* Update submodule: git log --oneline 9fdf7b61385633075d5c3b84803f2dd0578d7869..f10321a53b53a146ee299cfecc320b89c0cf6611

Detailed description of the changes:
* Remove unnecessary parentheses
  - esp-mqtt commit: db13533904
  - esp-mqtt MR: espressif/esp-mqtt!101
* outbox: Cleanup all items when connection closes
  - esp-mqtt commit: 1a94efe8b9
  - esp-mqtt MR: espressif/esp-mqtt!104
* Outbox: Removes unnecessary calls to outbox_set_pending
  - esp-mqtt commit: 36a3990404
  - esp-mqtt MR: espressif/esp-mqtt!105
* MQTT: Makes abort connection function void.
  - esp-mqtt commit: 67553aba45
  - esp-mqtt MR: espressif/esp-mqtt!106
* Client: Removes unused defines
  - esp-mqtt commit: eec6f0e17d
  - esp-mqtt MR: espressif/esp-mqtt!100
  - Closes https://github.com/espressif/esp-mqtt/issues/194
* Config: Added support for certificate bundle
  - esp-mqtt commit: 06157be118
  - esp-mqtt MR: espressif/esp-mqtt!98
  - Closes https://github.com/espressif/esp-mqtt/issues/190
* Config: Adds missing field at config struct (path field)
  - esp-mqtt commit: 5b27d1896e
  - esp-mqtt MR: espressif/esp-mqtt!96
* Client: Add support for partial transport writes
  - esp-mqtt commit: d8c9c7a9e7
  - esp-mqtt MR: espressif/esp-mqtt!99
  - Partially addresses https://github.com/espressif/esp-idf/issues/6940
* Client: Add support for Retain flag in messages posted by events
  - esp-mqtt commit: a00a3134c6
  - esp-mqtt MR: espressif/esp-mqtt!99
  - Closes https://github.com/espressif/esp-mqtt/issues/193
* esp-mqtt: Added nullchecks for public APIs
  - esp-mqtt commit: 2f57985c0b
  - esp-mqtt MR: espressif/esp-mqtt!94
  - Closes https://github.com/espressif/esp-mqtt/issues/185
* esp-mqtt: Reduce the includes used in all files
  - esp-mqtt commit: 87fcce72c9
  - esp-mqtt MR: espressif/esp-mqtt!93
* mqtt_outbox: Use STAILQ_FOREACH for outbox_delete_single_expired
  - esp-mqtt commit: ff8e64839a
  - esp-mqtt MR: espressif/esp-mqtt!97
  - Merges https://github.com/espressif/esp-mqtt/pull/187
* Client: Add optimize for depend on ssl
  - esp-mqtt commit: 8f3cac8c36
  - esp-mqtt MR: espressif/esp-mqtt!95
2021-06-25 14:15:49 +02:00
bde386ab94 esp_netif: Correct spelling mistakes 2021-06-25 19:40:22 +08:00
c1fe7fe230 slip: Fix the definition of cplusplus in the code 2021-06-25 19:40:08 +08:00
00d84a3bb2 esp_netif: Add CONFIG_PPP_SUPPORT and CONFIG_LWIP_SLIP_SUPPORT to sperate the code 2021-06-25 19:39:53 +08:00
3844f6bb84 Merge branch 'bugfix/ble_start_scan_crash_issue_mr_4.3' into 'release/v4.3'
ble start scan crash issue

See merge request espressif/esp-idf!14081
2021-06-25 11:25:36 +00:00
8767aa7a4f lwip: Add CONFIG_LWIP_ICMP and CONFIG_LWIP_ICMP6 to sperate the code 2021-06-25 16:36:11 +08:00
zwj
4d3715c836 support hw recorrect 2021-06-25 15:32:50 +08:00
zwj
dc209757b1 - fix data length update failed
- fix no callback when the value being used is the same as the value to be set
2021-06-25 15:32:28 +08:00
zwj
c2c3193209 hid examples support esp32c3/s3 2021-06-25 15:32:17 +08:00
2365242391 tools: stop building if compiler is unsupported 2021-06-25 11:48:26 +07:00
18e7da0285 ci: add debug artifacts for test_idf_tools 2021-06-25 11:48:26 +07:00
99115d7e52 ci: fix test_build_system* fails 2021-06-25 11:48:26 +07:00
b6c91daa68 Update toolchains to esp-2021r1
Adds ESP32-C3 support
    Updates ESP32-S3 overlay
    GDB 9.2 for ESP32-C3 with core dump support
    Linker supports eh-frame-hdr for ESP32-C3
    Newlib 3.3.0 includes fixes for <cmath> funcs, for overflow when TZ calculating, for malloc checks
    Binutils 2.35.1

    Closes https://github.com/espressif/esp-idf/issues/6795
2021-06-25 11:48:25 +07:00
12e882632b make build system: fix build for undefined _lock_* funcs 2021-06-25 11:48:25 +07:00
166281238f make build system: fix ar warning 2021-06-25 11:48:25 +07:00
29b8f3b719 newlib: Add ESP_ROM_HAS_RETARGETABLE_LOCKING capability for C3 and S3 chips 2021-06-25 11:48:25 +07:00
e7b70a2f44 hal: fix ee.get_gpio_in command for esp32-s3 2021-06-25 11:47:59 +07:00
39bf05467a tools: fix parsing regex 2021-06-25 11:47:59 +07:00
02872ada4f Merge branch 'test/wifi_connect_with_full_scan_in_examples_v4.3' into 'release/v4.3'
example: set example wifi scan method to all channel (v4.3)

See merge request espressif/esp-idf!13912
2021-06-25 04:07:47 +00:00
3a588d7d19 Merge branch 'bugfix/mdns_one_shot_multicast_v4.3' into 'release/v4.3'
mdns: Support for One-Shot mDNS queries (v4.3)

See merge request espressif/esp-idf!14130
2021-06-24 18:47:46 +00:00
0e2045006c Merge branch 'feature/netif_dhcp_cleint_server_update_v4.3' into 'release/v4.3'
esp_netif: Add CONFIG_LWIP_DHCPS to sperate the code(back port v4.3)

See merge request espressif/esp-idf!13175
2021-06-24 17:08:40 +00:00
424203e411 esp_netif: Add CONFIG_LWIP_DHCPS to sperate the code 2021-06-24 23:20:17 +08:00
460fc7f546 Merge branch 'feature/optimize_firmware_code_size_v4.3' into 'release/v4.3'
esp_wifi: refactor ioctl functions and build wifi lib with -Os to save binary size(Backport v4.3)

See merge request espressif/esp-idf!13265
2021-06-24 12:16:17 +00:00
5ab41b6c5d Merge branch 'bugfix/phy_calib_data_to_nvs_for_c3_s3_v4.3' into 'release/v4.3'
esp_wifi: re-enable phy calibration data to nvs for esp32c3 & esp32s3(V4.3)

See merge request espressif/esp-idf!13625
2021-06-24 09:50:18 +00:00
2a09b9d91f wpa_supplicant: Add WPS strict in config option
WPS strict disables workarounds with different APs and may cause
IOT issues. Remove this as default and introduce as a config option.

Also add changes to declare esp device as single band mobile device since
WFA sniffer was not able to identify it in the certification setup.
2021-06-24 16:15:40 +08:00
f12d7c5835 tools: Catch OSError which is raised when the tool is not available
Closes https://github.com/espressif/esp-idf/issues/7140
2021-06-24 09:14:50 +02:00
cd4c444af9 Merge branch 'bugfix/spp_connect_20_fail_v4.3' into 'release/v4.3'
component_bt: fix spp acceptor deadlock

See merge request espressif/esp-idf!14105
2021-06-24 06:53:05 +00:00
4d08c344bd Merge branch 'bugfix/mdns_interface_del_crash_v4.3' into 'release/v4.3'
mdns: Fix of crash when wifi interface get deleted and mdns receives the packets(Backport v4.3)

See merge request espressif/esp-idf!13857
2021-06-24 05:47:36 +00:00
951c6cb719 Merge branch 'bugfix/bt_sleep_state_check_assert_failed_for_v4.3' into 'release/v4.3'
Bluetooth: fixed the assertion failure in checking hardware sleep state during wake-up(backport v4.3)

See merge request espressif/esp-idf!14128
2021-06-24 05:23:35 +00:00
0e078d9481 mdns: Support for One-Shot mDNS queries 2021-06-24 06:58:53 +02:00
5abe2b059e Merge branch 'bugfix/lwip_config_dhcp_client_id_v4.3' into 'release/v4.3'
lw-ip: Add config for DHCP client id; Fix DNS server idx assert issue (v4.3)

See merge request espressif/esp-idf!13515
2021-06-24 04:21:38 +00:00
58583f187e [esp_system]: added __cxx_eh_arena_size_get again
* This function has been accidentally removed.
  It is necessary to provide the emergency
  exception memory pool size for C++ code.
  Since our libstdc++ always has exceptions
  enabled, this function must exist here even if
  -fno-exception is set for user code.
2021-06-24 12:19:34 +08:00
8744cb880b docs: add rf calibration docs for S2 and C3 2021-06-24 11:33:20 +08:00
3423cc2937 esp_wifi: re-enable phy calibration data to nvs for esp32c3 & esp32s3 2021-06-24 11:33:19 +08:00
306b035a51 esp_wifi: refactor ioctl functions and build wifi lib with -Os to save binary size 2021-06-24 10:11:09 +08:00
ffe43f2c45 component/bt: fixed the assert in checking hardware sleep state during wake-up
The hardware sleep state change can take some time after wake-up interrupt. Use busy waiting instead of directly assert
2021-06-24 08:28:24 +08:00
ecc86b3f22 Merge branch 'bugfix/rx_irq_flooding_during_scan_v4.3' into 'release/v4.3'
Bluetooth: fixed interrupt flooding during scan

See merge request espressif/esp-idf!14104
2021-06-24 00:12:59 +00:00
6ff1d8c828 Merge branch 'bugfix/eth_w5500_io_intr_missed_v4.3' into 'release/v4.3'
esp_eth: w5500: Improve GPIO interrupt processing (v4.3)

See merge request espressif/esp-idf!13863
2021-06-23 17:54:30 +00:00
0da3b397f2 Merge branch 'bugfix/otatool_wrong_switch_ota_partition_slots_v4.3' into 'release/v4.3'
otatool: Fix incorrect using otadata.seq&crc in switch_ota_partition cmd (v4.3)

See merge request espressif/esp-idf!13366
2021-06-23 15:37:40 +00:00
70912cb4b2 Merge branch 'feature/optimize_mqtt_option_v4.3' into 'release/v4.3'
transport: Add CONFI_WS_TRANSPORT for optimize the code size(backport v4.3)

See merge request espressif/esp-idf!14109
2021-06-23 15:00:47 +00:00
d42499a5db Merge branch 'docs/programming_guide_c3_update_twai_v4.3' into 'release/v4.3'
Update TWAI driver docs and registers for esp32c3 (backport v4.3)

See merge request espressif/esp-idf!13289
2021-06-23 14:41:07 +00:00
46144f7093 Merge branch 'bugfix/fix_amsdu_fragment_vulnerability_v4.3' into 'release/v4.3'
esp_wifi: fix amsdu & fragment vulnerabilities(v4.3)

See merge request espressif/esp-idf!13799
2021-06-23 13:38:27 +00:00
9175c9b706 Merge branch 'bugfix/idfpy_global_action_callbacks_order_v4.3' into 'release/v4.3'
idf.py: Run global_action_callbacks in predictable order (v4.3)

See merge request espressif/esp-idf!13681
2021-06-23 13:28:21 +00:00
b2d728075d Merge branch 'bugfix/esp_partition_get_sha256_v4.3' into 'release/v4.3'
bootloader_support: Fix bootloader_common_get_sha256_of_partition when CHECK_SIGNATURE is on (v4.3)

See merge request espressif/esp-idf!13665
2021-06-23 12:45:55 +00:00
beba6f954c Temporarily set LANG to en code to avoid RuntimeError
Closes https://github.com/espressif/esp-idf/issues/7173
2021-06-23 14:43:01 +02:00
1d23b83d3b otatool: Fix incorrect using otadata.seq&crc in switch_ota_partition cmd
Closes: https://github.com/espressif/esp-idf/issues/6773
2021-06-23 19:28:40 +08:00
9b014138bf Update TWAI driver docs and registers for esp32c3
This commit updates the documentation and register struct
of the TWAI driver for the ESP32-C3. Note that the register
fields for ESP32-S3 have also been updated.
2021-06-23 19:26:16 +08:00
4657069afd components/bt: Disable CS-RXDONEMSK to avoid RX interrupt flooding during scan event in Wi-Fi coexistence scenario 2021-06-23 19:14:41 +08:00
b67e388281 Merge branch 'feature/prevent_unwind_code_linking_4.3' into 'release/v4.3'
[C++]: prevent unwind code linking (backport 4.3)

See merge request espressif/esp-idf!13800
2021-06-23 08:32:17 +00:00
5186a968be coredump: core dump data check can now be parametrized
Core dump integrity check can now be parametrized through menuconfig.
It can be performed on boot or ignored. When core dump is activated
in the menuconfig, the user can still check the core dump at any time
with the function `esp_core_dump_image_check()`.

Fix a bug where `esp_core_dump_image_get()` was not accessible
when core dump was disabled.

Closes https://github.com/espressif/esp-idf/issues/6620
2021-06-23 16:17:15 +08:00
418fed12df espcoredump erase review comments 2021-06-23 16:17:15 +08:00
5d4e084669 coredump: Implemented esp_core_dump_image_erase() and esp_core_dump_image_get() now returns ESP_ERR_NOT_FOUND when partition is blank
Closes https://github.com/espressif/esp-idf/pull/6631
2021-06-23 16:17:12 +08:00
a79a8e4215 Merge branch 'bugfix/failing_python_wheels_download_v4.3' into 'release/v4.3'
Tools: Remove dependency on idf-python and idf-python-wheels (v4.3)

See merge request espressif/esp-idf!13221
2021-06-23 08:12:18 +00:00
e080f43245 Merge branch 'bugfix/dfu_split_large_bins_v4.3' into 'release/v4.3'
tools: Split up large binaries into smaller chunks in the DFU binary (v4.3)

See merge request espressif/esp-idf!13793
2021-06-23 08:11:59 +00:00
698964f4b9 example: set example wifi scan method to all channel:
in CI example test we could have runners with same SSID in the same lab.
Use scan on all channel will let DUT connect to the AP with best RSSI.
2021-06-23 13:58:42 +08:00
c93298c31d lwip: Add config for DHCP client id; Fix DNS server idx assert issue
This commit brings two esp-lwip fixes to IDF:

1) Add configuration to disable DHCP client identification
2195f7416f
This config could be used to disable option 61 in DHCP packets, so that
clients will be identified by their  chaddr only.
(This is the lwip upstream original behaviour)

2) Fix server_idx increasing to DNS_MAX_SERVERS and trigger the LWIP_ASSERT
5a567d52f7
When lwip doesn't have DNS server and resolve a domain address, the server_idx
will increase to DNS_MAX_SERVERS, which will trigger the LWIP_ASSERT and make device crash.

Closes https://github.com/espressif/esp-idf/issues/6878
2021-06-23 12:52:18 +08:00
2ee5178667 mdns: Fix of crash when wifi interface get deleted and mdns receives the packets
Closes https://github.com/espressif/esp-idf/issues/6973
2021-06-23 12:50:11 +08:00
d09f6cac24 esp_eth: Improve GPIO interrupt processing in w5500 driver
Increase the interrupt reassert level timing so the chances of missing
two consecutive events are minimal.
Enable only SIR_RECV interrupt event, so the SEND events are not used
for GPIO signal.
2021-06-23 12:41:45 +08:00
1f2af24118 esp_eth: Recover the w5500 driver from missed io interrupt
If the GPIO interrupt is re-asserted too quickly it could be missed. If this happens the driver goes silent and never receives any data. Recover by periodic checks of the IO signal level
2021-06-23 12:41:45 +08:00
b007024c62 Merge branch 'bugfix/heap_tracing_build_issue_for_c3_v4.3' into 'release/v4.3'
heap: fix build issue with HEAP_TRACING config for C3 (v4.3)

See merge request espressif/esp-idf!14075
2021-06-23 03:45:39 +00:00
63e489255f transport: Add CONFI_WS_TRANSPORT for optimize the code size 2021-06-23 11:26:56 +08:00
1d05bb7c01 Merge branch 'bugfix/esp_netif_ppp_set_auth_fail_v4.3' into 'release/v4.3'
esp_netif: Fix failing ppp_set_auth() due to wrong arg check (v4.3)

See merge request espressif/esp-idf!13864
2021-06-22 19:32:40 +00:00
4e120e36eb Merge branch 'bugfix/eth_w5500_4byte_corruption_v4.3' into 'release/v4.3'
esp_eth: Fix w5500 read register operations (v4.3)

See merge request espressif/esp-idf!13862
2021-06-22 19:07:40 +00:00
2c9d8ac64e Merge branch 'feature/sperate_slip_component_v4.3' into 'release/v4.3'
esp_netif: Add CONFIG_LWIP_SLIP_SUPPORT to sperate slip component (backport v4.3)

See merge request espressif/esp-idf!13633
2021-06-22 16:23:04 +00:00
a59eccdd9e Merge branch 'bugfix/fix_disable_ipv6_build_fail_v4.3' into 'release/v4.3'
ppp: Fix disable IPv6 will make esp_netif_lwip_ppp build fail(backport v4.3)

See merge request espressif/esp-idf!13835
2021-06-22 15:39:41 +00:00
7406312f11 Merge branch 'bugfix/start_enc_proc_mic_err_fix_release_4p3' into 'release/v4.3'
bt/component: Fix MIC error issue during start_encryption procedure in esp32c3 ble controller (release/v4.3)

See merge request espressif/esp-idf!14057
2021-06-22 12:54:38 +00:00
15dcd2eca1 fix spp acceptor deadlock
Closes: https://github.com/espressif/esp-idf/issues/6948
2021-06-22 20:37:51 +08:00
3b88d9231b Merge branch 'bugfix/fix_a2dp_sink_blocked_v4.3' into 'release/v4.3'
Bugfix/Fix a2dp Sink Blocked Bugs[backport v4.3]

See merge request espressif/esp-idf!14010
2021-06-22 12:28:03 +00:00
2fb93e6a54 esp_eth: Fix w5500 to break from potentially infinite tx loop
The issue typically happens for link-down during Tx. Added two retry levels, one before checking the sanity of the w5500 phy register and another for the Tx done itself (if the device is in the sane state)

Closes https://github.com/espressif/esp-idf/issues/6233
2021-06-22 17:23:07 +08:00
8534799d66 esp_eth: Fix w5500 to correctly read registers on -Os
Reading SPI data may come in 4-byte units and thus result in unwanted
overwrites if smaller size registers read, especially if multiple placed
one after another. Fixed by using direct reads to `trans` structure for
sizes smaller or equal to 4.

Closes https://github.com/espressif/esp-idf/issues/6579
2021-06-22 17:23:07 +08:00
e6115da7e9 bt/component: Fix MIC error issue during start_encryption procedure in esp32c3 ble controller 2021-06-22 17:17:29 +08:00
97f007c08c Merge branch 'bugfix/add-MAXNAMLEN-definition' into 'release/v4.3'
newlib: add the definition of MAXNAMLEN in sys/dirent.h (backport v4.3)

See merge request espressif/esp-idf!13757
2021-06-22 07:12:56 +00:00
976594b853 Merge branch 'bugfix/bta_hf_client_co_cb_ptr_macro_v4.3' into 'release/v4.3'
bugfix/bta_hf_client_co_cb_ptr requires HFP_DYNAMIC_MEMORY macro to be used

See merge request espressif/esp-idf!14037
2021-06-22 04:53:19 +00:00
efb4784d78 Merge branch 'bugfix/link_gcov_rtio_backport_v4.3' into 'release/v4.3'
Bugfix/link gcov rtio backport v4.3

See merge request espressif/esp-idf!13833
2021-06-22 03:14:41 +00:00
6d708d50d9 Merge branch 'bugfix/ci_panic_test_timeout_v4.3' into 'release/v4.3'
ci panic test: Update the panic test timeout from 1s to 10s (v4.3)

See merge request espressif/esp-idf!14083
2021-06-22 02:50:47 +00:00
6ee42ba036 Merge branch 'feature/update_libsodium_submodule_v4.3' into 'release/v4.3'
libsodium: Update library to v1.0.18 (v4.3)

See merge request espressif/esp-idf!13081
2021-06-22 02:38:03 +00:00
83e9c1d28d esp_netif: Add CONFIG_LWIP_SLIP_SUPPORT to sperate slip component 2021-06-22 10:12:53 +08:00
6a50197246 bootloader: Fix a wrong offset in image_load after refactoring 2021-06-22 08:30:43 +08:00
2d439ba001 simple_ota_example: Adds sha256 check for app images 2021-06-22 08:30:43 +08:00
54ae758b77 bootloader_support: Used esp_image_get_metadata() instead of esp_image_verify()
- bootloader_common_get_sha256_of_partition will not do any unnecessery verifies.
- Used esp_image_get_metadata() instead of esp_image_verify().
2021-06-22 08:30:43 +08:00
99af5e9a71 bootloader: Fixed a case when signed OTA updates fail when debugger is attached due to the wrong image_len.
And it fixed another case for bootloader_common_get_sha256_of_partition() when CHECK_SIGNATURE is on
- If RSA signature check is on in Kconfig then sha256 was 0xFFFFF...
because image_load gave image_len which pointed to the end of sign blocks.
And image_digest was filled from a wrong position.

Closes https://github.com/espressif/esp-idf/issues/6873
2021-06-22 08:30:41 +08:00
362c9234dc Merge branch 'bugfix/fix_ld_relinking_on_modification_v4.3' into 'release/v4.3'
build: fix linker scripts edition not triggering a rebuild (backport v4.3)

See merge request espressif/esp-idf!13450
2021-06-22 00:29:11 +00:00
9f6e09d0d3 Merge branch 'bugfix/flash_rodata_any_alignement_v4.3' into 'release/v4.3'
build: Fix cache issue and add dedicated section for (Custom) App version info (backport v4.3)

See merge request espressif/esp-idf!13448
2021-06-22 00:23:49 +00:00
fafaeb195c ci panic test: Update the panic test timeout from 3s to 10s
If it takes longer than 10s to respond, it's probably not because of the
runner...
2021-06-22 09:37:43 +10:00
c5fc90f579 ci: Extend timeout for initial gdbstub commands in panic tests
Theory is that on the runner, in rare cases, gdb may need more than
1 second to load and start responding to commands.

However it's possible these timeouts are due to some other problem
(like gdb failing)
2021-06-22 09:37:29 +10:00
fe9ecf2f7a If the scan window set as 4 slots and the scan interval set as 5 slots
,then the device will crash when starting scanning.This commit is to fix
this bug.
2021-06-21 21:56:03 +08:00
a6b1fda209 fix a2dp sink RxSbcQ bugs
Closes https://github.com/espressif/esp-idf/issues/6712
Closes https://github.com/espressif/esp-idf/issues/7100
2021-06-21 20:05:41 +08:00
7182219718 Merge branch 'feat/ble_mesh_make_unprov_beacon_interval_configurable_v4.3' into 'release/v4.3'
Feat/ble mesh make unprov beacon interval configurable (v4.3)

See merge request espressif/esp-idf!14061
2021-06-21 11:39:47 +00:00
e55985335d tools: remove dependency of idf-python and idf-python-wheels
Closes IDFGH-5097
Closes https://github.com/espressif/esp-idf/issues/6881
2021-06-21 11:29:17 +02:00
b2dfa2ed85 ppp: Fix disable IPv6 will make esp_netif_lwip_ppp build fail
Closes https://github.com/espressif/esp-idf/issues/6935
2021-06-21 17:23:58 +08:00
46d04231e6 docs/en: update heap debugging guide for tracing on RISC-V architecture 2021-06-21 14:40:07 +05:30
1c0fb793b4 test_apps: add HEAP_TRACING configuration to build tests 2021-06-21 14:40:07 +05:30
dd73ba9601 heap: use hal specific API to get cpu cycles count
This fixes compilation issue of heap tracing feature for RISC-V
architecture.
2021-06-21 14:40:07 +05:30
49c6b790c6 Merge branch 'bugfix/loadable_elf_test_eco3_v4.3' into 'release/v4.3'
tests: gdb_loadable_elf: adjust the breakpoint location for ESP32 ECO3 (v4.3)

See merge request espressif/esp-idf!14039
2021-06-21 05:35:27 +00:00
6203a22e2c ble_mesh: stack: Fix crash for net_key_del when subnet is NULL 2021-06-21 11:19:31 +08:00
c250bbc3fb ble_mesh: stack: Make unprovisioned beacon interval configurable.
Closes https://github.com/espressif/esp-idf/issues/6722
2021-06-21 11:19:01 +08:00
8c909d3319 Merge branch 'bugfix/AuthValue_leak_v4.3' into 'release/v4.3'
ble_mesh: stack: Fix AuthValue Leak and Predictable AuthValue in Bluetooth... (v4.3)

See merge request espressif/esp-idf!14024
2021-06-21 03:08:55 +00:00
2060f63130 bugfix/bta_hf_client_co_cb_ptr requires HFP_DYNAMIC_MEMORY macro to be used
Closes https://jira.espressif.com:8443/browse/IDFGH-5399
2021-06-21 10:55:34 +08:00
5f184c6556 driver/i2c: add notes to i2c deleteing function v4.3 2021-06-21 10:07:40 +08:00
b6826d8878 dreiver/i2c: delete i2c cmd_mux semaphore more cleanly v4.3
Merges https://github.com/espressif/esp-idf/pull/6846
2021-06-21 10:07:40 +08:00
51aaf310fd Merge branch 'bugfix/active_ext_scan_performance_in_coex_v4.3' into 'release/v4.3'
bugfix/active_ext_scan_performance_in_coex_v4.3

See merge request espressif/esp-idf!13544
2021-06-19 02:28:13 +00:00
84e4127f0c tests: gdb_loadable_elf: adjust the breakpoint location for ESP32 ECO3
The previous location was the return from the first ets_printf call
that prints ROM sign-on message. Since the main function was patched
in ECO3, the new address no longer works — there is no instruction at
0x40007901 in ECO3 ROM. This could be solved by setting two
breakpoints (one would work for ECO <=2, the other for ECO3), but we
would need to remove the unused breakpoint later.
Fix this by setting the breakpoint at ets_printf. This means that when
debugging a loadable ELF the ROM sign-on message will no longer be
shown, but this doesn't seem to be an issue.
2021-06-18 14:38:43 +02:00
694f7e349f libsodium: Update library to v1.0.18 2021-06-18 16:57:37 +08:00
e9fd883f50 Merge branch 'bugfix/esp32_u4wdh_quad_io_v4.3' into 'release/v4.3'
bootloader: Fix selection of Quad I/O modes on ESP32-U4WDH chip (v4.3)

See merge request espressif/esp-idf!13876
2021-06-18 07:16:50 +00:00
36cb29280a ble_mesh: stack: Fix AuthValue Leak and Predictable AuthValue in Bluetooth Mesh Provisioning Leads to MITM 2021-06-18 14:16:07 +08:00
f819a4fffa Merge branch 'feature/update_esp_cryptoauthlib_v4.3' into 'release/v4.3'
secure_element: Update esp-cryptoauthlib submodule latest version. (v4.3)

See merge request espressif/esp-idf!13836
2021-06-18 06:15:36 +00:00
cf3445db01 Merge branch 'bugfix/impersonation_attacks_and_AuthValue_disclosure_v4.3' into 'release/v4.3'
ble_mesh: stack: Add check the value of Provisioning Random & Confirmation... (v4.3)

See merge request espressif/esp-idf!13922
2021-06-18 03:33:15 +00:00
ef6910467c components/bt: fixed performance issue for extended active scan in coexistence scenario: use the same priority for Rx of AUX_ADV_IND and AUX_SCAN_RSP 2021-06-17 19:34:03 +08:00
4d20919ff3 Merge branch 'bugfix/ble_mesh_sensor_server_model_not_start_on_esp32s3_v4.3' into 'release/v4.3'
ble_mesh: stack: Add sdkconfig.defaults.esp32s3 for esp32s3 (v4.3)

See merge request espressif/esp-idf!13910
2021-06-17 07:42:08 +00:00
777907f8ef Merge branch 'bugfix/start_emac_after_phy_reset_v4.3' into 'release/v4.3'
esp_eth: restart negotiation in esp_eth_start (v4.3)

See merge request espressif/esp-idf!13698
2021-06-17 07:13:31 +00:00
1508b9ff03 Merge branch 'bugfix/enable_pmf_in_iperf_test_v4.3' into 'release/v4.3'
iperf example: set PMF capable to connect to PMF required APs (v4.3)

See merge request espressif/esp-idf!13869
2021-06-17 06:16:48 +00:00
92a5c34a61 secure_element: Update esp-cryptoauthlib submodule latest version.
*This updates the cryptoauthlib version in the esp-cryptoauthlib to cryptoauthlib-v3.3.1
2021-06-17 13:52:03 +08:00
5c3d5faeff i2s: fix driver uninstall issue 2021-06-17 12:57:58 +08:00
9249f05fc9 spi_flash: reverted unwilling cs_setup argument
Partially reverted 08f1bbe0c7.

The host should have this flexibility, which is consistent to the cs_hold argument.

However, the user should know as less as possible about the host.
So the wrapper layer (esp_flash_spi_init.c) should cover this, helping to set cs_setup to 1, to meet the common requirements.
2021-06-17 12:26:11 +08:00
cb8d4585b2 Merge branch 'test/support_multiple_targets_for_iperf_example_test_v4.3' into 'release/v4.3'
test: support multiple targets for iperf example test (v4.3)

See merge request espressif/esp-idf!13617
2021-06-17 03:48:12 +00:00
850d8170f5 Merge branch 'ci/ttfw_fix_dut_exception_not_added_to_junit_report_v4.3' into 'release/v4.3'
ttfw: fix DUT exception not added to junit report (v4.3)

See merge request espressif/esp-idf!13611
2021-06-17 03:36:02 +00:00
f2676b8e59 esp_wifi: fix amsdu & fragment vulnerabilities 2021-06-17 10:44:06 +08:00
21b3068b77 deep sleep: clear wakeup and reject int raw signal before entry sleep 2021-06-17 10:41:22 +08:00
b5256118ff Merge branch 'bugfix/riscv_stack_alignment_v4.3' into 'release/v4.3'
core: fix cases where riscv SP were not 16 byte aligned (v4.3)

See merge request espressif/esp-idf!13653
2021-06-17 02:09:34 +00:00
9d50e27aff Merge branch 'bugfix/cmake_ulp_reserved_size_v4.3' into 'release/v4.3'
ulp: Fix bug where ULP linker script not regenerated for new config (v4.3)

See merge request espressif/esp-idf!13628
2021-06-17 00:06:30 +00:00
f40f6b4bb1 Merge branch 'bugfix/ci_ble_wifi_example_test_v4.3' into 'release/v4.3'
Fix for ble and wifi example test (v4.3)

See merge request espressif/esp-idf!13802
2021-06-16 23:24:50 +00:00
a213b289be Merge branch 'feature/extmem_alloc_for_s2_v4.3' into 'release/v4.3'
External memory allocation policy support  for ESP32-S2 (GitHub PR) (v4.3)

See merge request espressif/esp-idf!13619
2021-06-16 16:34:13 +00:00
6300f7791a ble_mesh: stack: Add check the value of Provisioning Random & Confirmation sent and received by provisioner 2021-06-16 21:26:38 +08:00
a6f4f7399a Merge branch 'bugfix/doc_no_secure_boot_sig_verify_v4.3' into 'release/v4.3'
secure boot doc: Clarify limits for verifying signed updates without secure boot (v4.3)

See merge request espressif/esp-idf!13983
2021-06-16 09:56:19 +00:00
3e28c250d7 Merge branch 'bugfix/tcp_transport_tls_no_mem_v4.3' into 'release/v4.3'
tcp_transport: Fix error handling of esp_tls_init() (v4.3)

See merge request espressif/esp-idf!13676
2021-06-16 09:50:10 +00:00
a75b53954b Merge branch 'bugfix/btdm_set_discoverable_after_create_server_v4.3' into 'release/v4.3'
components/bt: Set discoverable after create server

See merge request espressif/esp-idf!13725
2021-06-16 09:01:11 +00:00
0c3173874e Merge branch 'bugfix/bt_impersonation_passkey_fix_v4.3' into 'release/v4.3'
Bluedroid: Check only x component of passkey to avoid passkey impersonation attack. (v4.3)

See merge request espressif/esp-idf!13758
2021-06-16 08:59:13 +00:00
b3d17474d6 Merge branch 'bugfix/invalid_feat_page_exec_v4.3' into 'release/v4.3'
bt controller: Fixed handling for invalid feature page. (v4.3)

See merge request espressif/esp-idf!13566
2021-06-16 08:57:36 +00:00
c0c0497de3 ulp: Fix bug where ULP linker script not regenerated for new config
ULP linker script relies on value of CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM,
when this value changes in config then it should be regenerated.
2021-06-16 16:54:03 +08:00
94f447f599 Merge branch 'bugfix/partition_table_integrity_check_v4.3' into 'release/v4.3'
paritition_table: Verify the partition table md5sum when loading in the app (v4.3)

See merge request espressif/esp-idf!13582
2021-06-16 08:49:55 +00:00
fdec7348e2 Merge branch 'bugfix/override_cmake_python_v4.3' into 'release/v4.3'
cmake: Minor Python CMake build fixes (v4.3)

See merge request espressif/esp-idf!13191
2021-06-16 08:48:59 +00:00
054770407e esp_netif: Fix failing ppp_set_auth() due to wrong arg check
Closes https://github.com/espressif/esp-idf/issues/7047
2021-06-16 13:59:35 +08:00
7e8afda8b2 Merge branch 'bugfix/fix_crash_when_csi_enable_v4.3' into 'release/v4.3'
esp_wifi: fix crash when csi enable(v4.3)

See merge request espressif/esp-idf!13925
2021-06-16 04:38:41 +00:00
d8966087b1 Merge branch 'ci/unify_all_target_test_artifacts_paths_v4.3' into 'release/v4.3'
ci: unify target test artifacts to all .log file and $LOG_PATH (v4.3)

See merge request espressif/esp-idf!13846
2021-06-16 04:25:36 +00:00
a45fa929c2 Merge branch 'bugfix/ulp_riscv_unintended_wake_v4.3' into 'release/v4.3'
ulp: unintended wakeup in ulp_riscv (v4.3)

See merge request espressif/esp-idf!13630
2021-06-16 04:25:29 +00:00
2baf0e626a Merge branch 'bugfix/fix_mbedtls_cmake_warning_v4.3' into 'release/v4.3'
mbedtls: fixed CMake build warning (v4.3)

See merge request espressif/esp-idf!13590
2021-06-16 04:20:46 +00:00
c0e07f8975 Merge branch 'bugfix/pthread_join_debug_log_v4.3' into 'release/v4.3'
pthread: Fix possible deadlock when using pthread_join() and Debug log level (v4.3)

See merge request espressif/esp-idf!13776
2021-06-16 04:19:56 +00:00
6507d1d892 secure boot doc: Clarify limits for verifying signed updates without secure boot
Closes https://github.com/espressif/esp-idf/issues/7080
2021-06-16 14:04:49 +10:00
0b2f0a3213 bt: use generic SPIRAM config option for memory alloc policy 2021-06-16 11:11:55 +08:00
4c8ae4fd56 mbedtls: Allow external mem alloc for ESP32-S2
Closes https://github.com/espressif/esp-idf/pull/6998
Closes IDFGH-5226
2021-06-16 11:11:55 +08:00
e660e32a6e Merge branch 'bugfix/check_readme_links_no_exception_v4.3' into 'release/v4.3'
check_readme_links: remove throwing of exception before exit (v4.3)

See merge request espressif/esp-idf!13345
2021-06-16 02:59:28 +00:00
9fde997b5c Merge branch 'enhance/update-vscode-setup-docs-v4.3' into 'release/v4.3'
docs: Fix vscode extension setup links (backport v4.3)

See merge request espressif/esp-idf!13322
2021-06-16 02:56:46 +00:00
f50a8cc7b5 docs: Fix vscode extension setup links (backport v4.3) 2021-06-16 10:56:40 +08:00
21dfe81a68 Merge branch 'bugfix/doc_freertos_task_stack_bytes_v4.3' into 'release/v4.3'
freertos docs: Specify that uxTaskGetStackHighWaterMark() returns bytes not words (v4.3)

See merge request espressif/esp-idf!13627
2021-06-16 02:54:35 +00:00
28010d4ef7 Merge branch 'docs/update_c3_devkit_user_guides' into 'release/v4.3'
Update Strapping Pins in ESP32-C3 Devkit User Guides (backport v4.3)

See merge request espressif/esp-idf!13768
2021-06-16 02:53:33 +00:00
09d7409f44 Merge branch 'feature/link_idf_common_docs_v4.3' into 'release/v4.3'
docs: Linking to a page to help navigate to documentation for specific ESP32-x chip (v4.3)

See merge request espressif/esp-idf!13842
2021-06-16 02:53:00 +00:00
ce9f195abe Merge branch 'doc/nvs_get_used_entry_count__clarify_4.3' into 'release/v4.3'
[doc]: NVS documentation updates  (backport 4.3)

See merge request espressif/esp-idf!13821
2021-06-16 02:52:15 +00:00
05f780cdb2 example: set PMF capable to connect to PMF required APs 2021-06-16 09:51:16 +08:00
528d162da5 ttfw: fix DUT exception not added to junit report 2021-06-16 09:50:09 +08:00
6fe2da9f89 ci: save built binaries could be tested locally:
we have some test cases not executed in CI. we need to save those
binaries as artifacts so we can test locally.
2021-06-16 09:49:23 +08:00
381464d1cf test: support multiple targets for iperf example test 2021-06-16 09:49:23 +08:00
04e4bdcff5 Merge branch 'bugfix/enable_wifi_prov_example_c3_v4.3' into 'release/v4.3'
CI: re-enable wifi prov examples for C3 (v4.3)

See merge request espressif/esp-idf!13605
2021-06-16 00:50:33 +00:00
2a6e69c9f3 Merge branch 'update/version_4_3_0' into 'release/v4.3'
Update version to 4.3.0

See merge request espressif/esp-idf!13936
2021-06-15 23:29:18 +00:00
9ac6b53760 docs: Correct uart default pin names and provid more information about ESP-Prog board 2021-06-15 15:32:22 +08:00
9c7d2c7595 spi_flash: fix cs line setup to make the flash driver more stable 2021-06-15 15:27:51 +08:00
1903d8587a docs: provide the link to pcb layout for ethernet board v1.2 and fix a typo in freetos/task 2021-06-15 15:26:10 +08:00
e86ca4edc2 esp_wifi: fix crash when csi enable 2021-06-10 16:00:01 +08:00
c9646ff0be versions: Update version to 4.3.0 2021-06-10 14:20:45 +08:00
b6bea34706 ble_mesh: stack: Add sdkconfig.defaults.esp32s3 for esp32s3
Closes https://github.com/espressif/esp-idf/issues/7061
2021-06-09 12:51:52 +00:00
88c2b69c68 Merge branch 'bugfix/example_test_socket_issue_4.3' into 'release/v4.3'
CI: fix connection failures in asio example tests (4.3)

See merge request espressif/esp-idf!13903
2021-06-09 10:33:43 +00:00
94a54d574b CI: fix connection failures in asio example tests 2021-06-08 17:00:55 +08:00
84b157e2ea component/bt: fix enable gattc nvs cache lead to crash 2021-06-07 17:33:06 +08:00
22a02656b7 bootloader: Fix selection of Quad I/O modes on ESP32-U4WDH chip
Closes https://github.com/espressif/esp-idf/issues/6191
2021-06-07 14:53:43 +10:00
cde3860d21 Run global_action_callbacks in predictable order 2021-06-04 15:56:41 +00:00
e8ad727b80 examples/simple_sniffer: add SPI work mode to SD card to support all chips 2021-06-04 05:00:02 +00:00
d7e8537dfa examples/simple_sniffer: only enable apptrace if JTAG is selected
Fixes compilation of this example on esp32c3, where apptrace is not
yet supported.
2021-06-04 05:00:02 +00:00
c7de165ccb tcp_transport: Fix error handling of esp_tls_init() 2021-06-03 13:47:41 +00:00
b53d874dac ci: unify target test artifacts to all .log file and $LOG_PATH 2021-06-03 15:21:56 +08:00
186fcc328b docs: Linking to a page that helps navigate to documentation for specific ESP32-x chip 2021-06-03 08:17:50 +02:00
e900224343 gcov: Fixes not linked gcov rtio functions 2021-06-02 22:05:15 +03:00
a560a506f2 Merge branch 'bugfix/rtc_retain_mem_addr_v4.3' into 'release/v4.3'
bootloader: Fix "skip validate in deep sleep" on ESP32 & ESP32-S2 (v4.3)

See merge request espressif/esp-idf!13812
2021-06-02 08:55:20 +00:00
57442c38bd core: fix cases where riscv SP were not 16 byte aligned
RISC-V stack pointer should always be 16 byte aligned, but for some cases where
we were doing manual SP manipulation this was not always the case.
2021-06-02 16:02:10 +08:00
7e4f7867f0 bugfix/fix crash when lmp flooding 2021-06-02 15:31:33 +08:00
5395f451a2 [doc]: NVS documentation updates
* Move nvs flash README to common doc directory
* correct markup of functions and types in text
  from old README
* Better comment of nvs_get_used_entry_count()
* Mention C++ example in API reference
* Used target instead of hard code ESP32
* Note that strings can only span one page
* Reflect that item types have been moved
* Some clarification about nvs_commit()
* Improved reference to the ESP Partition API
* fixed little mistake in documenting-code.rst
* Change of nvs_open_from_part() to
  nvs_open_from_partition() reflected in docs
* Corrected documentation of
  NVSHandle::get_string(), NVSHandle::get_blob()
  and NVSHandle::get_item_size().

* Closes DOC-165
* Closes IDF-1563
* Closes IDF-859
* Closes https://github.com/espressif/esp-idf/issues/6123
2021-06-02 13:34:35 +08:00
b41108b60a components/bt: Set discoverable after create server 2021-06-02 03:03:07 +00:00
f0679fe175 components/bt: Delete BLE ADV priority high 2021-06-01 16:19:24 +00:00
b7ab286edf bt controller: Fixed handling for invalid feature page. 2021-06-01 16:19:24 +00:00
0e904b3f7e ulp: clear rtc int at initialization
Closes https://github.com/espressif/esp-idf/issues/6654
2021-06-01 21:41:12 +08:00
9dafde59b1 docs/update_strapping_pins_in_c3_devkit_user_guides 2021-06-01 10:10:45 +00:00
1967e53f4a bootloader: Fix "skip validate in deep sleep" on ESP32 & ESP32-S2
Regression in 83bf2e1ac1, this memory region was shifted from fast to slow RTC
memory (no change on ESP32-C3 as no RTC fast memory on this chip.)
2021-06-01 19:05:09 +10:00
98c20ce417 Merge branch 'bugfix_fix_ble_ANON_ADV_addr_err_v4.3' into 'release/v4.3'
Fixed ANON_ADV address error(backport v4.3)

See merge request espressif/esp-idf!13790
2021-06-01 08:49:49 +00:00
1c875e5baa ble-wifi-example-tests: Add fixes and cleanups to ble and wifi tests
(cherry picked from commit 2d22374460)
2021-06-01 12:27:04 +05:30
d376c161aa [C++]: wrapper functions around unwind code
* Replaced all C++ exception related
  functions with wrappers if -fno-exception
  is used. This prevents linking of the
  corresponding code in libgcc. The code
  size will decrease by around 7-9 KB when
  building with -fno-exception.
* added no except test app

Closes https://github.com/espressif/esp-idf/pull/5380
Closes https://github.com/espressif/esp-idf/issues/5363
Closes https://github.com/espressif/esp-idf/issues/5224
Closes IDFGH-3153
Closes IDF-2577
2021-06-01 13:46:50 +08:00
9e2ce84a9a Fixed ANON_ADV address error 2021-06-01 11:49:21 +08:00
b66b98a25f tools: Split up large binaries into smaller chunks in the DFU binary
ROM will erase the region a partition is in as soon as it receives the
first bit of the data that is in the partition. For large partitions it
takes more than 5 seconds to erase which is a hard-coded limit in
dfu-utils.

This splits large binaries and adds them by chunks which should avoid
timing-out during flashing.

Closes https://github.com/espressif/esp-idf/issues/6999
2021-05-31 19:25:00 +02:00
9596f0d966 pthread: Fix possible deadlock when using pthread_join() and Debug log level
Possible for a joined task to be deleted at the moment it is logging,
meaning it might hold the stdout lock. In that case the lock isn't
released and the next task to try and take it (i.e. call printf)
will block indefinitely.
2021-05-31 13:49:59 +10:00
a3856c5438 esp_rom: Allow passing any type of data pointer to md5, remove unchecked size on digest pointer 2021-05-30 23:21:14 +00:00
58a3e08895 paritition_table: Verify the partition table md5sum when loading the app
Additionally, always enable the partition MD5 check if flash encryption is on in
Release mode. This ensures the partition table ciphertext has not been modified
(CVE-2021-27926).

The exception is pre-V3.1 ESP-IDF bootloaders and partition tables, which
don't have support for the MD5 entry.
2021-05-30 23:21:14 +00:00
24035f698d Bluedroid: Check only x component of passkey to avoid passkey impersonation attack. 2021-05-28 19:24:27 +05:30
ac362cc662 change MAXNAMLEN to 255 2021-05-28 20:41:25 +08:00
a29fe72cc9 add the definition of MAXNAMLEN in sys/dirent.h 2021-05-28 20:41:10 +08:00
4de9ba152a Merge branch 'bugfix/ble_fix_reconnect_failed_when_using_rpa_public_address_v4.3' into 'release/v4.3'
Fixed BLE reconnect failed when using rpa public address (backport v4.3)

See merge request espressif/esp-idf!13743
2021-05-28 08:31:18 +00:00
03a6c4975c esp_eth: restart negotiation in esp_eth_start 2021-05-28 08:22:56 +00:00
415418cf0e Merge branch 'bugfix/fix_coredump_fake_stack_bug_v4.3' into 'release/v4.3'
espcoredump: Fix bugs related to (fake) stacks v4.3

See merge request espressif/esp-idf!13657
2021-05-28 06:14:15 +00:00
0cca9e860d freertos docs: Specify that uxTaskGetStackHighWaterMark() returns bytes not words
As reported https://esp32.com/viewtopic.php?f=13&t=20043&p=73732
2021-05-28 05:13:40 +00:00
a573cfe58a espcoredump: Fix bugs related to (fake) stacks
Add support to tasks stacks in RTC DRAM. Before this fix, any stack
in RTC DRAM would have been considered as corrupted, whichi is not
the case.
Fix a bug related to wrong parameters passed to esp_core_dump_get_stack.
Fix a bug reading fake stack memory, triggering a memory violation.

* Closes https://github.com/espressif/esp-idf/issues/6751
* Merges https://github.com/espressif/esp-idf/pull/6750
2021-05-28 01:58:09 +00:00
zwj
7d1fe0b553 Fixed BLE reconnect failed when using rpa public address 2021-05-27 08:17:18 +00:00
f2f6acd6a6 Merge branch 'bugfix/fixed-autocompletion-test_v4.3' into 'release/v4.3'
Fixed test autocompletion (v4.3)

See merge request espressif/esp-idf!13738
2021-05-27 08:07:59 +00:00
e66fec955e Fixed test autocompletion 2021-05-26 13:47:29 +02:00
a9a8fd03b6 Merge branch 'feature/c3_example_tests_v4.3' into 'release/v4.3'
CI: add Example_GENERIC for C3 (v4.3)

See merge request espressif/esp-idf!12780
2021-05-20 07:42:48 +00:00
8efb2bb1ed ci: run Example_GENERIC for C3
Add support for running example_GENERIC tests for C3 on label.

Fix examples that fail.
2021-05-20 14:32:47 +10:00
c270a9f0b9 esp32c3: Updates a description in Kconfig about Universal MAC Address strategy 2021-05-20 04:30:31 +00:00
23b6e47aef CI: re-enable wifi prov examples for C3 2021-05-20 11:06:26 +08:00
390bdf2f78 mbedtls: fixed CMake build warning
Building mbedtls with CMake would warn that:

"A private source from a directory other than that of target "mbedcrypto
 has a relative path"

This happened due to some of the CMake variables listing sources could be empty.

Changed to only use target_sources in the code-path where we set the sources,
so we only call target_sources will non-empty variables.

Closes https://github.com/espressif/esp-idf/issues/6767
2021-05-19 11:11:04 +08:00
6be10fab09 Merge branch 'bugfix/addba_pmf_issue_fix_v4.3' into 'release/v4.3'
Fix aggregation issue and validate FTM config params (Backport v4.3)

See merge request espressif/esp-idf!13520
2021-05-14 03:49:02 +00:00
aa33c43644 esp_wifi: Update wifi lib
Update wifi library with below fixes -
1. Fix Block Ack setup issue in PMF scenario
2. Validate FTM Initiator config parameters and propagate status
2021-05-14 11:14:03 +08:00
2b19bd0c2f Merge branch 'doc/timer_group_update_for_esp32c3' into 'release/v4.3'
timer: clean up example and api reference (v4.3)

See merge request espressif/esp-idf!13279
2021-05-14 01:48:37 +00:00
de0063164d Merge branch 'bugfix/place_xt_int_fns_into_iram_4.3' into 'release/v4.3'
[system]: put xtensa_intr_asm into IRAM (backport 4.3)

See merge request espressif/esp-idf!13402
2021-05-14 01:48:11 +00:00
acb05c21d9 Merge branch 'feature/installed_tool_failed_v4.3' into 'release/v4.3'
tools: Warning about tool being installed but failed to run. (v4.3)

See merge request espressif/esp-idf!13230
2021-05-14 01:43:37 +00:00
93aee41c29 Merge branch 'bugfix/setjmp_longjmp_4.3' into 'release/v4.3'
[system]: Made longjmp save for context switch (backport 4.3)

See merge request espressif/esp-idf!13489
2021-05-14 01:40:17 +00:00
798aab5097 Merge branch 'docs/remove_c3_not_updated_warning_v4.3' into 'release/v4.3'
docs: remove c3 not updated warning (v4.3)

See merge request espressif/esp-idf!13443
2021-05-14 01:39:55 +00:00
4db80bcc78 Merge branch 'nimble/workaound_ble_conn_err_v4.3' into 'release/v4.3'
NimBLE: Add NimBLE host support to reattempt GAP connection and address MITM vulnerability (CVE-2020-26558) (release/v4.3)

See merge request espressif/esp-idf!13549
2021-05-13 16:25:54 +00:00
e97ddd80b7 Merge branch 'bugfix/mqtt_examples_certificates_update_v4.3' into 'release/v4.3'
bugfix/mqtt examples: Updates the CA certificates used. (v4.3)

See merge request espressif/esp-idf!13125
2021-05-13 16:22:11 +00:00
2647288d32 Merge branch 'bugfix/ag_use_dynamic_memory_error_v4.3' into 'release/v4.3'
Fix ag use dynamic memory error

See merge request espressif/esp-idf!13542
2021-05-13 16:20:38 +00:00
a75a988c98 Merge branch 'bugfix/wifi_modem_sleep_percentage_optimize_v4.3' into 'release/v4.3'
backport v4.3: optimize wifi station modem sleep percentage

See merge request espressif/esp-idf!13541
2021-05-13 16:19:08 +00:00
f00db86668 Merge branch 'bugfix/remove_spi_flash_qio_s2_cfg_v4.3' into 'release/v4.3'
ci: remove spi_flash_qio_s2 config (v4.3)

See merge request espressif/esp-idf!12991
2021-05-13 11:41:27 +00:00
c7a10f9293 Merge branch 'bugfix/timer_spinlock_iram_v4.3' into 'release/v4.3'
timer: add IRAM_ATTR to spinlock give/take API (v4.3)

See merge request espressif/esp-idf!13511
2021-05-13 11:36:48 +00:00
7095159a4c NimBLE: Update NimBLE submodule to reattempt conn and to fix vulnerability
* Add workaround to overcome connection establishment failure error.

* Fix vulnerability during public key exchange in secure connection
2021-05-13 16:44:17 +05:30
2644f793bd Remove btc_hf_idx_by_bdaddr in both btc_hf_init and btc_hf_deinit functions 2021-05-13 16:09:47 +08:00
848f931e06 fix ag use dynamic memory error 2021-05-13 16:09:40 +08:00
d5e2a482c3 bugfix/mqtt examples: Updates the CA certificates used.
- Updates the CA certificates.
- Updates the URI names to reflect the new URI in the service used in
  the examples.

Closes IDFGH-4986
Closes https://github.com/espressif/esp-idf/issues/6776
2021-05-13 06:51:43 +02:00
36d7af5200 check_readme_links: remove throwing of exception before exit
Reraising the exception before exiting was intended to help troubleshoot,
but turned out to be more confusing than helpful as it might look like the script was failing
2021-05-13 12:40:00 +08:00
410a0a5f5a Merge branch 'ci/wildcard_known_failure_cases_v4.3' into 'release/v4.3'
ci: allow wildcard in known failure cases (v4.3)

See merge request espressif/esp-idf!13303
2021-05-13 04:19:41 +00:00
7478d96228 Merge branch 'bugfix/gdbgui_v4.3' into 'release/v4.3'
tools: Add various fixes for idf.py gdbgui (v4.3)

See merge request espressif/esp-idf!13416
2021-05-13 04:18:51 +00:00
644e653293 Merge branch 'feature/IDF-2612_human_readable_error_v4.3' into 'release/v4.3'
export.bat/install.bat: print human-readable error message if Git or Python are not in PATH (v4.3)

See merge request espressif/esp-idf!13226
2021-05-13 04:18:31 +00:00
53956cf8ad Merge branch 'bugxif/fix-export-autocomplete-zsh_v4.3' into 'release/v4.3'
export.sh: Fix error when `ZSH_VERSION` is unset. (v4.3)

See merge request espressif/esp-idf!12731
2021-05-13 04:16:29 +00:00
effee74b2f Merge branch 'doc/backport_iot_solution_link_updates_to_v4.3' into 'release/v4.3'
fix dead links directed to ESP-IoT-Solution repo (backport v4.3)

See merge request espressif/esp-idf!13347
2021-05-13 04:15:28 +00:00
08c5b89096 Merge branch 'bugfix/fix_idf_monitor_unicode_path_crash_v4.3' into 'release/v4.3'
tools: handle exception in case of logging Unicode characters (v4.3)

See merge request espressif/esp-idf!13041
2021-05-13 04:14:40 +00:00
e6f96717ff Merge branch 'bugfix/remove_uart2_c3_v4.3' into 'release/v4.3'
uart: remove misleading ld files and soc defs for UART2 (v4.3)

See merge request espressif/esp-idf!13394
2021-05-13 04:11:32 +00:00
db49804f65 Merge branch 'feature/oocd_ver_backport_v4.3' into 'release/v4.3'
Feature/oocd ver backport v4.3

See merge request espressif/esp-idf!13374
2021-05-13 04:09:03 +00:00
ed76cc4dd4 Merge branch 'feature/support_adjust_voltage_storingInEfuse_open_glitch_rst_v4.3' into 'release/v4.3'
ESP32c3: auto adjust voltage dbias storing in efuse and open glitch reset for ECO3  (backport v4.3)

See merge request espressif/esp-idf!13388
2021-05-13 04:08:56 +00:00
d51ed40487 modem sleep: optimize wifi station modem sleep percentage 2021-05-13 11:57:12 +08:00
31b142cf93 Merge branch 'bugfix/concurrent_mode_sae_crash_fix_v4.3' into 'release/v4.3'
esp_wifi: Add station based check for auth frame formation (backport v4.3)

See merge request espressif/esp-idf!13526
2021-05-13 03:27:54 +00:00
d95e2c63ca Merge branch 'doc/update_i2c_on_esp32c3_v4.3' into 'release/v4.3'
i2c: update api reference and example pin definition (backport v4.3)

See merge request espressif/esp-idf!13451
2021-05-13 03:09:02 +00:00
cdec9f3659 Merge branch 'bugfix/fix_touch_sensor_power_source_v4.3' into 'release/v4.3'
touch_sensor: fix esp32s2&esp32s3 touch sensor default power source (Backport v4.3)

See merge request espressif/esp-idf!13484
2021-05-13 03:06:01 +00:00
02e742271d Merge branch 'feature/merge_c3_caps_v4.3' into 'release/v4.3'
soc: merge C3 caps into a single soc_caps.h (v4.3)

See merge request espressif/esp-idf!13518
2021-05-13 02:55:26 +00:00
5ec69efafa docs: remove front page C3 docs not updated warning 2021-05-13 10:04:27 +08:00
42657a7464 ci: remove spi_flash_qio_s2 config
This config is already run for all targets in spi_flash_qio config
2021-05-12 17:20:00 +08:00
f16ec53183 [system]: put xtensa_intr_asm into IRAM 2021-05-12 16:44:52 +08:00
3299a19c2f Merge branch 'bugfix/lwip_debug_define' into 'release/v4.3'
lw-ip: Fix LWIP_DEBUG define which is always defined(backport v4.3)

See merge request espressif/esp-idf!13118
2021-05-12 06:28:54 +00:00
a3ae9ae482 Merge branch 'bugfix/generate_value_0_when_prov_auth_v4.3' into 'release/v4.3'
ble_mesh: stack: Fix provisioning input or output count number should be at least 1 (v4.3)

See merge request espressif/esp-idf!13480
2021-05-12 06:22:04 +00:00
a6b169f91e Merge branch 'bugfix/fix_c3_s3_ble_multi_con_failed_when_dev_act_master_and_slave_v4.3' into 'release/v4.3'
Fixed C3/S3 BLE multi-connection failed when device acts as master and slave(backport v4.3)

See merge request espressif/esp-idf!13507
2021-05-12 06:19:14 +00:00
deeb517b72 esp_wifi: Add station based check for auth frame formation 2021-05-11 18:20:45 +05:30
874b470379 timer: add IRAM_ATTR to spinlock give/take API
Closes https://github.com/espressif/esp-idf/issues/6824
2021-05-11 15:31:59 +08:00
38aa99d63d soc: merge C3 caps into a single soc_caps.h 2021-05-11 15:20:54 +08:00
a37c20b417 [system]: Made longjmp save for context switch
* Patched longjmp to be context-switch safe
  longjmp modifies the windowbase and windowstart
  registers, which isn't safe if a context switch
  occurs during the modification. After a context
  switch, windowstart and windowbase will be
  different, leading to a wrongly set windowstart
  bit due to longjmp writing it based on the
  windowbase before the context switch. This
  corrupts the registers at the next window
  overflow reaching that wrongly set bit.

  The solution is to disable interrupts during
  this code. It is only 6 instructions long,
  the impact shouldn't be significant.

  The fix is implemented as a wrapper which
  replaces the original first instructions of
  longjmp which are buggy. Then, it jumps back
  to execute the rest of the original longjmp
  function.

  Added a comparably reliable test to the
  test apps.
2021-05-11 12:04:27 +08:00
fd5d6db71e tools: Updates OpenOCD version to 'v0.10.0-esp32-20210401' 2021-05-10 16:51:05 +00:00
zwj
1957025f4a fix C3/S3 ble multi-connection failed when device acts as master and slave 2021-05-10 13:12:01 +00:00
6d2bdfc5f5 1. open glitch reset for c3 ECO3;
2. set digital & rtc voltage to about 1.15v which storing in efuse.
2021-05-08 17:38:24 +08:00
d651e4e073 touch_sensor: fix esp32s2 touch sensor default power source 2021-05-08 13:54:59 +08:00
5fc3c0ca91 ble_mesh: stack: Fix provisioning input or output count number should be at least 1
Closes https://github.com/espressif/esp-idf/issues/6863
2021-05-08 11:58:04 +08:00
2e64d234c4 Merge branch 'bugfix/riscv_ulp_linker_script_reset_vector_v4.3' into 'release/v4.3'
Fix RISC-V ULP failure to start (v4.3)

See merge request espressif/esp-idf!13464
2021-05-07 23:28:43 +00:00
229fab87a5 ci: allow wildcard in known failure cases 2021-05-07 08:41:43 +00:00
e45be4dd4a Merge branch 'feature/ci_release_zips_v4.3' into 'release/v4.3'
ci: Use GitHub Actions to generate recursive source code zips for releases (v4.3)

See merge request espressif/esp-idf!13198
2021-05-07 08:22:43 +00:00
f6d96f33bb bugfix: add .rodata section for riscv ulp for esp32s2 2021-05-07 10:56:33 +10:00
228f875ada esp32s2 riscv ulp: Make re-linking depend on linker script file 2021-05-07 10:54:55 +10:00
997c07c2ee esp32s2 riscv ulp: Ensure reset vector is always at offset 0x0
Previous linker script relied on nothing else using the .text section

As reported at https://esp32.com/viewtopic.php?f=2&t=20734&p=75997
2021-05-07 10:54:55 +10:00
dca229df07 i2c: update api reference and example pin defination 2021-05-06 12:33:55 +08:00
831d470a75 build: fix linker scripts edition not triggering a rebuild
Fix the dependencies in CMakeLists files for triggering a relink
when linker script file is modified.
2021-05-06 12:19:01 +08:00
b7707c54ce freertos: fix TLS run-time address calculation
Since dd849ffc, _rodata_start label has been moved to a different
linker output section from where the TLS templates (.tdata, .tbss)
are located. Since link-time addresses of thread-local variables are
calculated relative to the section start address, this resulted in
incorrect calculation of THREADPTR/$tp registers.

Fix by introducing new linker label, _flash_rodata_start, which points
to the .flash.rodata output section where TLS variables are located,
and use it when calculating THREADPTR/$tp.

Also remove the hardcoded rodata section alignment for Xtensa targets.
Alignment of rodata can be affected by the user application, which is
the issue dd849ffc was fixing. To accommodate any possible alignment,
save it in a linker label (_flash_rodata_align) and then use when
calculating THREADPTR. Note that this is not required on RISC-V, since
this target doesn't use TPOFF.
2021-05-06 11:42:14 +08:00
375f969d43 build: (Custom) App version info is now on a dedicated section, independent of the rodata alignment
It is now possible to have any alignment restriction on rodata in the user
applicaiton. It will not affect the first section which must be aligned
on a 16-byte bound.

Closes https://github.com/espressif/esp-idf/issues/6719
2021-05-06 11:40:57 +08:00
c29dbda5fd build: fix cache issue when .flash.text section alignment is uncommon
rodata dummy section has now the same alignment as flash text section,
and at least the same size. For these reasons, the cache will map
correctly the following rodata section.
2021-05-06 11:40:47 +08:00
788312a009 Merge branch 'bugfix/freertos_addition_overflow_v4.3' into 'release/v4.3'
freertos: Fix addition overflow (v4.3)

See merge request espressif/esp-idf!13422
2021-05-05 08:49:32 +00:00
6c9005e11b ut: Exclude test_utils component from default_2_c3 config
Theory is that the large alignments in this test component are triggering linker
bug (to be fixed in next toolchain update). This component is already tested
in a dedicated config, so it doesn't need to be included in this config.
2021-05-05 16:39:58 +10:00
d30ec8c94e freertos: Add addition overflow check for stream buffer
Patch from upstream commit d05b9c123f2bf9090bce386a244fc934ae44db5b
2021-05-04 18:30:49 +10:00
658a0acdbe freertos: Check for arithmetic overflows on queue creation
Addition overflow check is from FreeRTOS kernel commit 47338393f1f79558f6144213409f09f81d7c4837
2021-05-04 18:30:49 +10:00
4c974574d7 cmake: Improve the error message if the Python interpreter fails to run
RESULT_VARIABLE will return a string not a number in this case, so display it
for the user.
2021-05-04 07:51:04 +00:00
6ee835f6ea cmake: Set IDFTOOL variable using the correct PYTHON interpreter variable 2021-05-04 07:51:04 +00:00
69b740dc5e cmake: Fix passing PYTHON path via CMake variable if using IDF as library
Closes https://github.com/espressif/esp-idf/issues/6285
2021-05-04 07:51:04 +00:00
2ecc8fad50 tools: Add various fixes for idf.py gdbgui
Closes https://github.com/espressif/esp-idf/issues/5968
2021-05-03 11:41:39 +02:00
467c7af33e Merge branch 'doc/general_notes_v4.3' into 'release/v4.3'
doc: Update docs about startup sequence and memory types (v4.3)

See merge request espressif/esp-idf!13316
2021-05-03 06:48:07 +00:00
6121046090 ci: Use GitHub Actions to generate recursive source code zips for releases
We do this for all ESP-IDF releases, this step automates it.

Uses action added in https://github.com/espressif/github-actions/pull/10
2021-05-02 23:45:32 +00:00
4c113a0c0c Merge branch 'bugfix/fix_mbedtls_send_alert_crash_v4.3' into 'release/v4.3'
mbedtls: Fix mbedtls_ssl_send_alert_message crash due to ssl->out_iv is NULL[backport v4.3]

See merge request espressif/esp-idf!13300
2021-04-30 07:08:19 +00:00
ad759ee5a7 Merge branch 'newlib/no_atomic_support_v4.3' into 'release/v4.3'
stdatomic: Implemented legacy __sync APIs and __atomic_exchange_n (backport v4.3)

See merge request espressif/esp-idf!13361
2021-04-30 07:07:37 +00:00
24af403dac Merge branch 'bugfix/esp_http_client_read_v4.3' into 'release/v4.3'
Fix esp_http_client_read for file size aligned to 289 bytes (v4.3)

See merge request espressif/esp-idf!13305
2021-04-30 07:06:33 +00:00
469bb082d7 Merge branch 'bugfix/fix_nolightsleep_after_wifi_init_v4.3' into 'release/v4.3'
esp_wif: fix nolightsleep after wifi init v4.3

See merge request espressif/esp-idf!13403
2021-04-30 05:52:09 +00:00
80e381e511 Merge branch 'bugfix/remove_redundant_other_core_cache_disable_v4.3' into 'release/v4.3'
[system]: Remove redundant othercore cache disable (backport v4.3)

See merge request espressif/esp-idf!13356
2021-04-30 05:51:43 +00:00
847273d0fb Merge branch 'bugfix/wifi_softap_deep_sleep_current_opt_v4.3' into 'release/v4.3'
backport v4.3: optimize deep sleep current in wifi softap mode

See merge request espressif/esp-idf!13391
2021-04-30 02:50:04 +00:00
6d32eec165 mbedtls: Fix mbedtls_ssl_send_alert_message crash due to ssl->out_iv is NULL 2021-04-30 02:01:51 +00:00
6dc067dda7 esp_wifi: fix nolightsleep after wifi init (backport to v4.3) 2021-04-29 22:01:55 +08:00
0ddf00c6e1 esp_pm: allow dfs to swith down alltime if no lightsleep (backport to v4.3) 2021-04-29 22:00:37 +08:00
8c6705ded5 Merge branch 'bugfix/interrupt_watchdog_on_reset_v4.3' into 'release/v4.3'
Bugfix/interrupt watchdog on reset v4.3

See merge request espressif/esp-idf!13386
2021-04-29 13:33:07 +00:00
a480a00237 Merge branch 'mesh/bugfix_0421_backport_v4.3' into 'release/v4.3'
esp_wifi_mesh: add esp_mesh_send_block_time to set blocking time of esp_mesh_send(v4.3)

See merge request espressif/esp-idf!13287
2021-04-29 12:24:08 +00:00
2f603a56a7 esp_wifi_mesh: update wifi mesh libs
1. Fix mesh deinit blocking issue
2. Fix root has no eb for deauth frames during the networking
3. Add esp_mesh_send_block_time to set blocking time of esp_mesh_send
4. Forward Mgmt frames with skipping CCMP headers to fix parsing issues in Application for ESP32C3
2021-04-29 15:05:07 +08:00
2bffeb7265 uart: fix misleading files for UART2
Includes: header files, ld files and clk.c

ESP32-C3 only have UART0 and UART1.
2021-04-29 14:23:13 +08:00
9c872b1851 components/bt: fixed bugs in Bluetooth Controller and Baseband
1. Removed the interrupt lock operation during controller enable/disable/reset, to avoid trigger interrupt watchdog time-out due to use of mutex/semaphore in coex_st_set

2: Update libbtbb.a for ESP32-C3 to fix the Rx performance issue for CODED PHY, especially in coexistence scenario
2021-04-29 03:58:29 +00:00
b2c18de9b3 components/bt: Minor fix for the range of GATTC number of reconnections. 2021-04-29 03:58:29 +00:00
f684bd10f5 deep sleep: optimize sleep current in wifi softap mode 2021-04-29 10:14:30 +08:00
9da031e0c3 Merge branch 'bugfix/twai_caps_naming_and_tidy_up_v4.3' into 'release/v4.3'
Fix TWAI caps (backport v4.3)

See merge request espressif/esp-idf!13304
2021-04-28 17:47:35 +00:00
64de7ee38c Merge branch 'feature/spi_slave_hd_segment_example_v4.3' into 'release/v4.3'
spi_slave_hd: add an spi slave hd segment example (4.3)

See merge request espressif/esp-idf!13312
2021-04-28 17:39:25 +00:00
52d9d466fb Merge branch 'ci/enable_i2c_test_v4.3' into 'release/v4.3'
I2C: enable all unit test for i2c on esp32c3 (backport 4.3)

See merge request espressif/esp-idf!13061
2021-04-28 15:00:20 +00:00
a4a7e7b3e9 Merge branch 'bugfix/update_esp32c3_phy_init_data_v4.3' into 'release/v4.3'
esp_wifi: update esp32c3 phy init data(v4.3)

See merge request espressif/esp-idf!13338
2021-04-28 12:45:36 +00:00
fbc6f27e81 Merge branch 'bugfix/update_esp32c3_docs_v4.3' into 'release/v4.3'
docs: update wifi driver docs(v4.3)

See merge request espressif/esp-idf!13381
2021-04-28 11:49:55 +00:00
31c396c127 spi_slave_hd: add segment mode example 2021-04-28 08:20:55 +00:00
a87f5c6c02 spi_slave_hd: add polling api to read/write buf to essl_spi 2021-04-28 08:20:55 +00:00
20993109e8 spi_slave_hd: add callback after data is loaded to the DMA for segment mode 2021-04-28 08:20:55 +00:00
6c38cc736a Merge branch 'bugfix/twai_esp32_errata_workarounds_backport_v4.3' into 'release/v4.3'
TWAI: Add FIFO overrun handling and ESP32 hardware errata workarounds  (backport v4.3)

See merge request espressif/esp-idf!12984
2021-04-28 08:12:06 +00:00
193b60afcf esp_wifi: update esp32c3 phy init data 2021-04-28 08:04:28 +00:00
e4d84804c1 update esp32c3 iperf config 2021-04-28 15:50:41 +08:00
e4ebaca693 esp_http_client_read: Add check for esp_http_client_is_complete_data_received before returning ESP_FAIL
Closes: https://github.com/espressif/esp-idf/issues/6772
2021-04-28 05:00:58 +00:00
3f358236f0 Merge branch 'feat/c3_driver_api_cleanup_gpio_v4.3' into 'release/v4.3'
gpio, rtcio: removed unsupported features on different targets (v4.3)

See merge request espressif/esp-idf!13120
2021-04-27 09:37:15 +00:00
ba1ce2ebd0 I2C: enable all unit test for i2c on esp32c3 2021-04-27 17:13:47 +08:00
aad1f7abde stdatomic: Implemented legacy __sync APIs and __atomic_exchange_n
These APIs are used when the architecture doesn't have atomic
instruction support

Closes https://github.com/espressif/esp-idf/issues/6463
2021-04-27 13:34:54 +05:30
29ad86ed5b remove othercore cache disable 2021-04-27 14:40:52 +08:00
dede31cd83 Merge branch 'bugfix/gtk_reinstallation_fix_1_4.3' into 'release/v4.3'
wpa_supplicant: Clean gtk after disconnect (backport v4.3)

See merge request espressif/esp-idf!13286
2021-04-27 03:32:46 +00:00
d592a9863b Human-readable error if Git or Python are missing.
When user forgot to add git.exe or python to the PATH, there was a not
very helpful error message.
This improves the error with which tool is misssing and shows a link to
the espressif installer tool.
2021-04-26 14:14:19 +02:00
f89f5b7f75 tools: Warning about tool beiing installed but failed to run.
idf_tool.py runs "<tool> --version" which returns the error message but it is not used
This improves the error printing.
2021-04-26 14:03:17 +02:00
07291fdd27 TWAI: FIFO overrun handling and errata workarounds
This commit adds handling for FIFO overruns and
adds workarounds for HW errats on the ESP32.

Closes https://github.com/espressif/esp-idf/issues/2519
Closes https://github.com/espressif/esp-idf/issues/4276
2021-04-26 19:35:13 +08:00
00801c8044 TWAI: Simply caps and remove unused caps 2021-04-26 19:34:30 +08:00
b8e31efcac TWAI: Fix incorrect CAP name
Fixes a bug where SOC_TWAI_BRP_DIV_SUPPORTED was mistyped preventing
slower bit rates from being enabled on ESP32 revision 2 and 3 chips
2021-04-26 19:34:30 +08:00
819ac7f847 backport link updates to v4.3 2021-04-26 11:33:22 +00:00
46ab19818a add default value for unset env variables
Closes IDFGH-4784
2021-04-26 11:00:26 +00:00
b9038d045e Fix error when ZSH_VERSION is unset.
Merges https://github.com/espressif/esp-idf/pull/6587
2021-04-26 11:00:26 +00:00
ae72870d43 Merge branch 'bugfix/fix_c3_ble_disconnect_due_to_con_param_update_v4.3' into 'release/v4.3'
Fix c3 ble disconnect due to con param update v4.3

See merge request espressif/esp-idf!13325
2021-04-26 06:00:15 +00:00
4d1aaed682 Merge branch 'refactor/bt_lib_submodules_v4.3' into 'release/v4.3'
Refactor/bt lib submodules(backports v4.3)

See merge request espressif/esp-idf!13275
2021-04-25 06:24:46 +00:00
6059ef26fb gpio, rtcio: removed unsupported features on different targets 2021-04-24 15:55:13 +00:00
5fa34f6a30 Merge branch 'docs/add_esp32-c3-devkitc-02_user_guide' into 'release/v4.3'
Add ESP32-C3-DevKitC-02 User Guide (backport master)

See merge request espressif/esp-idf!13284
2021-04-24 00:36:24 +00:00
56a3845986 Merge branch 'bugfix/fix_c3_typos_v4.3' into 'release/v4.3'
esp32c3: fix typos of c3 path (backport v4.3)

See merge request espressif/esp-idf!13326
2021-04-24 00:35:24 +00:00
2c153af57a Merge branch 'doc/c3_ledc_programming_guide_v4.3' into 'release/v4.3'
[doc]: Corrected C3 LEDC docs (backport 4.3)

See merge request espressif/esp-idf!13276
2021-04-24 00:35:12 +00:00
18d7d9497a Merge branch 'bugfix/doc_jtag_c3_v4.3' into 'release/v4.3'
docs: Update JTAG debugging guides for ESP32-C3 (v4.3)

See merge request espressif/esp-idf!13290
2021-04-24 00:35:03 +00:00
38db3d9507 lw-ip: Fix LWIP_DEBUG define which is always defined 2021-04-23 18:25:17 +00:00
42ae0166d7 esp32c3: fix typos of c3 path 2021-04-23 21:09:06 +08:00
eff7fd9052 Merge branch 'feature/update_adc_programming_guide_on_c3_v4.3' into 'release/v4.3'
adc: add adc programming guide on c3 (4.3)

See merge request espressif/esp-idf!13281
2021-04-23 12:53:04 +00:00
275743ab1c doc: Add notes that vTaskStartScheduler() is called during startup
Closes https://github.com/espressif/esp-idf/issues/1457
2021-04-23 22:48:47 +10:00
8a39b5237d doc: update the memory types and startup docs 2021-04-23 22:48:47 +10:00
zwj
5e9aa539ea fix c3 ble disconnect due to connection parameters update 2021-04-23 20:39:40 +08:00
6f3b1a0554 docs: split the 'general notes' page into two 2021-04-23 19:12:06 +10:00
d0e0f80bd0 esp_system: Mark the startup array as 'const' to save RAM 2021-04-23 19:12:06 +10:00
ecb01b28c4 Merge branch 'doc/guide_uart_esp32c3_v4.3' into 'release/v4.3'
doc: update programming guide to include ESP32-C3 updates

See merge request espressif/esp-idf!13277
2021-04-23 09:09:11 +00:00
1b82e9604c Merge branch 'bugfix/esp32c3_eco3_efuse_programming_v4.3' into 'release/v4.3'
esp32c3 espefuse: Fix efuse programming timing on ESP32-C3 ECO3 (v4.3)

See merge request espressif/esp-idf!13297
2021-04-23 09:08:24 +00:00
26139daaf5 Merge branch 'feature/adds_ota_example_test_check_sign_on_update_v4.3' into 'release/v4.3'
simple_ota_example: Adds config to test on_update_no_secure_boot option (v4.3)

See merge request espressif/esp-idf!13222
2021-04-23 08:57:46 +00:00
f9831301ce Merge branch 'bugfix/bootloader_min_revision_c3_v4.3' into 'release/v4.3'
Fix bootloader minimum revision check and print for ESP32-C3 (v4.3)

See merge request espressif/esp-idf!13263
2021-04-23 08:56:24 +00:00
cfb84d3381 Merge branch 'feature/mbedtls_md5_update_v4.3' into 'release/v4.3'
mbedtls: Add CONFIG_MBEDTLS_ROM_MD to enable ROM MD acceleration(back port v4.3)

See merge request espressif/esp-idf!13133
2021-04-23 08:56:08 +00:00
952e47d45d wpa_supplicant: Group key reinstallation fixes
This commit reverts previous commit for GTK reinstallation fix
and corrects original fix.
2021-04-23 13:45:13 +05:30
ed6a0c324c Merge branch 'feature/update_spi_programming_guide_on_c3_v4.3' into 'release/v4.3'
spi: update spi programming guide on c3 (4.3)

See merge request espressif/esp-idf!13280
2021-04-23 06:44:03 +00:00
c6ca4e3e88 Merge branch 'bugfix/fix_flash_ci_v4.3' into 'release/v4.3'
esp_flash: fix host number for passing ci(backport v4.3)

See merge request espressif/esp-idf!13264
2021-04-23 06:43:18 +00:00
999f648a35 esp32c3 espefuse: Fix efuse programming timing on ESP32-C3 ECO3
Without this timing change, efuse programming occasionally appears to fail
(although the efuse is programmed correctly).
2021-04-23 10:33:43 +10:00
9bf4d44235 mbedtls: Add CONFIG_MBEDTLS_ROM_MD5 to use ROM MD5 in mbedTLS 2021-04-22 12:34:00 +00:00
50e3f9f66c docs: Update JTAG debugging guides for ESP32-C3 2021-04-22 13:58:22 +02:00
613201c24d Add ESP32-C3-DevKitC-02 User Guide and fix some typos 2021-04-22 15:34:45 +08:00
1166bc5680 bootloader: Suppress a Cmake warning - variables were not used by the project
Manually-specified variables were not used by the project: SECURE_BOOT_SIGNING_KEY
2021-04-22 07:27:08 +00:00
02170d815e bootloader: Fix error in Make build system when signature options is on 2021-04-22 07:27:08 +00:00
6e06d323b1 simple_ota_example: Adds configs to test on_update_no_secure_boot option (RSA&ECDSA) 2021-04-22 07:27:08 +00:00
d7a793f406 spi_master: enable spi speed test on c3 and update the programming guide
accordingly
2021-04-22 06:31:49 +00:00
85e0728700 spi: update esp32c3 programming guide 2021-04-22 06:31:49 +00:00
3fb1165e4e adc: add adc programming guide on c3 2021-04-22 06:28:37 +00:00
34140d2a00 timer_group: added example test 2021-04-22 11:21:41 +08:00
face9518b2 timer_group: using isr callback in example 2021-04-22 11:21:41 +08:00
5f1887b3ca doc: update general purpose timer for esp32-c3 2021-04-22 11:19:18 +08:00
d8c4ab482b doc: update programming guide to include ESP32-C3 updates 2021-04-22 10:41:51 +08:00
94ed8f8606 [doc]: Corrected C3 LEDC docs 2021-04-22 09:38:26 +08:00
cdcb85fd70 component/bt: add another bt-lib submodule and refactor the directories
# Conflicts:
#	.gitmodules
#	components/bt/component.mk
2021-04-22 07:46:55 +08:00
a67793e9fc Merge branch 'bugfix/gtk_reinstallation_fix_v4.3' into 'release/v4.3'
wpa_supplicant: Prevent reinstallation of an already in-use group key (v4.3)

See merge request espressif/esp-idf!13181
2021-04-21 15:17:35 +00:00
182c2eda48 Merge branch 'bugfix/fix_bootloader_time_too_long_bug_v4.3' into 'release/v4.3'
esp32s2/esp32c3: decrease boot up and cpu start up time (backport v4.3)

See merge request espressif/esp-idf!12728
2021-04-21 14:20:28 +00:00
1d218485ec Merge branch 'nimble/add_c3_config_max_conn_v4.3' into 'release/v4.3'
NimBLE: Add max connection config option for C3 (v4.3)

See merge request espressif/esp-idf!12999
2021-04-21 13:07:48 +00:00
257047c073 remove original esp32-bt-lib submodule 2021-04-21 20:40:35 +08:00
83358061df Merge branch 'bugfix/endianness_in_output_or_input_oob_v4.3' into 'release/v4.3'
ble_mesh: stack: Fix endianness error in output or input oob data of number (v4.3)

See merge request espressif/esp-idf!13254
2021-04-21 12:35:51 +00:00
47e4386953 wpa_supplicant: Prevent reinstallation of an already in-use group key 2021-04-21 11:41:34 +00:00
60bf9d30b2 Merge branch 'bugfix/correct_cod_check_v4.3' into 'release/v4.3'
esp-idf: Corrected check of Class of Device for discovered devices (v4.3)

See merge request espressif/esp-idf!13019
2021-04-21 11:39:19 +00:00
e8282fb5c5 esp32s2/esp32s3/esp32c3: Decrease boot up time by delete useless slow clock calibration 2021-04-21 11:38:26 +00:00
5a5327e77e Merge branch 'bugfix/fix_esp32c3_macaddr_default_v4.3' into 'release/v4.3'
fix esp32c3 default mac addr count(v4.3)

See merge request espressif/esp-idf!13209
2021-04-21 11:35:43 +00:00
5580d578bd Merge branch 'nimble/add_error_prints_acl_buf_v4.3' into 'release/v4.3'
NimBLE: Add error prints for ACL buffer exhaustion in NPL (v4.3)

See merge request espressif/esp-idf!12968
2021-04-21 10:26:31 +00:00
759e4340a9 Merge branch 'bugfix/ci/runner_py_consider_no_junit_report_as_succeeded_v4.3' into 'release/v4.3'
CI: runner py consider no test case as succeeded (v4.3)

See merge request espressif/esp-idf!13250
2021-04-21 10:23:58 +00:00
949a3cd61a Merge branch 'bugfix/ble_timeout_disconnected_no_report_v4.3' into 'release/v4.3'
Fix  the controller do not report the disconnect event to host

See merge request espressif/esp-idf!13262
2021-04-21 09:55:38 +00:00
ac9bd8bcc4 NimBLE: Add max connection config option for ESP32C3 2021-04-21 08:52:32 +00:00
e45ce5c058 bugfix: Fix the issue that the controller do not report the timeout
disconnect event. This issue is caused by modem sleep.The sleep interrupt
will come the second time before the CLKN interrupt. If we disable the sleep
interrupt when it comes in the first time, the CLKN will never come.
2021-04-21 15:02:40 +08:00
44b81cb280 esp_flash: fix host number for passing ci 2021-04-21 13:54:26 +08:00
b24671e935 test_apps: increase partition table offset to fix build errors 2021-04-21 10:16:46 +05:30
d41781099a bootloader_support: fix min. revision error print for < C3-ECO3 revisions 2021-04-21 10:16:46 +05:30
6403a229eb bootloader: fix print related to min. chip revision
Closes https://github.com/espressif/esp-idf/issues/6890
Closes IDFGH-5106
2021-04-21 10:16:46 +05:30
98ad8cc2e3 Merge branch 'bugfix/ftm_fixes_logging_change_v4.3' into 'release/v4.3'
wifi/ftm: Move FTM report logging into application and some bugfixes (Backport v4.3)

See merge request espressif/esp-idf!13218
2021-04-21 03:22:59 +00:00
afc2f9b5d3 Merge branch 'bugfix/freertos_current_tcb_unpinned_v4.3' into 'release/v4.3'
freertos: Fix race condition returning incorrect TCB on unpinned tasks (v4.3)

See merge request espressif/esp-idf!13236
2021-04-20 22:57:47 +00:00
f2e222a8f8 Merge branch 'bugfix/optimize_c3_multi_con_and_add_connection_retry_v4.3' into 'release/v4.3'
optimize c3 multi con and add connection retry (backport v4.3)

See merge request espressif/esp-idf!12990
2021-04-20 15:28:30 +00:00
bdce35c3d7 ble_mesh: stack: Fix endianness error in output or input oob data of number
Closes https://github.com/espressif/esp-idf/issues/6862
2021-04-20 21:24:25 +08:00
7d7ad29d5a fix(ci): return as failed when no test case result generated 2021-04-20 17:16:02 +08:00
905293a6c9 ci: add helper info for tests with no config 2021-04-20 17:16:02 +08:00
6587ff6110 wifi/ftm: Move FTM report logging into application and some bugfixes
Move FTM report processing and logging to application
Update wifi lib with below bugfixes
1. Initiator parameters sanity checks
2. Responder config option, fix beacon caps
3. To save space, register FTM modules only when FTM is enabled

Co-Authored-By: Nachiket Kukade <nachiket.kukade@espressif.com>
Co-Authored-By: Zhang Jun Hao <zhangjunhao@espressif.com>
2021-04-20 14:00:23 +05:30
991d0b8c31 freertos: test: Add stress test for thread local storage
(Fails without the fix applied in parent commit.)
2021-04-20 03:51:43 +00:00
2290d0385e freertos: Fix race condition returning incorrect TCB on unpinned tasks
Noted as a problem with thread local storage returning a different task's
pointers, but some other were APIs also accessing current task unsafely.

Regression in FreeRTOS 10 update a3c90bf59a
2021-04-20 03:51:43 +00:00
4f04f48a70 Merge branch 'bugfix/update_esp32s2_phylib_v1800_v4.3' into 'release/v4.3'
esp_wifi: Update esp32s2 phylib and fix s3 beta2 tsf (backport v4.3)

See merge request espressif/esp-idf!13151
2021-04-20 03:50:17 +00:00
zwj
2a7df3bcd8 optimize C3 multi-connection 2021-04-20 02:53:07 +00:00
zwj
67b09d3db5 add option to enable multi-connection 2021-04-20 02:53:07 +00:00
zwj
5717f8f2fb update con state when getting connection cancle complete 2021-04-20 02:53:07 +00:00
zwj
fe2f3bfe1e fix ble 5.0 SMP failed 2021-04-20 02:53:07 +00:00
zwj
e2af75b5e4 add BLE connection establishment retry 2021-04-20 02:53:07 +00:00
a17b57b062 fix esp32c3 default mac addr count 2021-04-20 02:38:31 +00:00
df0c1a1285 Merge branch 'bugfix/ci/ci_fetch_submodule_fully_match_return_first_v4.3' into 'release/v4.3'
fix(ci): ci_fetch_submodule return full match name first (v4.3)

See merge request espressif/esp-idf!13210
2021-04-20 02:05:08 +00:00
662b6bb48a fix(ci): ci_fetch_submodule return full match name first 2021-04-19 20:19:43 +08:00
3d0a386c10 Merge branch 'feature/configure_max_server_profiles_count_v4.3' into 'release/v4.3'
esp32: Added an option in menuconfig to configure maximum gatt services (v4.3)

See merge request espressif/esp-idf!13187
2021-04-19 10:05:47 +00:00
9ed4e06dd2 esp-idf: Added an option in menuconfig to configure maximum gatt services
Currently Max GATT services count cannot be configured externally and
hence user needs to modify code ,everytime the count is to be
modified.

 Added an option in menuconfig to provide a way to user to set the count.

Fixes: https://jira.espressif.com:8443/browse/BT-1508
2021-04-19 12:28:49 +05:30
ededfb47b9 esp_wifi: fix esp32s2 and esp32s3beta2 issue
1.Update libphy.a to V1800 20210413_e7ef680 for esp32s2
2.fix esp32s3beta2 tsf issue
2021-04-19 14:45:08 +08:00
6f47a4e0a6 Merge branch 'feature/add_c3_trm_link_v4.3' into 'release/v4.3'
docs: add C3 TRM links (v4.3)

See merge request espressif/esp-idf!13091
2021-04-16 05:33:29 +00:00
2335e5026f Merge branch 'bugfix/freertos_task_delete_v4.3' into 'release/v4.3'
freertos: Fix race condition using vTaskDelete() cross-core causing resource leak (v4.3)

See merge request espressif/esp-idf!13142
2021-04-16 01:46:37 +00:00
2bd0e9371a Merge branch 'bugfix/mdns_configure_strict_mode_v4.3' into 'release/v4.3'
mdns: Fix mdns to correctly answer non-strict queries (+ additional fixes) (v4.3)

See merge request espressif/esp-idf!13121
2021-04-15 12:27:33 +00:00
fead8b8a06 Merge branch 'bugfix/fix-automatic-connection_v4.3' into 'release/v4.3'
bugfix: fixed automatic connection in idf_monitor (v4.3)

See merge request espressif/esp-idf!13130
2021-04-14 18:06:09 +00:00
e9cf9e2978 Merge branch 'bugfix/e8192_and_assert_param_bt1551' into 'release/v4.3'
Modify E8192 ELx 200 ELx40 log level to LOGD

See merge request espressif/esp-idf!12977
2021-04-14 16:23:57 +00:00
6463dd9630 Merge branch 'bugfix/esp32c3_deep_sleep_gpio_wakeup_issue_v4.3' into 'release/v4.3'
backport v4.3: fix deep sleep gpio wakeup fail issue

See merge request espressif/esp-idf!13140
2021-04-14 16:02:32 +00:00
c9f1b55287 Merge branch 'bugfix/fix_wifi_issue_for_pm_disconnected_v4.3' into 'release/v4.3'
esp_wifi: fix some issue about wifi pm (backport to v4.3)

See merge request espressif/esp-idf!13138
2021-04-14 14:36:56 +00:00
e16ec9a574 modify E8192 ELx200 ELx40 log level to LOGD 2021-04-14 19:33:03 +08:00
a7994b1a42 freertos: Add some comments about deleting tasks when using SMP
Some cases are not immediately obvious, so document them in comments.
2021-04-14 19:45:08 +10:00
c725aa3ec1 freertos: Fix race condition using vTaskDelete() cross-core causing resource leak
Causes test added in parent commit to pass.

This race happens if the deleted task is running on the other CPU,
and is already spinning in a critical section waiting for xTaskQueueMutex
because it's about to be blocked for a resource.

The "deleted" task would end up blocked, possibly indefinitely, and
never actually deleted or its resources cleaned up by the idle tasks.

Details:

vTaskDelete() adds the target task to the xTasksWaitingTermination list,
expecting it to be yielded off CPU and then cleaned up later. However as soon as
vTaskDelete() releases xTaskQueueMutex, the target task runs and moves itself to the
xDelayedTaskList1. Because interrupts are already disabled on that CPU,
the "yield" to the other CPU sent by the vTaskDelete() comes afterward so
doesn't help.
2021-04-14 19:45:08 +10:00
3687ae989b freertos: Add unit test for deleting task which may be blocking 2021-04-14 19:45:08 +10:00
16cf160d57 deep sleep: fix sleep gpio wakeup fail issue 2021-04-14 15:40:13 +08:00
58160d46c6 esp_wifi: fix some issue about wifi pm (backport to v4.3) 2021-04-14 14:44:19 +08:00
776906dc84 Merge branch 'bugfix/fix_some_pm_issue_v4.3' into 'release/v4.3'
esp_pm: fix an issue and add an interface (backport to v4.3)

See merge request espressif/esp-idf!13123
2021-04-14 06:43:17 +00:00
891a17ea62 Fixed automatic connection in idf_monitor
Closes https://github.com/espressif/esp-idf/issues/6415
2021-04-13 15:08:15 +02:00
bd03a0e66a esp_pm: fix an issue and add an interface (backport to v4.3) 2021-04-13 17:16:23 +08:00
eab4e6fedd mdns: Fixed the ip header TTL to be correctly set to 255
Defined in https://tools.ietf.org/html/rfc6762#section-11: All Multicast DNS responses (including responses sent via unicast)
   SHOULD be sent with IP TTL set to 255
2021-04-13 10:36:30 +02:00
03d504dbb2 mdns: Fix parsing answers with questions when instance name not set
mdns resolver didn't correctly resolved queries when host name wasn't
assigned. Fixed by allowing processing also if some answer present
(non-strict mode)

Closes https://github.com/espressif/esp-idf/issues/6598
2021-04-13 10:36:30 +02:00
8e8737c128 mdns: Fix the resolver to correctly parse it's own non-strict answers
The resolver was able to respond correctly, but would also resolve its
own queries and cause issues with BCT 1.5.2, specifically
* MULTIPLE QUESTIONS - DUPLICATE SUPPRESSION
* MULTIPLE QUESTIONS - DISTRIBUTED DUPLICATE SUPPRESSION
tests failed.
2021-04-13 10:36:30 +02:00
3a5d9d9431 mdns: Add MDNS_STRICT_MODE config option
Strict mode was hardcoded in private header file, but it's useful for
users to enable/disable it depending on the mdns library they are using.
e.g. Avahi might not resolve the non-strict answers.
2021-04-13 10:36:30 +02:00
693aaef039 Merge branch 'bugfix/enable_gpio18_gpio19_esp32c3_v4.3' into 'release/v4.3'
gpio: Disable USB JTAG when setting pins 18 and 19 as GPIOs on ESP32C3 (backport v4.3)

See merge request espressif/esp-idf!13112
2021-04-13 07:40:00 +00:00
7703fcbd8d Merge branch 'bugfix/silent_asserts_v4.3' into 'release/v4.3'
freertos/lw ip: Support silent assertions (v4.3)

See merge request espressif/esp-idf!13011
2021-04-13 04:30:09 +00:00
9a7deae742 Merge branch 'bugfix/reduce_the_consumption_of_touch_sensor_during_deep_sleep_backport_v4.3' into 'release/v4.3'
bugfix: reduce the consumption of touch sensor during deep sleep (backport v4.3)

See merge request espressif/esp-idf!12869
2021-04-13 04:16:01 +00:00
84dc42c4b0 gpio: Disable USB JTAG when setting pins 18 and 19 as GPIOs on ESP32C3
When `DIS_USB_JTAG` eFuse is NOT burned (`False`), it is not possible
to set pins 18 and 19 as GPIOs. This commit solves this by manually
disabling USB JTAG when using pins 18 or 19.
The functions shall use `gpio_hal_iomux_func_sel` instead of
`PIN_FUNC_SELELECT`.
2021-04-12 17:45:06 +08:00
d7e680828a Merge branch 'feature/seperate_ipv6_function_from_ipv4_v4.3' into 'release/v4.3'
Add LWIP_IPV6 macro to strip IPv6 function (backport v4.3)

See merge request espressif/esp-idf!12998
2021-04-12 08:38:45 +00:00
da47503c14 Merge branch 'bugfix/deep_sleep_skip_verify_rtc_mem_heap_v4.3' into 'release/v4.3'
Fix bootloader "skip validate on exiting deep sleep" option if "use RTC memory as heap" is enabled (v4.3)

See merge request espressif/esp-idf!13096
2021-04-12 08:18:21 +00:00
e490fdafbe doc: Add description for CONFIG_LWIP_IPV6 in api-guides 2021-04-12 05:42:50 +00:00
94e3141a32 examples: Make tcp_server example support tcp keepalive function 2021-04-12 05:42:50 +00:00
fd34406960 examples: Use CONFIG_LWIP_IPV6 to strip tcp_server example 2021-04-12 05:42:50 +00:00
4544b709e5 lwip: Fix spelling issues in lwip_debug.c 2021-04-12 05:42:50 +00:00
a95c1c302d examples: Strip IPv6 function in example and use sockaddr_storage to replace sockaddr_in6 2021-04-12 05:42:50 +00:00
1ef91c72e2 components: Use CONFIG_LWIP_IPV6 to strip IPv6 function in components 2021-04-12 05:42:50 +00:00
90696dad89 lwip: Add LWIP_IPV6 macro to strip IPv6 function in LWIP component 2021-04-12 05:42:50 +00:00
e310fb1393 fix: reduce the consumption of touch sensor during deep sleep 2021-04-12 12:24:53 +08:00
71de11e89d Merge branch 'feature/esp32c3_memprot_test3_v4.3' into 'release/v4.3'
ESP32C3/ESP32S2: memprot API upgrade and test application (v4.3)

See merge request espressif/esp-idf!12942
2021-04-12 03:29:29 +00:00
bda9e1fda7 Merge branch 'bugfix/doxygen_input_file_bug_v4.3' into 'release/v4.3'
docs: fix doxygen compile warnings for doxygen 1.9.1 (v4.3)

See merge request espressif/esp-idf!13075
2021-04-12 00:46:11 +00:00
97df333a3b docs: fix doxygen compile warnings for doxygen 1.9.1
Newer versions of doxygen will give warnings for comments in
INPUT lists

Delete all comment lines to fix these warnings, our folder structure
stil gives an OK overview of what we are including
2021-04-12 08:46:06 +08:00
6dfff2fdbd esp32c3: memprot API upgrade and test application
Closes IDF-2641
2021-04-12 10:21:58 +10:00
2ed3e8b344 Merge branch 'bugfix/prefetch_invalid_v4.3' into 'release/v4.3'
soc: add dummy bytes to ensure instr prefetch always valid (v4.3)

See merge request espressif/esp-idf!12993
2021-04-09 14:49:07 +00:00
58a7d9f239 NimBLE: Add error prints for ACL buffer exhaustion in NPL 2021-04-09 14:18:20 +00:00
e4dd9053c2 Merge branch 'feature/secure_bootv2_c3_v4.3' into 'release/v4.3'
secure_boot_v2: Support SB_V2 for ESP32-C3 ECO3 (v4.3)

See merge request espressif/esp-idf!13062
2021-04-09 13:06:46 +00:00
ff5e0d0d38 Merge branch 'bugfix/calc_8m_freq_test_v4.3' into 'release/v4.3'
rtc: increase CI acceptance range for calc 8M test (v4.3)

See merge request espressif/esp-idf!13085
2021-04-09 13:06:36 +00:00
03b0540bc6 esp32s3: Reserve RTC memory in bootloader in the app linker script 2021-04-09 19:15:43 +10:00
17e30c9e89 esp32c3: Reserve RTC memory from bootloader in the app linker script 2021-04-09 19:15:43 +10:00
00cfcde385 bootloader: Fix "skip validate on exit deep sleep" when "Use RTC fast memory as heap" is enabled
RTC region used to store boot partition needs to remain reserved in the app.
2021-04-09 19:15:43 +10:00
0839fd08dd Merge branch 'bugfix/dport_init_min_stack_size_v4.3' into 'release/v4.3'
freertos: Increase minimum task stack size when stack smashing checker is enabled (backport v4.3)

See merge request espressif/esp-idf!12797
2021-04-09 09:14:25 +00:00
626964beae docs: add C3 TRM links 2021-04-09 15:14:16 +08:00
220f3d2198 rtc: increase CI acceptance range for calc 8M test 2021-04-09 15:06:11 +08:00
904933745b Merge branch 'bugfix/fix_esp_restart_crash_v4.3' into 'release/v4.3'
esp_hw_support: fix esp_restart crash (v4.3)

See merge request espressif/esp-idf!13072
2021-04-09 03:44:09 +00:00
ea4a8d5e4f esp_hw_support: fix esp_restart crash
Closes https://github.com/espressif/esp-idf/issues/6836
2021-04-09 09:30:03 +08:00
10cce6b74a unit-test-app(config): esp32c3 uses eco0 for UTs 2021-04-09 00:02:40 +08:00
e36e433519 Merge branch 'bugfix/fix_uart_handler_call_inline_func_v43' into 'release/v4.3'
Bugfix/fix uart handler call inline func (backport v4.3)

See merge request espressif/esp-idf!13003
2021-04-08 09:38:51 +00:00
76ff1724b3 Merge branch 'feature/remove_hspi_macor_on_chips_later_than_s2_v4.3' into 'release/v4.3'
spi: remove hspi macor on chips later than s2 (v4.3)

See merge request espressif/esp-idf!12956
2021-04-08 09:37:07 +00:00
9f1ae278e0 Merge branch 'feature/vdd_sdio_pd_configurable_v4.3' into 'release/v4.3'
system: add VDD_SDIO power domain configuration for light sleep (backport v4.3)

See merge request espressif/esp-idf!13028
2021-04-08 09:27:57 +00:00
54908d3a42 esp32c3: Default supported ESP32-C3 Revision ECO3 2021-04-08 15:09:14 +08:00
19b90e8ba9 docs: Adds secure_boot_v2 for ESP32-C3 ECO3 2021-04-08 14:35:35 +08:00
a5e27d73a5 secure_boot_v2: Adds support SB_V2 for ESP32-C3 ECO3 2021-04-08 14:35:35 +08:00
1e6a6ffa0d Merge branch 'bugfix/check_a_time_after_deepsleep_v4.3' into 'release/v4.3'
Fix esp32s2 timekeeping on deep sleep issue (v4.3)

See merge request espressif/esp-idf!13046
2021-04-08 01:14:44 +00:00
dbf2a64adb esp_hw_support: add test for rtc clk compensation 2021-04-07 06:40:28 +08:00
11970e65a1 newlib: persist rtc clk corrections 2021-04-07 06:40:28 +08:00
3b8c7bdf0b tools: handle exception in case of logging Unicode characters 2021-04-06 19:16:15 +02:00
670b057b04 spi: remove HSPI macro on esp32c3 and esp32s3 2021-04-06 15:30:28 +08:00
ae3b4819da esp_system: add VDD_SDIO power domain configuration to documentation
Add a warning in `sleep_modes` doc page to explain how to keep
VDD_SDIO power domain ON.
2021-04-06 14:04:22 +08:00
b0684e8b3c esp_system: add VDD_SDIO power domain configuration for light sleep
VDD_SDIO power domain can now be configured for light sleep
by the application. It is now possible to keep the power domain
ON during light sleep, keeping the GPIOs connected to it powered.
The power domain will, by default be:
- Kept ON if CONFIG_ESP_SYSTEM_PD_FLASH is not set
- Turned OFF if not set

The application can still force it to be ON by calling
`esp_sleep_pd_config(ESP_PD_DOMAIN_VDDSDIO, ESP_PD_OPTION_ON);`
2021-04-06 14:01:38 +08:00
322cba0bf0 freertos: Add a small additional stack when optimization set to None
Fix for occasional crash on startup when DPORT task overwrites its stack during
context switch, otherwise.
2021-04-06 02:43:24 +00:00
f5c6595cb4 freertos: Increase minimum task stack size when stack smashing checker is enabled
Fixes issue with DPORT init task, this task uses minimum stack size and may not be
enough if stack smashing detection is set to Overall mode.

Also reworks the way we calculate minimum stack to allow for adding multiple
contributing factors.

Closes https://github.com/espressif/esp-idf/issues/6403
2021-04-06 02:43:24 +00:00
02de1a8071 esp-idf: Corrected check of Class of Device for discovered devices
Current code stopped inquiry if major class is not Phone. Modified the
condition to consider for both Phone and Audio to cover majority of real
world devices.

Closes https://github.com/espressif/esp-idf/issues/6548
2021-04-05 15:29:21 +05:30
e9e2b68587 freertos: Use the standard assert() function for configASSERT
Unless the option for "assert and keep running" is enabled.

This means that silent asserts now work for FreeRTOS, and disabling asserts
now also disables them in FreeRTOS without needing a separate config change.

Related to https://github.com/espressif/esp-idf/issues/6306
2021-04-02 11:07:23 +11:00
73d40cb813 lwip: Support silent assertion configuration
If silent assert configuration is enabled, LWIP asserts are now 'silent' also.

Also updates KConfig to note that LWIP asserts are also disabled when asserts
are disabled globally (this was already the behaviour, but the config item
suggested otherwise.)

Progress towards https://github.com/espressif/esp-idf/issues/5873
2021-04-02 11:03:44 +11:00
bf6ddf2557 bootloader: Allow 'silent assert' config to work in bootloader
Requires adding the 'newlib' component to the bootloader project, for
platform_include header.
2021-04-02 11:03:21 +11:00
d761226f36 driver: fix uart handler in iram calls inline uart_ll_is_tx_idle 2021-04-01 09:56:56 +02:00
5036ec363b soc: add dummy bytes to ensure instr prefetch always valid
The CPU might prefetch instructions, which means it in some cases
will try to fetch instruction located after the last instruction in
flash.text.

Add dummy bytes to ensure fetching these wont result in an error,
 e.g. MMU exceptions
2021-04-01 10:23:44 +08:00
c724236623 Merge branch 'bugfix/close_tsen_when_close_phy_v4.3' into 'release/v4.3'
esp_wifi: close tsen when close phy (backport to v4.3)

See merge request espressif/esp-idf!12986
2021-04-01 02:17:57 +00:00
f7034e7767 Merge branch 'bugfix/dirent-riscv-header-4.3' into 'release/v4.3'
vfs: use sys/dirent.h from newlib (backport v4.3)

See merge request espressif/esp-idf!12752
2021-04-01 02:16:59 +00:00
7e75d7f748 Merge branch 'bugfix/aes_dma_completion_v4.3' into 'release/v4.3'
mbedtls: Fix AES dma completion race condition (v4.3)

See merge request espressif/esp-idf!12903
2021-04-01 02:15:30 +00:00
e5437afa7f Merge branch 'bugfix/ds_invalidate_assert_v4.3' into 'release/v4.3'
esp32s2 ds: Fix invalidating Digital Signature key from HMAC peripheral if assertions are disabled (v4.3)

See merge request espressif/esp-idf!12905
2021-03-31 22:56:13 +00:00
319eecc793 Merge branch 'doc/c3_system_api_v4.3' into 'release/v4.3'
docs: updated system api-reference chapters for C3 (v.4.3)

See merge request espressif/esp-idf!12892
2021-03-31 17:57:41 +00:00
d17923151b Merge branch 'bugfix/fix_esp32c3_hardware_bug_before_ECO3_v4.3' into 'release/v4.3'
backport v4.3: fix c3 hardware bug before ECO3 and optimizate bbpll config:

See merge request espressif/esp-idf!12988
2021-03-31 17:44:01 +00:00
0a0b3bb23f Merge branch 'bugfix/assert_when_tcp_send_data_for_v4.3' into 'release/v4.3'
lw-ip:bugfix for assert when tcp send data(backport4.3)

See merge request espressif/esp-idf!12980
2021-03-31 17:40:43 +00:00
2a5cf2c3e0 esp_wifi: close tsens when close phy (backport v4.3) 2021-03-31 21:04:29 +08:00
ae15a0cab8 Merge branch 'bugfix/add_beacon_timeout_event_v4.3' into 'release/v4.3'
esp_wifi: Add beacon timeout event (backport v4.3)

See merge request espressif/esp-idf!12974
2021-03-31 13:01:41 +00:00
0c7f286a87 fix c3 hardware bug before ECO3 and optimizate bbpll config:
1. deepsleep poweron reset bug in high temperature before ECO3;
2. brownout reset bug before ECO2;
3. bbpll voltage low bug before ECO3;
4. need xpd iph for xtal before ECO3;
2021-03-31 20:17:54 +08:00
3e26049a05 bugfix for assert when tcp send data 2021-03-31 16:45:45 +08:00
dece3abd9c esp_wifi: Fix some wifi bugs
1.Add beacon timeout event.
2.Update TBTT when rx probe respones after beacon timeout.
3.Fix ESPTouch v2 issues.
2021-03-31 14:21:49 +08:00
1af5bc2f7d Merge branch 'bugfix/esp32c3_light_sleep_gpio_reset_issue_v4.3' into 'release/v4.3'
backport v4.3: add software workaround for esp32c3 gpio reset issue

See merge request espressif/esp-idf!12751
2021-03-31 03:12:09 +00:00
278cfc2047 Merge branch 'doc/embed_example_v4.3' into 'release/v4.3'
doc: Update the link to an example that embeds a file (v4.3)

See merge request espressif/esp-idf!12655
2021-03-31 01:31:12 +00:00
1790aa6bc6 Merge branch 'bugfix/spi_slv_dual_boad_test_slv_fail_issue_4.3' into 'release/v4.3'
spi: spi slv dual boad test slv fail issue (4.3)

See merge request espressif/esp-idf!12958
2021-03-30 17:16:33 +00:00
b75a5fd03a Merge branch 'bugfix/adc_power_issue_4.3' into 'release/v4.3'
adc: fix adc power issue (v4.3)

See merge request espressif/esp-idf!12921
2021-03-30 17:15:09 +00:00
cbf2858450 Merge branch 'bugfix/support_esp32c3eco3_v4.3' into 'release/v4.3'
Bugfix/support esp32c3eco3 v4.3

See merge request espressif/esp-idf!12931
2021-03-30 15:15:06 +00:00
868c96c59f Merge branch 'bugfix/flash_suspend_restriction_v4.3' into 'release/v4.3'
spi_flash: make suspend off by default and add more information for using suspend(backport v4.3)

See merge request espressif/esp-idf!12932
2021-03-30 11:00:53 +00:00
60d5dcb000 spi_slave: enable spi slave dual board test on esp32c3 2021-03-30 17:16:16 +08:00
62787fc277 spi: update slv dual board test for ci due to no pullup resistor on io10 on c3 2021-03-30 17:11:23 +08:00
9e97133481 Support new section addr and wifi lib for ESP32C3-ECO3. 2021-03-30 16:05:13 +08:00
c9087c205b docs: updated system api-reference chapters for C3 2021-03-30 14:28:02 +08:00
736b87db6d Merge branch 'ci/ignore_check_link_result_v4.3' into 'release/v4.3'
CI: ignore result from check_doc_links (v4.3)

See merge request espressif/esp-idf!12782
2021-03-30 03:11:00 +00:00
c2eaa3d844 Merge branch 'bugfix/esp32c3_gdbinit_v4.3' into 'release/v4.3'
.gdbinit generation fix (ESP32C3) (v4.3)

See merge request espressif/esp-idf!12750
2021-03-30 03:10:22 +00:00
2a715c811b Merge branch 'bugfix/extern_c_decl_4.3' into 'release/v4.3'
[cxx]: fixed extern "C" declarations (backport v4.3)

See merge request espressif/esp-idf!12741
2021-03-30 03:09:46 +00:00
17aa9c5ec4 Merge branch 'bugfix/broken_virtualenv_v4.3' into 'release/v4.3'
tools: Reinstall virtualenv if it is broken (v4.3)

See merge request espressif/esp-idf!12951
2021-03-30 03:08:08 +00:00
c93211db62 tools: Reinstall virtualenv if it is broken
Closes https://github.com/espressif/esp-idf/issues/6656
2021-03-29 15:05:42 +02:00
be56456add light sleep: add software workaround for esp32c3 gpio reset issue 2021-03-29 15:06:23 +08:00
413bbe4de4 Merge branch 'bugfix/btdm_incorrectly_spelled_v4.3' into 'release/v4.3'
component/bt: fix Spelling mistakes(release v4.3)

See merge request espressif/esp-idf!12815
2021-03-29 05:07:57 +00:00
4906779d50 spi_flash: make suspend off by default and add more information for using suspend 2021-03-29 12:02:43 +08:00
7d5d57ec03 esptool: update to support flashing esp32c3 eco 3 2021-03-26 18:42:41 +08:00
67a1858bb1 esp32c3: Add support for building image with a minimum target revision 2021-03-26 18:29:53 +08:00
fb9de62f74 bugfix: keep wakeup state during csa 2021-03-26 18:29:10 +08:00
f48346f22f adc: apply adc power API to adc driver 2021-03-26 17:41:20 +08:00
79ce133ed7 Merge branch 'feature/support_esp32c3_aligenie_demo_v4.3' into 'release/v4.3'
ble_mesh: aligenie_demo: Add sdkconfig.defaults for esp32c3 (backport V4.3)

See merge request espressif/esp-idf!12428
2021-03-26 06:02:55 +00:00
a59a5cb2cc ble_mesh: aligenie_demo: Add sdkconfig.defaults for esp32c3 (backport V4.3) 2021-03-26 14:02:49 +08:00
2d26c24e3a Merge branch 'bugfix/clear_interrupt_in_touch_sensor_initialization_backport_v4.3' into 'release/v4.3'
fix: clear interrupt in touch sensor initialization (backport v4.3)

See merge request espressif/esp-idf!12758
2021-03-26 05:55:18 +00:00
2792c333bc Merge branch 'bugfix/freemodbus_fix_mbm_event_processing_v43' into 'release/v4.3'
freemodbuss: fix event processing after merge (backport v4.3)

See merge request espressif/esp-idf!12821
2021-03-26 05:52:59 +00:00
7c5e920c37 Merge branch 'feature/temp_v4.3' into 'release/v4.3'
temp_sensor: add calibration for esp32c3(backport v4.3)

See merge request espressif/esp-idf!12703
2021-03-26 05:51:47 +00:00
d4ac30a978 Merge branch 'fix/dont_disable_uart_dl_mode_by_default_v4.3' into 'release/v4.3'
bootloader/ ESP32_ECO3: Do not disable UART download mode by default (v4.3)

See merge request espressif/esp-idf!12907
2021-03-26 05:50:48 +00:00
2596c7e2cc Merge branch 'nimble/mbedtls_aes_free_dma_v4.3' into 'release/v4.3'
NimBLE: Free AES context after use by calling `mbedtls_free_aes` (Needed for C3) (v4.3)

See merge request espressif/esp-idf!12917
2021-03-26 05:47:50 +00:00
e6b7c933d5 adc: rename adc examples according to hw feature and usage 2021-03-26 13:26:19 +08:00
8fe99aff96 adc: add implementation of missed public API
Added ``adc1_pad_get_io_num``, ``adc2_pad_get_io_num`` and
``adc_vref_to_gpio``.
2021-03-26 13:26:19 +08:00
4866027391 adc: update adc programming guide to avoid build fail 2021-03-26 13:26:19 +08:00
a6ed4611a2 adc: update lock scope on esp32c3 2021-03-26 13:26:19 +08:00
d457641f90 adc: rename adc related examples 2021-03-26 13:26:19 +08:00
1509264f2e adc: add pm_lock to adc driver on esp32c3 2021-03-26 13:26:19 +08:00
271b84f5b6 adc: update adc header files on c3 2021-03-26 13:26:19 +08:00
f1be501271 adc: refactor adc single read api on esp32c3 2021-03-26 13:26:19 +08:00
ea20966c29 adc: seperate hal layer and driver layer 2021-03-26 13:26:18 +08:00
f25c996b06 adc: remove unused functions on esp32c3 2021-03-26 13:26:18 +08:00
745bb2123f Merge branch 'bugfix/btdm_add_controller_support_RPA_4.3' into 'release/v4.3'
Add option to enable/disable esp32 controller RPA (backport v4.3)

See merge request espressif/esp-idf!12886
2021-03-26 04:21:04 +00:00
143bb1edf4 Merge branch 'bugfix/btdm_fix_multi-con_pair_failed_v4.3' into 'release/v4.3'
fix multi-connection pair failed (backport v4.3)

See merge request espressif/esp-idf!12885
2021-03-26 04:19:28 +00:00
f1737a630d Merge branch 'bugfix/btdm_synchronize_multiple_branch_of_bt_lib_v4.3' into 'release/v4.3'
Bugfix/btdm synchronize multiple branch of bt lib v4.3

See merge request espressif/esp-idf!12872
2021-03-26 04:15:52 +00:00
83087f15fa Merge branch 'feature/on_update_no_secure_boot_verify_only_one_sign_v4.3' into 'release/v4.3'
secure_boot: Only the first position of signature blocks is used to verify any update (v4.3)

See merge request espressif/esp-idf!12908
2021-03-26 03:18:42 +00:00
a9d1d44d4d NimBLE: Free AES context after use by calling mbedtls_free_aes
- Update NimBLE submodule to resolve issue observed while using mbedTLS as
  crypto stack during security exchanges.

Closes BT-1435, BT-1434
2021-03-25 18:43:49 +05:30
72b27f1782 components/bt: Synchronize multiple branch of bt lib 2021-03-25 15:58:42 +08:00
8e482c9423 components/bt: Fix assert without sw coexist enabled 2021-03-25 15:58:42 +08:00
1fb45977fa component/coex: Decouple Wi-Fi and bluetooth with coexist to reduce binary file size 2021-03-25 15:58:42 +08:00
257728feab Fix the bug of modem sleep which may lead to the crash issue "assert(-218959118,0)" 2021-03-25 15:58:22 +08:00
26d362040e secure_boot/SIGNED_ON_UPDATE_NO_SECURE_BOOT: Only the first position of signature blocks is used to verify any update 2021-03-25 15:40:24 +08:00
f6a794cf51 bootloader/ ESP32_ECO3: Do not disable UART download mode by default 2021-03-25 10:32:37 +05:30
974db3016b esp32s2 ds: Fix invalidating Digital Signature key from HMAC peripheral if assertions are disabled 2021-03-25 15:34:26 +11:00
9c4c377f2d mbedtls tests: Add optional debug log output to AES stream tests 2021-03-25 15:28:45 +11:00
e6b8bc6ecb mbedtls aes dma: Fix bug where DMA would complete when the first output descriptor was done, not the last 2021-03-25 15:28:45 +11:00
718f296587 Merge branch 'bugfix/revert_esp_log_issue_4.3' into 'release/v4.3'
efuse: revert ESP_LOG to ESP_EARLY_LOG in src/esp_efuse_utility.c (4.3)

See merge request espressif/esp-idf!12794
2021-03-25 03:56:02 +00:00
6c74618bff Merge branch 'bugfix/fix_wrong_bit_order_of_ksz8041_v4.3' into 'release/v4.3'
eth_phy: fix wrong register bit order in ksz8041

See merge request espressif/esp-idf!12735
2021-03-24 18:08:37 +00:00
974f345316 * fixed generation of .gdbinit file (esp32c3 dbg issue) 2021-03-24 11:39:30 +00:00
zwj
f2ca74b139 add option to enable/disable esp32 controller RPA 2021-03-24 16:45:58 +08:00
zwj
ac8ea9e9e5 fix multi-connection pair failed 2021-03-24 16:44:45 +08:00
48890daab1 Merge branch 'bugfix/idf_size_total_size_without_bss_v4.3' into 'release/v4.3'
tools: Don't count BSS into the total image size (v4.3)

See merge request espressif/esp-idf!12575
2021-03-24 08:12:27 +00:00
f1aabb2894 Merge branch 'bugfix/ble_tx_power_mapping_for_v4.3' into 'release/v4.3'
Bugfix/ble tx power mapping for v4.3

See merge request espressif/esp-idf!12870
2021-03-24 08:07:23 +00:00
cc8ef3660a components/bt: shorten some log messages for bluedroid 2021-03-24 03:38:56 +00:00
67402f035f component/bt: [ESP32S3] fix missing IRAM_ATTR for function in libbtdm_app.a 2021-03-24 03:38:56 +00:00
7dd5568cb7 fixed incorrect Tx power mappings for ESP32C3 chip 2021-03-24 03:38:56 +00:00
f00d7ee9d0 Merge branch 'bugfix/fix_wdt_timeout_when_enable_rf_v4.3' into 'release/v4.3'
esp_wifi: fix wdt timeout when enable rf (backport v4.3)

See merge request espressif/esp-idf!12833
2021-03-23 16:32:29 +00:00
dba5597edf component/bt: Modify some ambiguous descriptions(release v4.3) 2021-03-23 23:02:18 +08:00
5019a6571e Merge branch 'bugfix/nvs_encryption_keys_v4.3' into 'release/v4.3'
NVS: fix nvs_flash_generate_keys to generate random keys (Github PR) (v4.3)

See merge request espressif/esp-idf!12781
2021-03-23 04:41:01 +00:00
4f8d784753 esp_wifi: fix wdt timeout when enable rf 2021-03-23 10:26:56 +08:00
a697377871 [doc]: elaborated nvs encryption comments in nvs 2021-03-22 13:02:35 +00:00
6ceee165b5 Fix nvs_flash_generate_keys
Merges https://github.com/espressif/esp-idf/pull/6478
2021-03-22 13:02:35 +00:00
4a20f68f5c Merge branch 'feature/update_wifi_provisioning_readme_v4.3' into 'release/v4.3'
provisioning: Update README.md to explain QR code format [backport v4.3]

See merge request espressif/esp-idf!12802
2021-03-22 12:57:05 +00:00
8ec0ffe751 Merge branch 'bugfix/fix_rtc_memory_region_name_v4.3' into 'release/v4.3'
esp32c3: correct name for RTC memory region in heap (v4.3)

See merge request espressif/esp-idf!12820
2021-03-22 12:54:07 +00:00
5d0ce8b52f Merge branch 'bugfix/crash_on_enabling_verbose_logs_v4.3' into 'release/v4.3'
esp_wifi: Fixes issue of crashing when verbose logs are enabled. (v4.3)

See merge request espressif/esp-idf!12495
2021-03-22 12:52:37 +00:00
2313683b58 Merge branch 'bugfix/fix_l2cap_repeat_cid_v4.3' into 'release/v4.3'
Bugfix/Fix L2CAP Repeat Cid[backport v4.3]

See merge request espressif/esp-idf!12613
2021-03-22 12:49:03 +00:00
c41822dc7c Merge branch 'mesh/support_for_chain_topology_backport_v4.3' into 'release/v4.3'
mesh: support for chain topology (backport v4.3)

See merge request espressif/esp-idf!12805
2021-03-22 12:48:41 +00:00
21909d7823 Merge branch 'mesh/ps_duty_signaling_backport_v4.3' into 'release/v4.3'
mesh/ps: network duty signaling (backport v4.3)

See merge request espressif/esp-idf!12804
2021-03-22 12:47:53 +00:00
651a939643 Merge branch 'bugfix/spi_flash_compatible_with_rom_c3_and_s3_v4.3' into 'release/v4.3'
spi_flash: make spiflash compatible with ESP32C3 and ESP32S3 ROM (backport v4.3)

See merge request espressif/esp-idf!12784
2021-03-22 12:47:05 +00:00
3bf9d389ef Merge branch 'bufix/ag_deep_copy_crash_v_4_3' into 'release/v4.3'
components/bt: Fix crash in btc_hf_arg_deep_copy when name or number is NULL

See merge request espressif/esp-idf!12791
2021-03-22 12:46:18 +00:00
6238c49479 freemodbuss: fix event processing after merge 2021-03-19 13:59:54 +01:00
fe1126cccb mesh/ps: network duty signaling 2021-03-19 20:58:00 +08:00
4725249385 esp32c3: correct name for RTC memory region in heap 2021-03-19 17:59:12 +05:30
6cfef8ce93 Merge branch 'bugfix/sign_app_by_rsa_when_require_signed_app_v4.3' into 'release/v4.3'
secure_boot: Secure Boot V2 verify app signature on update (without Secure boot) (v4.3)

See merge request espressif/esp-idf!12766
2021-03-19 12:19:53 +00:00
a643ea9432 spi_flash: make spiflash compatible with ESP32C3 and ESP32S3 ROM 2021-03-19 16:37:34 +08:00
f54dfe2912 provisioning: update README.md 2021-03-19 13:58:08 +08:00
c2ba180de3 provisioning: Update README.md to explain QR code format
Add examples of how to create a QR code that will be recognised by the iOS or Android app

Signed-off-by: yuanjm <yuanjianmin@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/6629
2021-03-19 13:57:20 +08:00
d6f76f8a5f efuse: revert ESP_LOG to ESP_EARLY_LOG in src/esp_efuse_utility.c
Closes https://github.com/espressif/esp-idf/issues/6660
2021-03-19 13:25:32 +08:00
1d778c941c mesh: support for chain topology 2021-03-19 11:25:57 +08:00
87b613fd2f components/bt: Fix crash in btc_hf_arg_deep_copy when name or number is NULL 2021-03-18 20:29:05 +08:00
f5f7d21c83 CI: ignore result from check_doc_links
check_doc_links will always fail due to:
 * No rate limitation for requests
 * Not being able to handle github links with anchors
2021-03-18 13:15:24 +08:00
502a819757 secure boot v2: Fix issue checking multiple signature blocks on OTA update 2021-03-17 17:08:59 +08:00
802a01c0b7 docs: Add docs for Secure Boot V2 "verify on update without secure boot" 2021-03-17 17:08:59 +08:00
a479ee30c9 secure boot: Add boot check for SBV2 "check app signature on update"
As this mode uses the public keys attached to the existing app's signatures to
verify the next app, checking that a signature block is found on boot prevents
the possibility of deploying a non-updatable device from the factory.
2021-03-17 17:08:59 +08:00
46e85ed021 secure_boot: Secure Boot V2 verify app signature on update (without Secure boot)
- ESP32 ECO3, ESP32-S2/C3/S3
2021-03-17 17:08:59 +08:00
0862fe815b secure_boot: Adds empty esp_secure_boot_init_checks
There is no checks
2021-03-17 17:09:00 +08:00
918875424e fix: clear interrupt in touch sensor initialization 2021-03-16 11:37:41 +08:00
5490c0a243 vfs: use sys/dirent.h from newlib
The dirent.h shipped with the risc-v compiler lacks `extern "C"`
declartion and causes linkage declartion conflict when included in C++
files. Use the dirent.h from newlib only to avoid this issue.

(cherry picked from commit b14830c5c0)
2021-03-16 10:33:31 +08:00
a71d9cc466 [cxx]: fixed extern "C" declarations
* Moving #includes above
  #ifdef __cplusplus extern "C" { #endif
  So that we can compile with CPP.

Signed-off-by: Jakob Hasse <jakob.hasse@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/6634
Closes https://github.com/espressif/esp-idf/issues/6633
2021-03-15 17:48:23 +08:00
c75a8b11bb eth_phy: fix wrong register bit order in ksz8041 2021-03-15 13:12:17 +08:00
9c884b3ba9 fix l2cap repeat cid 2021-03-12 15:53:48 +08:00
9a2d251912 Merge branch 'feature/coredump_refactor_riscv_support_v4.3' into 'release/v4.3'
espcoredump: code refactoring and add support for RISC-V implementation (backport v4.3)

See merge request espressif/esp-idf!12680
2021-03-12 07:47:02 +00:00
3b9af23290 Merge branch 'component_bt/optimize_spp_stop_server_v4.3' into 'release/v4.3'
component_bt/Optimize SPP Stop Server API[backport v4.3]

See merge request espressif/esp-idf!12615
2021-03-12 07:45:05 +00:00
ff12b50e45 Merge branch 'feature/wifi_support_sta_sleep_at_disconnected_v4.3' into 'release/v4.3'
esp_wifi: wifi support sta sleep at disconnected (backport v4.3)

See merge request espressif/esp-idf!12720
2021-03-12 07:43:46 +00:00
f6336516d1 Merge branch 'bugfix/fix_ble_connect_evt_report_remote_addr_err_v4.3' into 'release/v4.3'
fix ble connection event report remote address error (backport v4.3)

See merge request espressif/esp-idf!12717
2021-03-12 05:59:25 +00:00
4d80dd1238 Merge branch 'bugfix/c++_usage_esp_core_dump_h_v4.3' into 'release/v4.3'
Fixed c++ include usage for esp_core_dump.h (backport v4.3)

See merge request espressif/esp-idf!12677
2021-03-12 04:01:42 +00:00
zwj
8a2155f95e fix ble connection event report remote address error 2021-03-12 11:44:13 +08:00
367190deaf esp_wifi: support sta to sleep at disconnected status 2021-03-12 00:22:38 +08:00
dbb632fe34 Merge branch 'bugfix/fix_smartconfig_issue_v4.3' into 'release/v4.3'
esp_wifi: Fix the second distribution network failure of smartconfig (backport v4.3)

See merge request espressif/esp-idf!12685
2021-03-11 14:28:52 +00:00
1329747dc1 Merge branch 'bugfix/flash_s3_v4.3' into 'release/v4.3'
spi_flash: remove useless dummy and make rom compatible on esp32s3(backport v4.3)

See merge request espressif/esp-idf!12704
2021-03-11 13:38:52 +00:00
f9e1942252 Merge branch 'bugfix/ota_v4.3' into 'release/v4.3'
ota: fix ota with flash encryption(backport v4.3)

See merge request espressif/esp-idf!12705
2021-03-11 13:21:00 +00:00
82ffb33085 Merge branch 'feature/crypto_reserve_gdma_ch_v4.3' into 'release/v4.3'
aes/sha: use a shared lazy allocated GDMA channel for AES and SHA (v4.3)

See merge request espressif/esp-idf!12676
2021-03-11 10:50:09 +00:00
9fd12182de Merge branch 'docs/esp32c3_fatal_errors_v4.3' into 'release/v4.3'
doc: update "Fatal Errors" chapter for ESP32C3 board (backport v4.3)

See merge request espressif/esp-idf!12678
2021-03-11 10:48:03 +00:00
d42958439d Merge branch 'doc/c3_api_ref_update_v4.3' into 'release/v4.3'
docs: update api-reference chapters for C3 (v4.3)

See merge request espressif/esp-idf!12583
2021-03-11 09:36:44 +00:00
37946ab300 deep sleep: power down wifi and bt during deep sleep 2021-03-11 07:32:30 +00:00
2b7a3f6d85 light sleep: some default parameters optimization 2021-03-11 07:32:30 +00:00
60642e580c esp_wifi: Fix the second distribution network failure of ESPTouch v2 2021-03-11 07:32:30 +00:00
4235e80008 Merge branch 'bugfix/backport_bugfixs_to_release_v4.3' into 'release/v4.3'
Bugfix/backport bugfixs to release v4.3

See merge request espressif/esp-idf!12682
2021-03-11 07:15:00 +00:00
a8e0989648 Merge branch 'feature/re-enable_suspend_test_esp32c3_v4.3' into 'release/v4.3'
freertos: Workaround delay between interrupt request and trigger on RISC-V (backport v4.3)

See merge request espressif/esp-idf!12679
2021-03-11 07:12:56 +00:00
28f50addda ota: fix ota with flash encryption 2021-03-11 14:42:09 +08:00
9393a402eb doc: update "Fatal Errors" chapter for ESP32C3 board 2021-03-11 06:37:30 +00:00
268787c5fb spi_flash: remove useless dummy and make rom compatible on esp32s3 2021-03-11 14:31:27 +08:00
d92ac450a2 temp_sensor: add calibration for esp32c3 2021-03-11 14:25:18 +08:00
233f3f80e5 Merge branch 'feature/skip_validate_v4.3' into 'release/v4.3'
bootloader: Add config options to skip validation of app for minimum boot time (v4.3)

See merge request espressif/esp-idf!12683
2021-03-11 05:47:43 +00:00
d01efe4b8c Fix for C2H flow control param check when only BLE mode is configured. 2021-03-11 12:04:01 +08:00
e48935d187 Merge branch 'bugfix/uart_baud_c3_s3_v4.3' into 'release/v4.3'
uart: fixed incorrect baudrate on C3 and S3 when target is too slow (v4.3)

See merge request espressif/esp-idf!12681
2021-03-10 17:10:13 +00:00
12bbd1f051 Merge branch 'bugfix/fix_some_wifi_bugs_0309_v4.3' into 'release/v4.3'
esp_wifi: Fix some Wi-Fi bugs 0309 (backport v4.3)

See merge request espressif/esp-idf!12670
2021-03-10 11:07:20 +00:00
0305d13467 bootloader: Add config options to skip validation of app for minimum boot time 2021-03-10 19:08:47 +11:00
e6ace495b4 Fix issues during light sleep and DFS 2021-03-10 14:14:49 +08:00
b449909b35 Fix controller task watchdog in Wi-Fi test 2021-03-10 14:14:29 +08:00
0253d825e9 Fix IRAM_ATTR missing 2021-03-10 14:14:04 +08:00
32b0836485 driver: esp32s3 fix UART driver
Fix set UART2 instance to correct base address (esp32s3 has non standard base periph address)
2021-03-10 13:41:10 +08:00
7dca6b7428 uart: fixed incorrect baudrate on C3 and S3 when target is too slow
The integer part of the divider is only 12-bit now. We used prescaler to get low frequency instead.
2021-03-10 13:41:10 +08:00
b180c2a146 Merge branch 'bugfix/touch_element_callback_para_v4.3' into 'release/v4.3'
touch_element: fix event callback parameter type, change it into pointer (backport v4.3)

See merge request espressif/esp-idf!12629
2021-03-10 05:26:50 +00:00
113bf479a4 espcoredump: code refactoring and add support for RISC-V implemetation
This commit includes the refactoring of the core dump feature. Thanks to
this refactoring, it is easier to integrate the support of RISC-V
architecture for this feature.

Fixes ESP-1758
2021-03-10 12:19:00 +08:00
774f010196 freertos: Fix delay between interrupt request and trigger on RISC-V
NOP instructions have been added in order to prevent the code
from executing code it shouldn't execute. This is due to a delay
between the moment an interrupt is requested and the moment it
is fired. It only happens on RISC-V SoC.
2021-03-10 12:14:21 +08:00
22a8fe5b6f Removed esp_core_dump.h from check_public_headers_exceptions.txt (as per @igrr 's request 2021-03-10 12:04:48 +08:00
d36c72fba0 Fixed c++ include usage for esp_core_dump.h 2021-03-10 12:04:42 +08:00
1c8fd4041e aes/sha: use a shared lazy allocated GDMA channel for AES and SHA
Removed the old dynamically allocated GDMA channel approach.
It proved too unreliable as we couldn't not ensure consumers of the mbedtls
would properly free the channels after use.

Replaced by a single shared GDMA channel for AES and SHA, which won't be
released unless user specifically calls API for releasing it.
2021-03-10 09:40:35 +08:00
d4263c2558 Merge branch 'bugfix/btdm_crash_when_esp_restart_v4.3' into 'release/v4.3'
components/bt: Fix crash in Bluetooth when esp_restart

See merge request espressif/esp-idf!12641
2021-03-09 17:30:45 +00:00
ea49545269 esp_wifi: Fix some Wi-Fi bugs 0309
1. Fix the issue that the parameters obtained from RAM cannot be saved to NVS
2. Modify not to store the default value in NVS
3. Fixed issue with hidden AP scans after connecting AP.
4. Fix watchdog issue when receiving action frame.
5. Fixed issue of reason code change from 15 to 204 when provide wrong password
6. Fix set config return value error
7. Fix ampdu age timer memory leak
2021-03-09 20:30:13 +08:00
9ca05c17ae Merge branch 'bugfix/ota_simple_backport_v4.3' into 'release/v4.3'
ota: fix ota with flash encryption(backport v4.3)

See merge request espressif/esp-idf!12639
2021-03-09 09:42:57 +00:00
fd93c475b6 update CN translation based on reviewers' comments 2021-03-09 10:31:33 +11:00
27c72a4105 api-guides: update CN translation for build-system and build-system-legacy,and fix line break in the EN version 2021-03-09 10:30:49 +11:00
5c8b1d6ab8 doc: Update the link to an example that embeds a file
Since we have the CA Certificate Store feature, https_request no longer needs to
embed any certs.
2021-03-09 10:30:49 +11:00
c5f8fbea02 Merge branch 'fix/esp_tls_prevent_freeing_global_CA_store_after_each_request_v4.3' into 'release/v4.3'
fix(esp_tls): prevent freeing global CA store after each request (v4.3)

See merge request espressif/esp-idf!12630
2021-03-08 04:59:19 +00:00
cf7891cb93 Merge branch 'feature/touch_element_api_reference_v4.3' into 'release/v4.3'
touch_element: add touch element lib api-reference doc (backport v4.3)

See merge request espressif/esp-idf!12572
2021-03-08 02:58:43 +00:00
1e77586120 components/bt: Fix crash in Bluetooth when esp_restart 2021-03-05 20:19:18 +08:00
1ea548ecb3 ota: fix ota with flash encryption 2021-03-05 18:39:32 +08:00
962ea61d53 protocomm: Fixed NULL check of allocated memory
Fixes one part of - https://github.com/espressif/esp-idf/issues/6440
2021-03-05 10:04:45 +05:30
d61ee580d5 esp_tls: Fix misplaced paranthesis in esp_tls_mbedtls.c
Fixes one part of -  https://github.com/espressif/esp-idf/issues/6440
2021-03-05 10:04:45 +05:30
947e445e02 Fix esp_tls: Prevent freeing of global ca store after each connection
when dynamic ssl buffers are enabled
2021-03-05 09:53:19 +05:30
1821fd766b touch_element: fix event callback parameter type, change it into pointer 2021-03-05 11:45:47 +08:00
d508182429 Merge branch 'feature/touch_element_example_v4.3' into 'release/v4.3'
touch_element: add touch element lib examples (backport v4.3)

See merge request espressif/esp-idf!12571
2021-03-05 03:29:43 +00:00
58c9a2eaba add API esp_spp_stop_srv_scn to stop a specific server 2021-03-04 15:16:44 +08:00
07b62da0d4 Merge branch 'feature/add_qrcode_in_provisioning_example_v4.3' into 'release/v4.3'
examples: Add QR code support for provisioning examples [backport v4.3]

See merge request espressif/esp-idf!12555
2021-03-03 06:24:56 +00:00
fb82bdb9da docs: update api-reference chapters for C3
Checked and updated the following chapters:
 * api-reference/network
 * api-reference/protocols
 * api-reference/provisioning
 * api-reference/storage
 * api-reference/peripherals/ds
 * api-reference/peripherals/hmac
 * api-reference/peripherals/secure_element
2021-03-02 15:00:56 +08:00
f3be9976b9 tools: Don't count BSS into the total image size 2021-03-01 14:39:32 +01:00
b639514793 touch_element: add touch element api-reference doc 2021-03-01 18:02:53 +08:00
f12b571f82 Merge branch 'bugfix/esp_wifi_deinit_v4.3' into 'release/v4.3'
esp_wifi_deinit: Return ESP_ERR_WIFI_NOT_STOPPED if wifi is not stopped (v4.3)

See merge request espressif/esp-idf!12539
2021-03-01 09:31:13 +00:00
c0f06115d4 touch_element: add touch element lib example 2021-03-01 17:28:04 +08:00
20b25a9667 esp_wifi_deinit: Return ESP_ERR_WIFI_NOT_STOPPED if wifi is not stopped
Add test case to test this workflow
2021-03-01 05:33:26 +00:00
1d9d444c07 Merge branch 'bugfix/deepsleep_disable_brownout_s2_v4.3' into 'release/v4.3'
deep_sleep: on S2 disable the brown out detector before deep sleeping (v4.3)

See merge request espressif/esp-idf!12499
2021-03-01 03:50:20 +00:00
060a829091 examples: Add QR code support for provisioning examples 2021-03-01 10:51:36 +08:00
78314df2a5 Merge branch 'feature/enable_c3_ut_v4.3' into 'release/v4.3'
CI: run C3 unit test on protected branches

See merge request espressif/esp-idf!12416
2021-03-01 02:10:51 +00:00
8ceb462993 Merge branch 'feature/enable_gpio19_esp32c3_v4.3' into 'release/v4.3'
gpio: enable GPIO19 on ESP32C3 boards (backport v4.3)

See merge request espressif/esp-idf!12542
2021-02-27 05:25:42 +00:00
6accffecea Merge branch 'bugfix/fix_spi_slv_hd_dma_reset_issue_4.3' into 'release/v4.3'
spi_slave_hd: fix spi slv hd dma reset issue (4.3)

See merge request espressif/esp-idf!12513
2021-02-27 04:12:42 +00:00
de79e482c9 Merge branch 'feaature/deep_sleep_wakeup_backport' into 'release/v4.3'
esp_system: support gpio wakeup from deep sleep on esp32c3(backport v4.3)

See merge request espressif/esp-idf!12537
2021-02-26 14:49:19 +00:00
6638b81f8e esp_wifi: Fixes issue of crashing when verbose logs are enabled. 2021-02-26 19:00:55 +05:30
d92b647199 Merge branch 'bugfix/fix_some_wifi_bugs_0226_v4.3' into 'release/v4.3'
esp_wifi: fix some wifi bugs (backport v4.3)

See merge request espressif/esp-idf!12538
2021-02-26 12:52:39 +00:00
965daf977a Merge branch 'bugfix/btdm_fix_spp_acceptor_cancle_pair_crash_4.3' into 'release/v4.3'
fix crash caused by spp pairing cancel (4.3)

See merge request espressif/esp-idf!12544
2021-02-26 12:42:21 +00:00
zwj
aa652adc12 fix crash caused by spp pairing cancel 2021-02-26 19:17:51 +08:00
5795075460 gpio: enable GPIO19 on ESP32C3 boards 2021-02-26 17:54:36 +08:00
198d350fe5 esp_system: support gpio wakeup from deep sleep on esp32c3 2021-02-26 17:08:22 +08:00
24f3341a2d Merge branch 'docs/spi_flash_auto_suspend_v4.3' into 'release/v4.3'
spi_flash: update docs after adding CONFIG_SPI_FLASH_AUTO_SUSPEND (v4.3)

See merge request espressif/esp-idf!12512
2021-02-26 08:53:48 +00:00
5a429f644f esp_wifi: update wifi lib 2021-02-26 16:36:16 +08:00
9aae8e0ce3 esp_wifi: synchronize Wi-Fi adapter between different chips
Support preferring to allocate Wi-Fi memory from PSRAM on ESP32-S3

Support Wi-Fi TX cache buffer on ESP32-S3
2021-02-26 16:34:23 +08:00
e5e47ebae6 esp_wifi: store PHY digital registers before disabling PHY and load
them after enabling PHY
2021-02-26 16:34:10 +08:00
436c3c289e esp_wifi: optimization wifi rate
1.support disable 11b rate
2.support config espnow rate
3.fix sta negotiate phymode issue
4.update ftm rate
2021-02-26 16:32:09 +08:00
2aa6aa8b88 change rom function for esp32c3 to fix eb lldesc size issue 2021-02-26 16:31:12 +08:00
3e9cd49d32 spi_slv_hd: add hal_trans_finish comments for clarifying risk 2021-02-26 10:39:12 +08:00
2c1845995b spi_slave_hd: refactor the hal append api to remove the spinlock 2021-02-26 10:39:10 +08:00
0c77299c34 Merge branch 'feature/update_efuse_doc_v4.3' into 'release/v4.3'
doc/efuse: Adds efuse doc for ESP32-C3 (v4.3)

See merge request espressif/esp-idf!12516
2021-02-25 23:22:51 +00:00
9ac3e7c5d1 Merge branch 'feature/doc_update_security_chapters_v4.3' into 'release/v4.3'
doc/secure features: Updates doc esp32c3 (v4.3)

See merge request espressif/esp-idf!12517
2021-02-25 23:14:12 +00:00
c42ce05941 Merge branch 'feature/apply_gdma_new_channel_api_to_adc_4.3' into 'release/v4.3'
adc: apply gdma new channel api to adc (v4.3)

See merge request espressif/esp-idf!12502
2021-02-25 17:37:17 +00:00
ea2eb9d833 doc(esp32c3): Updates secure features doc 2021-02-25 21:08:55 +08:00
dec52a93d4 doc/efuse: Adds efuse doc for ESP32-C3 2021-02-25 21:07:27 +08:00
41bee7831f adc: apply gdma api to adc on esp32c3 2021-02-25 18:53:32 +08:00
bd1b4dbda1 Merge branch 'feature/apply_gdma_new_channel_api_to_spi_4.3' into 'release/v4.3'
spi: apply gdma new channel api to spi (v4.3)

See merge request espressif/esp-idf!12501
2021-02-25 10:36:09 +00:00
1de12526eb spi_flash: update docs after adding CONFIG_SPI_FLASH_AUTO_SUSPEND 2021-02-25 18:08:23 +08:00
f0f2799946 Merge branch 'bugfix/gdma_pair_uninstall_concurrency_issue_v4.3' into 'release/v4.3'
gdma: fix wrong level of {group,pair} reference count (v4.3)

See merge request espressif/esp-idf!12488
2021-02-25 09:11:58 +00:00
5aabdd8abf Merge branch 'bugfix/eclipse_make_decode_v4.3' into 'release/v4.3'
tools: Fix Eclipse build: “UnicodeDecodeError: 'ascii' codec can't decode byte” (v4.3)

See merge request espressif/esp-idf!12357
2021-02-25 07:17:28 +00:00
8a2f91b48a spi: add enum for spi dma channels 2021-02-25 11:03:18 +08:00
ed6fb33726 spi: remove hard-coded DMA chan in soc_caps.h 2021-02-25 11:03:07 +08:00
66d10f0eec spi: refactor spi_common dma allocator 2021-02-25 11:01:33 +08:00
97f248d22c spi: update unit tests to spi gdma allocator 2021-02-25 11:01:27 +08:00
ffc4ff5a8c spi: apply gdma allocator to SPI 2021-02-25 11:01:16 +08:00
326d76ebdf spi: add dma channel auto-alloc feature on esp32 2021-02-25 11:01:06 +08:00
c6ed522d60 deep_sleep: on S2 disable the brown out detector before deep sleeping
On S2 the brown out detector would occasionally trigger erroneously during deep sleep.

Disable it before sleeping to circumvent this issue.

Closes https://github.com/espressif/esp-idf/issues/6179
2021-02-25 10:53:06 +08:00
8e187e7157 Merge branch 'bugfix/c3_unit_test_cleanup_v4.3' into 'release/v4.3'
System: C3 shared stack watchpoint & unit test cleanups (v4.3)

See merge request espressif/esp-idf!12418
2021-02-24 22:51:11 +00:00
19f18aaa11 gdma: fix wrong level of {group,pair} ref count 2021-02-24 17:46:23 +08:00
626a861115 async_mcp: clean eof flag when prepare rx descriptors 2021-02-24 17:46:23 +08:00
a0fdf4b06c Merge branch 'feature/riscv_get_tickrate_v4.3' into 'release/v4.3'
freertos: add API for getting tick rate on C3 (v4.3)

See merge request espressif/esp-idf!12471
2021-02-24 08:29:59 +00:00
3d9523724d freertos: add API for getting tick rate on C3 2021-02-23 12:14:11 +08:00
813b6c4ef6 Merge branch 'bugfix/fix_enable_reset_provision_cause_device_crash_v4.3' into 'release/v4.3'
provisioning: Fix enable CONFIG_EXAMPLE_RESET_PROVISIONED will cause device crash [backport v4.3]

See merge request espressif/esp-idf!12353
2021-02-22 06:13:17 +00:00
1b849d59de Merge branch 'bugfix/freemodbus_fix_parity_propagation_issue_v43' into 'release/v4.3'
freemodbus: fix mb controller parity propagation issues (Backport v4.3)

See merge request espressif/esp-idf!12390
2021-02-22 05:23:33 +00:00
87576aba28 provisioning: Fix enable CONFIG_EXAMPLE_RESET_PROVISIONED will cause device crash 2021-02-22 04:33:59 +00:00
57fb076590 Merge branch 'feature/prefer_python3_in_installer_v4.3' into 'release/v4.3'
tools: Prefer python3 during install and export (v4.3)

See merge request espressif/esp-idf!12376
2021-02-19 15:52:32 +00:00
360e7c4d51 system: enable shared stack watchpoint
Enable shared stack watchpoint for overflow detection

Enable unit tests:
 * "test printf using shared buffer stack" for C3
 * "Test vTaskDelayUntil" for S2
 * "UART can do poll()" for C3
2021-02-19 16:59:29 +08:00
9083ef97e5 spi_flash: disable mmap into instr space unit test for C3
On C3 the cache is programmatically split between Icache and dcache and with the default setup we dont leave a lot pages
available for additional mmaps into instruction space. Disabling this test for now since any hypothetical use case for this
is no longer supported "out of the box"
2021-02-19 16:58:47 +08:00
a7a1e4dfba CI: run C3 unit test on protected branches 2021-02-19 16:47:00 +08:00
8ad92a92b9 Merge branch 'feature/ulp_c3_not_exists_update_doc_v4.3' into 'release/v4.3'
doc/ulp(esp32c3): Excludes ulp and some RTC features from ESP32C3 doc (v4.3)

See merge request espressif/esp-idf!12386
2021-02-17 03:54:01 +00:00
321ee21c4c freemodbus: fix mb controller parity propagation issues
Closes https://github.com/espressif/esp-idf/issues/6377
2021-02-16 10:47:43 +01:00
33820657c5 doc/ulp(esp32c3): Excludes ulp and some RTC features from ESP32C3 doc 2021-02-16 15:37:26 +08:00
33892aadb9 tools: Prefer python3 during install and export
Install and export script should work on systems without "python"
executable.

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

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

Related to https://github.com/espressif/esp-idf/issues/6421 and
https://github.com/espressif/arduino-esp32/issues/4717
2021-02-14 18:49:21 +01:00
ad669801ae Fix eclipse build: “UnicodeDecodeError: 'ascii' codec can't decode byte”
Closes https://github.com/espressif/esp-idf/pull/6505
2021-02-10 12:48:44 +01:00
2426 changed files with 475907 additions and 58016 deletions

75
.github/workflows/docker.yml vendored Normal file
View File

@ -0,0 +1,75 @@
name: docker
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
on:
push:
branches:
- "master"
- "release/*"
tags:
- "v*.*"
env:
# Platforms to build the image for
BUILD_PLATFORMS: linux/amd64
DOCKERHUB_REPO: ${{ github.repository_owner }}/idf
jobs:
docker:
# Disable the job in forks
if: ${{ github.repository_owner == 'espressif' }}
runs-on: ubuntu-latest
steps:
# Depending on the branch/tag, set CLONE_BRANCH_OR_TAG variable (used in the Dockerfile
# as a build arg) and TAG_NAME (used when tagging the image).
#
# The following 3 steps cover the alternatives (tag, release branch, master branch):
- name: Set variables (tags)
if: ${{ github.ref_type == 'tag' }}
run: |
echo "CLONE_BRANCH_OR_TAG=$GITHUB_REF_NAME" >> $GITHUB_ENV
echo "TAG_NAME=$GITHUB_REF_NAME" >> $GITHUB_ENV
- name: Set variables (release branches)
if: ${{ github.ref_type == 'branch' && startsWith(github.ref_name, 'release/') }}
run: |
echo "CLONE_BRANCH_OR_TAG=$GITHUB_REF_NAME" >> $GITHUB_ENV
echo "TAG_NAME=release-${GITHUB_REF_NAME##release/}" >> $GITHUB_ENV
- name: Set variables (main branch)
if: ${{ github.ref_type == 'branch' && github.ref_name == 'master' }}
run: |
echo "CLONE_BRANCH_OR_TAG=master" >> $GITHUB_ENV
echo "TAG_NAME=latest" >> $GITHUB_ENV
# Display the variables set above, just in case.
- name: Check variables
run: |
echo "CLONE_BRANCH_OR_TAG: $CLONE_BRANCH_OR_TAG"
echo "CHECKOUT_REF: $CHECKOUT_REF"
echo "TAG_NAME: $TAG_NAME"
# The following steps are the standard boilerplate from
# https://github.com/marketplace/actions/build-and-push-docker-images
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU for multiarch builds
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v3
with:
context: tools/docker
push: true
tags: ${{ env.DOCKERHUB_REPO }}:${{ env.TAG_NAME }}
platforms: ${{ env.BUILD_PLATFORMS }}
build-args: |
IDF_CLONE_URL=${{ github.server_url }}/${{ github.repository }}.git
IDF_CLONE_BRANCH_OR_TAG=${{ env.CLONE_BRANCH_OR_TAG }}

17
.github/workflows/release_zips.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: Create zip file with recursive source clone for release
on:
push:
tags:
- v*
jobs:
release_zips:
name: Create release zip file
runs-on: ubuntu-20.04
steps:
- name: Create a recursive clone source zip
uses: espressif/github-actions/release_zips@master
env:
RELEASE_PROJECT_NAME: ESP-IDF
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

3
.gitignore vendored
View File

@ -88,3 +88,6 @@ build
# lock files for examples and components
dependencies.lock
# managed_components for examples
managed_components

View File

@ -60,17 +60,17 @@ variables:
# target test repo parameters
TEST_ENV_CONFIG_REPO: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/qa/ci-test-runner-configs.git"
CI_AUTO_TEST_SCRIPT_REPO_URL: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/qa/auto_test_script.git"
CI_AUTO_TEST_SCRIPT_REPO_BRANCH: "ci/v3.1"
CI_AUTO_TEST_SCRIPT_REPO_BRANCH: "ci/v4.1"
# Versioned esp-idf-doc env image to use for all document building jobs
ESP_IDF_DOC_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-doc-env:v8"
ESP_IDF_DOC_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-doc-env:v10"
.setup_tools_unless_target_test: &setup_tools_unless_target_test |
if [[ -n "$IDF_DONT_USE_MIRRORS" ]]; then
export IDF_MIRROR_PREFIX_MAP=
fi
if [[ "$SETUP_TOOLS" == "1" || "$CI_JOB_STAGE" != "target_test" ]]; then
tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
tools/idf_tools.py --non-interactive install ${SETUP_TOOLS_LIST:-} && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
fi
before_script:
@ -108,6 +108,7 @@ before_script:
before_script:
- source tools/ci/utils.sh
- apply_bot_filter
- export IDF_TOOLS_PATH="${HOME}/.espressif_runner_${CI_RUNNER_ID}_${CI_CONCURRENT_ID}"
- $IDF_PATH/tools/idf_tools.py install-python-env
# On macOS, these tools need to be installed
- $IDF_PATH/tools/idf_tools.py --non-interactive install cmake ninja
@ -120,6 +121,26 @@ before_script:
- export PYTHONPATH="$IDF_PATH/tools:$IDF_PATH/tools/ci/python_packages:$PYTHONPATH"
- fetch_submodules
# this is a workaround since CI on 4.3 is using python 3.4 and the real support version is 3.6
# Can't find package versions that match both of them at the same time.
# install the idf-component-manager here instead of in the dockerfile with a fixed version
.before_script_build_cmake:
before_script:
- source tools/ci/utils.sh
- source tools/ci/setup_python.sh
- apply_bot_filter
- add_gitlab_ssh_keys
- source tools/ci/configure_ci_environment.sh
- *setup_tools_unless_target_test
- fetch_submodules
- pip install "idf-component-manager~=1.1"
default:
retry:
max: 2
# In case of a runner failure we could hop to another one, or a network error could go away.
when: runner_system_failure
include:
- '/tools/ci/config/rules.yml'
- '/tools/ci/config/pre_check.yml'

View File

@ -2,170 +2,5 @@
#
# https://docs.gitlab.com/ee/user/project/code_owners.html#the-syntax-of-code-owners-files
#
# If more than one rule matches a given file, the latest rule is used.
# The file should be generally kept sorted, except when it is necessary
# to use a different order due to the fact above. In that case, use
# '# sort-order-reset' comment line to reset the sort order.
#
# Recipes for a few common cases:
#
# 1. Specific directory with all its contents:
#
# /components/app_trace/
#
# Note the trailing slash!
#
# 2. File with certain extension in any subdirectory of a certain directory:
#
# /examples/**/*.py
#
# This includes an *.py files in /examples/ directory as well.
#
# 3. Contents of a directory with a certain name, anywhere in the tree:
#
# test_*_host/
#
# Will match everything under components/efuse/test_efuse_host/,
# components/heap/test_multi_heap_host/, components/lwip/test_afl_host/, etc.
#
# 4. Same as above, except limited to a specific place in the tree:
#
# /components/esp32*/
#
# Matches everything under /components/esp32, /components/esp32s2, etc.
# Doesn't match /tools/some-test/components/esp32s5.
#
# 5. Specific file:
#
# /tools/tools.json
#
# 6. File with a certain name anywhere in the tree
#
# .gitignore
#
* @esp-idf-codeowners/other
/.* @esp-idf-codeowners/tools
/.gitlab-ci.yml @esp-idf-codeowners/ci
/.pre-commit-config.yaml @esp-idf-codeowners/ci
/.readthedocs.yml @esp-idf-codeowners/docs
/CMakeLists.txt @esp-idf-codeowners/build-config
/Kconfig @esp-idf-codeowners/build-config
/add_path.sh @esp-idf-codeowners/tools
/export.* @esp-idf-codeowners/tools
/install.* @esp-idf-codeowners/tools
/sdkconfig.rename @esp-idf-codeowners/build-config
# sort-order-reset
/components/app_trace/ @esp-idf-codeowners/tools
/components/app_update/ @esp-idf-codeowners/system @esp-idf-codeowners/app-utilities
/components/asio/ @esp-idf-codeowners/network
/components/bootloader*/ @esp-idf-codeowners/system @esp-idf-codeowners/security
/components/bt/ @esp-idf-codeowners/bluetooth
/components/cbor/ @esp-idf-codeowners/app-utilities
/components/coap/ @esp-idf-codeowners/app-utilities
/components/console/ @esp-idf-codeowners/system @esp-idf-codeowners/app-utilities
/components/cxx/ @esp-idf-codeowners/system
/components/driver/ @esp-idf-codeowners/peripherals
/components/efuse/ @esp-idf-codeowners/system
/components/esp32*/ @esp-idf-codeowners/system
/components/esp_adc_cal/ @esp-idf-codeowners/peripherals
/components/esp_common/ @esp-idf-codeowners/system
/components/esp_eth/ @esp-idf-codeowners/network
/components/esp_event/ @esp-idf-codeowners/system
/components/esp_gdbstub/ @esp-idf-codeowners/tools
/components/esp_hid/ @esp-idf-codeowners/bluetooth
/components/esp_http_client/ @esp-idf-codeowners/app-utilities
/components/esp_http_server/ @esp-idf-codeowners/app-utilities
/components/esp_https_ota/ @esp-idf-codeowners/app-utilities
/components/esp_https_server/ @esp-idf-codeowners/app-utilities
/components/esp_hw_support/ @esp-idf-codeowners/system
/components/esp_ipc/ @esp-idf-codeowners/system
/components/esp_local_ctrl/ @esp-idf-codeowners/app-utilities
/components/esp_netif/ @esp-idf-codeowners/network
/components/esp_pm/ @esp-idf-codeowners/power-management
/components/esp_ringbuf/ @esp-idf-codeowners/system
/components/esp_rom/ @esp-idf-codeowners/system
/components/esp_serial_slave_link/ @esp-idf-codeowners/peripherals
/components/esp_system/ @esp-idf-codeowners/system
/components/esp_timer/ @esp-idf-codeowners/system
/components/esp-tls/ @esp-idf-codeowners/app-utilities
/components/esp_websocket_client/ @esp-idf-codeowners/network
/components/esp_wifi/ @esp-idf-codeowners/wifi
/components/espcoredump/ @esp-idf-codeowners/tools
/components/esptool_py/ @esp-idf-codeowners/tools
/components/expat/ @esp-idf-codeowners/app-utilities
/components/fatfs/ @esp-idf-codeowners/storage
/components/freemodbus/ @esp-idf-codeowners/peripherals
/components/freertos/ @esp-idf-codeowners/system
/components/hal/ @esp-idf-codeowners/peripherals
/components/heap/ @esp-idf-codeowners/system
/components/idf_test/ @esp-idf-codeowners/ci
/components/jsmn/ @esp-idf-codeowners/app-utilities
/components/json/ @esp-idf-codeowners/app-utilities
/components/libsodium/ @esp-idf-codeowners/security
/components/log/ @esp-idf-codeowners/system
/components/lwip/ @esp-idf-codeowners/lwip
/components/mbedtls/ @esp-idf-codeowners/app-utilities @esp-idf-codeowners/security
/components/mdns/ @esp-idf-codeowners/network
/components/mqtt/ @esp-idf-codeowners/network
/components/newlib/ @esp-idf-codeowners/system @esp-idf-codeowners/tools
/components/nghttp/ @esp-idf-codeowners/app-utilities
/components/nvs_flash/ @esp-idf-codeowners/storage
/components/openssl/ @esp-idf-codeowners/network
/components/partition_table/ @esp-idf-codeowners/system
/components/perfmon/ @esp-idf-codeowners/tools
/components/protobuf-c/ @esp-idf-codeowners/app-utilities
/components/protocomm/ @esp-idf-codeowners/app-utilities
/components/pthread/ @esp-idf-codeowners/system
/components/sdmmc/ @esp-idf-codeowners/storage
/components/soc/ @esp-idf-codeowners/peripherals
/components/spi_flash/ @esp-idf-codeowners/peripherals
/components/spiffs/ @esp-idf-codeowners/storage
/components/tcp_transport/ @esp-idf-codeowners/network
/components/tcpip_adapter/ @esp-idf-codeowners/network
/components/tinyusb/ @esp-idf-codeowners/peripherals
/components/ulp/ @esp-idf-codeowners/system
/components/unity/ @esp-idf-codeowners/ci
/components/vfs/ @esp-idf-codeowners/storage
/components/wear_levelling/ @esp-idf-codeowners/storage
/components/wifi_provisioning/ @esp-idf-codeowners/app-utilities
/components/wpa_supplicant/ @esp-idf-codeowners/wifi
/components/xtensa/ @esp-idf-codeowners/system
/docs/ @esp-idf-codeowners/docs
/examples/**/*.py @esp-idf-codeowners/ci @esp-idf-codeowners/tools
/examples/bluetooth/ @esp-idf-codeowners/bluetooth
/examples/build_system/ @esp-idf-codeowners/build-config
/examples/common_components/ @esp-idf-codeowners/system
/examples/cxx/ @esp-idf-codeowners/system
/examples/ethernet/ @esp-idf-codeowners/network
/examples/get-started/ @esp-idf-codeowners/system
/examples/mesh/ @esp-idf-codeowners/wifi
/examples/peripherals/ @esp-idf-codeowners/peripherals
/examples/protocols/ @esp-idf-codeowners/network @esp-idf-codeowners/app-utilities
/examples/provisioning/ @esp-idf-codeowners/app-utilities
/examples/security/ @esp-idf-codeowners/security
/examples/storage/ @esp-idf-codeowners/storage
/examples/system/ @esp-idf-codeowners/system
/examples/wifi/ @esp-idf-codeowners/wifi
/make/ @esp-idf-codeowners/build-config
/tools/ @esp-idf-codeowners/tools
/tools/*_apps.py @esp-idf-codeowners/ci
/tools/ble/ @esp-idf-codeowners/app-utilities
/tools/catch/ @esp-idf-codeowners/ci
/tools/ci/ @esp-idf-codeowners/ci
/tools/cmake/ @esp-idf-codeowners/build-config
/tools/esp_prov/ @esp-idf-codeowners/app-utilities
/tools/find_build_apps/ @esp-idf-codeowners/ci
/tools/kconfig*/ @esp-idf-codeowners/build-config
/tools/ldgen/ @esp-idf-codeowners/build-config
/tools/mass_mfg/ @esp-idf-codeowners/app-utilities
requirements.txt @esp-idf-codeowners/tools
* @esp-idf-codeowners/all-maintainers

8
.gitmodules vendored
View File

@ -7,8 +7,8 @@
path = components/esptool_py/esptool
url = ../../espressif/esptool.git
[submodule "components/bt/controller/lib"]
path = components/bt/controller/lib
[submodule "components/bt/controller/lib_esp32"]
path = components/bt/controller/lib_esp32
url = ../../espressif/esp32-bt-lib.git
[submodule "components/bootloader/subproject/components/micro-ecc/micro-ecc"]
@ -90,3 +90,7 @@
[submodule "components/cmock/CMock"]
path = components/cmock/CMock
url = ../../ThrowTheSwitch/CMock.git
[submodule "components/bt/controller/lib_esp32c3_family"]
path = components/bt/controller/lib_esp32c3_family
url = ../../espressif/esp32c3-bt-lib.git

View File

@ -74,6 +74,10 @@ if(CONFIG_COMPILER_DISABLE_GCC8_WARNINGS)
"-Wno-int-in-bool-context")
endif()
if(CONFIG_COMPILER_WARN_WRITE_STRINGS)
list(APPEND compile_options "-Wwrite-strings")
endif()
if(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE)
list(APPEND compile_definitions "-DNDEBUG")
endif()
@ -90,6 +94,13 @@ if(CONFIG_COMPILER_DUMP_RTL_FILES)
list(APPEND compile_options "-fdump-rtl-expand")
endif()
if(NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS 8.0.0)
if(CONFIG_COMPILER_HIDE_PATHS_MACROS)
list(APPEND compile_options "-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.")
list(APPEND compile_options "-fmacro-prefix-map=${IDF_PATH}=IDF")
endif()
endif()
# GCC-specific options
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
list(APPEND compile_options "-fstrict-volatile-bitfields"

View File

@ -154,7 +154,7 @@ mainmenu "Espressif IoT Development Framework Configuration"
mon reset halt
# Run to a specific point in ROM code,
# where most of initialization is complete.
thb *0x40007901
thb *0x40007d54
c
# Load the application into RAM
load

View File

@ -2,20 +2,15 @@
* [中文版](./README_CN.md)
ESP-IDF is the official development framework for the **ESP32** and **ESP32-S** Series SoCs provided for Windows, Linux and macOS.
ESP-IDF is the development framework for Espressif SoCs (released after 2016<sup>[1](#fn1)</sup>) provided for Windows, Linux and macOS.
# Developing With ESP-IDF
## Setting Up ESP-IDF
See setup guides for detailed instructions to set up the ESP-IDF:
See https://idf.espressif.com/ for links to detailed instructions on how to set up the ESP-IDF depending on chip you use.
| Chip | Getting Started Guides for ESP-IDF |
|:----:|:----|
| <img src="docs/_static/chip-esp32.svg" height="85" alt="ESP32"> | <ul><li>[stable](https://docs.espressif.com/projects/esp-idf/en/stable/get-started/) version</li><li>[latest (master branch)](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/) version</li></ul> |
| <img src="docs/_static/chip-esp32-s2.svg" height="100" alt="ESP32-S2"> | <ul><li>[latest (master branch)](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/) version</li></ul> |
**Note:** Each ESP-IDF release has its own documentation. Please see Section [Versions](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/versions.html) how to find documentation and how to checkout specific release of ESP-IDF.
**Note:** Each SoC series and each ESP-IDF release has its own documentation. Please see Section [Versions](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/versions.html) on how to find documentation and how to checkout specific release of ESP-IDF.
### Non-GitHub forks
@ -70,7 +65,7 @@ You don't need to run `idf.py build` before running `idf.py flash`, `idf.py flas
## Viewing Serial Output
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 ESP32 or ESP32-S Series SoCs. 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 Espressif SoCs. 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-].
@ -106,3 +101,6 @@ This can be combined with other targets, ie `idf.py -p PORT erase_flash flash` w
* If you're interested in contributing to ESP-IDF, please check the [Contributions Guide](https://docs.espressif.com/projects/esp-idf/en/latest/contribute/index.html).
________
<a name="fn1">1</a>: ESP8266 and ESP8285 are not supported in ESP-IDF. See [RTOS SDK](https://github.com/espressif/ESP8266_RTOS_SDK) instead.

View File

@ -2,26 +2,22 @@
* [English Version](./README.md)
ESP-IDF 是由乐鑫官方推出的针对 **ESP32****ESP32-S2** 系列芯片的开发框架
ESP-IDF 是由乐鑫官方针对乐鑫各系列芯片产品(发布于 2016 年后<sup>[1](#fn1)</sup>)推出的开发框架,支持 Windows、Linux 和 macOS 操作系统
# 使用 ESP-IDF 进行开发
## 搭建 ESP-IDF 开发环境
请参阅如下指南搭建 ESP-IDF 的开发环境
| 芯片 | ESP-IDF 入门指南 |
|:----:|:----|
| <img src="docs/_static/chip-esp32.svg" height="85" alt="ESP32"> | <ul><li>[稳定](https://docs.espressif.com/projects/esp-idf/zh_CN/stable/get-started/) 版</li><li>[最新master 分支)](https://docs.espressif.com/projects/esp-idf/zh_CN/latest/get-started/) 版本</li></ul> |
| <img src="docs/_static/chip-esp32-s2.svg" height="100" alt="ESP32-S2"> | <ul><li>[最新master 分支)](https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32s2/get-started/) 版本</li></ul> |
**注意:** 每个 ESP-IDF 版本都有其对应的文档。 请参阅 [版本](https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/versions.html) 部分如何查找文档以及如何检出ESP-IDF的特定发行版。
关于不同芯片如何搭建 ESP-IDF 的开发环境,请参考 https://idf.espressif.com/。
**注意:** 不同系列芯片和不同 ESP-IDF 版本都有其对应的文档。请参阅[版本](https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/versions.html)部分,获得关于如何查找文档以及如何检出 ESP-IDF 的特定发行版的详细信息。
### 非 GitHub 分叉的 ESP-IDF 项目
ESP-IDF 中的子模块采用相对路径([详见 .gitmodules 文件](.gitmodules)),所以它们会指向 GitHub。
如果 ESP-IDF 被分叉到的仓库不在 GitHub 上,那么你需要在克隆结束后运行该[脚本](tools/set-submodules-to-github.sh)。它会为所有的子模块设置绝对路径,接着可以通过 `git submodule update --init --recursive` 完成子模块的更新
如果 ESP-IDF 被分叉到的仓库不在 GitHub 上,那么你需要在克隆结束后运行该脚本 [tools/set-submodules-to-github.sh](tools/set-submodules-to-github.sh)
这个脚本会为所有的子模块设置绝对路径,接着可以通过 `git submodule update --init --recursive` 完成子模块的更新。
如果 ESP-IDF 是从 GitHub 上克隆得到,则不需要此步骤。
## 寻找项目
@ -38,24 +34,16 @@ ESP-IDF 中的子模块采用相对路径([详见 .gitmodules 文件](.gitmodu
## 设置构建环境
请参考入门指南中列出的详细步骤。
* 在主机中安装入门指南中提到的构建所依赖的工具。
* 将 ESP-IDF 中的 `tools/` 目录加入 PATH 环境变量中。
* 运行 `python -m pip install -r requirements.txt` 安装 Python 依赖库。
请参考入门指南中列出的详细步骤。
* 在主机中安装入门指南中提到的构建所依赖的工具。
* 运行安装脚本来设置构建环境。可为 Windows shell 选择 `install.bat``install.ps1`,为 Unix shell 选择 `install.sh``install.fish`
* 在使用 ESP-IDF 之前,需要在 shell 中运行导出脚本。Windows 下可运行 `export.bat`Unix 下可运行 `source export.sh`
## 配置项目
`idf.py menuconfig`
* 打开项目的文本配置菜单。
* 使用上下键浏览菜单。
* 使用回车键进入子菜单,退出键返回上一级菜单或者退出配置。
* 输入 `?` 查看帮助界面,按下回车键可以退出帮助界面。
* 使用空格键或者 `Y``N` 按键来启用和禁用带复选框“`[*]`”的配置项。
* 高亮某个配置项的同时按下 `?` 键可以显示该选项的帮助文档。
* 输入 `/` 可以搜索指定的配置项。
一旦配置完成,请按下退出键多次以退出配置界面,当提示是否保存新的的配置时,选择 “Yes”。
* `idf.py set-target <chip_name>` 可将项目的目标芯片设置为 `<chip_name>`。运行 `idf.py set-target`,不用带任何参数,可查看所有支持的目标芯片列表。
* `idf.py menuconfig` 可打开一个基于文本的配置菜单,可以用来对项目进行配置。
## 编译项目
@ -65,23 +53,23 @@ ESP-IDF 中的子模块采用相对路径([详见 .gitmodules 文件](.gitmodu
## 烧写项目
当构建结束,终端会打印出一条命令行,告知如何使用 esptool.py 工具烧写项目到芯片中。但是你还可以运行下面这条命令来自动烧写:
当构建结束,终端会打印出一条命令行,告知如何使用 esptool.py 工具烧写项目到芯片中。但你也可以运行下面这条命令来自动烧写:
`idf.py -p PORT flash`
将其中的 PORT 替换为系统中实际串口的名字(比如 Windows 下的 `COM3`Linux 下的 `/dev/ttyUSB0`,或者 MacOS 下的 `/dev/cu.usbserial-X`。如果省略 `-p` 选项,`idf.py flash` 会尝试使用第一个可用的串口进行烧写。
将其中的 PORT 替换为系统中实际串口的名字(比如 Windows 下的 `COM3`Linux 下的 `/dev/ttyUSB0`,或者 macOS 下的 `/dev/cu.usbserial-X`。如果省略 `-p` 选项,`idf.py flash` 会尝试使用第一个可用的串口进行烧写。
这会烧写整个项目(包括应用程序,引导程序和分区表)到芯片中,此外还可以使用 `idf.py menuconfig` 来调整串口烧写相关的配置。
你也不必先运行 `idf.py build`再运行 `idf.py flash``idf.py flash` 会根据需要自动重新构建项目。
不必先运行 `idf.py build` 再运行 `idf.py flash``idf.py flash` 会根据需要自动重新构建项目。
## 观察串口输入
`idf.py monitor` 会调用 [idf_monitor 工具](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/idf-monitor.html)来显示 ESP32 和 ESP32-S2 的串口输出。`idf_monitor` 还包含一系列的功能来解析程序崩溃后的输出结果并与设备进行交互。更多详细内容,请参阅[文档](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/idf-monitor.html).
`idf.py monitor` 会调用 [idf_monitor 工具](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/idf-monitor.html)来显示乐鑫芯片的串口输出。`idf_monitor` 还包含一系列的功能来解析程序崩溃后的输出结果并与设备进行交互。更多详细内容,请参阅[文档](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/idf-monitor.html).
输入 `Ctrl-]` 可退出监视器。
想要一次性执行构建烧写和监视,可以运行如下命令:
想要一次性执行构建烧写和监视,可以运行如下命令:
`idf.py flash monitor`
@ -92,24 +80,27 @@ ESP-IDF 中的子模块采用相对路径([详见 .gitmodules 文件](.gitmodu
* `idf.py app` - 仅构建应用程序。
* `idf.py app-flash` - 仅烧写应用程序。
`idf.py app-flash` 会自动判断是否有源文件发生了改变后重新构建应用程序。
`idf.py app-flash` 会自动判断是否有源文件发生了改变后重新构建应用程序。
(在正常的开发中,即使引导程序和分区表没有发生变化,每次都重新烧写它们并不会带来什么危害。)
## 擦除 Flash
`idf.py flash` 并不会擦除 Flash 上所有的内容,但是有时候我们需要设备恢复到完全擦除的状态,尤其是分区表发生了变化或者 OTA 应用升级。要擦除整块 Flash 请运行 `idf.py erase_flash`
`idf.py flash` 并不会擦除 flash 上所有的内容,但是有时候我们需要设备恢复到完全擦除的状态,尤其是分区表发生了变化或者 OTA 应用升级。要擦除整块 flash 请运行 `idf.py erase_flash`
这条命令还可以和其余命令整合在一起,`idf.py -p PORT erase_flash flash` 会擦除一切然后重新烧写新的应用程序引导程序和分区表。
这条命令还可以和其余命令整合在一起,`idf.py -p PORT erase_flash flash` 会擦除一切然后重新烧写新的应用程序引导程序和分区表。
# 其它参考资源
* 最新版的文档https://docs.espressif.com/projects/esp-idf/ ,该文档是由本仓库 [docs 目录](docs) 构建得到。
* 最新版的文档https://docs.espressif.com/projects/esp-idf/,该文档是由本仓库 [docs 目录](docs) 构建得到。
* 可以前往 [esp32.com 论坛](https://esp32.com/) 提问,挖掘社区资源。
* 如果你在使用中发现了错误或者需要新的功能,请先[查看 GitHub Issues](https://github.com/espressif/esp-idf/issues),确保该问题不会被重复提交。
* 如果你在使用中发现了错误或者需要新的功能,请先[查看 GitHub Issues](https://github.com/espressif/esp-idf/issues),确保该问题没有重复提交。
* 如果你有兴趣为 ESP-IDF 作贡献,请先阅读[贡献指南](https://docs.espressif.com/projects/esp-idf/en/latest/contribute/index.html)。
__________
<a name="fn1">1</a>: ESP-IDF 不支持 ESP8266 和 ESP8285。如有需要请参考 [RTOS SDK](https://github.com/espressif/ESP8266_RTOS_SDK)。

View File

@ -6,7 +6,23 @@ set(srcs
set(include_dirs "include")
if(CONFIG_SYSVIEW_ENABLE)
set(priv_include_dirs "private_include" "port/include")
if(CONFIG_APPTRACE_MEMBUFS_APPTRACE_PROTO_ENABLE)
list(APPEND srcs
"app_trace_membufs_proto.c")
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
list(APPEND srcs
"port/xtensa/port.c")
endif()
if(CONFIG_IDF_TARGET_ARCH_RISCV)
list(APPEND srcs
"port/riscv/port.c")
endif()
endif()
if(CONFIG_APPTRACE_SV_ENABLE)
list(APPEND include_dirs
sys_view/Config
sys_view/SEGGER
@ -16,7 +32,7 @@ if(CONFIG_SYSVIEW_ENABLE)
"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/esp/SEGGER_RTT_esp.c"
"sys_view/ext/heap_trace_module.c"
"sys_view/ext/logging.c")
endif()
@ -30,13 +46,18 @@ endif()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
PRIV_REQUIRES soc
LDFRAGMENTS linker.lf)
# disable --coverage for this component, as it is used as transport
# for gcov
target_compile_options(${COMPONENT_LIB} PRIVATE "-fno-profile-arcs" "-fno-test-coverage")
# Force app_trace to also appear later than gcov in link line
idf_component_get_property(app_trace app_trace COMPONENT_LIB)
target_link_libraries(${COMPONENT_LIB} INTERFACE $<TARGET_FILE:${app_trace}> gcov $<TARGET_FILE:${app_trace}> c)
if(CONFIG_APPTRACE_GCOV_ENABLE)
# disable --coverage for this component, as it is used as transport
# for gcov
target_compile_options(${COMPONENT_LIB} PRIVATE "-fno-profile-arcs" "-fno-test-coverage")
# Force app_trace to also appear later than gcov in link line
idf_component_get_property(app_trace app_trace COMPONENT_LIB)
target_link_libraries(${COMPONENT_LIB} INTERFACE
"-Wl,--undefined=gcov_rtio_atexit" $<TARGET_FILE:${app_trace}> gcov $<TARGET_FILE:${app_trace}> c)
endif()

View File

@ -4,29 +4,44 @@ menu "Application Level Tracing"
prompt "Data Destination"
default APPTRACE_DEST_NONE
help
Select destination for application trace: trace memory or none (to disable).
Select destination for application trace: JTAG or none (to disable).
config APPTRACE_DEST_TRAX
bool "Trace memory"
config APPTRACE_DEST_JTAG
bool "JTAG"
select APPTRACE_DEST_TRAX if IDF_TARGET_ARCH_XTENSA
select APPTRACE_MEMBUFS_APPTRACE_PROTO_ENABLE
select APPTRACE_ENABLE
config APPTRACE_DEST_NONE
bool "None"
endchoice
config APPTRACE_ENABLE
config APPTRACE_DEST_TRAX
bool
depends on !ESP32_TRAX && !ESP32S2_TRAX
depends on IDF_TARGET_ARCH_XTENSA && !ESP32_TRAX && !ESP32S2_TRAX
select ESP32_MEMMAP_TRACEMEM
select ESP32S2_MEMMAP_TRACEMEM
select ESP32_MEMMAP_TRACEMEM_TWOBANKS
select ESP32S2_MEMMAP_TRACEMEM_TWOBANKS
default n
help
Enables/disable TRAX tracing HW.
config APPTRACE_MEMBUFS_APPTRACE_PROTO_ENABLE
bool
default n
help
Enables/disable swapping memory buffers tracing protocol.
config APPTRACE_ENABLE
bool
default n
help
Enables/disable application tracing module.
config APPTRACE_LOCK_ENABLE
bool
default !SYSVIEW_ENABLE
default !APPTRACE_SV_ENABLE
help
Enables/disable application tracing module internal sync lock.
@ -41,16 +56,23 @@ menu "Application Level Tracing"
config APPTRACE_POSTMORTEM_FLUSH_THRESH
int "Threshold for flushing last trace data to host on panic"
depends on APPTRACE_DEST_TRAX
depends on APPTRACE_ENABLE
range 0 16384
default 0
help
Threshold for flushing last trace data to host on panic in post-mortem mode.
This is minimal amount of data needed to perform flush. In bytes.
config APPTRACE_BUF_SIZE
int "Size of the apptrace buffer"
depends on APPTRACE_MEMBUFS_APPTRACE_PROTO_ENABLE && !APPTRACE_DEST_TRAX
default 16384
help
Size of the memory buffer for trace data in bytes.
config APPTRACE_PENDING_DATA_SIZE_MAX
int "Size of the pending data buffer"
depends on APPTRACE_DEST_TRAX
depends on APPTRACE_MEMBUFS_APPTRACE_PROTO_ENABLE
default 0
help
Size of the buffer for events in bytes. It is useful for buffering events from
@ -59,151 +81,151 @@ menu "Application Level Tracing"
menu "FreeRTOS SystemView Tracing"
depends on APPTRACE_ENABLE
config SYSVIEW_ENABLE
config APPTRACE_SV_ENABLE
bool "SystemView Tracing Enable"
depends on APPTRACE_ENABLE
default n
help
Enables supporrt for SEGGER SystemView tracing functionality.
choice SYSVIEW_TS_SOURCE
choice APPTRACE_SV_TS_SOURCE
prompt "Timer to use as timestamp source"
depends on SYSVIEW_ENABLE
default SYSVIEW_TS_SOURCE_CCOUNT if FREERTOS_UNICORE && !PM_ENABLE
default SYSVIEW_TS_SOURCE_TIMER_00 if !FREERTOS_UNICORE && !PM_ENABLE
default SYSVIEW_TS_SOURCE_ESP_TIMER if PM_ENABLE
depends on APPTRACE_SV_ENABLE
default APPTRACE_SV_TS_SOURCE_CCOUNT if FREERTOS_UNICORE && !PM_ENABLE && !IDF_TARGET_ESP32C3
default APPTRACE_SV_TS_SOURCE_TIMER_00 if !FREERTOS_UNICORE && !PM_ENABLE && !IDF_TARGET_ESP32C3
default APPTRACE_SV_TS_SOURCE_ESP_TIMER if PM_ENABLE || IDF_TARGET_ESP32C3
help
SystemView needs to use a hardware timer as the source of timestamps
when tracing. This option selects the timer for it.
config SYSVIEW_TS_SOURCE_CCOUNT
config APPTRACE_SV_TS_SOURCE_CCOUNT
bool "CPU cycle counter (CCOUNT)"
depends on FREERTOS_UNICORE && !PM_ENABLE
depends on FREERTOS_UNICORE && !PM_ENABLE && !IDF_TARGET_ESP32C3
config SYSVIEW_TS_SOURCE_TIMER_00
config APPTRACE_SV_TS_SOURCE_TIMER_00
bool "Timer 0, Group 0"
depends on !PM_ENABLE
depends on !PM_ENABLE && !IDF_TARGET_ESP32C3
config SYSVIEW_TS_SOURCE_TIMER_01
config APPTRACE_SV_TS_SOURCE_TIMER_01
bool "Timer 1, Group 0"
depends on !PM_ENABLE
depends on !PM_ENABLE && !IDF_TARGET_ESP32C3
config SYSVIEW_TS_SOURCE_TIMER_10
config APPTRACE_SV_TS_SOURCE_TIMER_10
bool "Timer 0, Group 1"
depends on !PM_ENABLE
depends on !PM_ENABLE && !IDF_TARGET_ESP32C3
config SYSVIEW_TS_SOURCE_TIMER_11
config APPTRACE_SV_TS_SOURCE_TIMER_11
bool "Timer 1, Group 1"
depends on !PM_ENABLE
depends on !PM_ENABLE && !IDF_TARGET_ESP32C3
config SYSVIEW_TS_SOURCE_ESP_TIMER
config APPTRACE_SV_TS_SOURCE_ESP_TIMER
bool "esp_timer high resolution timer"
endchoice
config SYSVIEW_MAX_TASKS
config APPTRACE_SV_MAX_TASKS
int "Maximum supported tasks"
depends on SYSVIEW_ENABLE
depends on APPTRACE_SV_ENABLE
range 1 64
default 16
help
Configures maximum supported tasks in sysview debug
config SYSVIEW_BUF_WAIT_TMO
config APPTRACE_SV_BUF_WAIT_TMO
int "Trace buffer wait timeout"
depends on SYSVIEW_ENABLE
depends on APPTRACE_SV_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
config APPTRACE_SV_EVT_OVERFLOW_ENABLE
bool "Trace Buffer Overflow Event"
depends on SYSVIEW_ENABLE
depends on APPTRACE_SV_ENABLE
default y
help
Enables "Trace Buffer Overflow" event.
config SYSVIEW_EVT_ISR_ENTER_ENABLE
config APPTRACE_SV_EVT_ISR_ENTER_ENABLE
bool "ISR Enter Event"
depends on SYSVIEW_ENABLE
depends on APPTRACE_SV_ENABLE
default y
help
Enables "ISR Enter" event.
config SYSVIEW_EVT_ISR_EXIT_ENABLE
config APPTRACE_SV_EVT_ISR_EXIT_ENABLE
bool "ISR Exit Event"
depends on SYSVIEW_ENABLE
depends on APPTRACE_SV_ENABLE
default y
help
Enables "ISR Exit" event.
config SYSVIEW_EVT_ISR_TO_SCHEDULER_ENABLE
config APPTRACE_SV_EVT_ISR_TO_SCHED_ENABLE
bool "ISR Exit to Scheduler Event"
depends on SYSVIEW_ENABLE
depends on APPTRACE_SV_ENABLE
default y
help
Enables "ISR to Scheduler" event.
config SYSVIEW_EVT_TASK_START_EXEC_ENABLE
config APPTRACE_SV_EVT_TASK_START_EXEC_ENABLE
bool "Task Start Execution Event"
depends on SYSVIEW_ENABLE
depends on APPTRACE_SV_ENABLE
default y
help
Enables "Task Start Execution" event.
config SYSVIEW_EVT_TASK_STOP_EXEC_ENABLE
config APPTRACE_SV_EVT_TASK_STOP_EXEC_ENABLE
bool "Task Stop Execution Event"
depends on SYSVIEW_ENABLE
depends on APPTRACE_SV_ENABLE
default y
help
Enables "Task Stop Execution" event.
config SYSVIEW_EVT_TASK_START_READY_ENABLE
config APPTRACE_SV_EVT_TASK_START_READY_ENABLE
bool "Task Start Ready State Event"
depends on SYSVIEW_ENABLE
depends on APPTRACE_SV_ENABLE
default y
help
Enables "Task Start Ready State" event.
config SYSVIEW_EVT_TASK_STOP_READY_ENABLE
config APPTRACE_SV_EVT_TASK_STOP_READY_ENABLE
bool "Task Stop Ready State Event"
depends on SYSVIEW_ENABLE
depends on APPTRACE_SV_ENABLE
default y
help
Enables "Task Stop Ready State" event.
config SYSVIEW_EVT_TASK_CREATE_ENABLE
config APPTRACE_SV_EVT_TASK_CREATE_ENABLE
bool "Task Create Event"
depends on SYSVIEW_ENABLE
depends on APPTRACE_SV_ENABLE
default y
help
Enables "Task Create" event.
config SYSVIEW_EVT_TASK_TERMINATE_ENABLE
config APPTRACE_SV_EVT_TASK_TERMINATE_ENABLE
bool "Task Terminate Event"
depends on SYSVIEW_ENABLE
depends on APPTRACE_SV_ENABLE
default y
help
Enables "Task Terminate" event.
config SYSVIEW_EVT_IDLE_ENABLE
config APPTRACE_SV_EVT_IDLE_ENABLE
bool "System Idle Event"
depends on SYSVIEW_ENABLE
depends on APPTRACE_SV_ENABLE
default y
help
Enables "System Idle" event.
config SYSVIEW_EVT_TIMER_ENTER_ENABLE
config APPTRACE_SV_EVT_TIMER_ENTER_ENABLE
bool "Timer Enter Event"
depends on SYSVIEW_ENABLE
depends on APPTRACE_SV_ENABLE
default y
help
Enables "Timer Enter" event.
config SYSVIEW_EVT_TIMER_EXIT_ENABLE
config APPTRACE_SV_EVT_TIMER_EXIT_ENABLE
bool "Timer Exit Event"
depends on SYSVIEW_ENABLE
depends on APPTRACE_SV_ENABLE
default y
help
Enables "Timer Exit" event.
@ -212,7 +234,7 @@ menu "Application Level Tracing"
config APPTRACE_GCOV_ENABLE
bool "GCOV to Host Enable"
depends on APPTRACE_ENABLE && !SYSVIEW_ENABLE
depends on APPTRACE_ENABLE && !APPTRACE_SV_ENABLE
select ESP_DEBUG_STUBS_ENABLE
default n
help

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,364 @@
#include <sys/param.h>
#include <string.h>
#include "sdkconfig.h"
#include "esp_log.h"
#include "esp_app_trace_membufs_proto.h"
/** Trace data header. Every user data chunk is prepended with this header.
* User allocates block with esp_apptrace_buffer_get and then fills it with data,
* in multithreading environment it can happen that tasks gets buffer and then gets interrupted,
* so it is possible that user data are incomplete when memory block is exposed to the host.
* In this case host SW will see that wr_sz < block_sz and will report error.
*/
typedef struct {
#if CONFIG_APPTRACE_SV_ENABLE
uint8_t block_sz; // size of allocated block for user data
uint8_t wr_sz; // size of actually written data
#else
uint16_t block_sz; // size of allocated block for user data
uint16_t wr_sz; // size of actually written data
#endif
} esp_tracedata_hdr_t;
/** TODO: docs
*/
typedef struct {
uint16_t block_sz; // size of allocated block for user data
} esp_hostdata_hdr_t;
#if CONFIG_APPTRACE_SV_ENABLE
#define ESP_APPTRACE_USR_BLOCK_CORE(_cid_) (0)
#define ESP_APPTRACE_USR_BLOCK_LEN(_v_) (_v_)
#define ESP_APPTRACE_USR_DATA_LEN_MAX(_hw_data_) 255UL
#else
#define ESP_APPTRACE_USR_BLOCK_CORE(_cid_) ((_cid_) << 15)
#define ESP_APPTRACE_USR_BLOCK_LEN(_v_) (~(1 << 15) & (_v_))
#define ESP_APPTRACE_USR_DATA_LEN_MAX(_hw_data_) (ESP_APPTRACE_INBLOCK(_hw_data_)->sz - sizeof(esp_tracedata_hdr_t))
#endif
#define ESP_APPTRACE_USR_BLOCK_RAW_SZ(_s_) ((_s_) + sizeof(esp_tracedata_hdr_t))
#define ESP_APPTRACE_INBLOCK_MARKER(_hw_data_) ((_hw_data_)->state.markers[(_hw_data_)->state.in_block % 2])
#define ESP_APPTRACE_INBLOCK_MARKER_UPD(_hw_data_, _v_) do {(_hw_data_)->state.markers[(_hw_data_)->state.in_block % 2] += (_v_);}while(0)
#define ESP_APPTRACE_INBLOCK(_hw_data_) (&(_hw_data_)->blocks[(_hw_data_)->state.in_block % 2])
const static char *TAG = "esp_apptrace";
static uint32_t esp_apptrace_membufs_down_buffer_write_nolock(esp_apptrace_membufs_proto_data_t *proto, uint8_t *data, uint32_t size);
esp_err_t esp_apptrace_membufs_init(esp_apptrace_membufs_proto_data_t *proto, const esp_apptrace_mem_block_t blocks_cfg[2])
{
// disabled by default
esp_apptrace_rb_init(&proto->rb_down, NULL, 0);
// membufs proto init
for (unsigned i = 0; i < 2; i++) {
proto->blocks[i].start = blocks_cfg[i].start;
proto->blocks[i].sz = blocks_cfg[i].sz;
proto->state.markers[i] = 0;
}
proto->state.in_block = 0;
#if CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX > 0
esp_apptrace_rb_init(&proto->rb_pend, proto->pending_data,
sizeof(proto->pending_data));
#endif
return ESP_OK;
}
void esp_apptrace_membufs_down_buffer_config(esp_apptrace_membufs_proto_data_t *data, uint8_t *buf, uint32_t size)
{
esp_apptrace_rb_init(&data->rb_down, buf, size);
}
// assumed to be protected by caller from multi-core/thread access
static esp_err_t esp_apptrace_membufs_swap(esp_apptrace_membufs_proto_data_t *proto)
{
int prev_block_num = proto->state.in_block % 2;
int new_block_num = prev_block_num ? (0) : (1);
esp_err_t res = ESP_OK;
res = proto->hw->swap_start(proto->state.in_block);
if (res != ESP_OK) {
return res;
}
proto->state.markers[new_block_num] = 0;
// switch to new block
proto->state.in_block++;
proto->hw->swap(new_block_num);
// handle data from host
esp_hostdata_hdr_t *hdr = (esp_hostdata_hdr_t *)proto->blocks[new_block_num].start;
// ESP_APPTRACE_LOGV("Host data %d, sz %d @ %p", proto->hw->host_data_pending(), hdr->block_sz, hdr);
if (proto->hw->host_data_pending() && hdr->block_sz > 0) {
// TODO: add support for multiple blocks from host, currently there is no need for that
uint8_t *p = proto->blocks[new_block_num].start + proto->blocks[new_block_num].sz;
ESP_APPTRACE_LOGD("Recvd %d bytes from host [%x %x %x %x %x %x %x %x .. %x %x %x %x %x %x %x %x]", hdr->block_sz,
*(proto->blocks[new_block_num].start+0), *(proto->blocks[new_block_num].start+1),
*(proto->blocks[new_block_num].start+2), *(proto->blocks[new_block_num].start+3),
*(proto->blocks[new_block_num].start+4), *(proto->blocks[new_block_num].start+5),
*(proto->blocks[new_block_num].start+6), *(proto->blocks[new_block_num].start+7),
*(p-8), *(p-7), *(p-6), *(p-5), *(p-4), *(p-3), *(p-2), *(p-1));
uint32_t sz = esp_apptrace_membufs_down_buffer_write_nolock(proto, (uint8_t *)(hdr+1), hdr->block_sz);
if (sz != hdr->block_sz) {
ESP_APPTRACE_LOGE("Failed to write %d bytes to down buffer (%d %d)!", hdr->block_sz - sz, hdr->block_sz, sz);
}
hdr->block_sz = 0;
}
#if CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX > 0
// copy pending data to block if any
while (proto->state.markers[new_block_num] < proto->blocks[new_block_num].sz) {
uint32_t read_sz = esp_apptrace_rb_read_size_get(&proto->rb_pend);
if (read_sz == 0) {
break; // no more data in pending buffer
}
if (read_sz > proto->blocks[new_block_num].sz - proto->state.markers[new_block_num]) {
read_sz = proto->blocks[new_block_num].sz - proto->state.markers[new_block_num];
}
uint8_t *ptr = esp_apptrace_rb_consume(&proto->rb_pend, read_sz);
if (!ptr) {
assert(false && "Failed to consume pended bytes!!");
break;
}
ESP_APPTRACE_LOGD("Pump %d pend bytes [%x %x %x %x : %x %x %x %x : %x %x %x %x : %x %x...%x %x]",
read_sz, *(ptr+0), *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4),
*(ptr+5), *(ptr+6), *(ptr+7), *(ptr+8), *(ptr+9), *(ptr+10), *(ptr+11), *(ptr+12), *(ptr+13), *(ptr+read_sz-2), *(ptr+read_sz-1));
memcpy(proto->blocks[new_block_num].start + proto->state.markers[new_block_num], ptr, read_sz);
proto->state.markers[new_block_num] += read_sz;
}
#endif
proto->hw->swap_end(proto->state.in_block, proto->state.markers[prev_block_num]);
return res;
}
static esp_err_t esp_apptrace_membufs_swap_waitus(esp_apptrace_membufs_proto_data_t *proto, esp_apptrace_tmo_t *tmo)
{
int res;
while ((res = esp_apptrace_membufs_swap(proto)) != ESP_OK) {
res = esp_apptrace_tmo_check(tmo);
if (res != ESP_OK) {
break;
}
}
return res;
}
uint8_t *esp_apptrace_membufs_down_buffer_get(esp_apptrace_membufs_proto_data_t *proto, uint32_t *size, esp_apptrace_tmo_t *tmo)
{
uint8_t *ptr = NULL;
while (1) {
uint32_t sz = esp_apptrace_rb_read_size_get(&proto->rb_down);
if (sz != 0) {
*size = MIN(*size, sz);
ptr = esp_apptrace_rb_consume(&proto->rb_down, *size);
if (!ptr) {
assert(false && "Failed to consume bytes from down buffer!");
}
break;
}
// may need to flush
if (proto->hw->host_data_pending()) {
ESP_APPTRACE_LOGD("force flush");
int res = esp_apptrace_membufs_swap_waitus(proto, tmo);
if (res != ESP_OK) {
ESP_APPTRACE_LOGE("Failed to switch to another block to recv data from host!");
/*do not return error because data can be in down buffer already*/
}
} else {
// check tmo only if there is no data from host
int res = esp_apptrace_tmo_check(tmo);
if (res != ESP_OK) {
return NULL;
}
}
}
return ptr;
}
esp_err_t esp_apptrace_membufs_down_buffer_put(esp_apptrace_membufs_proto_data_t *proto, uint8_t *ptr, esp_apptrace_tmo_t *tmo)
{
/* nothing todo */
return ESP_OK;
}
static uint32_t esp_apptrace_membufs_down_buffer_write_nolock(esp_apptrace_membufs_proto_data_t *proto, uint8_t *data, uint32_t size)
{
uint32_t total_sz = 0;
while (total_sz < size) {
ESP_APPTRACE_LOGD("esp_apptrace_trax_down_buffer_write_nolock WRS %d-%d-%d %d", proto->rb_down.wr, proto->rb_down.rd,
proto->rb_down.cur_size, size);
uint32_t wr_sz = esp_apptrace_rb_write_size_get(&proto->rb_down);
if (wr_sz == 0) {
break;
}
if (wr_sz > size - total_sz) {
wr_sz = size - total_sz;
}
ESP_APPTRACE_LOGD("esp_apptrace_trax_down_buffer_write_nolock wr %d", wr_sz);
uint8_t *ptr = esp_apptrace_rb_produce(&proto->rb_down, wr_sz);
if (!ptr) {
assert(false && "Failed to produce bytes to down buffer!");
}
ESP_APPTRACE_LOGD("esp_apptrace_trax_down_buffer_write_nolock wr %d to 0x%x from 0x%x", wr_sz, ptr, data + total_sz + wr_sz);
memcpy(ptr, data + total_sz, wr_sz);
total_sz += wr_sz;
ESP_APPTRACE_LOGD("esp_apptrace_trax_down_buffer_write_nolock wr %d/%d", wr_sz, total_sz);
}
return total_sz;
}
static inline uint8_t *esp_apptrace_membufs_wait4buf(esp_apptrace_membufs_proto_data_t *proto, uint16_t size, esp_apptrace_tmo_t *tmo, int *pended)
{
uint8_t *ptr = NULL;
int res = esp_apptrace_membufs_swap_waitus(proto, tmo);
if (res != ESP_OK) {
return NULL;
}
#if CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX > 0
// check if we still have pending data
if (esp_apptrace_rb_read_size_get(&proto->rb_pend) > 0) {
// if after block switch we still have pending data (not all pending data have been pumped to block)
// alloc new pending buffer
*pended = 1;
ptr = esp_apptrace_rb_produce(&proto->rb_pend, size);
if (!ptr) {
ESP_APPTRACE_LOGE("Failed to alloc pend buf 1: w-r-s %d-%d-%d!", proto->rb_pend.wr, proto->rb_pend.rd, proto->rb_pend.cur_size);
}
} else
#endif
{
// update block pointers
if (ESP_APPTRACE_INBLOCK_MARKER(proto) + size > ESP_APPTRACE_INBLOCK(proto)->sz) {
#if CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX > 0
*pended = 1;
ptr = esp_apptrace_rb_produce(&proto->rb_pend, size);
if (ptr == NULL) {
ESP_APPTRACE_LOGE("Failed to alloc pend buf 2: w-r-s %d-%d-%d!", proto->rb_pend.wr, proto->rb_pend.rd, proto->rb_pend.cur_size);
}
#endif
} else {
*pended = 0;
ptr = ESP_APPTRACE_INBLOCK(proto)->start + ESP_APPTRACE_INBLOCK_MARKER(proto);
}
}
return ptr;
}
static inline uint8_t *esp_apptrace_membufs_pkt_start(uint8_t *ptr, uint16_t size)
{
// it is safe to use cpu_hal_get_core_id() in macro call because arg is used only once inside it
((esp_tracedata_hdr_t *)ptr)->block_sz = ESP_APPTRACE_USR_BLOCK_CORE(cpu_hal_get_core_id()) | size;
((esp_tracedata_hdr_t *)ptr)->wr_sz = 0;
return ptr + sizeof(esp_tracedata_hdr_t);
}
static inline void esp_apptrace_membufs_pkt_end(uint8_t *ptr)
{
esp_tracedata_hdr_t *hdr = (esp_tracedata_hdr_t *)(ptr - sizeof(esp_tracedata_hdr_t));
// update written size
hdr->wr_sz = hdr->block_sz;
}
uint8_t *esp_apptrace_membufs_up_buffer_get(esp_apptrace_membufs_proto_data_t *proto, uint32_t size, esp_apptrace_tmo_t *tmo)
{
uint8_t *buf_ptr = NULL;
if (size > ESP_APPTRACE_USR_DATA_LEN_MAX(proto)) {
ESP_APPTRACE_LOGE("Too large user data size %d!", size);
return NULL;
}
// check for data in the pending buffer
#if CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX > 0
if (esp_apptrace_rb_read_size_get(&proto->rb_pend) > 0) {
// if we have buffered data try to switch block
esp_apptrace_membufs_swap(proto);
// if switch was successful, part or all pended data have been copied to block
}
if (esp_apptrace_rb_read_size_get(&proto->rb_pend) > 0) {
// if we have buffered data alloc new pending buffer
ESP_APPTRACE_LOGD("Get %d bytes from PEND buffer", size);
buf_ptr = esp_apptrace_rb_produce(&proto->rb_pend, ESP_APPTRACE_USR_BLOCK_RAW_SZ(size));
if (buf_ptr == NULL) {
int pended_buf;
buf_ptr = esp_apptrace_membufs_wait4buf(proto, ESP_APPTRACE_USR_BLOCK_RAW_SZ(size), tmo, &pended_buf);
if (buf_ptr && !pended_buf) {
ESP_APPTRACE_LOGD("Get %d bytes from block", size);
// update cur block marker
ESP_APPTRACE_INBLOCK_MARKER_UPD(proto, ESP_APPTRACE_USR_BLOCK_RAW_SZ(size));
}
}
} else {
#else
if (1) {
#endif
if (ESP_APPTRACE_INBLOCK_MARKER(proto) + ESP_APPTRACE_USR_BLOCK_RAW_SZ(size) > ESP_APPTRACE_INBLOCK(proto)->sz) {
#if CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX > 0
ESP_APPTRACE_LOGD("Block full. Get %d bytes from PEND buffer", size);
buf_ptr = esp_apptrace_rb_produce(&proto->rb_pend, ESP_APPTRACE_USR_BLOCK_RAW_SZ(size));
#endif
if (buf_ptr == NULL) {
int pended_buf;
ESP_APPTRACE_LOGD(" full. Get %d bytes from pend buffer", size);
buf_ptr = esp_apptrace_membufs_wait4buf(proto, ESP_APPTRACE_USR_BLOCK_RAW_SZ(size), tmo, &pended_buf);
if (buf_ptr && !pended_buf) {
ESP_APPTRACE_LOGD("Got %d bytes from block", size);
// update cur block marker
ESP_APPTRACE_INBLOCK_MARKER_UPD(proto, ESP_APPTRACE_USR_BLOCK_RAW_SZ(size));
}
}
} else {
ESP_APPTRACE_LOGD("Get %d bytes from buffer", size);
// fit to curr nlock
buf_ptr = ESP_APPTRACE_INBLOCK(proto)->start + ESP_APPTRACE_INBLOCK_MARKER(proto);
// update cur block marker
ESP_APPTRACE_INBLOCK_MARKER_UPD(proto, ESP_APPTRACE_USR_BLOCK_RAW_SZ(size));
}
}
if (buf_ptr) {
buf_ptr = esp_apptrace_membufs_pkt_start(buf_ptr, size);
}
return buf_ptr;
}
esp_err_t esp_apptrace_membufs_up_buffer_put(esp_apptrace_membufs_proto_data_t *proto, uint8_t *ptr, esp_apptrace_tmo_t *tmo)
{
esp_apptrace_membufs_pkt_end(ptr);
// TODO: mark block as busy in order not to re-use it for other tracing calls until it is completely written
// TODO: avoid potential situation when all memory is consumed by low prio tasks which can not complete writing due to
// higher prio tasks and the latter can not allocate buffers at all
// this is abnormal situation can be detected on host which will receive only uncompleted buffers
// workaround: use own memcpy which will kick-off dead tracing calls
return ESP_OK;
}
esp_err_t esp_apptrace_membufs_flush_nolock(esp_apptrace_membufs_proto_data_t *proto, uint32_t min_sz, esp_apptrace_tmo_t *tmo)
{
int res = ESP_OK;
if (ESP_APPTRACE_INBLOCK_MARKER(proto) < min_sz) {
ESP_APPTRACE_LOGI("Ignore flush request for min %d bytes. Bytes in block: %d.", min_sz, ESP_APPTRACE_INBLOCK_MARKER(proto));
return ESP_OK;
}
// switch block while size of data (including that in pending buffer) is more than min size
while (ESP_APPTRACE_INBLOCK_MARKER(proto) > min_sz) {
ESP_APPTRACE_LOGD("Try to flush %d bytes. Wait until block switch for %lld us", ESP_APPTRACE_INBLOCK_MARKER(proto), tmo->tmo);
res = esp_apptrace_membufs_swap_waitus(proto, tmo);
if (res != ESP_OK) {
if (tmo->tmo != ESP_APPTRACE_TMO_INFINITE)
ESP_APPTRACE_LOGW("Failed to switch to another block in %lld us!", tmo->tmo);
else
ESP_APPTRACE_LOGE("Failed to switch to another block in %lld us!", tmo->tmo);
return res;
}
}
return res;
}

View File

@ -16,33 +16,42 @@
#include "freertos/task.h"
#include "esp_app_trace_util.h"
#include "sdkconfig.h"
#if CONFIG_IDF_TARGET_ESP32
#include "esp32/clk.h"
#elif CONFIG_IDF_TARGET_ESP32S2
#include "esp32s2/clk.h"
#elif CONFIG_IDF_TARGET_ESP32S3
#include "esp32s3/clk.h"
#elif CONFIG_IDF_TARGET_ESP32C3
#include "esp32c3/clk.h"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////// Locks /////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#if ESP_APPTRACE_PRINT_LOCK
static esp_apptrace_lock_t s_log_lock = {.irq_stat = 0, .portmux = portMUX_INITIALIZER_UNLOCKED};
#endif
int esp_apptrace_log_lock(void)
{
#if ESP_APPTRACE_PRINT_LOCK
esp_apptrace_tmo_t tmo;
esp_apptrace_tmo_init(&tmo, ESP_APPTRACE_TMO_INFINITE);
int ret = esp_apptrace_lock_take(&s_log_lock, &tmo);
return ret;
#else
return 0;
#endif
}
void esp_apptrace_log_unlock(void)
{
#if ESP_APPTRACE_PRINT_LOCK
esp_apptrace_lock_give(&s_log_lock);
#endif
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////// TIMEOUT /////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#define ESP_APPTRACE_CPUTICKS2US(_t_, _cpu_freq_) ((_t_)/(_cpu_freq_/1000000))
#define ESP_APPTRACE_US2CPUTICKS(_t_, _cpu_freq_) ((_t_)*(_cpu_freq_/1000000))
esp_err_t esp_apptrace_tmo_check(esp_apptrace_tmo_t *tmo)
{
int cpu_freq = esp_clk_cpu_freq();
if (tmo->tmo != ESP_APPTRACE_TMO_INFINITE) {
unsigned cur = portGET_RUN_TIME_COUNTER_VALUE();
if (tmo->start <= cur) {
tmo->elapsed = ESP_APPTRACE_CPUTICKS2US(cur - tmo->start, cpu_freq);
} else {
tmo->elapsed = ESP_APPTRACE_CPUTICKS2US(0xFFFFFFFF - tmo->start + cur, cpu_freq);
}
if (tmo->tmo != (int64_t)-1) {
tmo->elapsed = esp_timer_get_time() - tmo->start;
if (tmo->elapsed >= tmo->tmo) {
return ESP_ERR_TIMEOUT;
}

View File

@ -4,14 +4,18 @@
COMPONENT_SRCDIRS := .
ifdef CONFIG_APPTRACE_MEMBUFS_APPTRACE_PROTO_ENABLE
COMPONENT_SRCDIRS += port/xtensa
endif
COMPONENT_ADD_INCLUDEDIRS = include
COMPONENT_PRIV_INCLUDEDIRS = private_include \
port/include
COMPONENT_ADD_LDFLAGS = -lapp_trace
# do not produce gcov info for this module, it is used as transport for gcov
CFLAGS := $(subst --coverage,,$(CFLAGS))
ifdef CONFIG_SYSVIEW_ENABLE
ifdef CONFIG_APPTRACE_SV_ENABLE
COMPONENT_ADD_INCLUDEDIRS += \
sys_view/Config \
@ -23,10 +27,15 @@ COMPONENT_SRCDIRS += \
sys_view/SEGGER \
sys_view/Sample/OS \
sys_view/Sample/Config \
sys_view/esp32 \
sys_view/esp \
sys_view/ext
else
ifdef CONFIG_APPTRACE_GCOV_ENABLE
# do not produce gcov info for this module, it is used as transport for gcov
CFLAGS := $(subst --coverage,,$(CFLAGS))
COMPONENT_ADD_LDFLAGS += -Wl,--undefined=gcov_rtio_atexit
COMPONENT_SRCDIRS += gcov
endif
endif
COMPONENT_ADD_LDFRAGMENTS += linker.lf

View File

@ -22,7 +22,9 @@
#include "soc/cpu.h"
#include "soc/timer_periph.h"
#include "esp_app_trace.h"
#include "esp_freertos_hooks.h"
#include "esp_private/dbg_stubs.h"
#include "esp_ipc.h"
#include "hal/wdt_hal.h"
#if CONFIG_IDF_TARGET_ESP32
#include "esp32/rom/libc_stubs.h"
@ -37,128 +39,113 @@
#define LOG_LOCAL_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include "esp_log.h"
const static char *TAG = "esp_gcov_rtio";
static volatile bool s_create_gcov_task = false;
static volatile bool s_gcov_task_running = false;
extern void __gcov_dump(void);
extern void __gcov_reset(void);
static struct syscall_stub_table s_gcov_stub_table;
static int gcov_stub_lock_try_acquire_recursive(_lock_t *lock)
void gcov_dump_task(void *pvParameter)
{
if (*lock && uxSemaphoreGetCount((xSemaphoreHandle)(*lock)) == 0) {
// we can do nothing here, gcov dump is initiated with some resource locked
// which is also used by gcov functions
ESP_EARLY_LOGE(TAG, "Lock 0x%x is busy during GCOV dump! System state can be inconsistent after dump!", lock);
}
return pdTRUE;
}
int dump_result = 0;
bool *running = (bool *)pvParameter;
static void gcov_stub_lock_acquire_recursive(_lock_t *lock)
{
gcov_stub_lock_try_acquire_recursive(lock);
}
ESP_EARLY_LOGV(TAG, "%s stack use in %d", __FUNCTION__, uxTaskGetStackHighWaterMark(NULL));
static void gcov_stub_lock_release_recursive(_lock_t *lock)
{
}
static int esp_dbg_stub_gcov_dump_do(void)
{
int ret = ESP_OK;
FILE* old_stderr = stderr;
FILE* old_stdout = stdout;
static struct syscall_stub_table *old_tables[portNUM_PROCESSORS];
old_tables[0] = syscall_table_ptr_pro;
#if portNUM_PROCESSORS > 1
old_tables[1] = syscall_table_ptr_app;
#endif
ESP_EARLY_LOGV(TAG, "Alloc apptrace down buf %d bytes", ESP_GCOV_DOWN_BUF_SIZE);
void *down_buf = malloc(ESP_GCOV_DOWN_BUF_SIZE);
if (down_buf == NULL) {
ESP_EARLY_LOGE(TAG, "Could not allocate memory for the buffer");
return ESP_ERR_NO_MEM;
dump_result = ESP_ERR_NO_MEM;
goto gcov_exit;
}
ESP_EARLY_LOGV(TAG, "Config apptrace down buf");
esp_apptrace_down_buffer_config(down_buf, ESP_GCOV_DOWN_BUF_SIZE);
/* we are directing the std outputs to the fake ones in order to reduce stack usage */
FILE *old_stderr = stderr;
FILE *old_stdout = stdout;
stderr = (FILE *) &__sf_fake_stderr;
stdout = (FILE *) &__sf_fake_stdout;
ESP_EARLY_LOGV(TAG, "Dump data...");
// incase of dual-core chip APP and PRO CPUs share the same table, so it is safe to save only PRO's table
memcpy(&s_gcov_stub_table, syscall_table_ptr_pro, sizeof(s_gcov_stub_table));
s_gcov_stub_table._lock_acquire_recursive = &gcov_stub_lock_acquire_recursive;
s_gcov_stub_table._lock_release_recursive = &gcov_stub_lock_release_recursive;
s_gcov_stub_table._lock_try_acquire_recursive = &gcov_stub_lock_try_acquire_recursive,
syscall_table_ptr_pro = &s_gcov_stub_table;
#if portNUM_PROCESSORS > 1
syscall_table_ptr_app = &s_gcov_stub_table;
#endif
stderr = (FILE*) &__sf_fake_stderr;
stdout = (FILE*) &__sf_fake_stdout;
__gcov_dump();
// reset dump status to allow incremental data accumulation
__gcov_reset();
stdout = old_stdout;
stderr = old_stderr;
syscall_table_ptr_pro = old_tables[0];
#if portNUM_PROCESSORS > 1
syscall_table_ptr_app = old_tables[1];
#endif
ESP_EARLY_LOGV(TAG, "Free apptrace down buf");
free(down_buf);
stderr = old_stderr;
stdout = old_stdout;
ESP_EARLY_LOGV(TAG, "Finish file transfer session");
ret = esp_apptrace_fstop(ESP_APPTRACE_DEST_TRAX);
if (ret != ESP_OK) {
ESP_EARLY_LOGE(TAG, "Failed to send files transfer stop cmd (%d)!", ret);
dump_result = esp_apptrace_fstop(ESP_APPTRACE_DEST_TRAX);
if (dump_result != ESP_OK) {
ESP_EARLY_LOGE(TAG, "Failed to send files transfer stop cmd (%d)!", dump_result);
}
gcov_exit:
ESP_EARLY_LOGV(TAG, "dump_result %d", dump_result);
if (running) {
*running = false;
}
ESP_EARLY_LOGV(TAG, "%s stack use out %d", __FUNCTION__, uxTaskGetStackHighWaterMark(NULL));
vTaskDelete(NULL);
}
void gcov_create_task(void *arg)
{
ESP_EARLY_LOGV(TAG, "%s", __FUNCTION__);
xTaskCreatePinnedToCore(&gcov_dump_task, "gcov_dump_task", 2048, (void *)&s_gcov_task_running, configMAX_PRIORITIES - 1, NULL, 0);
}
void gcov_create_task_tick_hook(void)
{
extern esp_err_t esp_ipc_start_gcov_from_isr(uint32_t cpu_id, esp_ipc_func_t func, void* arg);
if (s_create_gcov_task) {
if (esp_ipc_start_gcov_from_isr(xPortGetCoreID(), &gcov_create_task, NULL) == ESP_OK) {
s_create_gcov_task = false;
}
}
ESP_EARLY_LOGV(TAG, "exit %d", ret);
return ret;
}
/**
* @brief Triggers gcov info dump.
* @brief Triggers gcov info dump task
* This function is to be called by OpenOCD, not by normal user code.
* TODO: what about interrupted flash access (when cache disabled)???
* TODO: what about interrupted flash access (when cache disabled)
*
* @return ESP_OK on success, otherwise see esp_err_t
*/
static int esp_dbg_stub_gcov_entry(void)
{
return esp_dbg_stub_gcov_dump_do();
/* we are in isr context here */
s_create_gcov_task = true;
return ESP_OK;
}
int gcov_rtio_atexit(void (*function)(void) __attribute__ ((unused)))
{
uint32_t capabilities = 0;
ESP_EARLY_LOGV(TAG, "%s", __FUNCTION__);
esp_dbg_stub_entry_set(ESP_DBG_STUB_ENTRY_GCOV, (uint32_t)&esp_dbg_stub_gcov_entry);
return 0;
if (esp_dbg_stub_entry_get(ESP_DBG_STUB_ENTRY_CAPABILITIES, &capabilities) == ESP_OK) {
esp_dbg_stub_entry_set(ESP_DBG_STUB_ENTRY_CAPABILITIES, capabilities | ESP_DBG_STUB_CAP_GCOV_TASK);
}
esp_register_freertos_tick_hook(gcov_create_task_tick_hook);
return ESP_OK;
}
void esp_gcov_dump(void)
{
// disable IRQs on this CPU, other CPU is halted by OpenOCD
unsigned irq_state = portENTER_CRITICAL_NESTED();
#if !CONFIG_FREERTOS_UNICORE
int other_core = xPortGetCoreID() ? 0 : 1;
esp_cpu_stall(other_core);
#endif
ESP_EARLY_LOGV(TAG, "%s", __FUNCTION__);
while (!esp_apptrace_host_is_connected(ESP_APPTRACE_DEST_TRAX)) {
wdt_hal_context_t twdt = {.inst = WDT_MWDT0, .mwdt_dev = &TIMERG0};
wdt_hal_context_t iwdt = {.inst = WDT_MWDT1, .mwdt_dev = &TIMERG1};
//Feed the Task Watchdog (TG0) to prevent it from timing out
wdt_hal_write_protect_disable(&twdt);
wdt_hal_feed(&twdt);
wdt_hal_write_protect_enable(&twdt);
//Likewise, feed the Interrupt Watchdog (TG1) to prevent a reboot
wdt_hal_write_protect_disable(&iwdt);
wdt_hal_feed(&iwdt);
wdt_hal_write_protect_enable(&iwdt);
vTaskDelay(pdMS_TO_TICKS(10));
}
esp_dbg_stub_gcov_dump_do();
#if !CONFIG_FREERTOS_UNICORE
esp_cpu_unstall(other_core);
#endif
portEXIT_CRITICAL_NESTED(irq_state);
/* We are not in isr context here. Waiting for the completion is safe */
s_gcov_task_running = true;
s_create_gcov_task = true;
while (s_gcov_task_running) {
vTaskDelay(pdMS_TO_TICKS(10));
}
}
void *gcov_rtio_fopen(const char *path, const char *mode)
@ -177,7 +164,7 @@ int gcov_rtio_fclose(void *stream)
size_t gcov_rtio_fread(void *ptr, size_t size, size_t nmemb, void *stream)
{
ESP_EARLY_LOGV(TAG, "%s read %u", __FUNCTION__, size*nmemb);
ESP_EARLY_LOGV(TAG, "%s read %u", __FUNCTION__, size * nmemb);
size_t sz = esp_apptrace_fread(ESP_APPTRACE_DEST_TRAX, ptr, size, nmemb, stream);
ESP_EARLY_LOGV(TAG, "%s actually read %u", __FUNCTION__, sz);
return sz;

View File

@ -17,7 +17,7 @@
#include "esp_heap_trace.h"
#undef HEAP_TRACE_SRCFILE
#if CONFIG_SYSVIEW_ENABLE
#if CONFIG_APPTRACE_SV_ENABLE
#include "esp_app_trace.h"
#include "esp_sysview_trace.h"
#endif
@ -26,7 +26,7 @@
#ifdef CONFIG_HEAP_TRACING_TOHOST
#if !CONFIG_SYSVIEW_ENABLE
#if !CONFIG_APPTRACE_SV_ENABLE
#error None of the heap tracing backends is enabled! You must enable SystemView compatible tracing to use this feature.
#endif
@ -42,7 +42,7 @@ esp_err_t heap_trace_init_tohost(void)
esp_err_t heap_trace_start(heap_trace_mode_t mode_param)
{
#if CONFIG_SYSVIEW_ENABLE
#if CONFIG_APPTRACE_SV_ENABLE
esp_err_t ret = esp_sysview_heap_trace_start((uint32_t)-1);
if (ret != ESP_OK) {
return ret;
@ -55,7 +55,7 @@ esp_err_t heap_trace_start(heap_trace_mode_t mode_param)
esp_err_t heap_trace_stop(void)
{
esp_err_t ret = ESP_ERR_NOT_SUPPORTED;
#if CONFIG_SYSVIEW_ENABLE
#if CONFIG_APPTRACE_SV_ENABLE
ret = esp_sysview_heap_trace_stop();
#endif
s_tracing = false;
@ -88,7 +88,7 @@ static IRAM_ATTR void record_allocation(const heap_trace_record_t *record)
if (!s_tracing) {
return;
}
#if CONFIG_SYSVIEW_ENABLE
#if CONFIG_APPTRACE_SV_ENABLE
esp_sysview_heap_trace_alloc(record->address, record->size, record->alloced_by);
#endif
}
@ -103,7 +103,7 @@ static IRAM_ATTR void record_free(void *p, void **callers)
if (!s_tracing) {
return;
}
#if CONFIG_SYSVIEW_ENABLE
#if CONFIG_APPTRACE_SV_ENABLE
esp_sysview_heap_trace_free(p, callers);
#endif
}

View File

@ -26,8 +26,11 @@ extern "C" {
* Application trace data destinations bits.
*/
typedef enum {
ESP_APPTRACE_DEST_TRAX = 0x1, ///< JTAG destination
ESP_APPTRACE_DEST_UART0 = 0x2, ///< UART destination
ESP_APPTRACE_DEST_JTAG = 1, ///< JTAG destination
ESP_APPTRACE_DEST_TRAX = ESP_APPTRACE_DEST_JTAG, ///< xxx_TRAX name is obsolete, use more common xxx_JTAG
ESP_APPTRACE_DEST_UART0, ///< UART0 destination
ESP_APPTRACE_DEST_MAX = ESP_APPTRACE_DEST_UART0,
ESP_APPTRACE_DEST_NUM
} esp_apptrace_dest_t;
/**

View File

@ -20,6 +20,7 @@ extern "C" {
#include "freertos/FreeRTOS.h"
#include "esp_err.h"
#include "esp_timer.h"
/** Infinite waiting timeout */
#define ESP_APPTRACE_TMO_INFINITE ((uint32_t)-1)
@ -30,9 +31,9 @@ extern "C" {
* periodically to check timeout for expiration.
*/
typedef struct {
uint32_t start; ///< time interval start (in CPU ticks)
uint32_t tmo; ///< timeout value (in us)
uint32_t elapsed; ///< elapsed time (in us)
int64_t start; ///< time interval start (in us)
int64_t tmo; ///< timeout value (in us)
int64_t elapsed; ///< elapsed time (in us)
} esp_apptrace_tmo_t;
/**
@ -43,23 +44,23 @@ typedef struct {
*/
static inline void esp_apptrace_tmo_init(esp_apptrace_tmo_t *tmo, uint32_t user_tmo)
{
tmo->start = portGET_RUN_TIME_COUNTER_VALUE();
tmo->tmo = user_tmo;
tmo->start = esp_timer_get_time();
tmo->tmo = user_tmo == ESP_APPTRACE_TMO_INFINITE ? (int64_t)-1 : (int64_t)user_tmo;
tmo->elapsed = 0;
}
/**
* @brief Checks timeout for expiration.
*
* @param tmo Pointer to timeout structure to be initialized.
* @param tmo Pointer to timeout structure.
*
* @return ESP_OK on success, otherwise \see esp_err_t
* @return number of remaining us till tmo.
*/
esp_err_t esp_apptrace_tmo_check(esp_apptrace_tmo_t *tmo);
static inline uint32_t esp_apptrace_tmo_remaining_us(esp_apptrace_tmo_t *tmo)
{
return tmo->tmo != ESP_APPTRACE_TMO_INFINITE ? (tmo->elapsed - tmo->tmo) : ESP_APPTRACE_TMO_INFINITE;
return tmo->tmo != (int64_t)-1 ? (tmo->elapsed - tmo->tmo) : ESP_APPTRACE_TMO_INFINITE;
}
/** Tracing module synchronization lock */
@ -168,6 +169,30 @@ uint32_t esp_apptrace_rb_read_size_get(esp_apptrace_rb_t *rb);
*/
uint32_t esp_apptrace_rb_write_size_get(esp_apptrace_rb_t *rb);
int esp_apptrace_log_lock(void);
void esp_apptrace_log_unlock(void);
#define ESP_APPTRACE_LOG( format, ... ) \
do { \
esp_apptrace_log_lock(); \
esp_rom_printf(format, ##__VA_ARGS__); \
esp_apptrace_log_unlock(); \
} while(0)
#define ESP_APPTRACE_LOG_LEV( _L_, level, format, ... ) \
do { \
if (LOG_LOCAL_LEVEL >= level) { \
ESP_APPTRACE_LOG(LOG_FORMAT(_L_, format), esp_log_early_timestamp(), TAG, ##__VA_ARGS__); \
} \
} while(0)
#define ESP_APPTRACE_LOGE( format, ... ) ESP_APPTRACE_LOG_LEV(E, ESP_LOG_ERROR, format, ##__VA_ARGS__)
#define ESP_APPTRACE_LOGW( format, ... ) ESP_APPTRACE_LOG_LEV(W, ESP_LOG_WARN, format, ##__VA_ARGS__)
#define ESP_APPTRACE_LOGI( format, ... ) ESP_APPTRACE_LOG_LEV(I, ESP_LOG_INFO, format, ##__VA_ARGS__)
#define ESP_APPTRACE_LOGD( format, ... ) ESP_APPTRACE_LOG_LEV(D, ESP_LOG_DEBUG, format, ##__VA_ARGS__)
#define ESP_APPTRACE_LOGV( format, ... ) ESP_APPTRACE_LOG_LEV(V, ESP_LOG_VERBOSE, format, ##__VA_ARGS__)
#define ESP_APPTRACE_LOGO( format, ... ) ESP_APPTRACE_LOG_LEV(E, ESP_LOG_NONE, format, ##__VA_ARGS__)
#ifdef __cplusplus
}
#endif

View File

@ -20,7 +20,7 @@ extern "C" {
#include <stdarg.h>
#include "esp_err.h"
#include "SEGGER_RTT.h" // SEGGER_RTT_ESP32_Flush
#include "SEGGER_RTT.h" // SEGGER_RTT_ESP_Flush
#include "esp_app_trace_util.h" // ESP_APPTRACE_TMO_INFINITE
/**
@ -32,7 +32,7 @@ extern "C" {
*/
static inline esp_err_t esp_sysview_flush(uint32_t tmo)
{
SEGGER_RTT_ESP32_Flush(0, tmo);
SEGGER_RTT_ESP_Flush(0, tmo);
return ESP_OK;
}

View File

@ -3,17 +3,21 @@ archive: libapp_trace.a
entries:
app_trace (noflash)
app_trace_util (noflash)
if SYSVIEW_ENABLE = y:
if APPTRACE_MEMBUFS_APPTRACE_PROTO_ENABLE:
app_trace_membufs_proto (noflash)
if APPTRACE_DEST_JTAG = y:
port (noflash)
if APPTRACE_SV_ENABLE = y:
SEGGER_SYSVIEW (noflash)
SEGGER_RTT_esp32 (noflash)
SEGGER_RTT_esp (noflash)
SEGGER_SYSVIEW_Config_FreeRTOS (noflash)
SEGGER_SYSVIEW_FreeRTOS (noflash)
[mapping:driver]
[mapping:app_trace_driver]
archive: libdriver.a
entries:
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:
if APPTRACE_SV_TS_SOURCE_TIMER_00 = y || APPTRACE_SV_TS_SOURCE_TIMER_01 = y
|| APPTRACE_SV_TS_SOURCE_TIMER_10 = y || APPTRACE_SV_TS_SOURCE_TIMER_11 = y:
timer (noflash)
else:
* (default)

View File

@ -0,0 +1,43 @@
// Copyright 2020 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_APP_TRACE_PORT_H_
#define ESP_APP_TRACE_PORT_H_
#include "esp_app_trace_util.h"
#ifdef __cplusplus
extern "C" {
#endif
/** Apptrace HW interface. */
typedef struct {
esp_err_t (*init)(void *hw_data);
uint8_t *(*get_up_buffer)(void *hw_data, uint32_t, esp_apptrace_tmo_t *);
esp_err_t (*put_up_buffer)(void *hw_data, uint8_t *, esp_apptrace_tmo_t *);
esp_err_t (*flush_up_buffer_nolock)(void *hw_data, uint32_t, esp_apptrace_tmo_t *);
esp_err_t (*flush_up_buffer)(void *hw_data, esp_apptrace_tmo_t *);
void (*down_buffer_config)(void *hw_data, uint8_t *buf, uint32_t size);
uint8_t *(*get_down_buffer)(void *hw_data, uint32_t *, esp_apptrace_tmo_t *);
esp_err_t (*put_down_buffer)(void *hw_data, uint8_t *, esp_apptrace_tmo_t *);
bool (*host_is_connected)(void *hw_data);
} esp_apptrace_hw_t;
esp_apptrace_hw_t *esp_apptrace_jtag_hw_get(void **data);
esp_apptrace_hw_t *esp_apptrace_uart_hw_get(int num, void **data);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,374 @@
#include "esp_log.h"
#include "esp_app_trace_membufs_proto.h"
#include "esp_app_trace_port.h"
/** RISCV HW transport data */
typedef struct {
uint8_t inited; // initialization state flags for every core
#if CONFIG_APPTRACE_LOCK_ENABLE
esp_apptrace_lock_t lock; // sync lock
#endif
esp_apptrace_membufs_proto_data_t membufs;
} esp_apptrace_riscv_data_t;
/** RISCV memory host iface control block */
typedef struct {
uint32_t ctrl;
// - Guard field. If this register is not zero then CPU is changing this struct and
// this guard field holds address of the instruction which application will execute when CPU finishes with those modifications.
uint32_t stat;
esp_apptrace_mem_block_t * mem_blocks;
} esp_apptrace_riscv_ctrl_block_t;
#define RISCV_APPTRACE_SYSNR 0x64
#define ESP_APPTRACE_RISCV_BLOCK_LEN_MSK 0x7FFFUL
#define ESP_APPTRACE_RISCV_BLOCK_LEN(_l_) ((_l_) & ESP_APPTRACE_RISCV_BLOCK_LEN_MSK)
#define ESP_APPTRACE_RISCV_BLOCK_LEN_GET(_v_) ((_v_) & ESP_APPTRACE_RISCV_BLOCK_LEN_MSK)
#define ESP_APPTRACE_RISCV_BLOCK_ID_MSK 0x7FUL
#define ESP_APPTRACE_RISCV_BLOCK_ID(_id_) (((_id_) & ESP_APPTRACE_RISCV_BLOCK_ID_MSK) << 15)
#define ESP_APPTRACE_RISCV_BLOCK_ID_GET(_v_) (((_v_) >> 15) & ESP_APPTRACE_RISCV_BLOCK_ID_MSK)
#define ESP_APPTRACE_RISCV_HOST_DATA (1 << 22)
#define ESP_APPTRACE_RISCV_HOST_CONNECT (1 << 23)
#define ESP_APPTRACE_RISCV_INITED(_hw_) ((_hw_)->inited & (1 << 0/*cpu_hal_get_core_id()*/))
static esp_err_t esp_apptrace_riscv_init(esp_apptrace_riscv_data_t *hw_data);
static esp_err_t esp_apptrace_riscv_flush(esp_apptrace_riscv_data_t *hw_data, esp_apptrace_tmo_t *tmo);
static esp_err_t esp_apptrace_riscv_flush_nolock(esp_apptrace_riscv_data_t *hw_data, uint32_t min_sz, esp_apptrace_tmo_t *tmo);
static uint8_t *esp_apptrace_riscv_up_buffer_get(esp_apptrace_riscv_data_t *hw_data, uint32_t size, esp_apptrace_tmo_t *tmo);
static esp_err_t esp_apptrace_riscv_up_buffer_put(esp_apptrace_riscv_data_t *hw_data, uint8_t *ptr, esp_apptrace_tmo_t *tmo);
static void esp_apptrace_riscv_down_buffer_config(esp_apptrace_riscv_data_t *hw_data, uint8_t *buf, uint32_t size);
static uint8_t *esp_apptrace_riscv_down_buffer_get(esp_apptrace_riscv_data_t *hw_data, uint32_t *size, esp_apptrace_tmo_t *tmo);
static esp_err_t esp_apptrace_riscv_down_buffer_put(esp_apptrace_riscv_data_t *hw_data, uint8_t *ptr, esp_apptrace_tmo_t *tmo);
static bool esp_apptrace_riscv_host_is_connected(esp_apptrace_riscv_data_t *hw_data);
static esp_err_t esp_apptrace_riscv_buffer_swap_start(uint32_t curr_block_id);
static esp_err_t esp_apptrace_riscv_buffer_swap(uint32_t new_block_id);
static esp_err_t esp_apptrace_riscv_buffer_swap_end(uint32_t new_block_id, uint32_t prev_block_len);
static bool esp_apptrace_riscv_host_data_pending(void);
const static char *TAG = "esp_apptrace";
static esp_apptrace_riscv_ctrl_block_t s_tracing_ctrl[portNUM_PROCESSORS];
esp_apptrace_hw_t *esp_apptrace_uart_hw_get(int num, void **data)
{
return NULL;
}
esp_apptrace_hw_t *esp_apptrace_jtag_hw_get(void **data)
{
#if CONFIG_APPTRACE_DEST_JTAG
static esp_apptrace_membufs_proto_hw_t s_trace_proto_hw = {
.swap_start = esp_apptrace_riscv_buffer_swap_start,
.swap = esp_apptrace_riscv_buffer_swap,
.swap_end = esp_apptrace_riscv_buffer_swap_end,
.host_data_pending = esp_apptrace_riscv_host_data_pending,
};
static esp_apptrace_riscv_data_t s_trace_hw_data = {
.membufs = {
.hw = &s_trace_proto_hw,
},
};
static esp_apptrace_hw_t s_trace_hw = {
.init = (esp_err_t (*)(void *))esp_apptrace_riscv_init,
.get_up_buffer = (uint8_t *(*)(void *, uint32_t, esp_apptrace_tmo_t *))esp_apptrace_riscv_up_buffer_get,
.put_up_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_riscv_up_buffer_put,
.flush_up_buffer_nolock = (esp_err_t (*)(void *, uint32_t, esp_apptrace_tmo_t *))esp_apptrace_riscv_flush_nolock,
.flush_up_buffer = (esp_err_t (*)(void *, esp_apptrace_tmo_t *))esp_apptrace_riscv_flush,
.down_buffer_config = (void (*)(void *, uint8_t *, uint32_t ))esp_apptrace_riscv_down_buffer_config,
.get_down_buffer = (uint8_t *(*)(void *, uint32_t *, esp_apptrace_tmo_t *))esp_apptrace_riscv_down_buffer_get,
.put_down_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_riscv_down_buffer_put,
.host_is_connected = (bool (*)(void *))esp_apptrace_riscv_host_is_connected,
};
*data = &s_trace_hw_data;
return &s_trace_hw;
#else
return NULL;
#endif
}
/* Advertises apptrace control block address to host.
This function can be overriden with custom implementation,
e.g. OpenOCD flasher stub use own implementation of it. */
__attribute__((weak)) int esp_apptrace_advertise_ctrl_block(void *ctrl_block_addr)
{
register int sys_nr = RISCV_APPTRACE_SYSNR;
register int host_ret = 0;
if (!esp_cpu_in_ocd_debug_mode()) {
return 0;
}
__asm__ volatile ( \
".option push\n" \
".option norvc\n" \
"mv a0, %[sys_nr]\n" \
"mv a1, %[arg1]\n" \
"slli zero,zero,0x1f\n" \
"ebreak\n" \
"srai zero,zero,0x7\n" \
"mv %[host_ret], a0\n" \
".option pop\n" \
:[host_ret]"=r"(host_ret)
:[sys_nr]"r"(sys_nr),[arg1]"r"(ctrl_block_addr):"a0","a1");
return host_ret;
}
/* Returns up buffers config.
This function can be overriden with custom implementation,
e.g. OpenOCD flasher stub use own implementation of it. */
__attribute__((weak)) void esp_apptrace_get_up_buffers(esp_apptrace_mem_block_t mem_blocks_cfg[2])
{
static uint8_t s_mem_blocks[2][CONFIG_APPTRACE_BUF_SIZE];
mem_blocks_cfg[0].start = s_mem_blocks[0];
mem_blocks_cfg[0].sz = CONFIG_APPTRACE_BUF_SIZE;
mem_blocks_cfg[1].start = s_mem_blocks[1];
mem_blocks_cfg[1].sz = CONFIG_APPTRACE_BUF_SIZE;
}
static esp_err_t esp_apptrace_riscv_lock(esp_apptrace_riscv_data_t *hw_data, esp_apptrace_tmo_t *tmo)
{
#if CONFIG_APPTRACE_LOCK_ENABLE
esp_err_t ret = esp_apptrace_lock_take(&hw_data->lock, tmo);
if (ret != ESP_OK) {
return ESP_FAIL;
}
#endif
return ESP_OK;
}
static esp_err_t esp_apptrace_riscv_unlock(esp_apptrace_riscv_data_t *hw_data)
{
esp_err_t ret = ESP_OK;
#if CONFIG_APPTRACE_LOCK_ENABLE
ret = esp_apptrace_lock_give(&hw_data->lock);
#endif
return ret;
}
/*****************************************************************************************/
/***************************** Apptrace HW iface *****************************************/
/*****************************************************************************************/
static esp_err_t esp_apptrace_riscv_init(esp_apptrace_riscv_data_t *hw_data)
{
int core_id = cpu_hal_get_core_id();
if (hw_data->inited == 0) {
esp_apptrace_mem_block_t mem_blocks_cfg[2];
esp_apptrace_get_up_buffers(mem_blocks_cfg);
esp_err_t res = esp_apptrace_membufs_init(&hw_data->membufs, mem_blocks_cfg);
if (res != ESP_OK) {
ESP_APPTRACE_LOGE("Failed to init membufs proto (%d)!", res);
return res;
}
#if CONFIG_APPTRACE_LOCK_ENABLE
esp_apptrace_lock_init(&hw_data->lock);
#endif
}
hw_data->inited |= 1 << core_id;
ESP_APPTRACE_LOGI("Apptrace initialized on CPU%d. Tracing control block @ %p.", core_id, &s_tracing_ctrl[core_id]);
s_tracing_ctrl[core_id].mem_blocks = hw_data->membufs.blocks;
for (int i = 0; i < 2; i++) {
ESP_APPTRACE_LOGD("Mem buf[%d] %d bytes @ %p (%p/%p)", i,
s_tracing_ctrl[core_id].mem_blocks[i].sz, s_tracing_ctrl[core_id].mem_blocks[i].start,
&(s_tracing_ctrl[core_id].mem_blocks[i].start), &(s_tracing_ctrl[core_id].mem_blocks[i].sz));
}
// notify host about control block address
int res = esp_apptrace_advertise_ctrl_block(&s_tracing_ctrl[core_id]);
assert(res == 0 && "Falied to send config to host!");
return ESP_OK;
}
static uint8_t *esp_apptrace_riscv_up_buffer_get(esp_apptrace_riscv_data_t *hw_data, uint32_t size, esp_apptrace_tmo_t *tmo)
{
uint8_t *ptr;
if (!ESP_APPTRACE_RISCV_INITED(hw_data)) {
return NULL;
}
esp_err_t res = esp_apptrace_riscv_lock(hw_data, tmo);
if (res != ESP_OK) {
return NULL;
}
ptr = esp_apptrace_membufs_up_buffer_get(&hw_data->membufs, size, tmo);
// now we can safely unlock apptrace to allow other tasks/ISRs to get other buffers and write their data
if (esp_apptrace_riscv_unlock(hw_data) != ESP_OK) {
assert(false && "Failed to unlock apptrace data!");
}
return ptr;
}
static esp_err_t esp_apptrace_riscv_up_buffer_put(esp_apptrace_riscv_data_t *hw_data, uint8_t *ptr, esp_apptrace_tmo_t *tmo)
{
if (!ESP_APPTRACE_RISCV_INITED(hw_data)) {
return ESP_ERR_INVALID_STATE;
}
// Can avoid locking because esp_apptrace_membufs_up_buffer_put() just modifies buffer's header
esp_err_t res = esp_apptrace_membufs_up_buffer_put(&hw_data->membufs, ptr, tmo);
return res;
}
static void esp_apptrace_riscv_down_buffer_config(esp_apptrace_riscv_data_t *hw_data, uint8_t *buf, uint32_t size)
{
if (!ESP_APPTRACE_RISCV_INITED(hw_data)) {
return;
}
esp_apptrace_membufs_down_buffer_config(&hw_data->membufs, buf, size);
}
static uint8_t *esp_apptrace_riscv_down_buffer_get(esp_apptrace_riscv_data_t *hw_data, uint32_t *size, esp_apptrace_tmo_t *tmo)
{
uint8_t *ptr;
if (!ESP_APPTRACE_RISCV_INITED(hw_data)) {
return NULL;
}
esp_err_t res = esp_apptrace_riscv_lock(hw_data, tmo);
if (res != ESP_OK) {
return NULL;
}
ptr = esp_apptrace_membufs_down_buffer_get(&hw_data->membufs, size, tmo);
// now we can safely unlock apptrace to allow other tasks/ISRs to get other buffers and write their data
if (esp_apptrace_riscv_unlock(hw_data) != ESP_OK) {
assert(false && "Failed to unlock apptrace data!");
}
return ptr;
}
static esp_err_t esp_apptrace_riscv_down_buffer_put(esp_apptrace_riscv_data_t *hw_data, uint8_t *ptr, esp_apptrace_tmo_t *tmo)
{
if (!ESP_APPTRACE_RISCV_INITED(hw_data)) {
return ESP_ERR_INVALID_STATE;
}
// Can avoid locking because esp_apptrace_membufs_down_buffer_put() does nothing
/*esp_err_t res = esp_apptrace_riscv_lock(hw_data, tmo);
if (res != ESP_OK) {
return res;
}*/
esp_err_t res = esp_apptrace_membufs_down_buffer_put(&hw_data->membufs, ptr, tmo);
// now we can safely unlock apptrace to allow other tasks/ISRs to get other buffers and write their data
/*if (esp_apptrace_riscv_unlock(hw_data) != ESP_OK) {
assert(false && "Failed to unlock apptrace data!");
}*/
return res;
}
static bool esp_apptrace_riscv_host_is_connected(esp_apptrace_riscv_data_t *hw_data)
{
if (!ESP_APPTRACE_RISCV_INITED(hw_data)) {
return false;
}
return s_tracing_ctrl[cpu_hal_get_core_id()].ctrl & ESP_APPTRACE_RISCV_HOST_CONNECT ? true : false;
}
static esp_err_t esp_apptrace_riscv_flush_nolock(esp_apptrace_riscv_data_t *hw_data, uint32_t min_sz, esp_apptrace_tmo_t *tmo)
{
if (!ESP_APPTRACE_RISCV_INITED(hw_data)) {
return ESP_ERR_INVALID_STATE;
}
return esp_apptrace_membufs_flush_nolock(&hw_data->membufs, min_sz, tmo);
}
static esp_err_t esp_apptrace_riscv_flush(esp_apptrace_riscv_data_t *hw_data, esp_apptrace_tmo_t *tmo)
{
if (!ESP_APPTRACE_RISCV_INITED(hw_data)) {
return ESP_ERR_INVALID_STATE;
}
esp_err_t res = esp_apptrace_riscv_lock(hw_data, tmo);
if (res != ESP_OK) {
return res;
}
res = esp_apptrace_membufs_flush_nolock(&hw_data->membufs, 0, tmo);
// now we can safely unlock apptrace to allow other tasks/ISRs to get other buffers and write their data
if (esp_apptrace_riscv_unlock(hw_data) != ESP_OK) {
assert(false && "Failed to unlock apptrace data!");
}
return res;
}
/*****************************************************************************************/
/************************** Membufs proto HW iface ***************************************/
/*****************************************************************************************/
static inline void esp_apptrace_riscv_buffer_swap_lock(void)
{
extern uint32_t __esp_apptrace_riscv_updated;
// indicate to host that we are about to update.
// this is used only to place CPU into streaming mode at tracing startup
// before starting streaming host can halt us after we read ESP_APPTRACE_RISCV_CTRL_REG and before we updated it
// HACK: in this case host will set breakpoint just after ESP_APPTRACE_RISCV_CTRL_REG update,
// here we set address to set bp at
// enter ERI update critical section
s_tracing_ctrl[cpu_hal_get_core_id()].stat = (uint32_t)&__esp_apptrace_riscv_updated;
}
static __attribute__((noinline)) void esp_apptrace_riscv_buffer_swap_unlock(void)
{
// exit ERI update critical section
s_tracing_ctrl[cpu_hal_get_core_id()].stat = 0;
// TODO: currently host sets breakpoint, use break instruction to stop;
// it will allow to use ESP_APPTRACE_RISCV_STAT_REG for other purposes
asm volatile (
" .global __esp_apptrace_riscv_updated\n"
"__esp_apptrace_riscv_updated:\n"); // host will set bp here to resolve collision at streaming start
}
static esp_err_t esp_apptrace_riscv_buffer_swap_start(uint32_t curr_block_id)
{
esp_err_t res = ESP_OK;
esp_apptrace_riscv_buffer_swap_lock();
uint32_t ctrl_reg = s_tracing_ctrl[cpu_hal_get_core_id()].ctrl;
uint32_t host_connected = ESP_APPTRACE_RISCV_HOST_CONNECT & ctrl_reg;
if (host_connected) {
uint32_t acked_block = ESP_APPTRACE_RISCV_BLOCK_ID_GET(ctrl_reg);
uint32_t host_to_read = ESP_APPTRACE_RISCV_BLOCK_LEN_GET(ctrl_reg);
if (host_to_read != 0 || acked_block != (curr_block_id & ESP_APPTRACE_RISCV_BLOCK_ID_MSK)) {
ESP_APPTRACE_LOGD("[%d]: Can not switch %x %d %x %x/%lx", cpu_hal_get_core_id(), ctrl_reg, host_to_read, acked_block,
curr_block_id & ESP_APPTRACE_RISCV_BLOCK_ID_MSK, curr_block_id);
res = ESP_ERR_NO_MEM;
goto _on_err;
}
}
return ESP_OK;
_on_err:
esp_apptrace_riscv_buffer_swap_unlock();
return res;
}
static esp_err_t esp_apptrace_riscv_buffer_swap_end(uint32_t new_block_id, uint32_t prev_block_len)
{
uint32_t ctrl_reg = s_tracing_ctrl[cpu_hal_get_core_id()].ctrl;
uint32_t host_connected = ESP_APPTRACE_RISCV_HOST_CONNECT & ctrl_reg;
s_tracing_ctrl[cpu_hal_get_core_id()].ctrl = ESP_APPTRACE_RISCV_BLOCK_ID(new_block_id) |
host_connected | ESP_APPTRACE_RISCV_BLOCK_LEN(prev_block_len);
esp_apptrace_riscv_buffer_swap_unlock();
return ESP_OK;
}
static esp_err_t esp_apptrace_riscv_buffer_swap(uint32_t new_block_id)
{
/* do nothing */
return ESP_OK;
}
static bool esp_apptrace_riscv_host_data_pending(void)
{
uint32_t ctrl_reg = s_tracing_ctrl[cpu_hal_get_core_id()].ctrl;
// ESP_APPTRACE_LOGV("%s() 0x%x", __func__, ctrl_reg);
return (ctrl_reg & ESP_APPTRACE_RISCV_HOST_DATA) ? true : false;
}

View File

@ -0,0 +1,543 @@
//
// How It Works
// ************
// 1. Components Overview
// ======================
// Xtensa has useful feature: TRAX debug module. It allows recording program execution flow at run-time without disturbing CPU.
// Exectution flow data are written to configurable Trace RAM block. Besides accessing Trace RAM itself TRAX module also allows to read/write
// trace memory via its registers by means of JTAG, APB or ERI transactions.
// ESP32 has two Xtensa cores with separate TRAX modules on them and provides two special memory regions to be used as trace memory.
// Chip allows muxing access to those trace memory blocks in such a way that while one block is accessed by CPUs another one can be accessed by host
// by means of reading/writing TRAX registers via JTAG. Blocks muxing is configurable at run-time and allows switching trace memory blocks between
// accessors in round-robin fashion so they can read/write separate memory blocks without disturbing each other.
// This module implements application tracing feature based on above mechanisms. It allows to transfer arbitrary user data to/from
// host via JTAG with minimal impact on system performance. This module is implied to be used in the following tracing scheme.
// ------>------ ----- (host components) -----
// | | | |
// ------------------- ----------------------- ----------------------- ---------------- ------ --------- -----------------
// |trace data source|-->|target tracing module|<--->|TRAX_MEM0 | TRAX_MEM1|---->|TRAX_DATA_REGS|<-->|JTAG|<--->|OpenOCD|-->|trace data sink|
// ------------------- ----------------------- ----------------------- ---------------- ------ --------- -----------------
// | | | |
// | ------<------ ---------------- |
// |<------------------------------------------->|TRAX_CTRL_REGS|<---->|
// ----------------
// In general tracing goes in the following way. User application requests tracing module to send some data by calling esp_apptrace_buffer_get(),
// module allocates necessary buffer in current input trace block. Then user fills received buffer with data and calls esp_apptrace_buffer_put().
// When current input trace block is filled with app data it is exposed to host and the second block becomes input one and buffer filling restarts.
// While target application fills one TRAX block host reads another one via JTAG.
// This module also allows communication in the opposite direction: from host to target. As it was said ESP32 and host can access different TRAX blocks
// simultaneously, so while target writes trace data to one block host can write its own data (e.g. tracing commands) to another one then when
// blocks are switched host receives trace data and target receives data written by host application. Target user application can read host data
// by calling esp_apptrace_read() API.
// To control buffer switching and for other communication purposes this implementation uses some TRAX registers. It is safe since HW TRAX tracing
// can not be used along with application tracing feature so these registers are freely readable/writeable via JTAG from host and via ERI from ESP32 cores.
// Overhead of this implementation on target CPU is produced only by allocating/managing buffers and copying of data.
// On the host side special OpenOCD command must be used to read trace data.
// 2. TRAX Registers layout
// ========================
// This module uses two TRAX HW registers to communicate with host SW (OpenOCD).
// - Control register uses TRAX_DELAYCNT as storage. Only lower 24 bits of TRAX_DELAYCNT are writable. Control register has the following bitfields:
// | 31..XXXXXX..24 | 23 .(host_connect). 23| 22..(block_id)..15 | 14..(block_len)..0 |
// 14..0 bits - actual length of user data in trace memory block. Target updates it every time it fills memory block and exposes it to host.
// Host writes zero to this field when it finishes reading exposed block;
// 21..15 bits - trace memory block transfer ID. Block counter. It can overflow. Updated by target, host should not modify it. Actually can be 2 bits;
// 22 bit - 'host data present' flag. If set to one there is data from host, otherwise - no host data;
// 23 bit - 'host connected' flag. If zero then host is not connected and tracing module works in post-mortem mode, otherwise in streaming mode;
// - Status register uses TRAX_TRIGGERPC as storage. If this register is not zero then current CPU is changing TRAX registers and
// this register holds address of the instruction which application will execute when it finishes with those registers modifications.
// See 'Targets Connection' setion for details.
// 3. Modes of operation
// =====================
// This module supports two modes of operation:
// - Post-mortem mode. This is the default mode. In this mode application tracing module does not check whether host has read all the data from block
// exposed to it and switches block in any case. The mode does not need host interaction for operation and so can be useful when only the latest
// 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_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.
// On panic tracing module also waits (timeout is configured via menuconfig via CONFIG_APPTRACE_ONPANIC_HOST_FLUSH_TMO) for the host to read all data.
// 4. Communication Protocol
// =========================
// 4.1 Trace Memory Blocks
// -----------------------
// Communication is controlled via special register. Host periodically polls control register on each core to find out if there are any data available.
// When current input memory block is filled it is exposed to host and 'block_len' and 'block_id' fields are updated in the control register.
// Host reads new register value and according to it's value starts reading data from exposed block. Meanwhile target starts filling another trace block.
// When host finishes reading the block it clears 'block_len' field in control register indicating to the target that it is ready to accept the next one.
// If the host has some data to transfer to the target it writes them to trace memory block before clearing 'block_len' field. Then it sets
// 'host_data_present' bit and clears 'block_len' field in control register. Upon every block switch target checks 'host_data_present' bit and if it is set
// reads them to down buffer before writing any trace data to switched TRAX block.
// 4.2 User Data Chunks Level
// --------------------------
// Since trace memory block is shared between user data chunks and data copying is performed on behalf of the API user (in its normal context) in
// multithreading environment it can happen that task/ISR which copies data is preempted by another high prio task/ISR. So it is possible situation
// that task/ISR will fail to complete filling its data chunk before the whole trace block is exposed to the host. To handle such conditions tracing
// module prepends all user data chunks with header which contains allocated buffer size and actual data length within it. OpenOCD command
// which reads application traces reports error when it reads incomplete user data block.
// Data which are transffered from host to target are also prepended with a header. Down channel data header is simple and consists of one two bytes field
// containing length of host data following the header.
// 4.3 Data Buffering
// ------------------
// It takes some time for the host to read TRAX memory block via JTAG. In streaming mode it can happen that target has filled its TRAX block, but host
// has not completed reading of the previous one yet. So in this case time critical tracing calls (which can not be delayed for too long time due to
// the lack of free memory in TRAX block) can be dropped. To avoid such scenarios tracing module implements data buffering. Buffered data will be sent
// to the host later when TRAX block switch occurs. The maximum size of the buffered data is controlled by menuconfig option
// CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX.
// 4.4 Target Connection/Disconnection
// -----------------------------------
// When host is going to start tracing in streaming mode it needs to put both ESP32 cores into initial state when 'host connected' bit is set
// on both cores. To accomplish this host halts both cores and sets this bit in TRAX registers. But target code can be halted in state when it has read control
// register but has not updated its value. To handle such situations target code indicates to the host that it is updating control register by writing
// non-zero value to status register. Actually it writes address of the instruction which it will execute when it finishes with
// the registers update. When target is halted during control register update host sets breakpoint at the address from status register and resumes CPU.
// After target code finishes with register update it is halted on breakpoint, host detects it and safely sets 'host connected' bit. When both cores
// are set up they are resumed. Tracing starts without further intrusion into CPUs work.
// When host is going to stop tracing in streaming mode it needs to disconnect targets. Disconnection process is done using the same algorithm
// as for connecting, but 'host connected' bits are cleared on ESP32 cores.
// 5. Module Access Synchronization
// ================================
// Access to internal module's data is synchronized with custom mutex. Mutex is a wrapper for portMUX_TYPE and uses almost the same sync mechanism as in
// vPortCPUAcquireMutex/vPortCPUReleaseMutex. The mechanism uses S32C1I Xtensa instruction to implement exclusive access to module's data from tasks and
// ISRs running on both cores. Also custom mutex allows specifying timeout for locking operation. Locking routine checks underlaying mutex in cycle until
// it gets its ownership or timeout expires. The differences of application tracing module's mutex implementation from vPortCPUAcquireMutex/vPortCPUReleaseMutex are:
// - Support for timeouts.
// - Local IRQs for CPU which owns the mutex are disabled till the call to unlocking routine. This is made to avoid possible task's prio inversion.
// When low prio task takes mutex and enables local IRQs gets preempted by high prio task which in its turn can try to acquire mutex using infinite timeout.
// So no local task switch occurs when mutex is locked. But this does not apply to tasks on another CPU.
// WARNING: Priority inversion can happen when low prio task works on one CPU and medium and high prio tasks work on another.
// WARNING: Care must be taken when selecting timeout values for trace calls from ISRs. Tracing module does not care about watchdogs when waiting
// on internal locks and for host to complete previous block reading, so if timeout value exceeds watchdog's one it can lead to the system reboot.
// 6. Timeouts
// ===========
// Timeout mechanism is based on xthal_get_ccount() routine and supports timeout values in microseconds.
// There are two situations when task/ISR can be delayed by tracing API call. Timeout mechanism takes into account both conditions:
// - Trace data are locked by another task/ISR. When wating on trace data lock.
// - Current TRAX memory input block is full when working in streaming mode (host is connected). When waiting for host to complete previous block reading.
// When wating for any of above conditions xthal_get_ccount() is called periodically to calculate time elapsed from trace API routine entry. When elapsed
// time exceeds specified timeout value operation is canceled and ESP_ERR_TIMEOUT code is returned.
#include "sdkconfig.h"
#include "soc/soc.h"
#include "soc/dport_access.h"
#if CONFIG_IDF_TARGET_ESP32
#include "soc/dport_reg.h"
#elif CONFIG_IDF_TARGET_ESP32S2
#include "soc/sensitive_reg.h"
#endif
#include "eri.h"
#include "trax.h"
#include "esp_log.h"
#include "esp_app_trace_membufs_proto.h"
#include "esp_app_trace_port.h"
// TODO: move these (and same definitions in trax.c to dport_reg.h)
#if CONFIG_IDF_TARGET_ESP32
#define TRACEMEM_MUX_PROBLK0_APPBLK1 0
#define TRACEMEM_MUX_BLK0_ONLY 1
#define TRACEMEM_MUX_BLK1_ONLY 2
#define TRACEMEM_MUX_PROBLK1_APPBLK0 3
#elif CONFIG_IDF_TARGET_ESP32S2
#define TRACEMEM_MUX_BLK0_NUM 19
#define TRACEMEM_MUX_BLK1_NUM 20
#define TRACEMEM_BLK_NUM2ADDR(_n_) (0x3FFB8000UL + 0x4000UL*((_n_)-4))
#endif
// TRAX is disabled, so we use its registers for our own purposes
// | 31..XXXXXX..24 | 23 .(host_connect). 23 | 22 .(host_data). 22| 21..(block_id)..15 | 14..(block_len)..0 |
#define ESP_APPTRACE_TRAX_CTRL_REG ERI_TRAX_DELAYCNT
#define ESP_APPTRACE_TRAX_STAT_REG ERI_TRAX_TRIGGERPC
#define ESP_APPTRACE_TRAX_BLOCK_LEN_MSK 0x7FFFUL
#define ESP_APPTRACE_TRAX_BLOCK_LEN(_l_) ((_l_) & ESP_APPTRACE_TRAX_BLOCK_LEN_MSK)
#define ESP_APPTRACE_TRAX_BLOCK_LEN_GET(_v_) ((_v_) & ESP_APPTRACE_TRAX_BLOCK_LEN_MSK)
#define ESP_APPTRACE_TRAX_BLOCK_ID_MSK 0x7FUL
#define ESP_APPTRACE_TRAX_BLOCK_ID(_id_) (((_id_) & ESP_APPTRACE_TRAX_BLOCK_ID_MSK) << 15)
#define ESP_APPTRACE_TRAX_BLOCK_ID_GET(_v_) (((_v_) >> 15) & ESP_APPTRACE_TRAX_BLOCK_ID_MSK)
#define ESP_APPTRACE_TRAX_HOST_DATA (1 << 22)
#define ESP_APPTRACE_TRAX_HOST_CONNECT (1 << 23)
#define ESP_APPTRACE_TRAX_INITED(_hw_) ((_hw_)->inited & (1 << cpu_hal_get_core_id()))
#if CONFIG_IDF_TARGET_ESP32
static uint8_t * const s_trax_blocks[] = {
(uint8_t *) 0x3FFFC000,
(uint8_t *) 0x3FFF8000
};
#elif CONFIG_IDF_TARGET_ESP32S2
static uint8_t * const s_trax_blocks[] = {
(uint8_t *)TRACEMEM_BLK_NUM2ADDR(TRACEMEM_MUX_BLK0_NUM),
(uint8_t *)TRACEMEM_BLK_NUM2ADDR(TRACEMEM_MUX_BLK1_NUM)
};
#endif
#define ESP_APPTRACE_TRAX_BLOCK_SIZE (0x4000UL)
/** TRAX HW transport data */
typedef struct {
uint8_t inited;
#if CONFIG_APPTRACE_LOCK_ENABLE
esp_apptrace_lock_t lock; // sync lock
#endif
esp_apptrace_membufs_proto_data_t membufs;
} esp_apptrace_trax_data_t;
static esp_err_t esp_apptrace_trax_init(esp_apptrace_trax_data_t *hw_data);
static esp_err_t esp_apptrace_trax_flush(esp_apptrace_trax_data_t *hw_data, esp_apptrace_tmo_t *tmo);
static esp_err_t esp_apptrace_trax_flush_nolock(esp_apptrace_trax_data_t *hw_data, uint32_t min_sz, esp_apptrace_tmo_t *tmo);
static uint8_t *esp_apptrace_trax_up_buffer_get(esp_apptrace_trax_data_t *hw_data, uint32_t size, esp_apptrace_tmo_t *tmo);
static esp_err_t esp_apptrace_trax_up_buffer_put(esp_apptrace_trax_data_t *hw_data, uint8_t *ptr, esp_apptrace_tmo_t *tmo);
static void esp_apptrace_trax_down_buffer_config(esp_apptrace_trax_data_t *hw_data, uint8_t *buf, uint32_t size);
static uint8_t *esp_apptrace_trax_down_buffer_get(esp_apptrace_trax_data_t *hw_data, uint32_t *size, esp_apptrace_tmo_t *tmo);
static esp_err_t esp_apptrace_trax_down_buffer_put(esp_apptrace_trax_data_t *hw_data, uint8_t *ptr, esp_apptrace_tmo_t *tmo);
static bool esp_apptrace_trax_host_is_connected(esp_apptrace_trax_data_t *hw_data);
static esp_err_t esp_apptrace_trax_buffer_swap_start(uint32_t curr_block_id);
static esp_err_t esp_apptrace_trax_buffer_swap(uint32_t new_block_id);
static esp_err_t esp_apptrace_trax_buffer_swap_end(uint32_t new_block_id, uint32_t prev_block_len);
static bool esp_apptrace_trax_host_data_pending(void);
const static char *TAG = "esp_apptrace";
esp_apptrace_hw_t *esp_apptrace_uart_hw_get(int num, void **data)
{
return NULL;
}
esp_apptrace_hw_t *esp_apptrace_jtag_hw_get(void **data)
{
#if CONFIG_APPTRACE_DEST_JTAG
static esp_apptrace_membufs_proto_hw_t s_trax_proto_hw = {
.swap_start = esp_apptrace_trax_buffer_swap_start,
.swap = esp_apptrace_trax_buffer_swap,
.swap_end = esp_apptrace_trax_buffer_swap_end,
.host_data_pending = esp_apptrace_trax_host_data_pending,
};
static esp_apptrace_trax_data_t s_trax_hw_data = {
.membufs = {
.hw = &s_trax_proto_hw,
},
};
static esp_apptrace_hw_t s_trax_hw = {
.init = (esp_err_t (*)(void *))esp_apptrace_trax_init,
.get_up_buffer = (uint8_t *(*)(void *, uint32_t, esp_apptrace_tmo_t *))esp_apptrace_trax_up_buffer_get,
.put_up_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_trax_up_buffer_put,
.flush_up_buffer_nolock = (esp_err_t (*)(void *, uint32_t, esp_apptrace_tmo_t *))esp_apptrace_trax_flush_nolock,
.flush_up_buffer = (esp_err_t (*)(void *, esp_apptrace_tmo_t *))esp_apptrace_trax_flush,
.down_buffer_config = (void (*)(void *, uint8_t *, uint32_t ))esp_apptrace_trax_down_buffer_config,
.get_down_buffer = (uint8_t *(*)(void *, uint32_t *, esp_apptrace_tmo_t *))esp_apptrace_trax_down_buffer_get,
.put_down_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_trax_down_buffer_put,
.host_is_connected = (bool (*)(void *))esp_apptrace_trax_host_is_connected,
};
*data = &s_trax_hw_data;
return &s_trax_hw;
#else
return NULL;
#endif
}
static esp_err_t esp_apptrace_trax_lock(esp_apptrace_trax_data_t *hw_data, esp_apptrace_tmo_t *tmo)
{
#if CONFIG_APPTRACE_LOCK_ENABLE
esp_err_t ret = esp_apptrace_lock_take(&hw_data->lock, tmo);
if (ret != ESP_OK) {
return ESP_FAIL;
}
#endif
return ESP_OK;
}
static esp_err_t esp_apptrace_trax_unlock(esp_apptrace_trax_data_t *hw_data)
{
esp_err_t ret = ESP_OK;
#if CONFIG_APPTRACE_LOCK_ENABLE
ret = esp_apptrace_lock_give(&hw_data->lock);
#endif
return ret;
}
static inline void esp_apptrace_trax_hw_init(void)
{
// Stop trace, if any (on the current CPU)
eri_write(ERI_TRAX_TRAXCTRL, TRAXCTRL_TRSTP);
eri_write(ERI_TRAX_TRAXCTRL, TRAXCTRL_TMEN);
eri_write(ESP_APPTRACE_TRAX_CTRL_REG, ESP_APPTRACE_TRAX_BLOCK_ID(0));
// this is for OpenOCD to let him know where stub entries vector is resided
// must be read by host before any transfer using TRAX
eri_write(ESP_APPTRACE_TRAX_STAT_REG, 0);
ESP_APPTRACE_LOGI("Initialized TRAX on CPU%d", cpu_hal_get_core_id());
}
static inline void esp_apptrace_trax_select_memory_block(int block_num)
{
// select memory block to be exposed to the TRAX module (accessed by host)
#if CONFIG_IDF_TARGET_ESP32
DPORT_WRITE_PERI_REG(DPORT_TRACEMEM_MUX_MODE_REG, block_num ? TRACEMEM_MUX_BLK0_ONLY : TRACEMEM_MUX_BLK1_ONLY);
#elif CONFIG_IDF_TARGET_ESP32S2
WRITE_PERI_REG(DPORT_PMS_OCCUPY_3_REG, block_num ? BIT(TRACEMEM_MUX_BLK0_NUM-4) : BIT(TRACEMEM_MUX_BLK1_NUM-4));
#endif
}
static inline void esp_apptrace_trax_memory_enable(void)
{
#if CONFIG_IDF_TARGET_ESP32
/* Enable trace memory on PRO CPU */
DPORT_WRITE_PERI_REG(DPORT_PRO_TRACEMEM_ENA_REG, DPORT_PRO_TRACEMEM_ENA_M);
#if CONFIG_FREERTOS_UNICORE == 0
/* Enable trace memory on APP CPU */
DPORT_WRITE_PERI_REG(DPORT_APP_TRACEMEM_ENA_REG, DPORT_APP_TRACEMEM_ENA_M);
#endif
#endif
}
/*****************************************************************************************/
/***************************** Apptrace HW iface *****************************************/
/*****************************************************************************************/
static esp_err_t esp_apptrace_trax_init(esp_apptrace_trax_data_t *hw_data)
{
int core_id = cpu_hal_get_core_id();
// 'esp_apptrace_trax_init()' is called on every core, so ensure to do main initialization only once
if (core_id == 0) {
esp_apptrace_mem_block_t mem_blocks_cfg[2] = {
{
.start = s_trax_blocks[0],
.sz = ESP_APPTRACE_TRAX_BLOCK_SIZE
},
{
.start = s_trax_blocks[1],
.sz = ESP_APPTRACE_TRAX_BLOCK_SIZE
},
};
esp_err_t res = esp_apptrace_membufs_init(&hw_data->membufs, mem_blocks_cfg);
if (res != ESP_OK) {
ESP_APPTRACE_LOGE("Failed to init membufs proto (%d)!", res);
return res;
}
#if CONFIG_APPTRACE_LOCK_ENABLE
esp_apptrace_lock_init(&hw_data->lock);
#endif
esp_apptrace_trax_memory_enable();
esp_apptrace_trax_select_memory_block(0);
}
// init TRAX on this CPU
esp_apptrace_trax_hw_init();
hw_data->inited |= 1 << core_id;
return ESP_OK;
}
static uint8_t *esp_apptrace_trax_up_buffer_get(esp_apptrace_trax_data_t *hw_data, uint32_t size, esp_apptrace_tmo_t *tmo)
{
uint8_t *ptr;
if (!ESP_APPTRACE_TRAX_INITED(hw_data)) {
return NULL;
}
esp_err_t res = esp_apptrace_trax_lock(hw_data, tmo);
if (res != ESP_OK) {
return NULL;
}
ptr = esp_apptrace_membufs_up_buffer_get(&hw_data->membufs, size, tmo);
// now we can safely unlock apptrace to allow other tasks/ISRs to get other buffers and write their data
if (esp_apptrace_trax_unlock(hw_data) != ESP_OK) {
assert(false && "Failed to unlock apptrace data!");
}
return ptr;
}
static esp_err_t esp_apptrace_trax_up_buffer_put(esp_apptrace_trax_data_t *hw_data, uint8_t *ptr, esp_apptrace_tmo_t *tmo)
{
if (!ESP_APPTRACE_TRAX_INITED(hw_data)) {
return ESP_ERR_INVALID_STATE;
}
// Can avoid locking because esp_apptrace_membufs_up_buffer_put() just modifies buffer's header
esp_err_t res = esp_apptrace_membufs_up_buffer_put(&hw_data->membufs, ptr, tmo);
return res;
}
static void esp_apptrace_trax_down_buffer_config(esp_apptrace_trax_data_t *hw_data, uint8_t *buf, uint32_t size)
{
if (!ESP_APPTRACE_TRAX_INITED(hw_data)) {
return;
}
esp_apptrace_membufs_down_buffer_config(&hw_data->membufs, buf, size);
}
static uint8_t *esp_apptrace_trax_down_buffer_get(esp_apptrace_trax_data_t *hw_data, uint32_t *size, esp_apptrace_tmo_t *tmo)
{
uint8_t *ptr;
if (!ESP_APPTRACE_TRAX_INITED(hw_data)) {
return NULL;
}
esp_err_t res = esp_apptrace_trax_lock(hw_data, tmo);
if (res != ESP_OK) {
return NULL;
}
ptr = esp_apptrace_membufs_down_buffer_get(&hw_data->membufs, size, tmo);
// now we can safely unlock apptrace to allow other tasks/ISRs to get other buffers and write their data
if (esp_apptrace_trax_unlock(hw_data) != ESP_OK) {
assert(false && "Failed to unlock apptrace data!");
}
return ptr;
}
static esp_err_t esp_apptrace_trax_down_buffer_put(esp_apptrace_trax_data_t *hw_data, uint8_t *ptr, esp_apptrace_tmo_t *tmo)
{
if (!ESP_APPTRACE_TRAX_INITED(hw_data)) {
return ESP_ERR_INVALID_STATE;
}
// Can avoid locking because esp_apptrace_membufs_down_buffer_put() does nothing
/*esp_err_t res = esp_apptrace_trax_lock(hw_data, tmo);
if (res != ESP_OK) {
return res;
}*/
esp_err_t res = esp_apptrace_membufs_down_buffer_put(&hw_data->membufs, ptr, tmo);
// now we can safely unlock apptrace to allow other tasks/ISRs to get other buffers and write their data
/*if (esp_apptrace_trax_unlock(hw_data) != ESP_OK) {
assert(false && "Failed to unlock apptrace data!");
}*/
return res;
}
static bool esp_apptrace_trax_host_is_connected(esp_apptrace_trax_data_t *hw_data)
{
if (!ESP_APPTRACE_TRAX_INITED(hw_data)) {
return false;
}
return eri_read(ESP_APPTRACE_TRAX_CTRL_REG) & ESP_APPTRACE_TRAX_HOST_CONNECT ? true : false;
}
static esp_err_t esp_apptrace_trax_flush_nolock(esp_apptrace_trax_data_t *hw_data, uint32_t min_sz, esp_apptrace_tmo_t *tmo)
{
if (!ESP_APPTRACE_TRAX_INITED(hw_data)) {
return ESP_ERR_INVALID_STATE;
}
return esp_apptrace_membufs_flush_nolock(&hw_data->membufs, min_sz, tmo);
}
static esp_err_t esp_apptrace_trax_flush(esp_apptrace_trax_data_t *hw_data, esp_apptrace_tmo_t *tmo)
{
if (!ESP_APPTRACE_TRAX_INITED(hw_data)) {
return ESP_ERR_INVALID_STATE;
}
esp_err_t res = esp_apptrace_trax_lock(hw_data, tmo);
if (res != ESP_OK) {
return res;
}
res = esp_apptrace_membufs_flush_nolock(&hw_data->membufs, 0, tmo);
// now we can safely unlock apptrace to allow other tasks/ISRs to get other buffers and write their data
if (esp_apptrace_trax_unlock(hw_data) != ESP_OK) {
assert(false && "Failed to unlock apptrace data!");
}
return res;
}
/*****************************************************************************************/
/************************** Membufs proto HW iface ***************************************/
/*****************************************************************************************/
static inline void esp_apptrace_trax_buffer_swap_lock(void)
{
extern uint32_t __esp_apptrace_trax_eri_updated;
// indicate to host that we are about to update.
// this is used only to place CPU into streaming mode at tracing startup
// before starting streaming host can halt us after we read ESP_APPTRACE_TRAX_CTRL_REG and before we updated it
// HACK: in this case host will set breakpoint just after ESP_APPTRACE_TRAX_CTRL_REG update,
// here we set address to set bp at
// enter ERI update critical section
eri_write(ESP_APPTRACE_TRAX_STAT_REG, (uint32_t)&__esp_apptrace_trax_eri_updated);
}
static __attribute__((noinline)) void esp_apptrace_trax_buffer_swap_unlock(void)
{
// exit ERI update critical section
eri_write(ESP_APPTRACE_TRAX_STAT_REG, 0x0);
// TODO: currently host sets breakpoint, use break instruction to stop;
// it will allow to use ESP_APPTRACE_TRAX_STAT_REG for other purposes
asm volatile (
" .global __esp_apptrace_trax_eri_updated\n"
"__esp_apptrace_trax_eri_updated:\n"); // host will set bp here to resolve collision at streaming start
}
static esp_err_t esp_apptrace_trax_buffer_swap_start(uint32_t curr_block_id)
{
esp_err_t res = ESP_OK;
esp_apptrace_trax_buffer_swap_lock();
uint32_t ctrl_reg = eri_read(ESP_APPTRACE_TRAX_CTRL_REG);
uint32_t host_connected = ESP_APPTRACE_TRAX_HOST_CONNECT & ctrl_reg;
if (host_connected) {
uint32_t acked_block = ESP_APPTRACE_TRAX_BLOCK_ID_GET(ctrl_reg);
uint32_t host_to_read = ESP_APPTRACE_TRAX_BLOCK_LEN_GET(ctrl_reg);
if (host_to_read != 0 || acked_block != (curr_block_id & ESP_APPTRACE_TRAX_BLOCK_ID_MSK)) {
ESP_APPTRACE_LOGD("HC[%d]: Can not switch %x %d %x %x/%lx", cpu_hal_get_core_id(), ctrl_reg, host_to_read, acked_block,
curr_block_id & ESP_APPTRACE_TRAX_BLOCK_ID_MSK, curr_block_id);
res = ESP_ERR_NO_MEM;
goto _on_err;
}
}
return ESP_OK;
_on_err:
esp_apptrace_trax_buffer_swap_unlock();
return res;
}
static esp_err_t esp_apptrace_trax_buffer_swap_end(uint32_t new_block_id, uint32_t prev_block_len)
{
uint32_t ctrl_reg = eri_read(ESP_APPTRACE_TRAX_CTRL_REG);
uint32_t host_connected = ESP_APPTRACE_TRAX_HOST_CONNECT & ctrl_reg;
eri_write(ESP_APPTRACE_TRAX_CTRL_REG, ESP_APPTRACE_TRAX_BLOCK_ID(new_block_id) |
host_connected | ESP_APPTRACE_TRAX_BLOCK_LEN(prev_block_len));
esp_apptrace_trax_buffer_swap_unlock();
return ESP_OK;
}
static esp_err_t esp_apptrace_trax_buffer_swap(uint32_t new_block_id)
{
esp_apptrace_trax_select_memory_block(new_block_id);
return ESP_OK;
}
static bool esp_apptrace_trax_host_data_pending(void)
{
uint32_t ctrl_reg = eri_read(ESP_APPTRACE_TRAX_CTRL_REG);
return (ctrl_reg & ESP_APPTRACE_TRAX_HOST_DATA) ? true : false;
}

View File

@ -0,0 +1,70 @@
// Copyright 2020 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_APP_TRACE_MEMBUFS_PROTO_H_
#define ESP_APP_TRACE_MEMBUFS_PROTO_H_
#include "esp_app_trace_util.h"
#ifdef __cplusplus
extern "C" {
#endif
/** TRAX HW transport state */
typedef struct {
uint32_t in_block; // input block ID
// TODO: change to uint16_t
uint32_t markers[2]; // block filling level markers
} esp_apptrace_membufs_state_t;
/** memory block parameters,
* should be packed, because it is read from the host */
typedef struct {
uint8_t *start; // start address
uint32_t sz; // size
} esp_apptrace_mem_block_t;
typedef struct {
esp_err_t (*swap_start)(uint32_t curr_block_id);
esp_err_t (*swap)(uint32_t new_block_id);
esp_err_t (*swap_end)(uint32_t new_block_id, uint32_t prev_block_len);
bool (*host_data_pending)(void);
} esp_apptrace_membufs_proto_hw_t;
typedef struct {
esp_apptrace_membufs_proto_hw_t * hw;
volatile esp_apptrace_membufs_state_t state; // state
esp_apptrace_mem_block_t blocks[2]; // memory blocks
#if CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX > 0
// ring buffer control struct for pending user blocks
esp_apptrace_rb_t rb_pend;
// storage for pending user blocks
uint8_t pending_data[CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX + 1];
#endif
// ring buffer control struct for data from host (down buffer)
esp_apptrace_rb_t rb_down;
} esp_apptrace_membufs_proto_data_t;
esp_err_t esp_apptrace_membufs_init(esp_apptrace_membufs_proto_data_t *proto, const esp_apptrace_mem_block_t blocks_cfg[2]);
void esp_apptrace_membufs_down_buffer_config(esp_apptrace_membufs_proto_data_t *data, uint8_t *buf, uint32_t size);
uint8_t *esp_apptrace_membufs_down_buffer_get(esp_apptrace_membufs_proto_data_t *proto, uint32_t *size, esp_apptrace_tmo_t *tmo);
esp_err_t esp_apptrace_membufs_down_buffer_put(esp_apptrace_membufs_proto_data_t *proto, uint8_t *ptr, esp_apptrace_tmo_t *tmo);
uint8_t *esp_apptrace_membufs_up_buffer_get(esp_apptrace_membufs_proto_data_t *proto, uint32_t size, esp_apptrace_tmo_t *tmo);
esp_err_t esp_apptrace_membufs_up_buffer_put(esp_apptrace_membufs_proto_data_t *proto, uint8_t *ptr, esp_apptrace_tmo_t *tmo);
esp_err_t esp_apptrace_membufs_flush_nolock(esp_apptrace_membufs_proto_data_t *proto, uint32_t min_sz, esp_apptrace_tmo_t *tmo);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -3,10 +3,34 @@
CONFIG_ESP32_APPTRACE_DESTINATION CONFIG_APPTRACE_DESTINATION
CONFIG_ESP32_APPTRACE_DEST_NONE CONFIG_APPTRACE_DEST_NONE
CONFIG_ESP32_APPTRACE_DEST_TRAX CONFIG_APPTRACE_DEST_TRAX
CONFIG_ESP32_APPTRACE_DEST_TRAX CONFIG_APPTRACE_DEST_JTAG
CONFIG_ESP32_APPTRACE_ENABLE CONFIG_APPTRACE_ENABLE
CONFIG_ESP32_APPTRACE_LOCK_ENABLE CONFIG_APPTRACE_LOCK_ENABLE
CONFIG_ESP32_APPTRACE_ONPANIC_HOST_FLUSH_TMO CONFIG_APPTRACE_ONPANIC_HOST_FLUSH_TMO
CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_TRAX_THRESH CONFIG_APPTRACE_POSTMORTEM_FLUSH_THRESH
CONFIG_ESP32_APPTRACE_PENDING_DATA_SIZE_MAX CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX
CONFIG_ESP32_GCOV_ENABLE CONFIG_APPTRACE_GCOV_ENABLE
CONFIG_SYSVIEW_ENABLE CONFIG_APPTRACE_SV_ENABLE
CONFIG_SYSVIEW_TS_SOURCE CONFIG_APPTRACE_SV_TS_SOURCE
CONFIG_SYSVIEW_TS_SOURCE_CCOUNT CONFIG_APPTRACE_SV_TS_SOURCE_CCOUNT
CONFIG_SYSVIEW_TS_SOURCE_TIMER_00 CONFIG_APPTRACE_SV_TS_SOURCE_TIMER_00
CONFIG_SYSVIEW_TS_SOURCE_TIMER_01 CONFIG_APPTRACE_SV_TS_SOURCE_TIMER_01
CONFIG_SYSVIEW_TS_SOURCE_TIMER_10 CONFIG_APPTRACE_SV_TS_SOURCE_TIMER_10
CONFIG_SYSVIEW_TS_SOURCE_TIMER_11 CONFIG_APPTRACE_SV_TS_SOURCE_TIMER_11
CONFIG_SYSVIEW_TS_SOURCE_ESP_TIMER CONFIG_APPTRACE_SV_TS_SOURCE_ESP_TIMER
CONFIG_SYSVIEW_MAX_TASKS CONFIG_APPTRACE_SV_MAX_TASKS
CONFIG_SYSVIEW_BUF_WAIT_TMO CONFIG_APPTRACE_SV_BUF_WAIT_TMO
CONFIG_SYSVIEW_EVT_OVERFLOW_ENABLE CONFIG_APPTRACE_SV_EVT_OVERFLOW_ENABLE
CONFIG_SYSVIEW_EVT_ISR_ENTER_ENABLE CONFIG_APPTRACE_SV_EVT_ISR_ENTER_ENABLE
CONFIG_SYSVIEW_EVT_ISR_EXIT_ENABLE CONFIG_APPTRACE_SV_EVT_ISR_EXIT_ENABLE
CONFIG_SYSVIEW_EVT_ISR_TO_SCHEDULER_ENABLE CONFIG_APPTRACE_SV_EVT_ISR_TO_SCHED_ENABLE
CONFIG_SYSVIEW_EVT_TASK_START_EXEC_ENABLE CONFIG_APPTRACE_SV_EVT_TASK_START_EXEC_ENABLE
CONFIG_SYSVIEW_EVT_TASK_STOP_EXEC_ENABLE CONFIG_APPTRACE_SV_EVT_TASK_STOP_EXEC_ENABLE
CONFIG_SYSVIEW_EVT_TASK_START_READY_ENABLE CONFIG_APPTRACE_SV_EVT_TASK_START_READY_ENABLE
CONFIG_SYSVIEW_EVT_TASK_STOP_READY_ENABLE CONFIG_APPTRACE_SV_EVT_TASK_STOP_READY_ENABLE
CONFIG_SYSVIEW_EVT_TASK_CREATE_ENABLE CONFIG_APPTRACE_SV_EVT_TASK_CREATE_ENABLE
CONFIG_SYSVIEW_EVT_TASK_TERMINATE_ENABLE CONFIG_APPTRACE_SV_EVT_TASK_TERMINATE_ENABLE
CONFIG_SYSVIEW_EVT_IDLE_ENABLE CONFIG_APPTRACE_SV_EVT_IDLE_ENABLE
CONFIG_SYSVIEW_EVT_TIMER_ENTER_ENABLE CONFIG_APPTRACE_SV_EVT_TIMER_ENTER_ENABLE
CONFIG_SYSVIEW_EVT_TIMER_EXIT_ENABLE CONFIG_APPTRACE_SV_EVT_TIMER_EXIT_ENABLE

View File

@ -159,8 +159,8 @@ unsigned SEGGER_RTT_WriteNoLock (unsigned BufferIndex, const voi
unsigned SEGGER_RTT_WriteSkipNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
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);
void SEGGER_RTT_ESP_FlushNoLock (unsigned long min_sz, unsigned long tmo);
void SEGGER_RTT_ESP_Flush (unsigned long min_sz, unsigned long tmo);
//
// Function macro for performance optimization
//

View File

@ -73,6 +73,8 @@ Revision: $Rev: 3734 $
#include "esp32/clk.h"
#elif CONFIG_IDF_TARGET_ESP32S2
#include "esp32s2/clk.h"
#elif CONFIG_IDF_TARGET_ESP32C3
#include "esp32c3/clk.h"
#endif
@ -89,11 +91,17 @@ extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
// The target device name
#define SYSVIEW_DEVICE_NAME CONFIG_IDF_TARGET
// The target core name
#if CONFIG_IDF_TARGET_ARCH_XTENSA
#define SYSVIEW_CORE_NAME "xtensa"
#elif CONFIG_IDF_TARGET_ARCH_RISCV
#define SYSVIEW_CORE_NAME "riscv"
#endif
// Determine which timer to use as timestamp source
#if CONFIG_SYSVIEW_TS_SOURCE_CCOUNT
#if CONFIG_APPTRACE_SV_TS_SOURCE_CCOUNT
#define TS_USE_CCOUNT 1
#elif CONFIG_SYSVIEW_TS_SOURCE_ESP_TIMER
#elif CONFIG_APPTRACE_SV_TS_SOURCE_ESP_TIMER
#define TS_USE_ESP_TIMER 1
#else
#define TS_USE_TIMERGROUP 1
@ -109,13 +117,13 @@ extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
#define SYSVIEW_TIMESTAMP_FREQ (esp_clk_apb_freq() / SYSVIEW_TIMER_DIV)
// Timer ID and group ID
#if defined(CONFIG_SYSVIEW_TS_SOURCE_TIMER_00) || defined(CONFIG_SYSVIEW_TS_SOURCE_TIMER_01)
#if defined(CONFIG_APPTRACE_SV_TS_SOURCE_TIMER_00) || defined(CONFIG_APPTRACE_SV_TS_SOURCE_TIMER_01)
#define TS_TIMER_ID 0
#else
#define TS_TIMER_ID 1
#endif // TIMER_00 || TIMER_01
#if defined(CONFIG_SYSVIEW_TS_SOURCE_TIMER_00) || defined(CONFIG_SYSVIEW_TS_SOURCE_TIMER_10)
#if defined(CONFIG_APPTRACE_SV_TS_SOURCE_TIMER_00) || defined(CONFIG_APPTRACE_SV_TS_SOURCE_TIMER_10)
#define TS_TIMER_GROUP 0
#else
#define TS_TIMER_GROUP 1
@ -143,12 +151,16 @@ extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
// The lowest RAM address used for IDs (pointers)
#define SYSVIEW_RAM_BASE (SOC_DROM_LOW)
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
#if CONFIG_FREERTOS_CORETIMER_0
#define SYSTICK_INTR_ID (ETS_INTERNAL_TIMER0_INTR_SOURCE+ETS_INTERNAL_INTR_SOURCE_OFF)
#endif
#if CONFIG_FREERTOS_CORETIMER_1
#define SYSTICK_INTR_ID (ETS_INTERNAL_TIMER1_INTR_SOURCE+ETS_INTERNAL_INTR_SOURCE_OFF)
#endif
#elif CONFIG_IDF_TARGET_ESP32C3
#define SYSTICK_INTR_ID (ETS_SYSTIMER_TARGET0_EDGE_INTR_SOURCE+ETS_INTERNAL_INTR_SOURCE_OFF)
#endif
// SystemView is single core specific: it implies that SEGGER_SYSVIEW_LOCK()
// disables IRQs (disables rescheduling globally). So we can not use finite timeouts for locks and return error
@ -167,11 +179,13 @@ static esp_apptrace_lock_t s_sys_view_lock = {.mux = portMUX_INITIALIZER_UNLOCKE
*/
static void _cbSendSystemDesc(void) {
char irq_str[32];
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",C=Xtensa,O=FreeRTOS");
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",C="SYSVIEW_CORE_NAME",O=FreeRTOS");
snprintf(irq_str, sizeof(irq_str), "I#%d=SysTick", SYSTICK_INTR_ID);
SEGGER_SYSVIEW_SendSysDesc(irq_str);
size_t isr_count = sizeof(esp_isr_names)/sizeof(esp_isr_names[0]);
for (size_t i = 0; i < isr_count; ++i) {
if (esp_isr_names[i] == NULL || (ETS_INTERNAL_INTR_SOURCE_OFF + i) == SYSTICK_INTR_ID)
continue;
snprintf(irq_str, sizeof(irq_str), "I#%d=%s", ETS_INTERNAL_INTR_SOURCE_OFF + i, esp_isr_names[i]);
SEGGER_SYSVIEW_SendSysDesc(irq_str);
}
@ -213,43 +227,43 @@ void SEGGER_SYSVIEW_Conf(void) {
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
#if !CONFIG_SYSVIEW_EVT_OVERFLOW_ENABLE
#if !CONFIG_APPTRACE_SV_EVT_OVERFLOW_ENABLE
disable_evts |= SYSVIEW_EVTMASK_OVERFLOW;
#endif
#if !CONFIG_SYSVIEW_EVT_ISR_ENTER_ENABLE
#if !CONFIG_APPTRACE_SV_EVT_ISR_ENTER_ENABLE
disable_evts |= SYSVIEW_EVTMASK_ISR_ENTER;
#endif
#if !CONFIG_SYSVIEW_EVT_ISR_EXIT_ENABLE
#if !CONFIG_APPTRACE_SV_EVT_ISR_EXIT_ENABLE
disable_evts |= SYSVIEW_EVTMASK_ISR_EXIT;
#endif
#if !CONFIG_SYSVIEW_EVT_TASK_START_EXEC_ENABLE
#if !CONFIG_APPTRACE_SV_EVT_TASK_START_EXEC_ENABLE
disable_evts |= SYSVIEW_EVTMASK_TASK_START_EXEC;
#endif
#if !CONFIG_SYSVIEW_EVT_TASK_STOP_EXEC_ENABLE
#if !CONFIG_APPTRACE_SV_EVT_TASK_STOP_EXEC_ENABLE
disable_evts |= SYSVIEW_EVTMASK_TASK_STOP_EXEC;
#endif
#if !CONFIG_SYSVIEW_EVT_TASK_START_READY_ENABLE
#if !CONFIG_APPTRACE_SV_EVT_TASK_START_READY_ENABLE
disable_evts |= SYSVIEW_EVTMASK_TASK_START_READY;
#endif
#if !CONFIG_SYSVIEW_EVT_TASK_STOP_READY_ENABLE
#if !CONFIG_APPTRACE_SV_EVT_TASK_STOP_READY_ENABLE
disable_evts |= SYSVIEW_EVTMASK_TASK_STOP_READY;
#endif
#if !CONFIG_SYSVIEW_EVT_TASK_CREATE_ENABLE
#if !CONFIG_APPTRACE_SV_EVT_TASK_CREATE_ENABLE
disable_evts |= SYSVIEW_EVTMASK_TASK_CREATE;
#endif
#if !CONFIG_SYSVIEW_EVT_TASK_TERMINATE_ENABLE
#if !CONFIG_APPTRACE_SV_EVT_TASK_TERMINATE_ENABLE
disable_evts |= SYSVIEW_EVTMASK_TASK_TERMINATE;
#endif
#if !CONFIG_SYSVIEW_EVT_IDLE_ENABLE
#if !CONFIG_APPTRACE_SV_EVT_IDLE_ENABLE
disable_evts |= SYSVIEW_EVTMASK_IDLE;
#endif
#if !CONFIG_SYSVIEW_EVT_ISR_TO_SCHEDULER_ENABLE
#if !CONFIG_APPTRACE_SV_EVT_ISR_TO_SCHED_ENABLE
disable_evts |= SYSVIEW_EVTMASK_ISR_TO_SCHEDULER;
#endif
#if !CONFIG_SYSVIEW_EVT_TIMER_ENTER_ENABLE
#if !CONFIG_APPTRACE_SV_EVT_TIMER_ENTER_ENABLE
disable_evts |= SYSVIEW_EVTMASK_TIMER_ENTER;
#endif
#if !CONFIG_SYSVIEW_EVT_TIMER_EXIT_ENABLE
#if !CONFIG_APPTRACE_SV_EVT_TIMER_EXIT_ENABLE
disable_evts |= SYSVIEW_EVTMASK_TIMER_EXIT;
#endif
SEGGER_SYSVIEW_DisableEvents(disable_evts);

View File

@ -80,7 +80,7 @@ Notes:
#define portSTACK_GROWTH ( -1 )
#endif
#define SYSVIEW_FREERTOS_MAX_NOF_TASKS CONFIG_SYSVIEW_MAX_TASKS
#define SYSVIEW_FREERTOS_MAX_NOF_TASKS CONFIG_APPTRACE_SV_MAX_TASKS
/*********************************************************************
*
@ -290,12 +290,12 @@ Notes:
#define traceTASK_SWITCHED_IN() if(prvGetTCBFromHandle(NULL) == xTaskGetIdleTaskHandle()) { \
SEGGER_SYSVIEW_OnIdle(); \
} else { \
SEGGER_SYSVIEW_OnTaskStartExec((U32)pxCurrentTCB[xPortGetCoreID()]); \
SEGGER_SYSVIEW_OnTaskStartExec((U32)pxCurrentTCB[cpu_hal_get_core_id()]); \
}
#else
#define traceTASK_SWITCHED_IN() { \
if (memcmp(pxCurrentTCB[xPortGetCoreID()]->pcTaskName, "IDLE", 5) != 0) { \
SEGGER_SYSVIEW_OnTaskStartExec((U32)pxCurrentTCB[xPortGetCoreID()]); \
if (memcmp(pxCurrentTCB[cpu_hal_get_core_id()]->pcTaskName, "IDLE", 5) != 0) { \
SEGGER_SYSVIEW_OnTaskStartExec((U32)pxCurrentTCB[cpu_hal_get_core_id()]); \
} else { \
SEGGER_SYSVIEW_OnIdle(); \
} \
@ -305,14 +305,15 @@ Notes:
#define traceMOVED_TASK_TO_READY_STATE(pxTCB) SEGGER_SYSVIEW_OnTaskStartReady((U32)pxTCB)
#define traceREADDED_TASK_TO_READY_STATE(pxTCB)
#define traceMOVED_TASK_TO_DELAYED_LIST() SEGGER_SYSVIEW_OnTaskStopReady((U32)pxCurrentTCB[xPortGetCoreID()], (1u << 2))
#define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST() SEGGER_SYSVIEW_OnTaskStopReady((U32)pxCurrentTCB[xPortGetCoreID()], (1u << 2))
#define traceMOVED_TASK_TO_DELAYED_LIST() SEGGER_SYSVIEW_OnTaskStopReady((U32)pxCurrentTCB[cpu_hal_get_core_id()], (1u << 2))
#define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST() SEGGER_SYSVIEW_OnTaskStopReady((U32)pxCurrentTCB[cpu_hal_get_core_id()], (1u << 2))
#define traceMOVED_TASK_TO_SUSPENDED_LIST(pxTCB) SEGGER_SYSVIEW_OnTaskStopReady((U32)pxTCB, ((3u << 3) | 3))
#define traceISR_EXIT_TO_SCHEDULER() SEGGER_SYSVIEW_RecordExitISRToScheduler()
#define traceISR_EXIT() SEGGER_SYSVIEW_RecordExitISR()
#define traceISR_ENTER(_n_) SEGGER_SYSVIEW_RecordEnterISR(_n_)
/*********************************************************************
*
* API functions

View File

@ -28,10 +28,10 @@ const static char *TAG = "segger_rtt";
// size of down channel data buf
#define SYSVIEW_DOWN_BUF_SIZE 32
#define SEGGER_STOP_WAIT_TMO 1000000 //us
#if CONFIG_SYSVIEW_BUF_WAIT_TMO == -1
#if CONFIG_APPTRACE_SV_BUF_WAIT_TMO == -1
#define SEGGER_HOST_WAIT_TMO ESP_APPTRACE_TMO_INFINITE
#else
#define SEGGER_HOST_WAIT_TMO CONFIG_SYSVIEW_BUF_WAIT_TMO
#define SEGGER_HOST_WAIT_TMO CONFIG_APPTRACE_SV_BUF_WAIT_TMO
#endif
static uint8_t s_events_buf[SYSVIEW_EVENTS_BUF_SZ];
@ -47,7 +47,7 @@ static uint8_t s_down_buf[SYSVIEW_DOWN_BUF_SIZE];
/*********************************************************************
*
* SEGGER_RTT_ESP32_FlushNoLock()
* SEGGER_RTT_ESP_FlushNoLock()
*
* Function description
* Flushes buffered events.
@ -59,7 +59,7 @@ static uint8_t s_down_buf[SYSVIEW_DOWN_BUF_SIZE];
* Return value
* None.
*/
void SEGGER_RTT_ESP32_FlushNoLock(unsigned long min_sz, unsigned long tmo)
void SEGGER_RTT_ESP_FlushNoLock(unsigned long min_sz, unsigned long tmo)
{
esp_err_t res;
if (s_events_buf_filled > 0) {
@ -78,7 +78,7 @@ void SEGGER_RTT_ESP32_FlushNoLock(unsigned long min_sz, unsigned long tmo)
/*********************************************************************
*
* SEGGER_RTT_ESP32_Flush()
* SEGGER_RTT_ESP_Flush()
*
* Function description
* Flushes buffered events.
@ -90,10 +90,10 @@ void SEGGER_RTT_ESP32_FlushNoLock(unsigned long min_sz, unsigned long tmo)
* Return value
* None.
*/
void SEGGER_RTT_ESP32_Flush(unsigned long min_sz, unsigned long tmo)
void SEGGER_RTT_ESP_Flush(unsigned long min_sz, unsigned long tmo)
{
SEGGER_SYSVIEW_LOCK();
SEGGER_RTT_ESP32_FlushNoLock(min_sz, tmo);
SEGGER_RTT_ESP_FlushNoLock(min_sz, tmo);
SEGGER_SYSVIEW_UNLOCK();
}
@ -155,7 +155,7 @@ unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, u
ESP_LOGE(TAG, "Too large event %u bytes!", NumBytes);
return 0;
}
if (xPortGetCoreID()) { // dual core specific code
if (cpu_hal_get_core_id()) { // dual core specific code
// use the highest - 1 bit of event ID to indicate core ID
// the highest bit can not be used due to event ID encoding method
// this reduces supported ID range to [0..63] (for 1 byte IDs) plus [128..16383] (for 2 bytes IDs)
@ -175,7 +175,7 @@ unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, u
memcpy(&s_events_buf[s_events_buf_filled], pBuffer, NumBytes);
s_events_buf_filled += NumBytes;
if (event_id == SYSVIEW_EVTID_TRACE_STOP) {
SEGGER_RTT_ESP32_FlushNoLock(0, SEGGER_STOP_WAIT_TMO);
SEGGER_RTT_ESP_FlushNoLock(0, SEGGER_STOP_WAIT_TMO);
}
return NumBytes;
}

View File

@ -60,7 +60,7 @@ esp_err_t esp_sysview_heap_trace_start(uint32_t tmo)
esp_err_t esp_sysview_heap_trace_stop(void)
{
ESP_EARLY_LOGV(TAG, "%s", __func__);
SEGGER_RTT_ESP32_Flush(0, ESP_APPTRACE_TMO_INFINITE);
SEGGER_RTT_ESP_Flush(0, ESP_APPTRACE_TMO_INFINITE);
return ESP_OK;
}

View File

@ -83,7 +83,7 @@ static void esp_apptrace_test_timer_init(int timer_group, int timer_idx, uint32_
timer_enable_intr(timer_group, timer_idx);
}
#if CONFIG_SYSVIEW_ENABLE == 0
#if CONFIG_APPTRACE_SV_ENABLE == 0
#define ESP_APPTRACE_TEST_WRITE(_b_, _s_) esp_apptrace_write(ESP_APPTRACE_DEST_TRAX, _b_, _s_, ESP_APPTRACE_TMO_INFINITE)
#define ESP_APPTRACE_TEST_WRITE_FROM_ISR(_b_, _s_) esp_apptrace_write(ESP_APPTRACE_DEST_TRAX, _b_, _s_, 0UL)
#define ESP_APPTRACE_TEST_WRITE_NOWAIT(_b_, _s_) esp_apptrace_write(ESP_APPTRACE_DEST_TRAX, _b_, _s_, 0)
@ -209,7 +209,7 @@ static void esp_apptrace_dummy_task(void *p)
i = 0;
while (!arg->stop) {
ESP_APPTRACE_TEST_LOGD("%x: dummy task work %d.%d", xTaskGetCurrentTaskHandle(), xPortGetCoreID(), i++);
ESP_APPTRACE_TEST_LOGD("%x: dummy task work %d.%d", xTaskGetCurrentTaskHandle(), cpu_hal_get_core_id(), i++);
if (tmo_ticks) {
vTaskDelay(tmo_ticks);
}
@ -254,7 +254,7 @@ static void esp_apptrace_test_task(void *p)
ESP_APPTRACE_TEST_LOGE("Failed to timer_isr_register (%d)!", res);
goto on_fail;
}
*(uint32_t *)arg->timers[i].data.buf = ((uint32_t)inth[i]) | (1 << 31) | (xPortGetCoreID() ? 0x1 : 0);
*(uint32_t *)arg->timers[i].data.buf = ((uint32_t)inth[i]) | (1 << 31) | (cpu_hal_get_core_id() ? 0x1 : 0);
ESP_APPTRACE_TEST_LOGI("%x: start timer %x period %u us", xTaskGetCurrentTaskHandle(), inth[i], arg->timers[i].data.period);
res = timer_start(arg->timers[i].group, arg->timers[i].id);
if (res != ESP_OK) {
@ -264,7 +264,7 @@ static void esp_apptrace_test_task(void *p)
}
}
*(uint32_t *)arg->data.buf = (uint32_t)xTaskGetCurrentTaskHandle() | (xPortGetCoreID() ? 0x1 : 0);
*(uint32_t *)arg->data.buf = (uint32_t)xTaskGetCurrentTaskHandle() | (cpu_hal_get_core_id() ? 0x1 : 0);
arg->data.wr_cnt = 0;
arg->data.wr_err = 0;
while (!arg->stop) {
@ -744,7 +744,7 @@ static void esp_logtrace_task(void *p)
ESP_LOGI(TAG, "%p: sample print 4 %c", xTaskGetCurrentTaskHandle(), ((i & 0xFF) % 95) + 32);
ESP_LOGI(TAG, "%p: sample print 5 %f", xTaskGetCurrentTaskHandle(), 1.0);
ESP_LOGI(TAG, "%p: sample print 6 %f", xTaskGetCurrentTaskHandle(), 3.45);
ESP_LOGI(TAG, "%p: logtrace task work %d.%d", xTaskGetCurrentTaskHandle(), xPortGetCoreID(), i);
ESP_LOGI(TAG, "%p: logtrace task work %d.%d", xTaskGetCurrentTaskHandle(), cpu_hal_get_core_id(), i);
if (++i == 10000) {
break;
}

View File

@ -41,16 +41,6 @@
#include "esp_efuse.h"
#include "esp_attr.h"
#ifdef CONFIG_IDF_TARGET_ESP32
#include "esp32/rom/crc.h"
#elif CONFIG_IDF_TARGET_ESP32S2
#include "esp32s2/rom/crc.h"
#include "esp32s2/rom/secure_boot.h"
#elif CONFIG_IDF_TARGET_ESP32C3
#include "esp32c3/rom/crc.h"
#include "esp32c3/rom/secure_boot.h"
#endif
#define SUB_TYPE_ID(i) (i & 0x0F)
/* Partial_data is word aligned so no reallocation is necessary for encrypted flash write */
@ -897,8 +887,8 @@ esp_err_t esp_ota_erase_last_boot_app_partition(void)
}
#if SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS > 1 && CONFIG_SECURE_BOOT_V2_ENABLED
esp_err_t esp_ota_revoke_secure_boot_public_key(esp_ota_secure_boot_public_key_index_t index) {
esp_err_t esp_ota_revoke_secure_boot_public_key(esp_ota_secure_boot_public_key_index_t index)
{
if (!esp_secure_boot_enabled()) {
ESP_LOGE(TAG, "Secure boot v2 has not been enabled.");
return ESP_FAIL;
@ -911,8 +901,70 @@ esp_err_t esp_ota_revoke_secure_boot_public_key(esp_ota_secure_boot_public_key_i
return ESP_ERR_INVALID_ARG;
}
ets_secure_boot_revoke_public_key_digest(index);
ESP_LOGI(TAG, "Revoked signature block %d.", index);
esp_image_sig_public_key_digests_t app_digests = { 0 };
esp_err_t err = esp_secure_boot_get_signature_blocks_for_running_app(true, &app_digests);
if (err != ESP_OK || app_digests.num_digests == 0) {
ESP_LOGE(TAG, "This app is not signed, but check signature on update is enabled in config. It won't be possible to verify any update.");
return ESP_FAIL;
}
ets_secure_boot_key_digests_t trusted_keys;
int ets_status = ets_secure_boot_read_key_digests(&trusted_keys);
if (ets_status != ETS_OK) {
ESP_LOGE(TAG, "Could not read the secure boot key digests from efuse. Aborting..");
return ESP_FAIL;
}
if (trusted_keys.key_digests[index] == NULL) {
ESP_LOGI(TAG, "Trusted Key block(%d) already revoked.", index);
return ESP_OK;
}
esp_image_sig_public_key_digests_t trusted_digests = { 0 };
for (unsigned i = 0; i < SECURE_BOOT_NUM_BLOCKS; i++) {
if (i == index) {
continue; // omitting - to find if there is a valid key after revoking this digest
}
if (trusted_keys.key_digests[i] != NULL) {
bool all_zeroes = true;
for (unsigned j = 0; j < ESP_SECURE_BOOT_DIGEST_LEN; j++) {
all_zeroes = all_zeroes && (*(uint8_t *)(trusted_keys.key_digests[i] + j) == 0);
}
if (!all_zeroes) {
memcpy(trusted_digests.key_digests[trusted_digests.num_digests++], (uint8_t *)trusted_keys.key_digests[i], ESP_SECURE_BOOT_DIGEST_LEN);
} else {
ESP_LOGD(TAG, "Empty trusted key block (%d).", i);
}
}
}
bool match = false;
for (unsigned i = 0; i < trusted_digests.num_digests; i++) {
if (match == true) {
break;
}
for (unsigned j = 0; j < app_digests.num_digests; j++) {
if (memcmp(trusted_digests.key_digests[i], app_digests.key_digests[j], ESP_SECURE_BOOT_DIGEST_LEN) == 0) {
ESP_LOGI(TAG, "App key block(%d) matches Trusted key block(%d)[%d -> Next active trusted key block].", j, i, i);
esp_err_t err = esp_efuse_set_digest_revoke(index);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to revoke digest (0x%x).", err);
return ESP_FAIL;
}
ESP_LOGI(TAG, "Revoked signature block %d.", index);
match = true;
break;
}
}
}
if (match == false) {
ESP_LOGE(TAG, "Running app doesn't have another valid secure boot key. Cannot revoke current key(%d).", index);
return ESP_FAIL;
}
return ESP_OK;
}
#endif

View File

@ -326,9 +326,9 @@ typedef enum {
/**
* @brief Revokes the old signature digest. To be called in the application after the rollback logic.
*
* Relevant for Secure boot v2 on ESP32-S2 where upto 3 key digests can be stored (Key #N-1, Key #N, Key #N+1).
* When key #N-1 used to sign an app is invalidated, an OTA update is to be sent with an app signed with key #N-1 & Key #N.
* After successfully booting the OTA app should call this function to revoke Key #N-1.
* Relevant for Secure boot v2 on targets where upto 3 key digests can be stored (Key N-1, Key N, Key N+1).
* When key N-1 used to sign an app is invalidated, an OTA update is to be sent with an app signed with key N-1 & Key N.
* After successfully booting the OTA app should call this function to revoke Key N-1.
*
* @param index - The index of the signature block to be revoked
*

View File

@ -31,7 +31,6 @@ try:
except ImportError:
COMPONENTS_PATH = os.path.expandvars(os.path.join('$IDF_PATH', 'components'))
PARTTOOL_DIR = os.path.join(COMPONENTS_PATH, 'partition_table')
sys.path.append(PARTTOOL_DIR)
from parttool import PARTITION_TABLE_OFFSET, PartitionName, PartitionType, ParttoolTarget
@ -86,9 +85,8 @@ class OtatoolTarget():
seq = bytearray(self.otadata[start:start + 4])
crc = bytearray(self.otadata[start + 28:start + 32])
seq = struct.unpack('>I', seq)
crc = struct.unpack('>I', crc)
seq = struct.unpack('I', seq)
crc = struct.unpack('I', crc)
info.append(otadata_info(seq[0], crc[0]))
return info
@ -102,12 +100,11 @@ class OtatoolTarget():
def switch_ota_partition(self, ota_id):
self._check_otadata_partition()
sys.path.append(PARTTOOL_DIR)
import gen_esp32part as gen
def is_otadata_info_valid(status):
seq = status.seq % (1 << 32)
crc = hex(binascii.crc32(struct.pack('I', seq), 0xFFFFFFFF) % (1 << 32))
crc = binascii.crc32(struct.pack('I', seq), 0xFFFFFFFF) % (1 << 32)
return seq < (int('0xFFFFFFFF', 16) % (1 << 32)) and status.crc == crc
partition_table = self.target.partition_table
@ -219,7 +216,7 @@ def _read_otadata(target):
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,
print('Firmware: 0x{:08x} \t0x{:08x} | \t0x{:08x} \t 0x{:08x}'.format(otadata_info[0].seq, otadata_info[0].crc,
otadata_info[1].seq, otadata_info[1].crc))
@ -290,7 +287,7 @@ def main():
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')
read_ota_partition_subparser.add_argument('--output', help='file to write the contents of the ota partition to', required=True)
write_ota_partition_subparser = subparsers.add_parser('write_ota_partition', help='write contents to an ota partition', parents=[slot_or_name_parser])
write_ota_partition_subparser.add_argument('--input', help='file whose contents to write to the ota partition')

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Tests for switching between partitions: factory, OTAx, test.
*/
@ -821,3 +826,25 @@ static void test_flow6(void)
// 2 Stage: run factory -> check it -> copy factory to OTA0 -> reboot --//--
// 3 Stage: run OTA0 -> check it -> erase OTA_DATA for next tests -> PASS
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0 using esp_ota_write_with_offset", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow6, test_flow6);
TEST_CASE("Test bootloader_common_get_sha256_of_partition returns ESP_ERR_IMAGE_INVALID when image is ivalid", "[partitions]")
{
const esp_partition_t *cur_app = esp_ota_get_running_partition();
ESP_LOGI(TAG, "copy current app to next part");
const esp_partition_t *other_app = get_next_update_partition();
copy_current_app_to_next_part(cur_app, other_app);
erase_ota_data();
uint8_t sha_256_cur_app[32];
uint8_t sha_256_other_app[32];
TEST_ESP_OK(bootloader_common_get_sha256_of_partition(cur_app->address, cur_app->size, cur_app->type, sha_256_cur_app));
TEST_ESP_OK(bootloader_common_get_sha256_of_partition(other_app->address, other_app->size, other_app->type, sha_256_other_app));
TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha_256_cur_app, sha_256_other_app, sizeof(sha_256_cur_app), "must be the same");
uint32_t data = 0;
bootloader_flash_write(other_app->address + 0x50, &data, sizeof(data), false);
TEST_ESP_ERR(ESP_ERR_IMAGE_INVALID, bootloader_common_get_sha256_of_partition(other_app->address, other_app->size, other_app->type, sha_256_other_app));
TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha_256_cur_app, sha_256_other_app, sizeof(sha_256_cur_app), "must be the same");
}

View File

@ -1,3 +1,11 @@
if(NOT CONFIG_LWIP_IPV6 AND NOT CMAKE_BUILD_EARLY_EXPANSION)
# note: the component is still included in the build so it can become visible again in config
# without needing to re-run CMake. However no source or header files are built.
message(STATUS "IPV6 support is disabled so the asio component will not be built")
idf_component_register()
return()
endif()
set(asio_sources "asio/asio/src/asio.cpp")
if(CONFIG_ASIO_SSL_SUPPORT)

View File

@ -1,4 +1,6 @@
menu "ESP-ASIO"
visible if LWIP_IPV6
config ASIO_SSL_SUPPORT
bool "Enable SSL/TLS support of ASIO"
default n

View File

@ -1,3 +1,5 @@
ifdef CONFIG_LWIP_IPV6
COMPONENT_ADD_INCLUDEDIRS := asio/asio/include port/include
COMPONENT_PRIV_INCLUDEDIRS := private_include
COMPONENT_SRCDIRS := asio/asio/src port/src
@ -7,3 +9,5 @@ COMPONENT_OBJEXCLUDE := asio/asio/src/asio_ssl.o port/src/esp_asio_openssl_stubs
endif
COMPONENT_SUBMODULES += asio
endif # CONFIG_LWIP_IPV6

View File

@ -274,6 +274,10 @@ menu "Bootloader config"
config BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP
bool "Skip image validation when exiting deep sleep"
# note: dependencies for this config item are different to other "skip image validation"
# options, allowing to turn on "allow insecure options" and have secure boot with
# "skip validation when existing deep sleep". Keeping this to avoid a breaking change,
# but - as noted in help - it invalidates the integrity of Secure Boot checks
depends on (SECURE_BOOT && SECURE_BOOT_INSECURE) || !SECURE_BOOT
default n
help
@ -286,6 +290,48 @@ menu "Bootloader config"
partition as this would skip the validation upon first load of the new
OTA partition.
It is possible to enable this option with Secure Boot if "allow insecure
options" is enabled, however it's strongly recommended to NOT enable it as
it may allow a Secure Boot bypass.
config BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON
bool "Skip image validation from power on reset (READ HELP FIRST)"
# only available if both Secure Boot and Check Signature on Boot are disabled
depends on !SECURE_SIGNED_ON_BOOT
default n
help
Some applications need to boot very quickly from power on. By default, the entire app binary
is read from flash and verified which takes up a significant portion of the boot time.
Enabling this option will skip validation of the app when the SoC boots from power on.
Note that in this case it's not possible for the bootloader to detect if an app image is
corrupted in the flash, therefore it's not possible to safely fall back to a different app
partition. Flash corruption of this kind is unlikely but can happen if there is a serious
firmware bug or physical damage.
Following other reset types, the bootloader will still validate the app image. This increases
the chances that flash corruption resulting in a crash can be detected following soft reset, and
the bootloader will fall back to a valid app image. To increase the chances of successfully recovering
from a flash corruption event, keep the option BOOTLOADER_WDT_ENABLE enabled and consider also enabling
BOOTLOADER_WDT_DISABLE_IN_USER_CODE - then manually disable the RTC Watchdog once the app is running.
In addition, enable both the Task and Interrupt watchdog timers with reset options set.
config BOOTLOADER_SKIP_VALIDATE_ALWAYS
bool "Skip image validation always (READ HELP FIRST)"
# only available if both Secure Boot and Check Signature on Boot are disabled
depends on !SECURE_SIGNED_ON_BOOT
default n
select BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP
select BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON
help
Selecting this option prevents the bootloader from ever validating the app image before
booting it. Any flash corruption of the selected app partition will make the entire SoC
unbootable.
Although flash corruption is a very rare case, it is not recommended to select this option.
Consider selecting "Skip image validation from power on reset" instead. However, if boot time
is the only important factor then it can be enabled.
config BOOTLOADER_RESERVE_RTC_SIZE
hex
default 0x10 if BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP || BOOTLOADER_CUSTOM_RESERVE_RTC
@ -319,6 +365,15 @@ menu "Bootloader config"
in this area of memory, you can increase it. It must be a multiple of 4 bytes.
This area (rtc_retain_mem_t) is reserved and has access from the bootloader and an application.
config BOOTLOADER_FLASH_XMC_SUPPORT
bool "Enable the support for flash chips of XMC (READ HELP FIRST)"
default y
help
Perform the startup flow recommended by XMC. Please consult XMC for the details of this flow.
XMC chips will be forbidden to be used, when this option is disabled.
DON'T DISABLE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.
endmenu # Bootloader
@ -378,7 +433,7 @@ menu "Security features"
1. ECDSA based secure boot scheme. (Only choice for Secure Boot V1)
Supported in ESP32 and ESP32-ECO3.
2. The RSA based secure boot scheme. (Only choice for Secure Boot V2)
Supported in ESP32-ECO3. (ESP32 Chip Revision 3 onwards)
Supported in ESP32-ECO3 (ESP32 Chip Revision 3 onwards), ESP32-S2, ESP32-C3, ESP32-S3.
config SECURE_SIGNED_APPS_ECDSA_SCHEME
bool "ECDSA"
@ -390,7 +445,7 @@ menu "Security features"
config SECURE_SIGNED_APPS_RSA_SCHEME
bool "RSA"
depends on SECURE_BOOT_SUPPORTS_RSA && SECURE_BOOT_V2_ENABLED
depends on SECURE_BOOT_SUPPORTS_RSA && (SECURE_SIGNED_APPS_NO_SECURE_BOOT || SECURE_BOOT_V2_ENABLED)
help
Appends the RSA-3072 based Signature block to the application.
Refer to <Secure Boot Version 2 documentation link> before enabling.
@ -399,7 +454,7 @@ menu "Security features"
config SECURE_SIGNED_ON_BOOT_NO_SECURE_BOOT
bool "Bootloader verifies app signatures"
default n
depends on SECURE_SIGNED_APPS_NO_SECURE_BOOT
depends on SECURE_SIGNED_APPS_NO_SECURE_BOOT && SECURE_SIGNED_APPS_ECDSA_SCHEME
help
If this option is set, the bootloader will be compiled with code to verify that an app is signed before
booting it.
@ -425,7 +480,8 @@ menu "Security features"
config SECURE_BOOT
bool "Enable hardware Secure Boot in bootloader (READ DOCS FIRST)"
default n
depends on !IDF_TARGET_ESP32C3 # IDF-2647
depends on IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || ESP32C3_REV_MIN >= 3
select ESPTOOLPY_NO_STUB if !IDF_TARGET_ESP32 && !IDF_TARGET_ESP32S2
help
Build a bootloader which enables Secure Boot on first boot.
@ -442,7 +498,7 @@ menu "Security features"
help
Select the Secure Boot Version. Depends on the Chip Revision.
Secure Boot V2 is the new RSA based secure boot scheme.
Supported in ESP32-ECO3. (ESP32 Chip Revision 3 onwards)
Supported in ESP32-ECO3 (ESP32 Chip Revision 3 onwards), ESP32-S2, ESP32-C3 ECO3.
Secure Boot V1 is the AES based secure boot scheme.
Supported in ESP32 and ESP32-ECO3.
@ -456,8 +512,6 @@ menu "Security features"
config SECURE_BOOT_V2_ENABLED
bool "Enable Secure Boot version 2"
depends on SECURE_BOOT_SUPPORTS_RSA
select SECURE_ENABLE_SECURE_ROM_DL_MODE if !IDF_TARGET_ESP32 && !SECURE_INSECURE_ALLOW_DL_MODE && !SECURE_DISABLE_ROM_DL_MODE # NOERROR
select SECURE_DISABLE_ROM_DL_MODE if ESP32_REV_MIN_3 && !SECURE_INSECURE_ALLOW_DL_MODE
help
Build a bootloader which enables Secure Boot version 2 on first boot.
Refer to Secure Boot V2 section of the ESP-IDF Programmer's Guide for this version before enabling.
@ -539,6 +593,22 @@ menu "Security features"
Refer to the Secure Boot section of the ESP-IDF Programmer's Guide for this version before enabling.
config SECURE_BOOT_ENABLE_AGGRESSIVE_KEY_REVOKE
bool "Enable Aggressive key revoke strategy"
depends on SECURE_BOOT && (IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3)
default N
help
If this option is set, ROM bootloader will revoke the public key digest burned in efuse block
if it fails to verify the signature of software bootloader with it.
Revocation of keys does not happen when enabling secure boot. Once secure boot is enabled,
key revocation checks will be done on subsequent boot-up, while verifying the software bootloader
This feature provides a strong resistance against physical attacks on the device.
NOTE: Once a digest slot is revoked, it can never be used again to verify an image
This can lead to permanent bricking of the device, in case all keys are revoked
because of signature verification failure.
choice SECURE_BOOTLOADER_KEY_ENCODING
bool "Hardware Key Encoding"
depends on SECURE_BOOTLOADER_REFLASHABLE
@ -626,7 +696,7 @@ menu "Security features"
config SECURE_FLASH_ENCRYPTION_MODE_RELEASE
bool "Release"
select SECURE_ENABLE_SECURE_ROM_DL_MODE if SECURE_TARGET_HAS_SECURE_ROM_DL_MODE && !SECURE_DISABLE_ROM_DL_MODE # NOERROR
select PARTITION_TABLE_MD5 if !ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS
endchoice
@ -688,22 +758,17 @@ menu "Security features"
efuse when Secure Boot is enabled. This prevents any more efuses from being read protected.
If this option is set, it will remain possible to write the EFUSE_RD_DIS efuse field after Secure
Boot is enabled. This may allow an attacker to read-protect the BLK2 efuse holding the public
key digest, causing an immediate denial of service and possibly allowing an additional fault
injection attack to bypass the signature protection.
Boot is enabled. This may allow an attacker to read-protect the BLK2 efuse (for ESP32) and
BLOCK4-BLOCK10 (i.e. BLOCK_KEY0-BLOCK_KEY5)(for other chips) holding the public key digest, causing an
immediate denial of service and possibly allowing an additional fault injection attack to
bypass the signature protection.
config SECURE_INSECURE_ALLOW_DL_MODE
bool "Don't automatically restrict UART download mode"
depends on SECURE_BOOT_INSECURE && SECURE_BOOT_V2_ENABLED
default N
help
By default, enabling either flash encryption in release mode or secure boot will automatically
disable UART download mode on ESP32 ECO3, or enable secure download mode on newer chips.
This is recommended to reduce the attack surface of the chip.
NOTE: Once a BLOCK is read-protected, the application will read all zeros from that block
To allow the full UART download mode to stay enabled, enable this option and ensure
the options SECURE_DISABLE_ROM_DL_MODE and SECURE_ENABLE_SECURE_ROM_DL_MODE are disabled as applicable.
This is not recommended.
NOTE: If "UART ROM download mode (Permanently disabled (recommended))" or
"UART ROM download mode (Permanently switch to Secure mode (recommended))" is set,
then it is __NOT__ possible to read/write efuses using espefuse.py utility.
However, efuse can be read/written from the application
config SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC
bool "Leave UART bootloader encryption enabled"
@ -752,47 +817,58 @@ menu "Security features"
endmenu # Potentially Insecure
config SECURE_DISABLE_ROM_DL_MODE
bool "Permanently disable ROM Download Mode"
choice SECURE_UART_ROM_DL_MODE
bool "UART ROM download mode"
default SECURE_ENABLE_SECURE_ROM_DL_MODE if SECURE_TARGET_HAS_SECURE_ROM_DL_MODE && !SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT # NOERROR
default SECURE_INSECURE_ALLOW_DL_MODE
depends on SECURE_BOOT_V2_ENABLED || SECURE_FLASH_ENC_ENABLED
depends on !IDF_TARGET_ESP32 || ESP32_REV_MIN_3
default n
help
If set, during startup the app will burn an eFuse bit to permanently disable the UART ROM
Download Mode. This prevents any future use of esptool.py, espefuse.py and similar tools.
Once disabled, if the SoC is booted with strapping pins set for ROM Download Mode
then an error is printed instead.
config SECURE_DISABLE_ROM_DL_MODE
bool "UART ROM download mode (Permanently disabled (recommended))"
help
If set, during startup the app will burn an eFuse bit to permanently disable the UART ROM
Download Mode. This prevents any future use of esptool.py, espefuse.py and similar tools.
It is recommended to enable this option in any production application where Flash
Encryption and/or Secure Boot is enabled and access to Download Mode is not required.
Once disabled, if the SoC is booted with strapping pins set for ROM Download Mode
then an error is printed instead.
It is also possible to permanently disable Download Mode by calling
esp_efuse_disable_rom_download_mode() at runtime.
It is recommended to enable this option in any production application where Flash
Encryption and/or Secure Boot is enabled and access to Download Mode is not required.
config SECURE_ENABLE_SECURE_ROM_DL_MODE
bool "Permanently switch to ROM UART Secure Download mode"
depends on SECURE_TARGET_HAS_SECURE_ROM_DL_MODE && !SECURE_DISABLE_ROM_DL_MODE
select ESPTOOLPY_NO_STUB
help
If set, during startup the app will burn an eFuse bit to permanently switch the UART ROM
Download Mode into a separate Secure Download mode. This option can only work if
Download Mode is not already disabled by eFuse.
It is also possible to permanently disable Download Mode by calling
esp_efuse_disable_rom_download_mode() at runtime.
Secure Download mode limits the use of Download Mode functions to simple flash read,
write and erase operations, plus a command to return a summary of currently enabled
security features.
config SECURE_ENABLE_SECURE_ROM_DL_MODE
bool "UART ROM download mode (Permanently switch to Secure mode (recommended))"
depends on SECURE_TARGET_HAS_SECURE_ROM_DL_MODE
select ESPTOOLPY_NO_STUB
help
If set, during startup the app will burn an eFuse bit to permanently switch the UART ROM
Download Mode into a separate Secure Download mode. This option can only work if
Download Mode is not already disabled by eFuse.
Secure Download mode is not compatible with the esptool.py flasher stub feature,
espefuse.py, read/writing memory or registers, encrypted download, or any other
features that interact with unsupported Download Mode commands.
Secure Download mode limits the use of Download Mode functions to simple flash read,
write and erase operations, plus a command to return a summary of currently enabled
security features.
Secure Download mode should be enabled in any application where Flash Encryption
and/or Secure Boot is enabled. Disabling this option does not immediately cancel
the benefits of the security features, but it increases the potential "attack
surface" for an attacker to try and bypass them with a successful physical attack.
Secure Download mode is not compatible with the esptool.py flasher stub feature,
espefuse.py, read/writing memory or registers, encrypted download, or any other
features that interact with unsupported Download Mode commands.
It is also possible to enable secure download mode at runtime by calling
esp_efuse_enable_rom_secure_download_mode()
Secure Download mode should be enabled in any application where Flash Encryption
and/or Secure Boot is enabled. Disabling this option does not immediately cancel
the benefits of the security features, but it increases the potential "attack
surface" for an attacker to try and bypass them with a successful physical attack.
It is also possible to enable secure download mode at runtime by calling
esp_efuse_enable_rom_secure_download_mode()
config SECURE_INSECURE_ALLOW_DL_MODE
bool "UART ROM download mode (Enabled (not recommended))"
help
This is a potentially insecure option.
Enabling this option will allow the full UART download mode to stay enabled.
This option SHOULD NOT BE ENABLED for production use cases.
endchoice
endmenu # Security features

View File

@ -17,6 +17,8 @@ CONFIG_SECURE_BOOT_SIGNING_KEY ?=
SECURE_BOOT_SIGNING_KEY=$(abspath $(call dequote,$(CONFIG_SECURE_BOOT_SIGNING_KEY)))
export SECURE_BOOT_SIGNING_KEY # used by bootloader_support component
BOOTLOADER_SIGNED_BIN ?=
# Has a matching value in bootloader_support esp_flash_partitions.h
BOOTLOADER_OFFSET := 0x1000

View File

@ -28,10 +28,11 @@ set(COMPONENTS
micro-ecc
main
efuse
esp_system)
esp_system
newlib)
set(BOOTLOADER_BUILD 1)
include("${IDF_PATH}/tools/cmake/project.cmake")
set(common_req log esp_rom esp_common esp_hw_support hal)
set(common_req log esp_rom esp_common esp_hw_support hal newlib)
if(LEGACY_INCLUDE_COMMON_HEADERS)
list(APPEND common_req soc hal)
endif()
@ -53,6 +54,9 @@ string(REPLACE ";" " " esptoolpy_write_flash
string(REPLACE ";" " " espsecurepy "${ESPSECUREPY}")
string(REPLACE ";" " " espefusepy "${ESPEFUSEPY}")
# Suppress warning: "Manually-specified variables were not used by the project: SECURE_BOOT_SIGNING_KEY"
set(ignore_signing_key "${SECURE_BOOT_SIGNING_KEY}")
if(CONFIG_SECURE_BOOTLOADER_REFLASHABLE)
if(CONFIG_SECURE_BOOTLOADER_KEY_ENCODING_192BIT)
set(key_digest_len 192)

View File

@ -8,15 +8,16 @@ endif
PROJECT_NAME := bootloader
COMPONENTS := esp_hw_support esptool_py bootloader_support log spi_flash micro-ecc soc main efuse esp_rom hal
COMPONENTS := esp_hw_support esptool_py bootloader_support log spi_flash micro-ecc soc main efuse esp_rom hal xtensa
# Clear C and CXX from top level project
CFLAGS =
CXXFLAGS =
#We cannot include the idf_target, esp_common component directly but we need their includes.
#We cannot include the some components like idf_target, esp_common directly but we need their includes.
CFLAGS += -I $(IDF_PATH)/components/$(IDF_TARGET)/include
CFLAGS += -I $(IDF_PATH)/components/esp_common/include
CFLAGS += -I $(IDF_PATH)/components/newlib/platform_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

@ -48,11 +48,12 @@ SECTIONS
*libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_soc.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:secure_boot_signatures.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
*libmicro-ecc.a:*.*(.literal .text .literal.* .text.*)
*libspi_flash.a:*.*(.literal .text .literal.* .text.*)
*libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*)
@ -107,8 +108,6 @@ SECTIONS
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s.*)
*(.sdata2)
*(.sdata2.*)
*(.gnu.linkonce.s2.*)
*(.jcr)
_data_end = ABSOLUTE(.);
@ -121,6 +120,7 @@ SECTIONS
*(.rodata.*)
*(.gnu.linkonce.r.*)
*(.rodata1)
*(.sdata2 .sdata2.*)
__XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
*(.xt_except_table)
*(.gcc_except_table)
@ -167,6 +167,14 @@ SECTIONS
*(.fini.literal)
*(.fini)
*(.gnu.version)
/** CPU will try to prefetch up to 16 bytes of
* of instructions. This means that any configuration (e.g. MMU, PMS) must allow
* safe access to up to 16 bytes after the last real instruction, add
* dummy bytes to ensure this
*/
. += 16;
_text_end = ABSOLUTE(.);
_etext = .;
} > iram_seg

View File

@ -36,11 +36,12 @@ SECTIONS
*libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_soc.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:secure_boot_signatures.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
*libmicro-ecc.a:*.*(.literal .text .literal.* .text.*)
*libspi_flash.a:*.*(.literal .text .literal.* .text.*)
*libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*)
@ -96,8 +97,6 @@ SECTIONS
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s.*)
*(.sdata2)
*(.sdata2.*)
*(.gnu.linkonce.s2.*)
*(.jcr)
_data_end = ABSOLUTE(.);
@ -110,6 +109,7 @@ SECTIONS
*(.rodata.*)
*(.gnu.linkonce.r.*)
*(.rodata1)
*(.sdata2 .sdata2.* .srodata .srodata.*)
__XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
*(.xt_except_table)
*(.gcc_except_table)
@ -156,6 +156,14 @@ SECTIONS
*(.fini.literal)
*(.fini)
*(.gnu.version)
/** CPU will try to prefetch up to 16 bytes of
* of instructions. This means that any configuration (e.g. MMU, PMS) must allow
* safe access to up to 16 bytes after the last real instruction, add
* dummy bytes to ensure this
*/
. += 16;
_text_end = ABSOLUTE(.);
_etext = .;
} > iram_seg

View File

@ -35,11 +35,12 @@ SECTIONS
*libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_soc.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:secure_boot_signatures.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
*libmicro-ecc.a:*.*(.literal .text .literal.* .text.*)
*libspi_flash.a:*.*(.literal .text .literal.* .text.*)
*libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*)
@ -95,8 +96,6 @@ SECTIONS
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s.*)
*(.sdata2)
*(.sdata2.*)
*(.gnu.linkonce.s2.*)
*(.jcr)
_data_end = ABSOLUTE(.);
@ -109,6 +108,7 @@ SECTIONS
*(.rodata.*)
*(.gnu.linkonce.r.*)
*(.rodata1)
*(.sdata2 .sdata2.*)
__XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
*(.xt_except_table)
*(.gcc_except_table)
@ -155,6 +155,14 @@ SECTIONS
*(.fini.literal)
*(.fini)
*(.gnu.version)
/** CPU will try to prefetch up to 16 bytes of
* of instructions. This means that any configuration (e.g. MMU, PMS) must allow
* safe access to up to 16 bytes after the last real instruction, add
* dummy bytes to ensure this
*/
. += 16;
_text_end = ABSOLUTE(.);
_etext = .;
} > iram_seg

View File

@ -36,11 +36,12 @@ SECTIONS
*libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:bootloader_soc.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:secure_boot_signatures.*(.literal .text .literal.* .text.*)
*libbootloader_support.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
*libmicro-ecc.a:*.*(.literal .text .literal.* .text.*)
*libspi_flash.a:*.*(.literal .text .literal.* .text.*)
*libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*)
@ -96,8 +97,6 @@ SECTIONS
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s.*)
*(.sdata2)
*(.sdata2.*)
*(.gnu.linkonce.s2.*)
*(.jcr)
_data_end = ABSOLUTE(.);
@ -110,6 +109,7 @@ SECTIONS
*(.rodata.*)
*(.gnu.linkonce.r.*)
*(.rodata1)
*(.sdata2 .sdata2.*)
__XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
*(.xt_except_table)
*(.gcc_except_table)
@ -156,6 +156,14 @@ SECTIONS
*(.fini.literal)
*(.fini)
*(.gnu.version)
/** CPU will try to prefetch up to 16 bytes of
* of instructions. This means that any configuration (e.g. MMU, PMS) must allow
* safe access to up to 16 bytes after the last real instruction, add
* dummy bytes to ensure this
*/
. += 16;
_text_end = ABSOLUTE(.);
_etext = .;
} > iram_seg

View File

@ -9,6 +9,7 @@ set(srcs
"src/bootloader_utility.c"
"src/esp_image_format.c"
"src/flash_encrypt.c"
"src/secure_boot.c"
"src/flash_partitions.c"
"src/flash_qio_mode.c"
"src/bootloader_flash_config_${IDF_TARGET}.c"
@ -26,6 +27,7 @@ if(BOOTLOADER_BUILD)
"src/bootloader_panic.c"
"src/${IDF_TARGET}/bootloader_sha.c"
"src/${IDF_TARGET}/flash_encrypt.c"
"src/${IDF_TARGET}/bootloader_soc.c"
"src/${IDF_TARGET}/bootloader_${IDF_TARGET}.c"
)
list(APPEND priv_requires hal)
@ -34,16 +36,28 @@ else()
"src/idf/bootloader_sha.c")
set(include_dirs "include")
set(priv_include_dirs "include_bootloader")
set(priv_requires spi_flash mbedtls efuse)
set(priv_requires spi_flash mbedtls efuse app_update)
endif()
if(CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME OR CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME)
if(BOOTLOADER_BUILD)
list(APPEND srcs
"src/${IDF_TARGET}/secure_boot_signatures.c")
else()
list(APPEND srcs
"src/idf/secure_boot_signatures.c")
if(BOOTLOADER_BUILD)
if(CONFIG_SECURE_SIGNED_ON_BOOT)
if(CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME)
list(APPEND srcs "src/secure_boot_v1/secure_boot_signatures_bootloader.c")
endif()
if(CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME)
list(APPEND srcs "src/secure_boot_v2/secure_boot_signatures_bootloader.c")
endif()
endif()
else()
if(CONFIG_SECURE_SIGNED_ON_UPDATE)
if(CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME)
list(APPEND srcs "src/secure_boot_v1/secure_boot_signatures_app.c")
endif()
if(CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME)
list(APPEND srcs "src/secure_boot_v2/secure_boot_signatures_app.c")
endif()
endif()
endif()

View File

@ -7,7 +7,9 @@ else
COMPONENT_PRIV_INCLUDEDIRS := include_bootloader
endif
COMPONENT_SRCDIRS := src
COMPONENT_SRCDIRS := src \
src/secure_boot_v2 \
src/secure_boot_v1
ifndef IS_BOOTLOADER_BUILD
COMPONENT_SRCDIRS += src/idf # idf sub-directory contains platform agnostic IDF versions
@ -33,12 +35,27 @@ COMPONENT_OBJEXCLUDE += src/bootloader_flash_config_esp32s2.o \
src/bootloader_random_esp32s3.o \
src/bootloader_random_esp32c3.o
ifndef CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
ifndef CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME
COMPONENT_OBJEXCLUDE += src/$(IDF_TARGET)/secure_boot_signatures.o \
src/idf/secure_boot_signatures.o
endif
endif
ifdef IS_BOOTLOADER_BUILD
ifndef CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
COMPONENT_OBJEXCLUDE += src/secure_boot_v1/secure_boot_signatures_bootloader.o
endif
ifndef CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME
COMPONENT_OBJEXCLUDE += src/secure_boot_v2/secure_boot_signatures_bootloader.o
endif
COMPONENT_OBJEXCLUDE += src/secure_boot_v1/secure_boot_signatures_app.o \
src/secure_boot_v2/secure_boot_signatures_app.o
else
ifndef CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
COMPONENT_OBJEXCLUDE += src/secure_boot_v1/secure_boot_signatures_app.o
endif
ifndef CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME
COMPONENT_OBJEXCLUDE += src/secure_boot_v2/secure_boot_signatures_app.o
endif
COMPONENT_OBJEXCLUDE += src/secure_boot_v1/secure_boot_signatures_bootloader.o \
src/secure_boot_v2/secure_boot_signatures_bootloader.o
endif # IS_BOOTLOADER_BUILD
ifndef CONFIG_SECURE_BOOT
COMPONENT_OBJEXCLUDE += src/$(IDF_TARGET)/secure_boot.o

View File

@ -105,6 +105,15 @@ bool bootloader_common_label_search(const char *list, char *label);
*/
void bootloader_configure_spi_pins(int drv);
/**
* @brief Get flash CS IO
*
* Can be determined by eFuse values, or the default value
*
* @return Flash CS IO
*/
uint8_t bootloader_flash_get_cs_io(void);
/**
* @brief Calculates a sha-256 for a given partition or returns a appended digest.
*

View File

@ -17,6 +17,20 @@
#include <esp_spi_flash.h> /* including in bootloader for error values */
#include "sdkconfig.h"
#include "soc/soc_caps.h"
#include "bootloader_flash_override.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Read flash ID by sending RDID command (0x9F)
* @return flash raw ID
* mfg_id = (ID >> 16) & 0xFF;
flash_id = ID & 0xffff;
*/
uint32_t bootloader_read_flash_id(void);
#if SOC_CACHE_SUPPORT_WRAP
/**
@ -27,3 +41,23 @@
*/
esp_err_t bootloader_flash_wrap_set(spi_flash_wrap_mode_t mode);
#endif
/**
* @brief Startup flow recommended by XMC. Call at startup before any erase/write operation.
*
* @return ESP_OK When startup successfully, otherwise ESP_FAIL (indiciating you should reboot before erase/write).
*/
esp_err_t bootloader_flash_xmc_startup(void);
/**
* @brief Unlock Flash write protect.
* Please do not call this function in SDK.
*
* @note This can be overridden because it's attribute weak.
*/
esp_err_t IRAM_ATTR __attribute__((weak)) bootloader_flash_unlock(void);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,101 @@
/*
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "esp_err.h"
#include "esp_attr.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned (*bootloader_flash_read_status_fn_t)(void);
typedef void (*bootloader_flash_write_status_fn_t)(unsigned);
typedef struct __attribute__((packed))
{
const char *manufacturer;
uint8_t mfg_id; /* 8-bit JEDEC manufacturer ID */
uint16_t flash_id; /* 16-bit JEDEC flash chip ID */
uint16_t id_mask; /* Bits to match on in flash chip ID */
bootloader_flash_read_status_fn_t read_status_fn;
bootloader_flash_write_status_fn_t write_status_fn;
uint8_t status_qio_bit;
} bootloader_qio_info_t;
/**
* @brief Read 8 bit status using RDSR command
*
* @return Value of SR1.
*/
unsigned bootloader_read_status_8b_rdsr(void);
/**
* @brief Read 8 bit status (second byte) using RDSR2 command
*
* @return Value of SR2
*/
unsigned bootloader_read_status_8b_rdsr2(void);
/**
* @brief Read 16 bit status using RDSR & RDSR2 (low and high bytes)
*
* @return Value of SR2#SR1.
*/
unsigned bootloader_read_status_16b_rdsr_rdsr2(void);
/**
* @brief Write 8 bit status using WRSR
*/
void bootloader_write_status_8b_wrsr(unsigned new_status);
/**
* @brief Write 8 bit status (second byte) using WRSR2.
*/
void bootloader_write_status_8b_wrsr2(unsigned new_status);
/**
* @brief Write 16 bit status using WRSR, (both write SR1 and SR2)
*/
void bootloader_write_status_16b_wrsr(unsigned new_status);
/**
* @brief Read 8 bit status of XM25QU64A.
*
* @return Value of 8 bit SR.
*/
unsigned bootloader_read_status_8b_xmc25qu64a(void);
/**
* @brief Write 8 bit status for XM25QU64A
*/
void bootloader_write_status_8b_xmc25qu64a(unsigned new_status);
/* Array of known flash chips and data to enable Quad I/O mode
Manufacturer & flash ID can be tested by running "esptool.py
flash_id"
If manufacturer ID matches, and flash ID ORed with flash ID mask
matches, enable_qio_mode() will execute "Read Cmd", test if bit
number "QIE Bit" is set, and if not set it will call "Write Cmd"
with this bit set.
Searching of this table stops when the first match is found.
*/
extern const bootloader_qio_info_t __attribute__((weak)) bootloader_flash_qe_support_list[];
/**
* @brief Unlock Flash write protect.
* Please do not call this function in SDK.
*
* @note This can be overridden because it's attribute weak.
*/
esp_err_t IRAM_ATTR __attribute__((weak)) bootloader_flash_unlock(void);
#ifdef __cplusplus
}
#endif

View File

@ -42,6 +42,9 @@ extern "C" {
#define PART_FLAG_ENCRYPTED (1<<0)
/* The md5sum value is found this many bytes after the ESP_PARTITION_MAGIC_MD5 offset */
#define ESP_PARTITION_MD5_OFFSET 16
/* Pre-partition table fixed flash offsets */
#define ESP_BOOTLOADER_DIGEST_OFFSET 0x0
#define ESP_BOOTLOADER_OFFSET CONFIG_BOOTLOADER_OFFSET_IN_FLASH /* Offset of bootloader image. Has matching value in bootloader KConfig.projbuild file. */

View File

@ -106,6 +106,20 @@ _Static_assert(sizeof(rtc_retain_mem_t) <= ESP_BOOTLOADER_RESERVE_RTC, "Reserved
*/
esp_err_t esp_image_verify(esp_image_load_mode_t mode, const esp_partition_pos_t *part, esp_image_metadata_t *data);
/**
* @brief Get metadata of app
*
* If encryption is enabled, data will be transparently decrypted.
*
* @param part Partition to load the app from.
* @param[out] metadata Pointer to the image metadata structure which is be filled in by this function.
* Fields will all be initialised by this function.
*
* @return
* - ESP_OK if filling of metadata was successful
*/
esp_err_t esp_image_get_metadata(const esp_partition_pos_t *part, esp_image_metadata_t *metadata);
/**
* @brief Verify and load an app image (available only in space of bootloader).
*

View File

@ -19,17 +19,22 @@
#include "esp_image_format.h"
#include "esp_rom_efuse.h"
#include "sdkconfig.h"
#include "esp_rom_crc.h"
#if CONFIG_IDF_TARGET_ESP32
#include "esp32/rom/efuse.h"
#include "esp32/rom/secure_boot.h"
#elif CONFIG_IDF_TARGET_ESP32S2
#include "esp32s2/rom/efuse.h"
#include "esp32s2/rom/secure_boot.h"
#elif CONFIG_IDF_TARGET_ESP32C3
#include "esp32c3/rom/efuse.h"
#include "esp32c3/rom/secure_boot.h"
#elif CONFIG_IDF_TARGET_ESP32S3
#include "esp32s3/rom/efuse.h"
#include "esp32s3/rom/secure_boot.h"
#endif
typedef struct ets_secure_boot_signature ets_secure_boot_signature_t;
#ifdef CONFIG_SECURE_BOOT_V1_ENABLED
#if !defined(CONFIG_SECURE_SIGNED_ON_BOOT) || !defined(CONFIG_SECURE_SIGNED_ON_UPDATE) || !defined(CONFIG_SECURE_SIGNED_APPS)
#error "internal sdkconfig error, secure boot should always enable all signature options"
@ -45,6 +50,8 @@ extern "C" {
Can be compiled as part of app or bootloader code.
*/
#define ESP_SECURE_BOOT_DIGEST_LEN 32
/** @brief Is secure boot currently enabled in hardware?
*
* This means that the ROM bootloader code will only boot
@ -181,6 +188,16 @@ typedef struct {
*/
esp_err_t esp_secure_boot_verify_ecdsa_signature_block(const esp_secure_boot_sig_block_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest);
#if !CONFIG_IDF_TARGET_ESP32 || CONFIG_ESP32_REV_MIN_3
/**
* @brief Structure to hold public key digests calculated from the signature blocks of a single image.
*
* Each image can have one or more signature blocks (up to SECURE_BOOT_NUM_BLOCKS). Each signature block includes a public key.
*/
typedef struct {
uint8_t key_digests[SECURE_BOOT_NUM_BLOCKS][ESP_SECURE_BOOT_DIGEST_LEN]; /* SHA of the public key components in the signature block */
unsigned num_digests; /* Number of valid digests, starting at index 0 */
} esp_image_sig_public_key_digests_t;
/** @brief Verify the RSA secure boot signature block for Secure Boot V2.
*
@ -194,6 +211,7 @@ esp_err_t esp_secure_boot_verify_ecdsa_signature_block(const esp_secure_boot_sig
*
*/
esp_err_t esp_secure_boot_verify_rsa_signature_block(const ets_secure_boot_signature_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest);
#endif // !CONFIG_IDF_TARGET_ESP32 || CONFIG_ESP32_REV_MIN_3
/** @brief Legacy ECDSA verification function
*
@ -214,6 +232,45 @@ typedef struct {
uint8_t digest[64];
} esp_secure_boot_iv_digest_t;
/** @brief Check the secure boot V2 during startup
*
* @note This function is called automatically during app startup,
* it doesn't need to be called from the app.
*
* Verifies the secure boot config during startup:
*
* - Correct any insecure secure boot settings
*/
void esp_secure_boot_init_checks(void);
#if !BOOTLOADER_BUILD && CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME
/** @brief Scan the current running app for signature blocks
*
* @note This function doesn't verify that the signatures are valid or the
* corresponding public keys are trusted, it only reads the number of signature
* blocks present and optionally calculates the digests of the public keys
* provided in the signature blocks.
*
* @param digest_public_keys If true, the key_digests fields in the
* public_key_digests structure will be filled with the digests of the public
* key provided in each signature block. Note that if Secure Boot V2 is enabled,
* each public key will only be trusted if the same digest is also present in
* eFuse (but this is not checked by this function).
*
* @param public_key_digests[out] Structure is initialized with the num_digests
* field set to the number of signatures found. If digest_public_keys is set,
* the public key digests are also calculated and stored here.
*
* @return
* - ESP_OK - At least one signature was found
* - ESP_ERR_NOT_FOUND - No signatures were found, num_digests value will be zero
* - ESP_FAIL - An error occured trying to read the signature blocks from flash
*/
esp_err_t esp_secure_boot_get_signature_blocks_for_running_app(bool digest_public_keys, esp_image_sig_public_key_digests_t *public_key_digests);
#endif // !BOOTLOADER_BUILD && CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME
#ifdef __cplusplus
}
#endif

View File

@ -37,6 +37,7 @@
#define CMD_RDSR 0x05
#define CMD_RDSR2 0x35 /* Not all SPI flash uses this command */
#define CMD_OTPEN 0x3A /* Enable OTP mode, not all SPI flash uses this command */
#define CMD_RDSFDP 0x5A /* Read the SFDP of the flash */
#define CMD_WRAP 0x77 /* Set burst with wrap command */
#define CMD_RESUME 0x7A /* Resume command to clear flash suspend bit */
@ -164,6 +165,15 @@ static inline uint32_t bootloader_cache_pages_to_map(uint32_t size, uint32_t vad
*/
uint32_t bootloader_execute_flash_command(uint8_t command, uint32_t mosi_data, uint8_t mosi_len, uint8_t miso_len);
/**
* @brief Read the SFDP of the flash
*
* @param sfdp_addr Address of the parameter to read
* @param miso_byte_num Bytes to read
* @return The read SFDP, little endian, 4 bytes at most
*/
uint32_t bootloader_flash_read_sfdp(uint32_t sfdp_addr, unsigned int miso_byte_num);
/**
* @brief Enable the flash write protect (WEL bit).
*/

View File

@ -0,0 +1,27 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
/**
* @brief Configure analog super WDT reset
*
* @param enable Boolean to enable or disable super WDT reset
*/
void bootloader_ana_super_wdt_reset_config(bool enable);
/**
* @brief Configure analog brownout reset
*
* @param enable Boolean to enable or disable brownout reset
*/
void bootloader_ana_bod_reset_config(bool enable);
/**
* @brief Configure analog clock glitch reset
*
* @param enable Boolean to enable or disable clock glitch reset
*/
void bootloader_ana_clock_glitch_reset_config(bool enable);

View File

@ -104,9 +104,10 @@ void bootloader_atexit(void);
esp_err_t bootloader_sha256_hex_to_str(char *out_str, const uint8_t *in_array_hex, size_t len);
/**
* @brief Debug log contents of a buffer as hexadecimal
* @brief Debug log contents of a buffer as hexadecimal.
*
* @note Only works if component log level is DEBUG or higher.
* @note - Only works if component log level is DEBUG or higher.
* - It will print at most 128 bytes from @c buffer.
*
* @param buffer Buffer to log
* @param length Length of buffer in bytes. Maximum length 128 bytes.

View File

@ -80,4 +80,7 @@ __attribute__((weak)) void bootloader_clock_configure(void)
rtc_clk_32k_bootstrap(CONFIG_ESP_SYSTEM_RTC_EXT_XTAL_BOOTSTRAP_CYCLES);
}
#endif // CONFIG_ESP_SYSTEM_RTC_EXT_XTAL
REG_WRITE(RTC_CNTL_INT_ENA_REG, 0);
REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX);
}

View File

@ -29,6 +29,7 @@
#include "esp_rom_crc.h"
#include "esp_rom_gpio.h"
#include "esp_rom_sys.h"
#include "esp_rom_efuse.h"
#include "esp_flash_partitions.h"
#include "bootloader_flash_priv.h"
#include "bootloader_common.h"
@ -163,13 +164,17 @@ esp_err_t bootloader_common_get_sha256_of_partition (uint32_t address, uint32_t
.size = size,
};
esp_image_metadata_t data;
// Function esp_image_verify() verifies and fills the structure data.
// here important to get: image_digest, image_len, hash_appended.
if (esp_image_verify(ESP_IMAGE_VERIFY_SILENT, &partition_pos, &data) != ESP_OK) {
if (esp_image_get_metadata(&partition_pos, &data) != ESP_OK) {
return ESP_ERR_IMAGE_INVALID;
}
if (data.image.hash_appended) {
memcpy(out_sha_256, data.image_digest, ESP_PARTITION_HASH_LEN);
uint8_t calc_sha256[ESP_PARTITION_HASH_LEN];
// The hash is verified before returning, if app content is invalid then the function returns ESP_ERR_IMAGE_INVALID.
esp_err_t error = bootloader_sha256_flash_contents(address, data.image_len - ESP_PARTITION_HASH_LEN, calc_sha256);
if (error || memcmp(data.image_digest, calc_sha256, ESP_PARTITION_HASH_LEN) != 0) {
return ESP_ERR_IMAGE_INVALID;
}
return ESP_OK;
}
// If image doesn't have a appended hash then hash calculates for entire image.
@ -194,8 +199,19 @@ void bootloader_common_vddsdio_configure(void)
#endif // CONFIG_BOOTLOADER_VDDSDIO_BOOST
}
RESET_REASON bootloader_common_get_reset_reason(int cpu_no)
{
return rtc_get_reset_reason(cpu_no);
}
uint8_t bootloader_flash_get_cs_io(void)
{
uint8_t cs_io;
const uint32_t spiconfig = esp_rom_efuse_get_flash_gpio_info();
if (spiconfig == ESP_ROM_EFUSE_FLASH_DEFAULT_SPI) {
cs_io = SPI_CS0_GPIO_NUM;
} else {
cs_io = (spiconfig >> 18) & 0x3f;
}
return cs_io;
}

View File

@ -30,6 +30,7 @@
#include "soc/gpio_periph.h"
#include "soc/rtc.h"
#include "soc/efuse_reg.h"
#include "soc/soc_memory_layout.h"
#include "hal/gpio_ll.h"
#include "esp_image_format.h"
#include "bootloader_sha.h"
@ -76,7 +77,9 @@ esp_err_t bootloader_common_check_chip_validity(const esp_image_header_t* img_hd
}
uint8_t revision = bootloader_common_get_chip_revision();
if (revision < img_hdr->min_chip_rev) {
ESP_LOGE(TAG, "can't run on lower chip revision, expected %d, found %d", revision, img_hdr->min_chip_rev);
/* To fix this error, please update mininum supported chip revision from configuration,
* located in TARGET (e.g. ESP32) specific options under "Component config" menu */
ESP_LOGE(TAG, "This chip is revision %d but the application is configured for minimum revision %d. Can't run.", revision, img_hdr->min_chip_rev);
err = ESP_FAIL;
} else if (revision != img_hdr->min_chip_rev) {
#ifdef BOOTLOADER_BUILD
@ -138,7 +141,18 @@ esp_err_t bootloader_common_get_partition_description(const esp_partition_pos_t
#if defined( CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP ) || defined( CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC )
rtc_retain_mem_t *const rtc_retain_mem = (rtc_retain_mem_t *)(SOC_RTC_DRAM_HIGH - sizeof(rtc_retain_mem_t));
#define RTC_RETAIN_MEM_ADDR (SOC_RTC_DRAM_HIGH - sizeof(rtc_retain_mem_t))
rtc_retain_mem_t *const rtc_retain_mem = (rtc_retain_mem_t *)RTC_RETAIN_MEM_ADDR;
#if !IS_BOOTLOADER_BUILD
/* The app needs to be told this memory is reserved, important if configured to use RTC memory as heap.
Note that keeping this macro here only works when other symbols in this file are referenced by the app, as
this feature is otherwise 100% part of the bootloader. However this seems to happen in all apps.
*/
SOC_RESERVE_MEMORY_REGION(RTC_RETAIN_MEM_ADDR, RTC_RETAIN_MEM_ADDR + sizeof(rtc_retain_mem_t), rtc_retain_mem);
#endif
static bool check_rtc_retain_mem(void)
{

View File

@ -21,11 +21,13 @@
#include "soc/gpio_sig_map.h"
#include "soc/rtc.h"
#include "hal/clk_gate_ll.h"
#include "hal/gpio_hal.h"
#if CONFIG_IDF_TARGET_ESP32S2
#include "esp32s2/rom/usb/cdc_acm.h"
#include "esp32s2/rom/usb/usb_common.h"
#elif CONFIG_IDF_TARGET_ESP32C3
#include "esp32c3/rom/ets_sys.h"
#include "esp32c3/rom/uart.h"
#endif
#include "esp_rom_gpio.h"
#include "esp_rom_uart.h"
@ -69,15 +71,17 @@ void bootloader_console_init(void)
uart_tx_gpio != UART_NUM_0_TXD_DIRECT_GPIO_NUM ||
uart_rx_gpio != UART_NUM_0_RXD_DIRECT_GPIO_NUM) {
// Change default UART pins back to GPIOs
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, PIN_FUNC_GPIO);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, PIN_FUNC_GPIO);
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_U0RXD_U, PIN_FUNC_GPIO);
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_U0TXD_U, PIN_FUNC_GPIO);
// Route GPIO signals to/from pins
const uint32_t tx_idx = uart_periph_signal[uart_num].tx_sig;
const uint32_t rx_idx = uart_periph_signal[uart_num].rx_sig;
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[uart_rx_gpio], PIN_FUNC_GPIO);
PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[uart_rx_gpio]);
esp_rom_gpio_pad_pullup_only(uart_rx_gpio);
esp_rom_gpio_connect_out_signal(uart_tx_gpio, tx_idx, 0, 0);
esp_rom_gpio_connect_in_signal(uart_rx_gpio, rx_idx, 0);
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[uart_tx_gpio], PIN_FUNC_GPIO);
// Enable the peripheral
periph_ll_enable_clk_clear_rst(PERIPH_UART0_MODULE + uart_num);
}
@ -110,3 +114,11 @@ void bootloader_console_init(void)
esp_rom_install_channel_putc(1, bootloader_console_write_char_usb);
}
#endif //CONFIG_ESP_CONSOLE_USB_CDC
#ifdef CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
void bootloader_console_init(void)
{
UartDevice *uart = GetUartDevice();
uart->buff_uart_no = ESP_ROM_USB_SERIAL_DEVICE_NUM;
}
#endif //CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG

View File

@ -16,8 +16,9 @@
#include "bootloader_clock.h"
#include "soc/efuse_reg.h"
#include "soc/apb_ctrl_reg.h"
#include "esp_attr.h"
uint8_t bootloader_common_get_chip_revision(void)
IRAM_ATTR uint8_t bootloader_common_get_chip_revision(void)
{
uint8_t eco_bit0, eco_bit1, eco_bit2;
eco_bit0 = (REG_READ(EFUSE_BLK0_RDATA3_REG) & 0xF000) >> 15;
@ -45,7 +46,7 @@ uint8_t bootloader_common_get_chip_revision(void)
return chip_ver;
}
uint32_t bootloader_common_get_chip_ver_pkg(void)
IRAM_ATTR uint32_t bootloader_common_get_chip_ver_pkg(void)
{
uint32_t pkg_version = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
uint32_t pkg_version_4bit = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG_4BIT);

View File

@ -14,14 +14,15 @@
#include <stdint.h>
#include "soc/efuse_reg.h"
#include "esp_attr.h"
uint8_t bootloader_common_get_chip_revision(void)
IRAM_ATTR uint8_t bootloader_common_get_chip_revision(void)
{
// should return the same value as esp_efuse_get_chip_ver()
return REG_GET_FIELD(EFUSE_RD_MAC_SPI_SYS_3_REG, EFUSE_WAFER_VERSION);
}
uint32_t bootloader_common_get_chip_ver_pkg(void)
IRAM_ATTR uint32_t bootloader_common_get_chip_ver_pkg(void)
{
// should return the same value as esp_efuse_get_pkg_ver()
return REG_GET_FIELD(EFUSE_RD_MAC_SPI_SYS_3_REG, EFUSE_PKG_VERSION);

View File

@ -16,16 +16,17 @@
#include "bootloader_clock.h"
#include "bootloader_common.h"
#include "soc/efuse_reg.h"
#include "esp_attr.h"
uint8_t bootloader_common_get_chip_revision(void)
IRAM_ATTR uint8_t bootloader_common_get_chip_revision(void)
{
// should return the same value as esp_efuse_get_chip_ver()
/* No other revisions for ESP32-S2 */
return REG_GET_FIELD(EFUSE_RD_MAC_SPI_SYS_3_REG, EFUSE_WAFER_VERSION);
return 0;
}
uint32_t bootloader_common_get_chip_ver_pkg(void)
IRAM_ATTR uint32_t bootloader_common_get_chip_ver_pkg(void)
{
// should return the same value as esp_efuse_get_pkg_ver()
return REG_GET_FIELD(EFUSE_RD_MAC_SPI_SYS_3_REG, EFUSE_PKG_VERSION);
return REG_GET_FIELD(EFUSE_RD_MAC_SPI_SYS_4_REG, EFUSE_PKG_VERSION);
}

View File

@ -13,15 +13,16 @@
// limitations under the License.
#include <stdint.h>
#include "esp_attr.h"
uint8_t bootloader_common_get_chip_revision(void)
IRAM_ATTR uint8_t bootloader_common_get_chip_revision(void)
{
// should return the same value as esp_efuse_get_chip_ver()
/* No other revisions for ESP32-S3 */
return 0;
}
uint32_t bootloader_common_get_chip_ver_pkg(void)
IRAM_ATTR uint32_t bootloader_common_get_chip_ver_pkg(void)
{
// should return the same value as esp_efuse_get_pkg_ver()
return 0;

View File

@ -31,7 +31,9 @@
# define SPIFLASH SPIMEM1
#endif
#if CONFIG_IDF_TARGET_ESP32S2
#if CONFIG_IDF_TARGET_ESP32
#include "esp32/rom/spi_flash.h"
#elif CONFIG_IDF_TARGET_ESP32S2
#include "esp32s2/rom/spi_flash.h"
#elif CONFIG_IDF_TARGET_ESP32S3
#include "esp32s3/rom/spi_flash.h"
@ -39,6 +41,17 @@
#include "esp32c3/rom/spi_flash.h"
#endif
#define BYTESHIFT(VAR, IDX) (((VAR) >> ((IDX) * 8)) & 0xFF)
#define ISSI_ID 0x9D
#define MXIC_ID 0xC2
#define GD_Q_ID_HIGH 0xC8
#define GD_Q_ID_MID 0x40
#define GD_Q_ID_LOW 0x16
#define ESP_BOOTLOADER_SPIFLASH_BP_MASK_ISSI (BIT7 | BIT5 | BIT4 | BIT3 | BIT2)
#define ESP_BOOTLOADER_SPIFLASH_QE_GD_SR2 BIT1 // QE position when you write 8 bits(for SR2) at one time.
#define ESP_BOOTLOADER_SPIFLASH_QE_SR1_2BYTE BIT9 // QE position when you write 16 bits at one time.
#ifndef BOOTLOADER_BUILD
/* Normal app version maps to esp_spi_flash.h operations...
@ -109,7 +122,7 @@ esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size)
return spi_flash_erase_range(start_addr, size);
}
#else
#else //BOOTLOADER_BUILD
/* Bootloader version, uses ROM functions only */
#if CONFIG_IDF_TARGET_ESP32
#include "esp32/rom/spi_flash.h"
@ -398,7 +411,7 @@ esp_err_t bootloader_flash_write(size_t dest_addr, void *src, size_t size, bool
return ESP_FAIL;
}
err = spi_to_esp_err(esp_rom_spiflash_unlock());
err = bootloader_flash_unlock();
if (err != ESP_OK) {
return err;
}
@ -440,31 +453,136 @@ esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size)
return spi_to_esp_err(rc);
}
#endif
#endif // BOOTLOADER_BUILD
FORCE_INLINE_ATTR bool is_issi_chip(const esp_rom_spiflash_chip_t* chip)
{
return BYTESHIFT(chip->device_id, 2) == ISSI_ID;
}
// For GD25Q32, GD25Q64, GD25Q127C, GD25Q128, which use single command to read/write different SR.
FORCE_INLINE_ATTR bool is_gd_q_chip(const esp_rom_spiflash_chip_t* chip)
{
return BYTESHIFT(chip->device_id, 2) == GD_Q_ID_HIGH && BYTESHIFT(chip->device_id, 1) == GD_Q_ID_MID && BYTESHIFT(chip->device_id, 0) >= GD_Q_ID_LOW;
}
FORCE_INLINE_ATTR bool is_mxic_chip(const esp_rom_spiflash_chip_t* chip)
{
return BYTESHIFT(chip->device_id, 2) == MXIC_ID;
}
esp_err_t IRAM_ATTR __attribute__((weak)) bootloader_flash_unlock(void)
{
// At the beginning status == new_status == status_sr2 == new_status_sr2 == 0.
// If the register doesn't need to be updated, keep them the same (0), so that no command will be actually sent.
uint16_t status = 0; // status for SR1 or SR1+SR2 if writing SR with 01H + 2Bytes.
uint16_t new_status = 0;
uint8_t status_sr2 = 0; // status_sr2 for SR2.
uint8_t new_status_sr2 = 0;
uint8_t sr1_bit_num = 0;
esp_err_t err = ESP_OK;
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
if (is_issi_chip(&g_rom_flashchip) || is_mxic_chip(&g_rom_flashchip)) {
// Currently ISSI & MXIC share the same command and register layout, which is different from the default model.
// If any code here needs to be modified, check both chips.
status = bootloader_execute_flash_command(CMD_RDSR, 0, 0, 8);
/* Clear all bits in the mask.
(This is different from ROM esp_rom_spiflash_unlock, which keeps all bits as-is.)
*/
sr1_bit_num = 8;
new_status = status & (~ESP_BOOTLOADER_SPIFLASH_BP_MASK_ISSI);
} else if (is_gd_q_chip(&g_rom_flashchip)) {
/* The GD chips behaviour is to clear all bits in SR1 and clear bits in SR2 except QE bit.
Use 01H to write SR1 and 31H to write SR2.
*/
status = bootloader_execute_flash_command(CMD_RDSR, 0, 0, 8);
sr1_bit_num = 8;
new_status = 0;
status_sr2 = bootloader_execute_flash_command(CMD_RDSR2, 0, 0, 8);
new_status_sr2 = status_sr2 & ESP_BOOTLOADER_SPIFLASH_QE_GD_SR2;
} else {
/* For common behaviour, like XMC chips, Use 01H+2Bytes to write both SR1 and SR2*/
status = bootloader_execute_flash_command(CMD_RDSR, 0, 0, 8) | (bootloader_execute_flash_command(CMD_RDSR2, 0, 0, 8) << 8);
/* Clear all bits except QE, if it is set.
(This is different from ROM esp_rom_spiflash_unlock, which keeps all bits as-is.)
*/
sr1_bit_num = 16;
new_status = status & ESP_BOOTLOADER_SPIFLASH_QE_SR1_2BYTE;
}
// When SR is written, set to true to indicate that WRDI need to be sent to ensure the protection is ON before return.
bool status_written = false;
// Skip if nothing needs to be changed. Meaningless writing to SR increases the risk during write and wastes time.
if (status != new_status) {
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
bootloader_execute_flash_command(CMD_WREN, 0, 0, 0);
bootloader_execute_flash_command(CMD_WRSR, new_status, sr1_bit_num, 0);
status_written = true;
}
if (status_sr2 != new_status_sr2) {
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
bootloader_execute_flash_command(CMD_WREN, 0, 0, 0);
bootloader_execute_flash_command(CMD_WRSR2, new_status_sr2, 8, 0);
status_written = true;
}
if (status_written) {
//Call esp_rom_spiflash_wait_idle to make sure previous WRSR is completed.
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
bootloader_execute_flash_command(CMD_WRDI, 0, 0, 0);
}
return err;
}
/* dummy_len_plus values defined in ROM for SPI flash configuration */
#ifndef g_rom_spiflash_dummy_len_plus // ESP32-C3 uses a macro to access ROM data here
extern uint8_t g_rom_spiflash_dummy_len_plus[];
#endif
uint32_t bootloader_execute_flash_command(uint8_t command, uint32_t mosi_data, uint8_t mosi_len, uint8_t miso_len)
IRAM_ATTR static uint32_t bootloader_flash_execute_command_common(
uint8_t command,
uint32_t addr_len, uint32_t address,
uint8_t dummy_len,
uint8_t mosi_len, uint32_t mosi_data,
uint8_t miso_len)
{
assert(mosi_len <= 32);
assert(miso_len <= 32);
uint32_t old_ctrl_reg = SPIFLASH.ctrl.val;
uint32_t old_user_reg = SPIFLASH.user.val;
uint32_t old_user1_reg = SPIFLASH.user1.val;
#if CONFIG_IDF_TARGET_ESP32
SPIFLASH.ctrl.val = SPI_WP_REG_M; // keep WP high while idle, otherwise leave DIO mode
#else
SPIFLASH.ctrl.val = SPI_MEM_WP_REG_M; // keep WP high while idle, otherwise leave DIO mode
#endif
SPIFLASH.user.usr_dummy = 0;
SPIFLASH.user.usr_addr = 0;
//command phase
SPIFLASH.user.usr_command = 1;
SPIFLASH.user2.usr_command_bitlen = 7;
SPIFLASH.user2.usr_command_value = command;
SPIFLASH.user.usr_miso = miso_len > 0;
//addr phase
SPIFLASH.user.usr_addr = addr_len > 0;
SPIFLASH.user1.usr_addr_bitlen = addr_len - 1;
#if CONFIG_IDF_TARGET_ESP32
SPIFLASH.miso_dlen.usr_miso_dbitlen = miso_len ? (miso_len - 1) : 0;
SPIFLASH.addr = (addr_len > 0)? (address << (32-addr_len)) : 0;
#else
SPIFLASH.miso_dlen.usr_miso_bit_len = miso_len ? (miso_len - 1) : 0;
SPIFLASH.addr = address;
#endif
//dummy phase
if (miso_len > 0) {
uint32_t total_dummy = dummy_len + g_rom_spiflash_dummy_len_plus[1];
SPIFLASH.user.usr_dummy = total_dummy > 0;
SPIFLASH.user1.usr_dummy_cyclelen = total_dummy - 1;
} else {
SPIFLASH.user.usr_dummy = 0;
SPIFLASH.user1.usr_dummy_cyclelen = 0;
}
//output data
SPIFLASH.user.usr_mosi = mosi_len > 0;
#if CONFIG_IDF_TARGET_ESP32
SPIFLASH.mosi_dlen.usr_mosi_dbitlen = mosi_len ? (mosi_len - 1) : 0;
@ -472,24 +590,52 @@ uint32_t bootloader_execute_flash_command(uint8_t command, uint32_t mosi_data, u
SPIFLASH.mosi_dlen.usr_mosi_bit_len = mosi_len ? (mosi_len - 1) : 0;
#endif
SPIFLASH.data_buf[0] = mosi_data;
if (g_rom_spiflash_dummy_len_plus[1]) {
/* When flash pins are mapped via GPIO matrix, need a dummy cycle before reading via MISO */
if (miso_len > 0) {
SPIFLASH.user.usr_dummy = 1;
SPIFLASH.user1.usr_dummy_cyclelen = g_rom_spiflash_dummy_len_plus[1] - 1;
} else {
SPIFLASH.user.usr_dummy = 0;
SPIFLASH.user1.usr_dummy_cyclelen = 0;
}
}
//input data
SPIFLASH.user.usr_miso = miso_len > 0;
#if CONFIG_IDF_TARGET_ESP32
SPIFLASH.miso_dlen.usr_miso_dbitlen = miso_len ? (miso_len - 1) : 0;
#else
SPIFLASH.miso_dlen.usr_miso_bit_len = miso_len ? (miso_len - 1) : 0;
#endif
SPIFLASH.cmd.usr = 1;
while (SPIFLASH.cmd.usr != 0) {
}
SPIFLASH.ctrl.val = old_ctrl_reg;
return SPIFLASH.data_buf[0];
SPIFLASH.user.val = old_user_reg;
SPIFLASH.user1.val = old_user1_reg;
uint32_t ret = SPIFLASH.data_buf[0];
if (miso_len < 32) {
//set unused bits to 0
ret &= ~(UINT32_MAX << miso_len);
}
return ret;
}
uint32_t IRAM_ATTR bootloader_execute_flash_command(uint8_t command, uint32_t mosi_data, uint8_t mosi_len, uint8_t miso_len)
{
const uint8_t addr_len = 0;
const uint8_t address = 0;
const uint8_t dummy_len = 0;
return bootloader_flash_execute_command_common(command, addr_len, address,
dummy_len, mosi_len, mosi_data, miso_len);
}
// cmd(0x5A) + 24bit address + 8 cycles dummy
uint32_t IRAM_ATTR bootloader_flash_read_sfdp(uint32_t sfdp_addr, unsigned int miso_byte_num)
{
assert(miso_byte_num <= 4);
const uint8_t command = CMD_RDSFDP;
const uint8_t addr_len = 24;
const uint8_t dummy_len = 8;
const uint8_t mosi_len = 0;
const uint32_t mosi_data = 0;
const uint8_t miso_len = miso_byte_num * 8;
return bootloader_flash_execute_command_common(command, addr_len, sfdp_addr,
dummy_len, mosi_len, mosi_data, miso_len);
}
void bootloader_enable_wp(void)
@ -497,6 +643,13 @@ void bootloader_enable_wp(void)
bootloader_execute_flash_command(CMD_WRDI, 0, 0, 0); /* Exit OTP mode */
}
uint32_t IRAM_ATTR bootloader_read_flash_id(void)
{
uint32_t id = bootloader_execute_flash_command(CMD_RDID, 0, 0, 24);
id = ((id & 0xff) << 16) | ((id >> 16) & 0xff) | (id & 0xff00);
return id;
}
#if SOC_CACHE_SUPPORT_WRAP
esp_err_t bootloader_flash_wrap_set(spi_flash_wrap_mode_t mode)
{
@ -528,3 +681,104 @@ esp_err_t bootloader_flash_wrap_set(spi_flash_wrap_mode_t mode)
return ESP_OK;
}
#endif //SOC_CACHE_SUPPORT_WRAP
/*******************************************************************************
* XMC startup flow
******************************************************************************/
#define XMC_SUPPORT CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT
#define XMC_VENDOR_ID 0x20
#if BOOTLOADER_BUILD
#define BOOTLOADER_FLASH_LOG(level, ...) ESP_LOG##level(TAG, ##__VA_ARGS__)
#else
static DRAM_ATTR char bootloader_flash_tag[] = "bootloader_flash";
#define BOOTLOADER_FLASH_LOG(level, ...) ESP_DRAM_LOG##level(bootloader_flash_tag, ##__VA_ARGS__)
#endif
#if XMC_SUPPORT
//strictly check the model
static IRAM_ATTR bool is_xmc_chip_strict(uint32_t rdid)
{
uint32_t vendor_id = BYTESHIFT(rdid, 2);
uint32_t mfid = BYTESHIFT(rdid, 1);
uint32_t cpid = BYTESHIFT(rdid, 0);
if (vendor_id != XMC_VENDOR_ID) {
return false;
}
bool matched = false;
if (mfid == 0x40) {
if (cpid >= 0x13 && cpid <= 0x20) {
matched = true;
}
} else if (mfid == 0x41) {
if (cpid >= 0x17 && cpid <= 0x20) {
matched = true;
}
} else if (mfid == 0x50) {
if (cpid >= 0x15 && cpid <= 0x16) {
matched = true;
}
}
return matched;
}
esp_err_t IRAM_ATTR bootloader_flash_xmc_startup(void)
{
// If the RDID value is a valid XMC one, may skip the flow
const bool fast_check = true;
if (fast_check && is_xmc_chip_strict(g_rom_flashchip.device_id)) {
BOOTLOADER_FLASH_LOG(D, "XMC chip detected by RDID (%08X), skip.", g_rom_flashchip.device_id);
return ESP_OK;
}
// Check the Manufacturer ID in SFDP registers (JEDEC standard). If not XMC chip, no need to run the flow
const int sfdp_mfid_addr = 0x10;
uint8_t mf_id = (bootloader_flash_read_sfdp(sfdp_mfid_addr, 1) & 0xff);
if (mf_id != XMC_VENDOR_ID) {
BOOTLOADER_FLASH_LOG(D, "non-XMC chip detected by SFDP Read (%02X), skip.", mf_id);
return ESP_OK;
}
BOOTLOADER_FLASH_LOG(I, "XM25QHxxC startup flow");
// Enter DPD
bootloader_execute_flash_command(0xB9, 0, 0, 0);
// Enter UDPD
bootloader_execute_flash_command(0x79, 0, 0, 0);
// Exit UDPD
bootloader_execute_flash_command(0xFF, 0, 0, 0);
// Delay tXUDPD
esp_rom_delay_us(2000);
// Release Power-down
bootloader_execute_flash_command(0xAB, 0, 0, 0);
esp_rom_delay_us(20);
// Read flash ID and check again
g_rom_flashchip.device_id = bootloader_read_flash_id();
if (!is_xmc_chip_strict(g_rom_flashchip.device_id)) {
BOOTLOADER_FLASH_LOG(E, "XMC flash startup fail");
return ESP_FAIL;
}
return ESP_OK;
}
#else
//only compare the vendor id
static IRAM_ATTR bool is_xmc_chip(uint32_t rdid)
{
uint32_t vendor_id = (rdid >> 16) & 0xFF;
return (vendor_id == XMC_VENDOR_ID);
}
esp_err_t IRAM_ATTR bootloader_flash_xmc_startup(void)
{
if (is_xmc_chip(g_rom_flashchip.device_id)) {
BOOTLOADER_FLASH_LOG(E, "XMC chip detected (%08X) while support disabled.", g_rom_flashchip.device_id);
return ESP_FAIL;
}
return ESP_OK;
}
#endif //XMC_SUPPORT

View File

@ -25,6 +25,7 @@
#include "soc/spi_reg.h"
#include "soc/soc_caps.h"
#include "soc/soc_pins.h"
#include "hal/gpio_hal.h"
#include "flash_qio_mode.h"
#include "bootloader_common.h"
#include "bootloader_flash_config.h"
@ -87,7 +88,7 @@ void IRAM_ATTR bootloader_flash_gpio_config(const esp_image_header_t* pfhdr)
pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOV302) {
// For ESP32D2WD or ESP32-PICO series,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);
gpio_hal_iomux_func_sel(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 = esp_rom_efuse_get_flash_gpio_info();
@ -102,14 +103,14 @@ void IRAM_ATTR bootloader_flash_gpio_config(const esp_image_header_t* pfhdr)
esp_rom_gpio_connect_out_signal(SPI_IOMUX_PIN_NUM_HD, SPIHD_OUT_IDX, 0, 0);
esp_rom_gpio_connect_in_signal(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);
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA0_U, PIN_FUNC_GPIO);
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA1_U, PIN_FUNC_GPIO);
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA2_U, PIN_FUNC_GPIO);
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA3_U, PIN_FUNC_GPIO);
gpio_hal_iomux_func_sel(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);
gpio_hal_iomux_func_sel(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;
@ -178,9 +179,9 @@ int bootloader_flash_get_wp_pin(void)
uint8_t chip_ver;
uint32_t pkg_ver = bootloader_common_get_chip_ver_pkg();
switch(pkg_ver) {
case EFUSE_RD_CHIP_VER_PKG_ESP32U4WDH:
case EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5:
return ESP32_D2WD_WP_GPIO;
case EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2:
case EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4:
/* Same package IDs are used for ESP32-PICO-V3 and ESP32-PICO-D4, silicon version differentiates */
chip_ver = bootloader_common_get_chip_revision();

View File

@ -24,7 +24,7 @@
#include "soc/efuse_reg.h"
#include "soc/spi_reg.h"
#include "soc/spi_mem_reg.h"
#include "soc/spi_caps.h"
#include "soc/soc_caps.h"
#include "flash_qio_mode.h"
#include "bootloader_flash_config.h"
#include "bootloader_common.h"

View File

@ -77,7 +77,9 @@
#include "bootloader_utility.h"
#include "bootloader_sha.h"
#include "bootloader_console.h"
#include "bootloader_soc.h"
#include "esp_efuse.h"
#include "esp_fault.h"
static const char *TAG = "boot";
@ -269,9 +271,16 @@ 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_BOOTLOADER_APP_ANTI_ROLLBACK
esp_app_desc_t app_desc;
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;
if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to get partition description %d", err);
return false;
}
bool sec_ver = esp_efuse_check_secure_version(app_desc.secure_version);
/* Anti FI check */
ESP_FAULT_ASSERT(sec_ver == esp_efuse_check_secure_version(app_desc.secure_version));
return sec_ver;
#else
return true;
#endif
@ -284,6 +293,8 @@ static void update_anti_rollback(const esp_partition_pos_t *partition)
esp_err_t err = bootloader_common_get_partition_description(partition, &app_desc);
if (err == ESP_OK) {
esp_efuse_update_secure_version(app_desc.secure_version);
} else {
ESP_LOGE(TAG, "Failed to get partition description %d", err);
}
}
@ -637,6 +648,12 @@ static void load_image(const esp_image_metadata_t *image_data)
ESP_LOGI(TAG, "Disabling RNG early entropy source...");
bootloader_random_disable();
/* Disable glitch reset after all the security checks are completed.
* Glitch detection can be falsely triggered by EMI interference (high RF TX power, etc)
* and to avoid such false alarms, disable it.
*/
bootloader_ana_clock_glitch_reset_config(false);
// copy loaded segments to RAM, set up caches for mapped segments, and start application
unpack_load_app(image_data);
}
@ -843,22 +860,19 @@ esp_err_t bootloader_sha256_hex_to_str(char *out_str, const uint8_t *in_array_he
void bootloader_debug_buffer(const void *buffer, size_t length, const char *label)
{
#if BOOT_LOG_LEVEL >= LOG_LEVEL_DEBUG
assert(length <= 128); // Avoid unbounded VLA size
#if CONFIG_BOOTLOADER_LOG_LEVEL >= 4
const uint8_t *bytes = (const uint8_t *)buffer;
char hexbuf[length * 2 + 1];
hexbuf[length * 2] = 0;
for (size_t i = 0; i < length; i++) {
for (int shift = 0; shift < 2; shift++) {
uint8_t nibble = (bytes[i] >> (shift ? 0 : 4)) & 0x0F;
if (nibble < 10) {
hexbuf[i * 2 + shift] = '0' + nibble;
} else {
hexbuf[i * 2 + shift] = 'a' + nibble - 10;
}
}
}
const size_t output_len = MIN(length, 128);
char hexbuf[128 * 2 + 1];
bootloader_sha256_hex_to_str(hexbuf, bytes, output_len);
hexbuf[output_len * 2] = '\0';
ESP_LOGD(TAG, "%s: %s", label, hexbuf);
#else
(void) buffer;
(void) length;
(void) label;
#endif
}

View File

@ -34,6 +34,7 @@
#include "soc/io_mux_reg.h"
#include "soc/rtc.h"
#include "soc/spi_periph.h"
#include "hal/gpio_hal.h"
#include "esp32/rom/cache.h"
#include "esp_rom_gpio.h"
@ -61,7 +62,7 @@ void bootloader_configure_spi_pins(int drv)
pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOV302) {
// For ESP32D2WD or ESP32-PICO series,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);
gpio_hal_iomux_func_sel(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 = esp_rom_efuse_get_flash_gpio_info();
@ -76,14 +77,14 @@ void bootloader_configure_spi_pins(int drv)
esp_rom_gpio_connect_out_signal(FLASH_SPIHD_IO, SPIHD_OUT_IDX, 0, 0);
esp_rom_gpio_connect_in_signal(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);
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA0_U, PIN_FUNC_GPIO);
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA1_U, PIN_FUNC_GPIO);
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA2_U, PIN_FUNC_GPIO);
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA3_U, PIN_FUNC_GPIO);
gpio_hal_iomux_func_sel(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);
gpio_hal_iomux_func_sel(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 || CONFIG_SPIRAM_TYPE_ESPPSRAM64
@ -259,7 +260,7 @@ static esp_err_t bootloader_init_spi_flash(void)
}
#endif
esp_rom_spiflash_unlock();
bootloader_flash_unlock();
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
bootloader_enable_qio_mode();
@ -387,6 +388,11 @@ esp_err_t bootloader_init(void)
bootloader_print_banner();
// update flash ID
bootloader_flash_update_id();
// Check and run XMC startup flow
if ((ret = bootloader_flash_xmc_startup()) != ESP_OK) {
ESP_LOGE(TAG, "failed when running XMC startup flow, reboot!");
goto err;
}
// read bootloader header
if ((ret = bootloader_read_bootloader_header()) != ESP_OK) {
goto err;

View File

@ -0,0 +1,21 @@
/*
* SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdbool.h>
void bootloader_ana_super_wdt_reset_config(bool enable)
{
(void)enable;
}
void bootloader_ana_bod_reset_config(bool enable)
{
(void)enable;
}
void bootloader_ana_clock_glitch_reset_config(bool enable)
{
(void)enable;
}

View File

@ -19,7 +19,6 @@
#include "esp_log.h"
#include "esp32/rom/cache.h"
#include "esp_rom_crc.h"
#include "soc/efuse_periph.h"
#include "soc/rtc_periph.h"
@ -223,16 +222,12 @@ esp_err_t esp_secure_boot_permanently_enable(void)
#define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
static const char *TAG = "secure_boot_v2";
#define SIG_BLOCK_MAGIC_BYTE 0xe7
#define CRC_SIGN_BLOCK_LEN 1196
#define SIG_BLOCK_PADDING 4096
#define DIGEST_LEN 32
static esp_err_t validate_signature_block(const ets_secure_boot_signature_t *sig_block, uint8_t *digest)
{
uint32_t crc = esp_rom_crc32_le(0, (uint8_t *)sig_block, CRC_SIGN_BLOCK_LEN);
if (sig_block->block[0].magic_byte == SIG_BLOCK_MAGIC_BYTE && sig_block->block[0].block_crc == crc && !memcmp(digest, sig_block->block[0].image_digest, DIGEST_LEN)) {
if (sig_block->block[0].magic_byte == ETS_SECURE_BOOT_V2_SIGNATURE_MAGIC
&& sig_block->block[0].block_crc == crc
&& !memcmp(digest, sig_block->block[0].image_digest, ESP_SECURE_BOOT_DIGEST_LEN)) {
ESP_LOGI(TAG, "valid signature block found");
return ESP_OK;
}
@ -243,7 +238,7 @@ static esp_err_t secure_boot_v2_digest_generate(uint32_t flash_offset, uint32_t
{
esp_err_t ret = ESP_FAIL;
uint8_t image_digest[DIGEST_LEN] = {0};
uint8_t image_digest[ESP_SECURE_BOOT_DIGEST_LEN] = {0};
size_t sig_block_addr = flash_offset + ALIGN_UP(flash_size, FLASH_SECTOR_SIZE);
ret = bootloader_sha256_flash_contents(flash_offset, sig_block_addr - flash_offset, image_digest);
if (ret != ESP_OK) {
@ -266,7 +261,7 @@ static esp_err_t secure_boot_v2_digest_generate(uint32_t flash_offset, uint32_t
}
/* Verifying Signature block */
uint8_t verified_digest[DIGEST_LEN] = {0};
uint8_t verified_digest[ESP_SECURE_BOOT_DIGEST_LEN] = {0};
/* Generating the SHA of the public key components in the signature block */
bootloader_sha256_handle_t sig_block_sha;
@ -318,7 +313,7 @@ esp_err_t esp_secure_boot_v2_permanently_enable(const esp_image_metadata_t *imag
return ret;
}
uint8_t boot_pub_key_digest[DIGEST_LEN];
uint8_t boot_pub_key_digest[ESP_SECURE_BOOT_DIGEST_LEN];
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;
@ -350,7 +345,7 @@ esp_err_t esp_secure_boot_v2_permanently_enable(const esp_image_metadata_t *imag
}
ESP_LOGI(TAG, "Burning public key hash to efuse.");
ret = esp_efuse_write_block(EFUSE_BLK2, boot_pub_key_digest, 0, (DIGEST_LEN * 8));
ret = esp_efuse_write_block(EFUSE_BLK2, boot_pub_key_digest, 0, (ESP_SECURE_BOOT_DIGEST_LEN * 8));
if (ret != ESP_OK) {
ESP_LOGE(TAG, "Writing public key hash to efuse failed.");
return ret;
@ -366,7 +361,7 @@ esp_err_t esp_secure_boot_v2_permanently_enable(const esp_image_metadata_t *imag
efuse_blk2_digest[5] = efuse_blk2_r5;
efuse_blk2_digest[6] = efuse_blk2_r6;
efuse_blk2_digest[7] = efuse_blk2_r7;
memcpy(boot_pub_key_digest, efuse_blk2_digest, DIGEST_LEN);
memcpy(boot_pub_key_digest, efuse_blk2_digest, ESP_SECURE_BOOT_DIGEST_LEN);
ESP_LOGW(TAG, "Using pre-loaded secure boot v2 public key digest in EFUSE block 2");
}
@ -380,7 +375,7 @@ esp_err_t esp_secure_boot_v2_permanently_enable(const esp_image_metadata_t *imag
efuse_key_write_protected = true;
}
uint8_t app_pub_key_digest[DIGEST_LEN];
uint8_t app_pub_key_digest[ESP_SECURE_BOOT_DIGEST_LEN];
ret = secure_boot_v2_digest_generate(image_data->start_addr, image_data->image_len - SIG_BLOCK_PADDING, app_pub_key_digest);
if (ret != ESP_OK) {
ESP_LOGE(TAG, "Application signature block is invalid.");
@ -388,7 +383,7 @@ esp_err_t esp_secure_boot_v2_permanently_enable(const esp_image_metadata_t *imag
}
/* Confirming if the public key in the bootloader's signature block matches with the one in the application's signature block */
if (memcmp(boot_pub_key_digest, app_pub_key_digest, DIGEST_LEN) != 0) {
if (memcmp(boot_pub_key_digest, app_pub_key_digest, ESP_SECURE_BOOT_DIGEST_LEN) != 0) {
ESP_LOGE(TAG, "Application not signed with a valid private key.");
return ESP_FAIL;
}
@ -441,7 +436,7 @@ esp_err_t esp_secure_boot_v2_permanently_enable(const esp_image_metadata_t *imag
return ESP_FAIL;
}
#else
ESP_LOGW(TAG, "Not disabling ROM Download mode - SECURITY COMPROMISED");
ESP_LOGW(TAG, "UART ROM Download mode kept enabled - SECURITY COMPROMISED");
#endif
#ifndef CONFIG_SECURE_BOOT_V2_ALLOW_EFUSE_RD_DIS

View File

@ -1,184 +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.
#include "sdkconfig.h"
#include "bootloader_flash_priv.h"
#include "bootloader_sha.h"
#include "bootloader_utility.h"
#include "esp_log.h"
#include "esp_image_format.h"
#include "esp_secure_boot.h"
#include "esp_spi_flash.h"
#include "esp_fault.h"
#include "esp32/rom/sha.h"
#include "uECC_verify_antifault.h"
#include <sys/param.h>
#include <string.h>
static const char *TAG = "secure_boot";
#define DIGEST_LEN 32
#ifdef CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
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");
#define SIGNATURE_VERIFICATION_KEYLEN 64
esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
{
uint8_t digest[DIGEST_LEN];
uint8_t verified_digest[DIGEST_LEN] = { 0 }; /* ignored in this function */
const esp_secure_boot_sig_block_t *sigblock;
ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
esp_err_t err = bootloader_sha256_flash_contents(src_addr, length, digest);
if (err != ESP_OK) {
return err;
}
// 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
err = esp_secure_boot_verify_ecdsa_signature_block(sigblock, digest, verified_digest);
// 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)
{
uint8_t verified_digest[DIGEST_LEN] = { 0 };
return esp_secure_boot_verify_ecdsa_signature_block(sig_block, image_digest, verified_digest);
}
esp_err_t esp_secure_boot_verify_ecdsa_signature_block(const esp_secure_boot_sig_block_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest)
{
ptrdiff_t keylen;
keylen = signature_verification_key_end - signature_verification_key_start;
if (keylen != SIGNATURE_VERIFICATION_KEYLEN) {
ESP_LOGE(TAG, "Embedded public verification key has wrong length %d", keylen);
return ESP_FAIL;
}
if (sig_block->version != 0) {
ESP_LOGE(TAG, "image has invalid signature version field 0x%08x", sig_block->version);
return ESP_FAIL;
}
ESP_LOGD(TAG, "Verifying secure boot signature");
bool is_valid;
is_valid = uECC_verify_antifault(signature_verification_key_start,
image_digest,
DIGEST_LEN,
sig_block->signature,
uECC_secp256r1(),
verified_digest);
ESP_LOGD(TAG, "Verification result %d", is_valid);
return is_valid ? ESP_OK : ESP_ERR_IMAGE_INVALID;
}
#elif CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME
#define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
{
uint8_t digest[DIGEST_LEN] = {0};
uint8_t verified_digest[DIGEST_LEN] = {0}; // ignored in this function
const uint8_t *data;
/* Padding to round off the input to the nearest 4k boundary */
int padded_length = ALIGN_UP(length, FLASH_SECTOR_SIZE);
ESP_LOGD(TAG, "verifying src_addr 0x%x length", src_addr, padded_length);
data = bootloader_mmap(src_addr, padded_length + sizeof(ets_secure_boot_signature_t));
if (data == NULL) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", src_addr, padded_length);
return ESP_FAIL;
}
/* Calculate digest of main image */
esp_err_t err = bootloader_sha256_flash_contents(src_addr, padded_length, digest);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Digest calculation failed 0x%x, 0x%x", src_addr, padded_length);
bootloader_munmap(data);
return err;
}
const ets_secure_boot_signature_t *sig_block = (const ets_secure_boot_signature_t *)(data + padded_length);
err = esp_secure_boot_verify_rsa_signature_block(sig_block, digest, verified_digest);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Secure Boot V2 verification failed.");
}
bootloader_munmap(data);
return err;
}
esp_err_t esp_secure_boot_verify_rsa_signature_block(const ets_secure_boot_signature_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest)
{
secure_boot_v2_status_t r;
uint8_t efuse_trusted_digest[DIGEST_LEN] = {0}, sig_block_trusted_digest[DIGEST_LEN] = {0};
memcpy(efuse_trusted_digest, (uint8_t *)EFUSE_BLK2_RDATA0_REG, DIGEST_LEN); /* EFUSE_BLK2_RDATA0_REG - Stores the Secure Boot Public Key Digest */
if (!ets_use_secure_boot_v2()) {
ESP_LOGI(TAG, "Secure Boot eFuse bit(ABS_DONE_1) not yet programmed.");
/* Generating the SHA of the public key components in the signature block */
bootloader_sha256_handle_t sig_block_sha;
sig_block_sha = bootloader_sha256_start();
bootloader_sha256_data(sig_block_sha, &sig_block->block[0].key, sizeof(sig_block->block[0].key));
bootloader_sha256_finish(sig_block_sha, (unsigned char *)sig_block_trusted_digest);
#if CONFIG_SECURE_BOOT_V2_ENABLED
if (memcmp(efuse_trusted_digest, sig_block_trusted_digest, DIGEST_LEN) != 0) {
/* Most likely explanation for this is that BLK2 is empty, and we're going to burn it
after we verify that the signature is valid. However, if BLK2 is not empty then we need to
fail here.
*/
bool all_zeroes = true;
for (int i = 0; i < DIGEST_LEN; i++) {
all_zeroes = all_zeroes && (efuse_trusted_digest[i] == 0);
}
if (!all_zeroes) {
ESP_LOGE(TAG, "Different public key digest burned to eFuse BLK2");
return ESP_ERR_INVALID_STATE;
}
}
ESP_FAULT_ASSERT(!ets_use_secure_boot_v2());
#endif
memcpy(efuse_trusted_digest, sig_block_trusted_digest, DIGEST_LEN);
}
ESP_LOGI(TAG, "Verifying with RSA-PSS...");
r = ets_secure_boot_verify_signature(sig_block, image_digest, efuse_trusted_digest, verified_digest);
if (r != SBV2_SUCCESS) {
ESP_LOGE(TAG, "Secure Boot V2 verification failed.");
}
return (r == SBV2_SUCCESS) ? ESP_OK : ESP_ERR_IMAGE_INVALID;
}
#endif

View File

@ -45,6 +45,7 @@
#include "regi2c_ctrl.h"
#include "bootloader_console.h"
#include "bootloader_flash_priv.h"
#include "bootloader_soc.h"
static const char *TAG = "boot.esp32c3";
@ -211,7 +212,7 @@ static esp_err_t bootloader_init_spi_flash(void)
#endif
bootloader_spi_flash_resume();
esp_rom_spiflash_unlock();
bootloader_flash_unlock();
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
bootloader_enable_qio_mode();
@ -264,26 +265,52 @@ static void bootloader_super_wdt_auto_feed(void)
static inline void bootloader_hardware_init(void)
{
// TODO ESP32-C3 IDF-2452
REGI2C_WRITE_MASK(I2C_ULP, I2C_ULP_IR_FORCE_XPD_IPH, 1);
REGI2C_WRITE_MASK(I2C_BIAS, I2C_BIAS_DREG_1P1_PVT, 12);
// This check is always included in the bootloader so it can
// print the minimum revision error message later in the boot
if (bootloader_common_get_chip_revision() < 3) {
REGI2C_WRITE_MASK(I2C_ULP, I2C_ULP_IR_FORCE_XPD_IPH, 1);
REGI2C_WRITE_MASK(I2C_BIAS, I2C_BIAS_DREG_1P1_PVT, 12);
}
}
/* There happend clock glitch reset for some chip when testing wifi[BIT0] and brownout reset when chip startup[BIT1].
* But super_watch_dog_reset function is ok, so open it[BIT2].
* Whether this api will deleted or not depends on analog design & test result when ECO chip come back.
*/
static inline void bootloader_glitch_reset_disable(void)
static inline void bootloader_ana_reset_config(void)
{
// TODO ESP32-C3 IDF-2453
REG_SET_FIELD(RTC_CNTL_FIB_SEL_REG, RTC_CNTL_FIB_SEL, BIT2);
/*
For origin chip & ECO1: only support swt reset;
For ECO2: fix brownout reset bug, support swt & brownout reset;
For ECO3: fix clock glitch reset bug, support all reset, include: swt & brownout & clock glitch reset.
*/
uint8_t chip_version = bootloader_common_get_chip_revision();
switch (chip_version) {
case 0:
case 1:
//Enable WDT reset. Disable BOR and GLITCH reset
bootloader_ana_super_wdt_reset_config(true);
bootloader_ana_bod_reset_config(false);
bootloader_ana_clock_glitch_reset_config(false);
break;
case 2:
//Enable WDT and BOR reset. Disable GLITCH reset
bootloader_ana_super_wdt_reset_config(true);
bootloader_ana_bod_reset_config(true);
bootloader_ana_clock_glitch_reset_config(false);
break;
case 3:
default:
//Enable WDT, BOR, and GLITCH reset
bootloader_ana_super_wdt_reset_config(true);
bootloader_ana_bod_reset_config(true);
bootloader_ana_clock_glitch_reset_config(true);
break;
}
}
esp_err_t bootloader_init(void)
{
esp_err_t ret = ESP_OK;
bootloader_hardware_init();
bootloader_glitch_reset_disable();
bootloader_ana_reset_config();
bootloader_super_wdt_auto_feed();
// protect memory region
bootloader_init_mem();
@ -302,6 +329,11 @@ esp_err_t bootloader_init(void)
bootloader_print_banner();
// update flash ID
bootloader_flash_update_id();
// Check and run XMC startup flow
if ((ret = bootloader_flash_xmc_startup()) != ESP_OK) {
ESP_LOGE(TAG, "failed when running XMC startup flow, reboot!");
goto err;
}
// read bootloader header
if ((ret = bootloader_read_bootloader_header()) != ESP_OK) {
goto err;

View File

@ -0,0 +1,41 @@
/*
* SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdbool.h>
#include "soc/soc.h"
#include "soc/rtc_cntl_reg.h"
void bootloader_ana_super_wdt_reset_config(bool enable)
{
REG_CLR_BIT(RTC_CNTL_FIB_SEL_REG, RTC_CNTL_FIB_SUPER_WDT_RST);
if (enable) {
REG_SET_BIT(RTC_CNTL_SWD_CONF_REG, RTC_CNTL_SWD_BYPASS_RST);
} else {
REG_CLR_BIT(RTC_CNTL_SWD_CONF_REG, RTC_CNTL_SWD_BYPASS_RST);
}
}
void bootloader_ana_bod_reset_config(bool enable)
{
REG_CLR_BIT(RTC_CNTL_FIB_SEL_REG, RTC_CNTL_FIB_BOR_RST);
if (enable) {
REG_SET_BIT(RTC_CNTL_BROWN_OUT_REG, RTC_CNTL_BROWN_OUT_ANA_RST_EN);
} else {
REG_CLR_BIT(RTC_CNTL_BROWN_OUT_REG, RTC_CNTL_BROWN_OUT_ANA_RST_EN);
}
}
void bootloader_ana_clock_glitch_reset_config(bool enable)
{
REG_CLR_BIT(RTC_CNTL_FIB_SEL_REG, RTC_CNTL_FIB_GLITCH_RST);
if (enable) {
REG_SET_BIT(RTC_CNTL_ANA_CONF_REG, RTC_CNTL_GLITCH_RST_EN);
} else {
REG_CLR_BIT(RTC_CNTL_ANA_CONF_REG, RTC_CNTL_GLITCH_RST_EN);
}
}

View File

@ -150,7 +150,13 @@ static esp_err_t initialise_flash_encryption(void)
ESP_LOGW(TAG, "Not disabling JTAG - SECURITY COMPROMISED");
#endif
esp_efuse_write_field_bit(ESP_EFUSE_DIS_LEGACY_SPI_BOOT);
esp_efuse_write_field_bit(ESP_EFUSE_DIS_DIRECT_BOOT);
#if defined(CONFIG_SECURE_BOOT_V2_ENABLED) && !defined(CONFIG_SECURE_BOOT_V2_ALLOW_EFUSE_RD_DIS)
// This bit is set when enabling Secure Boot V2, but we can't enable it until this later point in the first boot
// otherwise the Flash Encryption key cannot be read protected
esp_efuse_write_field_bit(ESP_EFUSE_WR_DIS_RD_DIS);
#endif
esp_err_t err = esp_efuse_batch_write_commit();
if (err != ESP_OK) {

View File

@ -31,17 +31,11 @@
static const char *TAG = "secure_boot_v2";
#define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
#define SIG_BLOCK_MAGIC_BYTE 0xe7
#define CRC_SIGN_BLOCK_LEN 1196
#define SIG_BLOCK_PADDING 4096
#define DIGEST_LEN 32
/* A signature block is valid when it has correct magic byte, crc and image digest. */
static esp_err_t validate_signature_block(const ets_secure_boot_sig_block_t *block, int block_num, const uint8_t *image_digest)
{
uint32_t crc = esp_rom_crc32_le(0, (uint8_t *)block, CRC_SIGN_BLOCK_LEN);
if (block->magic_byte != SIG_BLOCK_MAGIC_BYTE) {
if (block->magic_byte != ETS_SECURE_BOOT_V2_SIGNATURE_MAGIC) {
// All signature blocks have been parsed, no new signature block present.
ESP_LOGD(TAG, "Signature block(%d) invalid/absent.", block_num);
return ESP_FAIL;
@ -50,7 +44,7 @@ static esp_err_t validate_signature_block(const ets_secure_boot_sig_block_t *blo
ESP_LOGE(TAG, "Magic byte correct but incorrect crc.");
return ESP_FAIL;
}
if (memcmp(image_digest, block->image_digest, DIGEST_LEN)) {
if (memcmp(image_digest, block->image_digest, ESP_SECURE_BOOT_DIGEST_LEN)) {
ESP_LOGE(TAG, "Magic byte & CRC correct but incorrect image digest.");
return ESP_FAIL;
} else {
@ -61,19 +55,6 @@ static esp_err_t validate_signature_block(const ets_secure_boot_sig_block_t *blo
return ESP_FAIL;
}
/* Structure to hold public key digests calculated from the signature blocks of a single image.
Each image can have one or more signature blocks (up to SECURE_BOOT_NUM_BLOCKS). Each signature block
includes a public key.
Different to the ROM ets_secure_boot_key_digests_t structure which holds pointers to eFuse data with digests,
in this data structure the digest data is included.
*/
typedef struct {
uint8_t key_digests[SECURE_BOOT_NUM_BLOCKS][DIGEST_LEN];
unsigned num_digests; /* Number of valid digests, starting at index 0 */
} image_sig_public_key_digests_t;
/* Generates the public key digests of the valid public keys in an image's
signature block, verifies each signature, and stores the key digests in the
public_key_digests structure.
@ -89,16 +70,16 @@ typedef struct {
@return - ESP_OK if no signatures failed to verify, or if no valid signature blocks are found at all.
- ESP_FAIL if there's a valid signature block that doesn't verify using the included public key (unexpected!)
*/
static esp_err_t s_calculate_image_public_key_digests(uint32_t flash_offset, uint32_t flash_size, image_sig_public_key_digests_t *public_key_digests)
static esp_err_t s_calculate_image_public_key_digests(uint32_t flash_offset, uint32_t flash_size, esp_image_sig_public_key_digests_t *public_key_digests)
{
esp_err_t ret;
uint8_t image_digest[DIGEST_LEN] = {0};
uint8_t __attribute__((aligned(4))) key_digest[DIGEST_LEN] = {0};
uint8_t image_digest[ESP_SECURE_BOOT_DIGEST_LEN] = {0};
uint8_t __attribute__((aligned(4))) key_digest[ESP_SECURE_BOOT_DIGEST_LEN] = {0};
size_t sig_block_addr = flash_offset + ALIGN_UP(flash_size, FLASH_SECTOR_SIZE);
ESP_LOGD(TAG, "calculating public key digests for sig blocks of image offset 0x%x (sig block offset 0x%x)", flash_offset, sig_block_addr);
bzero(public_key_digests, sizeof(image_sig_public_key_digests_t));
bzero(public_key_digests, sizeof(esp_image_sig_public_key_digests_t));
ret = bootloader_sha256_flash_contents(flash_offset, sig_block_addr - flash_offset, image_digest);
if (ret != ESP_OK) {
@ -129,7 +110,7 @@ static esp_err_t s_calculate_image_public_key_digests(uint32_t flash_offset, uin
bootloader_sha256_finish(sig_block_sha, key_digest);
// Check we can verify the image using this signature and this key
uint8_t temp_verified_digest[DIGEST_LEN];
uint8_t temp_verified_digest[ESP_SECURE_BOOT_DIGEST_LEN];
bool verified = ets_rsa_pss_verify(&block->key, block->signature, image_digest, temp_verified_digest);
if (!verified) {
@ -142,7 +123,7 @@ static esp_err_t s_calculate_image_public_key_digests(uint32_t flash_offset, uin
}
ESP_LOGD(TAG, "Signature block (%d) is verified", i);
/* Copy the key digest to the buffer provided by the caller */
memcpy((void *)public_key_digests->key_digests[i], key_digest, DIGEST_LEN);
memcpy((void *)public_key_digests->key_digests[i], key_digest, ESP_SECURE_BOOT_DIGEST_LEN);
public_key_digests->num_digests++;
}
@ -173,8 +154,8 @@ static esp_err_t check_and_generate_secure_boot_keys(const esp_image_metadata_t
ESP_LOGI(TAG, "Secure boot digests %s", has_secure_boot_digest ? "already present":"absent, generating..");
if (!has_secure_boot_digest) {
image_sig_public_key_digests_t boot_key_digests = {0};
image_sig_public_key_digests_t app_key_digests = {0};
esp_image_sig_public_key_digests_t boot_key_digests = {0};
esp_image_sig_public_key_digests_t app_key_digests = {0};
/* Generate the bootloader public key digests */
ret = s_calculate_image_public_key_digests(bootloader_data.start_addr, bootloader_data.image_len - SIG_BLOCK_PADDING, &boot_key_digests);
@ -234,7 +215,7 @@ static esp_err_t check_and_generate_secure_boot_keys(const esp_image_metadata_t
}
for (int j = 0; j < app_key_digests.num_digests; j++) {
if (!memcmp(boot_key_digests.key_digests[i], app_key_digests.key_digests[j], DIGEST_LEN)) {
if (!memcmp(boot_key_digests.key_digests[i], app_key_digests.key_digests[j], ESP_SECURE_BOOT_DIGEST_LEN)) {
ESP_LOGI(TAG, "Application key(%d) matches with bootloader key(%d).", j, i);
match = true;
}
@ -275,20 +256,32 @@ esp_err_t esp_secure_boot_v2_permanently_enable(const esp_image_metadata_t *imag
return key_state;
}
esp_efuse_write_field_bit(ESP_EFUSE_DIS_LEGACY_SPI_BOOT);
esp_efuse_write_field_bit(ESP_EFUSE_DIS_DIRECT_BOOT);
esp_err_t err = ESP_FAIL;
#ifdef CONFIG_SECURE_ENABLE_SECURE_ROM_DL_MODE
ESP_LOGI(TAG, "Enabling Security download mode...");
esp_efuse_write_field_bit(ESP_EFUSE_ENABLE_SECURITY_DOWNLOAD);
err = esp_efuse_enable_rom_secure_download_mode();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Could not enable Security download mode...");
return err;
}
#elif CONFIG_SECURE_DISABLE_ROM_DL_MODE
ESP_LOGI(TAG, "Disable ROM Download mode...");
err = esp_efuse_disable_rom_download_mode();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Could not disable ROM Download mode...");
return err;
}
#else
ESP_LOGW(TAG, "Not enabling Security download mode - SECURITY COMPROMISED");
ESP_LOGW(TAG, "UART ROM Download mode kept enabled - SECURITY COMPROMISED");
#endif
#ifndef CONFIG_SECURE_BOOT_ALLOW_JTAG
ESP_LOGI(TAG, "Disable hardware & software JTAG...");
esp_efuse_write_field_bit(ESP_EFUSE_DIS_PAD_JTAG);
esp_efuse_write_field_bit(ESP_EFUSE_DIS_USB_JTAG);
esp_efuse_write_field_bit(ESP_EFUSE_SOFT_DIS_JTAG);
esp_efuse_write_field_cnt(ESP_EFUSE_SOFT_DIS_JTAG, ESP_EFUSE_SOFT_DIS_JTAG[0]->bit_count);
#else
ESP_LOGW(TAG, "Not disabling JTAG - SECURITY COMPROMISED");
#endif
@ -299,7 +292,22 @@ esp_err_t esp_secure_boot_v2_permanently_enable(const esp_image_metadata_t *imag
esp_efuse_write_field_bit(ESP_EFUSE_SECURE_BOOT_EN);
esp_err_t err = esp_efuse_batch_write_commit();
#ifndef CONFIG_SECURE_BOOT_V2_ALLOW_EFUSE_RD_DIS
bool rd_dis_now = true;
#ifdef CONFIG_SECURE_FLASH_ENC_ENABLED
/* If flash encryption is not enabled yet then don't read-disable efuses yet, do it later in the boot
when Flash Encryption is being enabled */
rd_dis_now = esp_flash_encryption_enabled();
#endif
if (rd_dis_now) {
ESP_LOGI(TAG, "Prevent read disabling of additional efuses...");
esp_efuse_write_field_bit(ESP_EFUSE_WR_DIS_RD_DIS);
}
#else
ESP_LOGW(TAG, "Allowing read disabling of additional efuses - SECURITY COMPROMISED");
#endif
err = esp_efuse_batch_write_commit();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Error programming security eFuses (err=0x%x).", err);
return err;

View File

@ -1,94 +0,0 @@
// Copyright 2015-2020 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"
#include <string.h>
#include "esp_fault.h"
#include "bootloader_flash_priv.h"
#include "bootloader_sha.h"
#include "bootloader_utility.h"
#include "esp_log.h"
#include "esp_image_format.h"
#include "esp_secure_boot.h"
#include "esp32c3/rom/secure_boot.h"
static const char* TAG = "secure_boot";
#define DIGEST_LEN 32
#define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
{
uint8_t digest[DIGEST_LEN];
uint8_t verified_digest[DIGEST_LEN] = { 0 }; /* Note: this function doesn't do any anti-FI checks on this buffer */
const uint8_t *data;
ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
/* Padding to round off the input to the nearest 4k boundary */
int padded_length = ALIGN_UP(length, FLASH_SECTOR_SIZE);
ESP_LOGD(TAG, "verifying src_addr 0x%x length", src_addr, padded_length);
data = bootloader_mmap(src_addr, length + sizeof(struct ets_secure_boot_sig_block));
if (data == NULL) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", src_addr, length+sizeof(ets_secure_boot_signature_t));
return ESP_FAIL;
}
/* Calculate digest of main image */
esp_err_t err = bootloader_sha256_flash_contents(src_addr, padded_length, digest);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Digest calculation failed 0x%x, 0x%x", src_addr, padded_length);
bootloader_munmap(data);
return err;
}
const ets_secure_boot_signature_t *sig = (const ets_secure_boot_signature_t *)(data + length);
int r = esp_secure_boot_verify_rsa_signature_block(sig, digest, verified_digest);
bootloader_munmap(data);
return (r == ETS_OK) ? ESP_OK : ESP_FAIL;
}
esp_err_t esp_secure_boot_verify_rsa_signature_block(const ets_secure_boot_signature_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest)
{
ets_secure_boot_key_digests_t trusted_keys;
ets_secure_boot_key_digests_t trusted_key_copies[2];
ETS_STATUS r;
ets_secure_boot_status_t sb_result;
memset(&trusted_keys, 0, sizeof(ets_secure_boot_key_digests_t));
memset(trusted_key_copies, 0, 2 * sizeof(ets_secure_boot_key_digests_t));
if (!esp_secure_boot_enabled()) {
return ESP_OK;
}
r = ets_secure_boot_read_key_digests(&trusted_keys);
if (r != ETS_OK) {
ESP_LOGI(TAG, "Could not read secure boot digests!");
return ESP_FAIL;
}
// Create the copies for FI checks (assuming result is ETS_OK, if it's not then it'll fail the fault check anyhow)
ets_secure_boot_read_key_digests(&trusted_key_copies[0]);
ets_secure_boot_read_key_digests(&trusted_key_copies[1]);
ESP_FAULT_ASSERT(memcmp(&trusted_keys, &trusted_key_copies[0], sizeof(ets_secure_boot_key_digests_t)) == 0);
ESP_FAULT_ASSERT(memcmp(&trusted_keys, &trusted_key_copies[1], sizeof(ets_secure_boot_key_digests_t)) == 0);
ESP_LOGI(TAG, "Verifying with RSA-PSS boot...");
sb_result = ets_secure_boot_verify_signature(sig_block, image_digest, &trusted_keys, verified_digest);
return (sb_result == SB_SUCCESS) ? ESP_OK : ESP_FAIL;
}

View File

@ -206,7 +206,7 @@ static esp_err_t bootloader_init_spi_flash(void)
}
#endif
esp_rom_spiflash_unlock();
bootloader_flash_unlock();
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
bootloader_enable_qio_mode();
@ -310,6 +310,11 @@ esp_err_t bootloader_init(void)
bootloader_print_banner();
// update flash ID
bootloader_flash_update_id();
// Check and run XMC startup flow
if ((ret = bootloader_flash_xmc_startup()) != ESP_OK) {
ESP_LOGE(TAG, "failed when running XMC startup flow, reboot!");
goto err;
}
// read bootloader header
if ((ret = bootloader_read_bootloader_header()) != ESP_OK) {
goto err;

View File

@ -0,0 +1,21 @@
/*
* SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdbool.h>
void bootloader_ana_super_wdt_reset_config(bool enable)
{
(void)enable;
}
void bootloader_ana_bod_reset_config(bool enable)
{
(void)enable;
}
void bootloader_ana_clock_glitch_reset_config(bool enable)
{
(void)enable;
}

View File

@ -176,6 +176,12 @@ static esp_err_t initialise_flash_encryption(void)
esp_efuse_write_field_bit(ESP_EFUSE_DIS_BOOT_REMAP);
esp_efuse_write_field_bit(ESP_EFUSE_DIS_LEGACY_SPI_BOOT);
#if defined(CONFIG_SECURE_BOOT_V2_ENABLED) && !defined(CONFIG_SECURE_BOOT_V2_ALLOW_EFUSE_RD_DIS)
// This bit is set when enabling Secure Boot V2, but we can't enable it until this later point in the first boot
// otherwise the Flash Encryption key cannot be read protected
esp_efuse_write_field_bit(ESP_EFUSE_WR_DIS_RD_DIS);
#endif
esp_err_t err = esp_efuse_batch_write_commit();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Error programming security eFuses (err=0x%x).", err);

View File

@ -28,20 +28,16 @@
#include "esp32s2/rom/efuse.h"
#include "esp32s2/rom/secure_boot.h"
#include "esp_flash_encrypt.h"
static const char *TAG = "secure_boot_v2";
#define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
#define SIG_BLOCK_MAGIC_BYTE 0xe7
#define CRC_SIGN_BLOCK_LEN 1196
#define SIG_BLOCK_PADDING 4096
#define DIGEST_LEN 32
/* A signature block is valid when it has correct magic byte, crc and image digest. */
static esp_err_t validate_signature_block(const ets_secure_boot_sig_block_t *block, int block_num, const uint8_t *image_digest)
{
uint32_t crc = esp_rom_crc32_le(0, (uint8_t *)block, CRC_SIGN_BLOCK_LEN);
if (block->magic_byte != SIG_BLOCK_MAGIC_BYTE) {
if (block->magic_byte != ETS_SECURE_BOOT_V2_SIGNATURE_MAGIC) {
// All signature blocks have been parsed, no new signature block present.
ESP_LOGD(TAG, "Signature block(%d) invalid/absent.", block_num);
return ESP_FAIL;
@ -50,7 +46,7 @@ static esp_err_t validate_signature_block(const ets_secure_boot_sig_block_t *blo
ESP_LOGE(TAG, "Magic byte correct but incorrect crc.");
return ESP_FAIL;
}
if (memcmp(image_digest, block->image_digest, DIGEST_LEN)) {
if (memcmp(image_digest, block->image_digest, ESP_SECURE_BOOT_DIGEST_LEN)) {
ESP_LOGE(TAG, "Magic byte & CRC correct but incorrect image digest.");
return ESP_FAIL;
} else {
@ -61,19 +57,6 @@ static esp_err_t validate_signature_block(const ets_secure_boot_sig_block_t *blo
return ESP_FAIL;
}
/* Structure to hold public key digests calculated from the signature blocks of a single image.
Each image can have one or more signature blocks (up to SECURE_BOOT_NUM_BLOCKS). Each signature block
includes a public key.
Different to the ROM ets_secure_boot_key_digests_t structure which holds pointers to eFuse data with digests,
in this data structure the digest data is included.
*/
typedef struct {
uint8_t key_digests[SECURE_BOOT_NUM_BLOCKS][DIGEST_LEN];
unsigned num_digests; /* Number of valid digests, starting at index 0 */
} image_sig_public_key_digests_t;
/* Generates the public key digests of the valid public keys in an image's
signature block, verifies each signature, and stores the key digests in the
public_key_digests structure.
@ -89,16 +72,16 @@ typedef struct {
@return - ESP_OK if no signatures failed to verify, or if no valid signature blocks are found at all.
- ESP_FAIL if there's a valid signature block that doesn't verify using the included public key (unexpected!)
*/
static esp_err_t s_calculate_image_public_key_digests(uint32_t flash_offset, uint32_t flash_size, image_sig_public_key_digests_t *public_key_digests)
static esp_err_t s_calculate_image_public_key_digests(uint32_t flash_offset, uint32_t flash_size, esp_image_sig_public_key_digests_t *public_key_digests)
{
esp_err_t ret;
uint8_t image_digest[DIGEST_LEN] = {0};
uint8_t __attribute__((aligned(4))) key_digest[DIGEST_LEN] = {0};
uint8_t image_digest[ESP_SECURE_BOOT_DIGEST_LEN] = {0};
uint8_t __attribute__((aligned(4))) key_digest[ESP_SECURE_BOOT_DIGEST_LEN] = {0};
size_t sig_block_addr = flash_offset + ALIGN_UP(flash_size, FLASH_SECTOR_SIZE);
ESP_LOGD(TAG, "calculating public key digests for sig blocks of image offset 0x%x (sig block offset 0x%x)", flash_offset, sig_block_addr);
bzero(public_key_digests, sizeof(image_sig_public_key_digests_t));
bzero(public_key_digests, sizeof(esp_image_sig_public_key_digests_t));
ret = bootloader_sha256_flash_contents(flash_offset, sig_block_addr - flash_offset, image_digest);
if (ret != ESP_OK) {
@ -129,7 +112,7 @@ static esp_err_t s_calculate_image_public_key_digests(uint32_t flash_offset, uin
bootloader_sha256_finish(sig_block_sha, key_digest);
// Check we can verify the image using this signature and this key
uint8_t temp_verified_digest[DIGEST_LEN];
uint8_t temp_verified_digest[ESP_SECURE_BOOT_DIGEST_LEN];
bool verified = ets_rsa_pss_verify(&block->key, block->signature, image_digest, temp_verified_digest);
if (!verified) {
@ -142,7 +125,7 @@ static esp_err_t s_calculate_image_public_key_digests(uint32_t flash_offset, uin
}
ESP_LOGD(TAG, "Signature block (%d) is verified", i);
/* Copy the key digest to the buffer provided by the caller */
memcpy((void *)public_key_digests->key_digests[i], key_digest, DIGEST_LEN);
memcpy((void *)public_key_digests->key_digests[i], key_digest, ESP_SECURE_BOOT_DIGEST_LEN);
public_key_digests->num_digests++;
}
@ -173,8 +156,8 @@ static esp_err_t check_and_generate_secure_boot_keys(const esp_image_metadata_t
ESP_LOGI(TAG, "Secure boot digests %s", has_secure_boot_digest ? "already present":"absent, generating..");
if (!has_secure_boot_digest) {
image_sig_public_key_digests_t boot_key_digests = {0};
image_sig_public_key_digests_t app_key_digests = {0};
esp_image_sig_public_key_digests_t boot_key_digests = {0};
esp_image_sig_public_key_digests_t app_key_digests = {0};
/* Generate the bootloader public key digests */
ret = s_calculate_image_public_key_digests(bootloader_data.start_addr, bootloader_data.image_len - SIG_BLOCK_PADDING, &boot_key_digests);
@ -234,7 +217,7 @@ static esp_err_t check_and_generate_secure_boot_keys(const esp_image_metadata_t
}
for (int j = 0; j < app_key_digests.num_digests; j++) {
if (!memcmp(boot_key_digests.key_digests[i], app_key_digests.key_digests[j], DIGEST_LEN)) {
if (!memcmp(boot_key_digests.key_digests[i], app_key_digests.key_digests[j], ESP_SECURE_BOOT_DIGEST_LEN)) {
ESP_LOGI(TAG, "Application key(%d) matches with bootloader key(%d).", j, i);
match = true;
}
@ -280,11 +263,23 @@ esp_err_t esp_secure_boot_v2_permanently_enable(const esp_image_metadata_t *imag
esp_efuse_write_field_bit(ESP_EFUSE_DIS_BOOT_REMAP);
esp_efuse_write_field_bit(ESP_EFUSE_DIS_LEGACY_SPI_BOOT);
esp_err_t err = ESP_FAIL;
#ifdef CONFIG_SECURE_ENABLE_SECURE_ROM_DL_MODE
ESP_LOGI(TAG, "Enabling Security download mode...");
esp_efuse_write_field_bit(ESP_EFUSE_ENABLE_SECURITY_DOWNLOAD);
err = esp_efuse_enable_rom_secure_download_mode();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Could not enable Security download mode...");
return err;
}
#elif CONFIG_SECURE_DISABLE_ROM_DL_MODE
ESP_LOGI(TAG, "Disable ROM Download mode...");
err = esp_efuse_disable_rom_download_mode();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Could not disable ROM Download mode...");
return err;
}
#else
ESP_LOGW(TAG, "Not enabling Security download mode - SECURITY COMPROMISED");
ESP_LOGW(TAG, "UART ROM Download mode kept enabled - SECURITY COMPROMISED");
#endif
#ifndef CONFIG_SECURE_BOOT_ALLOW_JTAG
@ -301,7 +296,22 @@ esp_err_t esp_secure_boot_v2_permanently_enable(const esp_image_metadata_t *imag
esp_efuse_write_field_bit(ESP_EFUSE_SECURE_BOOT_EN);
esp_err_t err = esp_efuse_batch_write_commit();
#ifndef CONFIG_SECURE_BOOT_V2_ALLOW_EFUSE_RD_DIS
bool rd_dis_now = true;
#ifdef CONFIG_SECURE_FLASH_ENC_ENABLED
/* If flash encryption is not enabled yet then don't read-disable efuses yet, do it later in the boot
when Flash Encryption is being enabled */
rd_dis_now = esp_flash_encryption_enabled();
#endif
if (rd_dis_now) {
ESP_LOGI(TAG, "Prevent read disabling of additional efuses...");
esp_efuse_write_field_bit(ESP_EFUSE_WR_DIS_RD_DIS);
}
#else
ESP_LOGW(TAG, "Allowing read disabling of additional efuses - SECURITY COMPROMISED");
#endif
err = esp_efuse_batch_write_commit();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Error programming security eFuses (err=0x%x).", err);
return err;

View File

@ -1,93 +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.
#include "sdkconfig.h"
#include <string.h>
#include "esp_fault.h"
#include "bootloader_flash_priv.h"
#include "bootloader_sha.h"
#include "bootloader_utility.h"
#include "esp_log.h"
#include "esp_image_format.h"
#include "esp_secure_boot.h"
#include "esp32s2/rom/secure_boot.h"
static const char* TAG = "secure_boot";
#define DIGEST_LEN 32
#define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
{
uint8_t digest[DIGEST_LEN];
uint8_t verified_digest[DIGEST_LEN] = { 0 }; /* Note: this function doesn't do any anti-FI checks on this buffer */
const uint8_t *data;
ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
/* Padding to round off the input to the nearest 4k boundary */
int padded_length = ALIGN_UP(length, FLASH_SECTOR_SIZE);
ESP_LOGD(TAG, "verifying src_addr 0x%x length", src_addr, padded_length);
data = bootloader_mmap(src_addr, length + sizeof(struct ets_secure_boot_sig_block));
if (data == NULL) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", src_addr, length+sizeof(ets_secure_boot_signature_t));
return ESP_FAIL;
}
/* Calculate digest of main image */
esp_err_t err = bootloader_sha256_flash_contents(src_addr, padded_length, digest);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Digest calculation failed 0x%x, 0x%x", src_addr, padded_length);
bootloader_munmap(data);
return err;
}
const ets_secure_boot_signature_t *sig = (const ets_secure_boot_signature_t *)(data + length);
int r = esp_secure_boot_verify_rsa_signature_block(sig, digest, verified_digest);
bootloader_munmap(data);
return (r == ETS_OK) ? ESP_OK : ESP_FAIL;
}
esp_err_t esp_secure_boot_verify_rsa_signature_block(const ets_secure_boot_signature_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest)
{
ets_secure_boot_key_digests_t trusted_keys;
ets_secure_boot_key_digests_t trusted_key_copies[2];
ETS_STATUS r;
ets_secure_boot_status_t sb_result;
memset(&trusted_keys, 0, sizeof(ets_secure_boot_key_digests_t));
memset(trusted_key_copies, 0, 2 * sizeof(ets_secure_boot_key_digests_t));
if (!esp_secure_boot_enabled()) {
return ESP_OK;
}
r = ets_secure_boot_read_key_digests(&trusted_keys);
if (r != ETS_OK) {
ESP_LOGI(TAG, "Could not read secure boot digests!");
return ESP_FAIL;
}
// Create the copies for FI checks (assuming result is ETS_OK, if it's not then it'll fail the fault check anyhow)
ets_secure_boot_read_key_digests(&trusted_key_copies[0]);
ets_secure_boot_read_key_digests(&trusted_key_copies[1]);
ESP_FAULT_ASSERT(memcmp(&trusted_keys, &trusted_key_copies[0], sizeof(ets_secure_boot_key_digests_t)) == 0);
ESP_FAULT_ASSERT(memcmp(&trusted_keys, &trusted_key_copies[1], sizeof(ets_secure_boot_key_digests_t)) == 0);
ESP_LOGI(TAG, "Verifying with RSA-PSS boot...");
sb_result = ets_secure_boot_verify_signature(sig_block, image_digest, &trusted_keys, verified_digest);
return (sb_result == SB_SUCCESS) ? ESP_OK : ESP_FAIL;
}

View File

@ -206,7 +206,7 @@ static esp_err_t bootloader_init_spi_flash(void)
}
#endif
esp_rom_spiflash_unlock();
bootloader_flash_unlock();
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
bootloader_enable_qio_mode();
@ -318,6 +318,11 @@ esp_err_t bootloader_init(void)
bootloader_print_banner();
// update flash ID
bootloader_flash_update_id();
// Check and run XMC startup flow
if ((ret = bootloader_flash_xmc_startup()) != ESP_OK) {
ESP_LOGE(TAG, "failed when running XMC startup flow, reboot!");
goto err;
}
// read bootloader header
if ((ret = bootloader_read_bootloader_header()) != ESP_OK) {
goto err;

View File

@ -0,0 +1,21 @@
/*
* SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdbool.h>
void bootloader_ana_super_wdt_reset_config(bool enable)
{
(void)enable;
}
void bootloader_ana_bod_reset_config(bool enable)
{
(void)enable;
}
void bootloader_ana_clock_glitch_reset_config(bool enable)
{
(void)enable;
}

View File

@ -172,7 +172,7 @@ static esp_err_t initialise_flash_encryption(void)
ESP_LOGW(TAG, "Not disabling JTAG - SECURITY COMPROMISED");
#endif
esp_efuse_write_field_bit(ESP_EFUSE_DIS_LEGACY_SPI_BOOT);
esp_efuse_write_field_bit(ESP_EFUSE_DIS_DIRECT_BOOT);
esp_err_t err = esp_efuse_batch_write_commit();
if (err != ESP_OK) {

View File

@ -31,17 +31,11 @@
static const char *TAG = "secure_boot_v2";
#define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
#define SIG_BLOCK_MAGIC_BYTE 0xe7
#define CRC_SIGN_BLOCK_LEN 1196
#define SIG_BLOCK_PADDING 4096
#define DIGEST_LEN 32
/* A signature block is valid when it has correct magic byte, crc and image digest. */
static esp_err_t validate_signature_block(const ets_secure_boot_sig_block_t *block, int block_num, const uint8_t *image_digest)
{
uint32_t crc = esp_rom_crc32_le(0, (uint8_t *)block, CRC_SIGN_BLOCK_LEN);
if (block->magic_byte != SIG_BLOCK_MAGIC_BYTE) {
if (block->magic_byte != ETS_SECURE_BOOT_V2_SIGNATURE_MAGIC) {
// All signature blocks have been parsed, no new signature block present.
ESP_LOGD(TAG, "Signature block(%d) invalid/absent.", block_num);
return ESP_FAIL;
@ -50,7 +44,7 @@ static esp_err_t validate_signature_block(const ets_secure_boot_sig_block_t *blo
ESP_LOGE(TAG, "Magic byte correct but incorrect crc.");
return ESP_FAIL;
}
if (memcmp(image_digest, block->image_digest, DIGEST_LEN)) {
if (memcmp(image_digest, block->image_digest, ESP_SECURE_BOOT_DIGEST_LEN)) {
ESP_LOGE(TAG, "Magic byte & CRC correct but incorrect image digest.");
return ESP_FAIL;
} else {
@ -61,19 +55,6 @@ static esp_err_t validate_signature_block(const ets_secure_boot_sig_block_t *blo
return ESP_FAIL;
}
/* Structure to hold public key digests calculated from the signature blocks of a single image.
Each image can have one or more signature blocks (up to SECURE_BOOT_NUM_BLOCKS). Each signature block
includes a public key.
Different to the ROM ets_secure_boot_key_digests_t structure which holds pointers to eFuse data with digests,
in this data structure the digest data is included.
*/
typedef struct {
uint8_t key_digests[SECURE_BOOT_NUM_BLOCKS][DIGEST_LEN];
unsigned num_digests; /* Number of valid digests, starting at index 0 */
} image_sig_public_key_digests_t;
/* Generates the public key digests of the valid public keys in an image's
signature block, verifies each signature, and stores the key digests in the
public_key_digests structure.
@ -89,16 +70,16 @@ typedef struct {
@return - ESP_OK if no signatures failed to verify, or if no valid signature blocks are found at all.
- ESP_FAIL if there's a valid signature block that doesn't verify using the included public key (unexpected!)
*/
static esp_err_t s_calculate_image_public_key_digests(uint32_t flash_offset, uint32_t flash_size, image_sig_public_key_digests_t *public_key_digests)
static esp_err_t s_calculate_image_public_key_digests(uint32_t flash_offset, uint32_t flash_size, esp_image_sig_public_key_digests_t *public_key_digests)
{
esp_err_t ret;
uint8_t image_digest[DIGEST_LEN] = {0};
uint8_t __attribute__((aligned(4))) key_digest[DIGEST_LEN] = {0};
uint8_t image_digest[ESP_SECURE_BOOT_DIGEST_LEN] = {0};
uint8_t __attribute__((aligned(4))) key_digest[ESP_SECURE_BOOT_DIGEST_LEN] = {0};
size_t sig_block_addr = flash_offset + ALIGN_UP(flash_size, FLASH_SECTOR_SIZE);
ESP_LOGD(TAG, "calculating public key digests for sig blocks of image offset 0x%x (sig block offset 0x%x)", flash_offset, sig_block_addr);
bzero(public_key_digests, sizeof(image_sig_public_key_digests_t));
bzero(public_key_digests, sizeof(esp_image_sig_public_key_digests_t));
ret = bootloader_sha256_flash_contents(flash_offset, sig_block_addr - flash_offset, image_digest);
if (ret != ESP_OK) {
@ -129,7 +110,7 @@ static esp_err_t s_calculate_image_public_key_digests(uint32_t flash_offset, uin
bootloader_sha256_finish(sig_block_sha, key_digest);
// Check we can verify the image using this signature and this key
uint8_t temp_verified_digest[DIGEST_LEN];
uint8_t temp_verified_digest[ESP_SECURE_BOOT_DIGEST_LEN];
bool verified = ets_rsa_pss_verify(&block->key, block->signature, image_digest, temp_verified_digest);
if (!verified) {
@ -142,7 +123,7 @@ static esp_err_t s_calculate_image_public_key_digests(uint32_t flash_offset, uin
}
ESP_LOGD(TAG, "Signature block (%d) is verified", i);
/* Copy the key digest to the buffer provided by the caller */
memcpy((void *)public_key_digests->key_digests[i], key_digest, DIGEST_LEN);
memcpy((void *)public_key_digests->key_digests[i], key_digest, ESP_SECURE_BOOT_DIGEST_LEN);
public_key_digests->num_digests++;
}
@ -173,8 +154,8 @@ static esp_err_t check_and_generate_secure_boot_keys(const esp_image_metadata_t
ESP_LOGI(TAG, "Secure boot digests %s", has_secure_boot_digest ? "already present":"absent, generating..");
if (!has_secure_boot_digest) {
image_sig_public_key_digests_t boot_key_digests = {0};
image_sig_public_key_digests_t app_key_digests = {0};
esp_image_sig_public_key_digests_t boot_key_digests = {0};
esp_image_sig_public_key_digests_t app_key_digests = {0};
/* Generate the bootloader public key digests */
ret = s_calculate_image_public_key_digests(bootloader_data.start_addr, bootloader_data.image_len - SIG_BLOCK_PADDING, &boot_key_digests);
@ -234,7 +215,7 @@ static esp_err_t check_and_generate_secure_boot_keys(const esp_image_metadata_t
}
for (int j = 0; j < app_key_digests.num_digests; j++) {
if (!memcmp(boot_key_digests.key_digests[i], app_key_digests.key_digests[j], DIGEST_LEN)) {
if (!memcmp(boot_key_digests.key_digests[i], app_key_digests.key_digests[j], ESP_SECURE_BOOT_DIGEST_LEN)) {
ESP_LOGI(TAG, "Application key(%d) matches with bootloader key(%d).", j, i);
match = true;
}
@ -277,19 +258,31 @@ esp_err_t esp_secure_boot_v2_permanently_enable(const esp_image_metadata_t *imag
__attribute__((unused)) static const uint8_t enable = 1;
esp_efuse_write_field_bit(ESP_EFUSE_DIS_LEGACY_SPI_BOOT);
esp_efuse_write_field_bit(ESP_EFUSE_DIS_DIRECT_BOOT);
esp_err_t err = ESP_FAIL;
#ifdef CONFIG_SECURE_ENABLE_SECURE_ROM_DL_MODE
ESP_LOGI(TAG, "Enabling Security download mode...");
esp_efuse_write_field_bit(ESP_EFUSE_ENABLE_SECURITY_DOWNLOAD);
err = esp_efuse_enable_rom_secure_download_mode();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Could not enable Security download mode...");
return err;
}
#elif CONFIG_SECURE_DISABLE_ROM_DL_MODE
ESP_LOGI(TAG, "Disable ROM Download mode...");
err = esp_efuse_disable_rom_download_mode();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Could not disable ROM Download mode...");
return err;
}
#else
ESP_LOGW(TAG, "Not enabling Security download mode - SECURITY COMPROMISED");
ESP_LOGW(TAG, "UART ROM Download mode kept enabled - SECURITY COMPROMISED");
#endif
#ifndef CONFIG_SECURE_BOOT_ALLOW_JTAG
ESP_LOGI(TAG, "Disable hardware & software JTAG...");
esp_efuse_write_field_bit(ESP_EFUSE_HARD_DIS_JTAG);
esp_efuse_write_field_bit(ESP_EFUSE_SOFT_DIS_JTAG);
esp_efuse_write_field_cnt(ESP_EFUSE_SOFT_DIS_JTAG, ESP_EFUSE_SOFT_DIS_JTAG[0]->bit_count);
#else
ESP_LOGW(TAG, "Not disabling JTAG - SECURITY COMPROMISED");
#endif
@ -300,7 +293,7 @@ esp_err_t esp_secure_boot_v2_permanently_enable(const esp_image_metadata_t *imag
esp_efuse_write_field_bit(ESP_EFUSE_SECURE_BOOT_EN);
esp_err_t err = esp_efuse_batch_write_commit();
err = esp_efuse_batch_write_commit();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Error programming security eFuses (err=0x%x).", err);
return err;

View File

@ -1,93 +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.
#include <string.h>
#include "sdkconfig.h"
#include "esp_fault.h"
#include "bootloader_flash_priv.h"
#include "bootloader_sha.h"
#include "bootloader_utility.h"
#include "esp_log.h"
#include "esp_image_format.h"
#include "esp_secure_boot.h"
#include "esp32s3/rom/secure_boot.h"
static const char* TAG = "secure_boot";
#define DIGEST_LEN 32
#define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
{
uint8_t digest[DIGEST_LEN];
uint8_t verified_digest[DIGEST_LEN] = { 0 }; /* Note: this function doesn't do any anti-FI checks on this buffer */
const uint8_t *data;
ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
/* Padding to round off the input to the nearest 4k boundary */
int padded_length = ALIGN_UP(length, FLASH_SECTOR_SIZE);
ESP_LOGD(TAG, "verifying src_addr 0x%x length", src_addr, padded_length);
data = bootloader_mmap(src_addr, length + sizeof(struct ets_secure_boot_sig_block));
if (data == NULL) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", src_addr, length+sizeof(ets_secure_boot_signature_t));
return ESP_FAIL;
}
/* Calculate digest of main image */
esp_err_t err = bootloader_sha256_flash_contents(src_addr, padded_length, digest);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Digest calculation failed 0x%x, 0x%x", src_addr, padded_length);
bootloader_munmap(data);
return err;
}
const ets_secure_boot_signature_t *sig = (const ets_secure_boot_signature_t *)(data + length);
int r = esp_secure_boot_verify_rsa_signature_block(sig, digest, verified_digest);
bootloader_munmap(data);
return (r == ETS_OK) ? ESP_OK : ESP_FAIL;
}
esp_err_t esp_secure_boot_verify_rsa_signature_block(const ets_secure_boot_signature_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest)
{
ets_secure_boot_key_digests_t trusted_keys;
ets_secure_boot_key_digests_t trusted_key_copies[2];
ETS_STATUS r;
ets_secure_boot_status_t sb_result;
memset(&trusted_keys, 0, sizeof(ets_secure_boot_key_digests_t));
memset(trusted_key_copies, 0, 2 * sizeof(ets_secure_boot_key_digests_t));
if (!esp_secure_boot_enabled()) {
return ESP_OK;
}
r = ets_secure_boot_read_key_digests(&trusted_keys);
if (r != ETS_OK) {
ESP_LOGI(TAG, "Could not read secure boot digests!");
return ESP_FAIL;
}
// Create the copies for FI checks (assuming result is ETS_OK, if it's not then it'll fail the fault check anyhow)
ets_secure_boot_read_key_digests(&trusted_key_copies[0]);
ets_secure_boot_read_key_digests(&trusted_key_copies[1]);
ESP_FAULT_ASSERT(memcmp(&trusted_keys, &trusted_key_copies[0], sizeof(ets_secure_boot_key_digests_t)) == 0);
ESP_FAULT_ASSERT(memcmp(&trusted_keys, &trusted_key_copies[1], sizeof(ets_secure_boot_key_digests_t)) == 0);
ESP_LOGI(TAG, "Verifying with RSA-PSS boot...");
sb_result = ets_secure_boot_verify_signature(sig_block, image_digest, &trusted_keys, verified_digest);
return (sb_result == SB_SUCCESS) ? ESP_OK : ESP_FAIL;
}

View File

@ -47,10 +47,14 @@
#ifdef BOOTLOADER_BUILD
#ifdef CONFIG_SECURE_SIGNED_ON_BOOT
#define SECURE_BOOT_CHECK_SIGNATURE 1
#else
#define SECURE_BOOT_CHECK_SIGNATURE 0
#endif
#else /* !BOOTLOADER_BUILD */
#ifdef CONFIG_SECURE_SIGNED_ON_UPDATE
#define SECURE_BOOT_CHECK_SIGNATURE 1
#else
#define SECURE_BOOT_CHECK_SIGNATURE 0
#endif
#endif
@ -77,6 +81,7 @@ static bool should_load(uint32_t load_addr);
/* Return true if load_addr is an address the bootloader should map via flash cache */
static bool should_map(uint32_t load_addr);
static esp_err_t process_segments(esp_image_metadata_t *data, bool silent, bool do_load, bootloader_sha256_handle_t sha_handle, uint32_t *checksum);
/* Load or verify a segment */
static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segment_header_t *header, bool silent, bool do_load, bootloader_sha256_handle_t sha_handle, uint32_t *checksum);
@ -98,7 +103,16 @@ static esp_err_t verify_segment_header(int index, const esp_image_segment_header
} \
while(0)
static esp_err_t verify_checksum(bootloader_sha256_handle_t sha_handle, uint32_t checksum_word, esp_image_metadata_t *data);
#define CHECK_ERR(func) do { \
if ((err = func) != ESP_OK) { \
goto err; \
} \
} \
while(0)
static esp_err_t process_image_header(esp_image_metadata_t *data, uint32_t part_offset, bootloader_sha256_handle_t *sha_handle, bool do_verify, bool silent);
static esp_err_t process_appended_hash(esp_image_metadata_t *data, uint32_t part_len, bool do_verify, bool silent);
static esp_err_t process_checksum(bootloader_sha256_handle_t sha_handle, uint32_t checksum_word, esp_image_metadata_t *data, bool silent, bool skip_check_checksum);
static esp_err_t __attribute__((unused)) verify_secure_boot_signature(bootloader_sha256_handle_t sha_handle, esp_image_metadata_t *data, uint8_t *image_digest, uint8_t *verified_digest);
static esp_err_t __attribute__((unused)) verify_simple_hash(bootloader_sha256_handle_t sha_handle, esp_image_metadata_t *data);
@ -116,13 +130,22 @@ static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_
esp_err_t err = ESP_OK;
// checksum the image a word at a time. This shaves 30-40ms per MB of image size
uint32_t checksum_word = ESP_ROM_CHECKSUM_INITIAL;
uint32_t *checksum = NULL;
uint32_t *checksum = (do_verify) ? &checksum_word : NULL;
bootloader_sha256_handle_t sha_handle = NULL;
#if SECURE_BOOT_CHECK_SIGNATURE
#if (SECURE_BOOT_CHECK_SIGNATURE == 1)
/* used for anti-FI checks */
uint8_t image_digest[HASH_LEN] = { [ 0 ... 31] = 0xEE };
uint8_t verified_digest[HASH_LEN] = { [ 0 ... 31 ] = 0x01 };
#endif
#if CONFIG_SECURE_BOOT_V2_ENABLED
// For Secure Boot V2, we do verify signature on bootloader which includes the SHA calculation.
bool verify_sha = do_verify;
#else // Secure boot not enabled
// For secure boot V1 on ESP32, we don't calculate SHA or verify signature on bootloaders.
// (For non-secure boot, we don't verify any SHA-256 hash appended to the bootloader because
// esptool.py may have rewritten the header - rely on esptool.py having verified the bootloader at flashing time, instead.)
bool verify_sha = (part->offset != ESP_BOOTLOADER_OFFSET) && do_verify;
#endif
if (data == NULL || part == NULL) {
return ESP_ERR_INVALID_ARG;
@ -133,142 +156,41 @@ static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_
FAIL_LOAD("partition size 0x%x invalid, larger than 16MB", part->size);
}
bzero(data, sizeof(esp_image_metadata_t));
data->start_addr = part->offset;
ESP_LOGD(TAG, "reading image header @ 0x%x", data->start_addr);
err = bootloader_flash_read(data->start_addr, &data->image, sizeof(esp_image_header_t), true);
if (err != ESP_OK) {
goto err;
}
if (do_verify) {
checksum = &checksum_word;
// Calculate SHA-256 of image if secure boot is on, or if image has a hash appended
#ifdef SECURE_BOOT_CHECK_SIGNATURE
if (1) {
#else
if (data->image.hash_appended) {
#endif
sha_handle = bootloader_sha256_start();
if (sha_handle == NULL) {
return ESP_ERR_NO_MEM;
}
bootloader_sha256_data(sha_handle, &data->image, sizeof(esp_image_header_t));
}
ESP_LOGD(TAG, "image header: 0x%02x 0x%02x 0x%02x 0x%02x %08x",
data->image.magic,
data->image.segment_count,
data->image.spi_mode,
data->image.spi_size,
data->image.entry_addr);
err = verify_image_header(data->start_addr, &data->image, silent);
if (err != ESP_OK) {
goto err;
}
if (data->image.segment_count > ESP_IMAGE_MAX_SEGMENTS) {
FAIL_LOAD("image at 0x%x segment count %d exceeds max %d",
data->start_addr, data->image.segment_count, ESP_IMAGE_MAX_SEGMENTS);
}
} // if (do_verify)
uint32_t next_addr = data->start_addr + sizeof(esp_image_header_t);
for (int i = 0; i < data->image.segment_count; i++) {
esp_image_segment_header_t *header = &data->segments[i];
ESP_LOGV(TAG, "loading segment header %d at offset 0x%x", i, next_addr);
err = process_segment(i, next_addr, header, silent, do_load, sha_handle, checksum);
if (err != ESP_OK) {
goto err;
}
next_addr += sizeof(esp_image_segment_header_t);
data->segment_data[i] = next_addr;
next_addr += header->data_len;
}
if (do_verify) {
// Segments all loaded, verify length
uint32_t end_addr = next_addr;
if (end_addr < data->start_addr) {
FAIL_LOAD("image offset has wrapped");
}
data->image_len = end_addr - data->start_addr;
ESP_LOGV(TAG, "image start 0x%08x end of last section 0x%08x", data->start_addr, end_addr);
if (NULL != checksum && !esp_cpu_in_ocd_debug_mode()) {
err = verify_checksum(sha_handle, checksum_word, data);
if (err != ESP_OK) {
goto err;
}
}
/* For secure boot V1 on ESP32, we don't calculate SHA or verify signature on bootloaders.
For Secure Boot V2, we do verify signature on bootloader which includes the SHA calculation.
(For non-secure boot, we don't verify any SHA-256 hash appended to the bootloader because
esptool.py may have rewritten the header - rely on esptool.py having verified the bootloader at flashing time, instead.)
*/
bool verify_sha;
#if CONFIG_SECURE_BOOT_V2_ENABLED
verify_sha = true;
#else // Secure boot not enabled
verify_sha = (data->start_addr != ESP_BOOTLOADER_OFFSET);
#endif
if (verify_sha) {
if (data->image_len > part->size) {
FAIL_LOAD("Image length %d doesn't fit in partition length %d", data->image_len, part->size);
}
#ifdef SECURE_BOOT_CHECK_SIGNATURE
// secure boot images have a signature appended
bootloader_sha256_handle_t *p_sha_handle = &sha_handle;
CHECK_ERR(process_image_header(data, part->offset, (verify_sha) ? p_sha_handle : NULL, do_verify, silent));
CHECK_ERR(process_segments(data, silent, do_load, sha_handle, checksum));
bool skip_check_checksum = !do_verify || esp_cpu_in_ocd_debug_mode();
CHECK_ERR(process_checksum(sha_handle, checksum_word, data, silent, skip_check_checksum));
CHECK_ERR(process_appended_hash(data, part->size, do_verify, silent));
if (verify_sha) {
#if (SECURE_BOOT_CHECK_SIGNATURE == 1)
// secure boot images have a signature appended
#if defined(BOOTLOADER_BUILD) && !defined(CONFIG_SECURE_BOOT)
// If secure boot is not enabled in hardware, then
// skip the signature check in bootloader when the debugger is attached.
// This is done to allow for breakpoints in Flash.
if (!esp_cpu_in_ocd_debug_mode()) {
// If secure boot is not enabled in hardware, then
// skip the signature check in bootloader when the debugger is attached.
// This is done to allow for breakpoints in Flash.
bool do_verify_sig = !esp_cpu_in_ocd_debug_mode();
#else // CONFIG_SECURE_BOOT
if (true) {
bool do_verify_sig = true;
#endif // end checking for JTAG
err = verify_secure_boot_signature(sha_handle, data, image_digest, verified_digest);
sha_handle = NULL; // verify_secure_boot_signature finishes sha_handle
}
#else // SECURE_BOOT_CHECK_SIGNATURE
// No secure boot, but SHA-256 can be appended for basic corruption detection
if (sha_handle != NULL && !esp_cpu_in_ocd_debug_mode()) {
err = verify_simple_hash(sha_handle, data);
#ifdef CONFIG_IDF_ENV_FPGA
if (err != ESP_OK) {
ESP_LOGW(TAG, "Ignoring invalid SHA-256 as running on FPGA");
err = ESP_OK;
}
#endif
sha_handle = NULL; // calling verify_simple_hash finishes sha_handle
}
#endif // SECURE_BOOT_CHECK_SIGNATURE
} else { // verify_sha
// bootloader may still have a sha256 digest handle open
if (sha_handle != NULL) {
bootloader_sha256_finish(sha_handle, NULL);
}
sha_handle = NULL;
} //verify_sha
// Separately, if there's a hash appended to the image then copy it out to the data->image_digest field
if (data->image.hash_appended) {
const void *hash = bootloader_mmap(data->start_addr + data->image_len - HASH_LEN, HASH_LEN);
if (hash == NULL) {
err = ESP_FAIL;
goto err;
}
memcpy(data->image_digest, hash, HASH_LEN);
bootloader_munmap(hash);
if (do_verify_sig) {
err = verify_secure_boot_signature(sha_handle, data, image_digest, verified_digest);
sha_handle = NULL; // verify_secure_boot_signature finishes sha_handle
}
} // do_verify
#else // SECURE_BOOT_CHECK_SIGNATURE
// No secure boot, but SHA-256 can be appended for basic corruption detection
if (sha_handle != NULL && !esp_cpu_in_ocd_debug_mode()) {
err = verify_simple_hash(sha_handle, data);
sha_handle = NULL; // calling verify_simple_hash finishes sha_handle
}
#endif // SECURE_BOOT_CHECK_SIGNATURE
} // verify_sha
// bootloader may still have a sha256 digest handle open
if (sha_handle != NULL) {
bootloader_sha256_finish(sha_handle, NULL);
sha_handle = NULL;
}
if (err != ESP_OK) {
goto err;
@ -276,7 +198,7 @@ static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_
#ifdef BOOTLOADER_BUILD
#ifdef SECURE_BOOT_CHECK_SIGNATURE
#if (SECURE_BOOT_CHECK_SIGNATURE == 1)
/* If signature was checked in bootloader build, verified_digest should equal image_digest
This is to detect any fault injection that caused signature verification to not complete normally.
@ -307,7 +229,7 @@ static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_
}
}
}
#endif
#endif // BOOTLOADER_BUILD
// Success!
return ESP_OK;
@ -327,11 +249,28 @@ err:
esp_err_t bootloader_load_image(const esp_partition_pos_t *part, esp_image_metadata_t *data)
{
#ifdef BOOTLOADER_BUILD
return image_load(ESP_IMAGE_LOAD, part, data);
#else
#if !defined(BOOTLOADER_BUILD)
return ESP_FAIL;
#else
esp_image_load_mode_t mode = ESP_IMAGE_LOAD;
#if !defined(CONFIG_SECURE_BOOT)
/* Skip validation under particular configurations */
#if CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS
mode = ESP_IMAGE_LOAD_NO_VALIDATE;
#elif CONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON
if (rtc_get_reset_reason(0) == POWERON_RESET
#if SOC_EFUSE_HAS_EFUSE_RST_BUG
|| rtc_get_reset_reason(0) == EFUSE_RESET
#endif
) {
mode = ESP_IMAGE_LOAD_NO_VALIDATE;
}
#endif // CONFIG_BOOTLOADER_SKIP_...
#endif // CONFIG_SECURE_BOOT
return image_load(mode, part, data);
#endif // BOOTLOADER_BUILD
}
esp_err_t bootloader_load_image_no_verify(const esp_partition_pos_t *part, esp_image_metadata_t *data)
@ -348,15 +287,39 @@ esp_err_t esp_image_verify(esp_image_load_mode_t mode, const esp_partition_pos_t
return image_load(mode, part, data);
}
esp_err_t esp_image_get_metadata(const esp_partition_pos_t *part, esp_image_metadata_t *metadata)
{
esp_err_t err;
if (metadata == NULL || part == NULL || part->size > SIXTEEN_MB) {
return ESP_ERR_INVALID_ARG;
}
bool silent = true;
bool do_verify = false;
bool do_load = false;
CHECK_ERR(process_image_header(metadata, part->offset, NULL, do_verify, silent));
CHECK_ERR(process_segments(metadata, silent, do_load, NULL, NULL));
bool skip_check_checksum = true;
CHECK_ERR(process_checksum(NULL, 0, metadata, silent, skip_check_checksum));
CHECK_ERR(process_appended_hash(metadata, part->size, true, silent));
return ESP_OK;
err:
return err;
}
static esp_err_t verify_image_header(uint32_t src_addr, const esp_image_header_t *image, bool silent)
{
esp_err_t err = ESP_OK;
ESP_LOGD(TAG, "image header: 0x%02x 0x%02x 0x%02x 0x%02x %08x",
image->magic,
image->segment_count,
image->spi_mode,
image->spi_size,
image->entry_addr);
if (image->magic != ESP_IMAGE_HEADER_MAGIC) {
if (!silent) {
ESP_LOGE(TAG, "image at 0x%x has invalid magic byte", src_addr);
}
err = ESP_ERR_IMAGE_INVALID;
FAIL_LOAD("image at 0x%x has invalid magic byte (nothing flashed here?)", src_addr);
}
if (!silent) {
if (image->spi_mode > ESP_IMAGE_SPI_MODE_SLOW_READ) {
@ -370,15 +333,19 @@ static esp_err_t verify_image_header(uint32_t src_addr, const esp_image_header_t
}
}
if (err == ESP_OK) {
// Checking the chip revision header *will* print a bunch of other info
// regardless of silent setting as this may be important, but don't bother checking it
// if it looks like the app partition is erased or otherwise garbage
if (bootloader_common_check_chip_validity(image, ESP_IMAGE_APPLICATION) != ESP_OK) {
err = ESP_ERR_IMAGE_INVALID;
}
}
// Checking the chip revision header *will* print a bunch of other info
// regardless of silent setting as this may be important, but don't bother checking it
// if it looks like the app partition is erased or otherwise garbage
CHECK_ERR(bootloader_common_check_chip_validity(image, ESP_IMAGE_APPLICATION));
if (image->segment_count > ESP_IMAGE_MAX_SEGMENTS) {
FAIL_LOAD("image at 0x%x segment count %d exceeds max %d", src_addr, image->segment_count, ESP_IMAGE_MAX_SEGMENTS);
}
return err;
err:
if (err == ESP_OK) {
err = ESP_ERR_IMAGE_INVALID;
}
return err;
}
@ -391,14 +358,15 @@ static bool verify_load_addresses(int segment_index, intptr_t load_addr, intptr_
const char *reason = NULL;
extern int _dram_start, _dram_end, _loader_text_start, _loader_text_end;
void *load_addr_p = (void *)load_addr;
void *load_end_p = (void *)load_end;
void *load_inclusive_end_p = (void *)load_end - 0x1;
void *load_exclusive_end_p = (void *)load_end;
if (load_end == load_addr) {
return true; // zero-length segments are fine
}
assert(load_end > load_addr); // data_len<16MB is checked in verify_segment_header() which is called before this, so this should always be true
if (esp_ptr_in_dram(load_addr_p) && esp_ptr_in_dram(load_end_p)) { /* Writing to DRAM */
if (esp_ptr_in_dram(load_addr_p) && esp_ptr_in_dram(load_inclusive_end_p)) { /* Writing to DRAM */
/* Check if we're clobbering the stack */
intptr_t sp = (intptr_t)get_sp();
if (bootloader_util_regions_overlap(sp - STACK_LOAD_HEADROOM, SOC_ROM_STACK_START,
@ -433,8 +401,8 @@ static bool verify_load_addresses(int segment_index, intptr_t load_addr, intptr_
iram_load_addr = (intptr_t)esp_ptr_diram_dram_to_iram((void *)SOC_DIRAM_DRAM_LOW);
}
if (esp_ptr_in_diram_dram(load_end_p)) {
iram_load_end = (intptr_t)esp_ptr_diram_dram_to_iram(load_end_p);
if (esp_ptr_in_diram_dram(load_inclusive_end_p)) {
iram_load_end = (intptr_t)esp_ptr_diram_dram_to_iram(load_exclusive_end_p);
} else {
iram_load_end = (intptr_t)esp_ptr_diram_dram_to_iram((void *)SOC_DIRAM_DRAM_HIGH);
}
@ -446,7 +414,7 @@ static bool verify_load_addresses(int segment_index, intptr_t load_addr, intptr_
}
}
}
else if (esp_ptr_in_iram(load_addr_p) && esp_ptr_in_iram(load_end_p)) { /* Writing to IRAM */
else if (esp_ptr_in_iram(load_addr_p) && esp_ptr_in_iram(load_inclusive_end_p)) { /* Writing to IRAM */
/* Check for overlap of 'loader' section of IRAM */
if (bootloader_util_regions_overlap((intptr_t)&_loader_text_start, (intptr_t)&_loader_text_end,
load_addr, load_end)) {
@ -470,8 +438,8 @@ static bool verify_load_addresses(int segment_index, intptr_t load_addr, intptr_
dram_load_addr = (intptr_t)esp_ptr_diram_iram_to_dram((void *)SOC_DIRAM_IRAM_LOW);
}
if (esp_ptr_in_diram_iram(load_end_p)) {
dram_load_end = (intptr_t)esp_ptr_diram_iram_to_dram(load_end_p);
if (esp_ptr_in_diram_iram(load_inclusive_end_p)) {
dram_load_end = (intptr_t)esp_ptr_diram_iram_to_dram(load_exclusive_end_p);
} else {
dram_load_end = (intptr_t)esp_ptr_diram_iram_to_dram((void *)SOC_DIRAM_IRAM_HIGH);
}
@ -483,11 +451,11 @@ static bool verify_load_addresses(int segment_index, intptr_t load_addr, intptr_
}
}
/* Sections entirely in RTC memory won't overlap with a vanilla bootloader but are valid load addresses, thus skipping them from the check */
} else if (esp_ptr_in_rtc_iram_fast(load_addr_p) && esp_ptr_in_rtc_iram_fast(load_end_p)){
} else if (esp_ptr_in_rtc_iram_fast(load_addr_p) && esp_ptr_in_rtc_iram_fast(load_inclusive_end_p)){
return true;
} else if (esp_ptr_in_rtc_dram_fast(load_addr_p) && esp_ptr_in_rtc_dram_fast(load_end_p)){
} else if (esp_ptr_in_rtc_dram_fast(load_addr_p) && esp_ptr_in_rtc_dram_fast(load_inclusive_end_p)){
return true;
} else if (esp_ptr_in_rtc_slow(load_addr_p) && esp_ptr_in_rtc_slow(load_end_p)) {
} else if (esp_ptr_in_rtc_slow(load_addr_p) && esp_ptr_in_rtc_slow(load_inclusive_end_p)) {
return true;
} else { /* Not a DRAM or an IRAM or RTC Fast IRAM, RTC Fast DRAM or RTC Slow address */
reason = "bad load address range";
@ -503,6 +471,63 @@ static bool verify_load_addresses(int segment_index, intptr_t load_addr, intptr_
}
#endif // BOOTLOADER_BUILD
static esp_err_t process_image_header(esp_image_metadata_t *data, uint32_t part_offset, bootloader_sha256_handle_t *sha_handle, bool do_verify, bool silent)
{
esp_err_t err;
bzero(data, sizeof(esp_image_metadata_t));
data->start_addr = part_offset;
ESP_LOGD(TAG, "reading image header @ 0x%x", data->start_addr);
CHECK_ERR(bootloader_flash_read(data->start_addr, &data->image, sizeof(esp_image_header_t), true));
if (do_verify) {
// Calculate SHA-256 of image if secure boot is on, or if image has a hash appended
if (SECURE_BOOT_CHECK_SIGNATURE || data->image.hash_appended) {
if (sha_handle != NULL) {
*sha_handle = bootloader_sha256_start();
if (*sha_handle == NULL) {
return ESP_ERR_NO_MEM;
}
bootloader_sha256_data(*sha_handle, &data->image, sizeof(esp_image_header_t));
}
}
CHECK_ERR(verify_image_header(data->start_addr, &data->image, silent));
}
data->image_len = sizeof(esp_image_header_t);
return ESP_OK;
err:
return err;
}
static esp_err_t process_segments(esp_image_metadata_t *data, bool silent, bool do_load, bootloader_sha256_handle_t sha_handle, uint32_t *checksum)
{
esp_err_t err = ESP_OK;
uint32_t start_segments = data->start_addr + data->image_len;
uint32_t next_addr = start_segments;
for (int i = 0; i < data->image.segment_count; i++) {
esp_image_segment_header_t *header = &data->segments[i];
ESP_LOGV(TAG, "loading segment header %d at offset 0x%x", i, next_addr);
CHECK_ERR(process_segment(i, next_addr, header, silent, do_load, sha_handle, checksum));
next_addr += sizeof(esp_image_segment_header_t);
data->segment_data[i] = next_addr;
next_addr += header->data_len;
}
// Segments all loaded, verify length
uint32_t end_addr = next_addr;
if (end_addr < data->start_addr) {
FAIL_LOAD("image offset has wrapped");
}
data->image_len += end_addr - start_segments;
ESP_LOGV(TAG, "image start 0x%08x end of last section 0x%08x", data->start_addr, end_addr);
return err;
err:
if (err == ESP_OK) {
err = ESP_ERR_IMAGE_INVALID;
}
return err;
}
static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segment_header_t *header, bool silent, bool do_load, bootloader_sha256_handle_t sha_handle, uint32_t *checksum)
{
esp_err_t err;
@ -523,10 +548,7 @@ static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segme
ESP_LOGV(TAG, "segment data length 0x%x data starts 0x%x", data_len, data_addr);
err = verify_segment_header(index, header, data_addr, silent);
if (err != ESP_OK) {
return err;
}
CHECK_ERR(verify_segment_header(index, header, data_addr, silent));
if (data_len % 4 != 0) {
FAIL_LOAD("unaligned segment length 0x%x", data_len);
@ -557,17 +579,14 @@ static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segme
uint32_t data_len_remain = data_len;
while (data_len_remain > 0) {
#if SECURE_BOOT_CHECK_SIGNATURE && defined(BOOTLOADER_BUILD)
#if (SECURE_BOOT_CHECK_SIGNATURE == 1) && defined(BOOTLOADER_BUILD)
/* Double check the address verification done above */
ESP_FAULT_ASSERT(!do_load || verify_load_addresses(0, load_addr, load_addr + data_len_remain, false, false));
#endif
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;
}
CHECK_ERR(process_segment_data(load_addr, data_addr, data_len, do_load, sha_handle, checksum));
data_addr += data_len;
data_len_remain -= data_len;
}
@ -742,41 +761,64 @@ esp_err_t esp_image_verify_bootloader_data(esp_image_metadata_t *data)
data);
}
static esp_err_t verify_checksum(bootloader_sha256_handle_t sha_handle, uint32_t checksum_word, esp_image_metadata_t *data)
static esp_err_t process_appended_hash(esp_image_metadata_t *data, uint32_t part_len, bool do_verify, bool silent)
{
esp_err_t err = ESP_OK;
if (data->image.hash_appended) {
// Account for the hash in the total image length
if (do_verify) {
CHECK_ERR(bootloader_flash_read(data->start_addr + data->image_len, &data->image_digest, HASH_LEN, true));
}
data->image_len += HASH_LEN;
}
if (data->image_len > part_len) {
FAIL_LOAD("Image length %d doesn't fit in partition length %d", data->image_len, part_len);
}
return err;
err:
if (err == ESP_OK) {
err = ESP_ERR_IMAGE_INVALID;
}
return err;
}
static esp_err_t process_checksum(bootloader_sha256_handle_t sha_handle, uint32_t checksum_word, esp_image_metadata_t *data, bool silent, bool skip_check_checksum)
{
esp_err_t err = ESP_OK;
uint32_t unpadded_length = data->image_len;
uint32_t length = unpadded_length + 1; // Add a byte for the checksum
length = (length + 15) & ~15; // Pad to next full 16 byte block
length = length - unpadded_length;
// Verify checksum
WORD_ALIGNED_ATTR uint8_t buf[16];
esp_err_t err = bootloader_flash_read(data->start_addr + unpadded_length, buf, length - unpadded_length, true);
uint8_t calc = buf[length - unpadded_length - 1];
uint8_t checksum = (checksum_word >> 24)
^ (checksum_word >> 16)
^ (checksum_word >> 8)
^ (checksum_word >> 0);
if (err != ESP_OK || checksum != calc) {
ESP_LOGE(TAG, "Checksum failed. Calculated 0x%x read 0x%x", checksum, calc);
return ESP_ERR_IMAGE_INVALID;
if (!skip_check_checksum || sha_handle != NULL) {
CHECK_ERR(bootloader_flash_read(data->start_addr + unpadded_length, buf, length, true));
}
uint8_t read_checksum = buf[length - 1];
uint8_t calc_checksum = (checksum_word >> 24) ^ (checksum_word >> 16) ^ (checksum_word >> 8) ^ (checksum_word >> 0);
if (!skip_check_checksum && calc_checksum != read_checksum) {
FAIL_LOAD("Checksum failed. Calculated 0x%x read 0x%x", calc_checksum, read_checksum);
}
if (sha_handle != NULL) {
bootloader_sha256_data(sha_handle, buf, length - unpadded_length);
bootloader_sha256_data(sha_handle, buf, length);
}
data->image_len += length;
return err;
err:
if (err == ESP_OK) {
err = ESP_ERR_IMAGE_INVALID;
}
if (data->image.hash_appended) {
// Account for the hash in the total image length
length += HASH_LEN;
}
data->image_len = length;
return ESP_OK;
return err;
}
static esp_err_t verify_secure_boot_signature(bootloader_sha256_handle_t sha_handle, esp_image_metadata_t *data, uint8_t *image_digest, uint8_t *verified_digest)
{
#ifdef SECURE_BOOT_CHECK_SIGNATURE
#if (SECURE_BOOT_CHECK_SIGNATURE == 1)
uint32_t end = data->start_addr + data->image_len;
ESP_LOGI(TAG, "Verifying image signature...");
@ -808,18 +850,18 @@ static esp_err_t verify_secure_boot_signature(bootloader_sha256_handle_t sha_han
// Use hash to verify signature block
esp_err_t err = ESP_ERR_IMAGE_INVALID;
#if defined(CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME) || defined(CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME)
const void *sig_block;
#ifdef CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
ESP_FAULT_ASSERT(memcmp(image_digest, verified_digest, HASH_LEN) != 0); /* sanity check that these values start differently */
#ifdef CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
sig_block = bootloader_mmap(data->start_addr + data->image_len, sizeof(esp_secure_boot_sig_block_t));
err = esp_secure_boot_verify_ecdsa_signature_block(sig_block, image_digest, verified_digest);
#elif CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME
ESP_FAULT_ASSERT(memcmp(image_digest, verified_digest, HASH_LEN) != 0); /* sanity check that these values start differently */
#else
sig_block = bootloader_mmap(end, sizeof(ets_secure_boot_signature_t));
err = esp_secure_boot_verify_rsa_signature_block(sig_block, image_digest, verified_digest);
#endif
bootloader_munmap(sig_block);
#endif // CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME or CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME
if (err != ESP_OK) {
ESP_LOGE(TAG, "Secure boot signature verification failed");
@ -857,15 +899,16 @@ static esp_err_t verify_simple_hash(bootloader_sha256_handle_t sha_handle, esp_i
bootloader_debug_buffer(image_hash, HASH_LEN, "Calculated hash");
// Simple hash for verification only
const void *hash = bootloader_mmap(data->start_addr + data->image_len - HASH_LEN, HASH_LEN);
if (memcmp(hash, image_hash, HASH_LEN) != 0) {
if (memcmp(data->image_digest, image_hash, HASH_LEN) != 0) {
ESP_LOGE(TAG, "Image hash failed - image is corrupt");
bootloader_debug_buffer(hash, HASH_LEN, "Expected hash");
bootloader_munmap(hash);
bootloader_debug_buffer(data->image_digest, HASH_LEN, "Expected hash");
#ifdef CONFIG_IDF_ENV_FPGA
ESP_LOGW(TAG, "Ignoring invalid SHA-256 as running on FPGA");
return ESP_OK;
#endif
return ESP_ERR_IMAGE_INVALID;
}
bootloader_munmap(hash);
return ESP_OK;
}

View File

@ -58,7 +58,7 @@ esp_err_t esp_partition_table_verify(const esp_partition_info_t *partition_table
esp_rom_md5_update(&context, (unsigned char *) partition_table, num_parts * sizeof(esp_partition_info_t));
esp_rom_md5_final(digest, &context);
unsigned char *md5sum = ((unsigned char *) part) + 16; // skip the 2B magic number and the 14B fillup bytes
unsigned char *md5sum = ((unsigned char *) part) + ESP_PARTITION_MD5_OFFSET;
if (memcmp(md5sum, digest, sizeof(digest)) != 0) {
if (log_errors) {

View File

@ -36,39 +36,6 @@
static const char *TAG = "qio_mode";
typedef unsigned (*read_status_fn_t)(void);
typedef void (*write_status_fn_t)(unsigned);
typedef struct __attribute__((packed))
{
const char *manufacturer;
uint8_t mfg_id; /* 8-bit JEDEC manufacturer ID */
uint16_t flash_id; /* 16-bit JEDEC flash chip ID */
uint16_t id_mask; /* Bits to match on in flash chip ID */
read_status_fn_t read_status_fn;
write_status_fn_t write_status_fn;
uint8_t status_qio_bit;
} qio_info_t;
/* Read 8 bit status using RDSR command */
static unsigned read_status_8b_rdsr(void);
/* Read 8 bit status (second byte) using RDSR2 command */
static unsigned read_status_8b_rdsr2(void);
/* read 16 bit status using RDSR & RDSR2 (low and high bytes) */
static unsigned read_status_16b_rdsr_rdsr2(void);
/* Write 8 bit status using WRSR */
static void write_status_8b_wrsr(unsigned new_status);
/* Write 8 bit status (second byte) using WRSR2 */
static void write_status_8b_wrsr2(unsigned new_status);
/* Write 16 bit status using WRSR */
static void write_status_16b_wrsr(unsigned new_status);
/* Read 8 bit status of XM25QU64A */
static unsigned read_status_8b_xmc25qu64a(void);
/* Write 8 bit status of XM25QU64A */
static void write_status_8b_xmc25qu64a(unsigned new_status);
/* Array of known flash chips and data to enable Quad I/O mode
Manufacturer & flash ID can be tested by running "esptool.py
@ -81,13 +48,14 @@ static void write_status_8b_xmc25qu64a(unsigned new_status);
Searching of this table stops when the first match is found.
*/
const static qio_info_t chip_data[] = {
const bootloader_qio_info_t __attribute__((weak)) bootloader_flash_qe_support_list[] = {
/* Manufacturer, mfg_id, flash_id, id mask, Read Status, Write Status, QIE Bit */
{ "MXIC", 0xC2, 0x2000, 0xFF00, read_status_8b_rdsr, write_status_8b_wrsr, 6 },
{ "ISSI", 0x9D, 0x4000, 0xCF00, read_status_8b_rdsr, write_status_8b_wrsr, 6 }, /* IDs 0x40xx, 0x70xx */
{ "WinBond", 0xEF, 0x4000, 0xFF00, read_status_16b_rdsr_rdsr2, write_status_16b_wrsr, 9 },
{ "GD", 0xC8, 0x6000, 0xFF00, read_status_16b_rdsr_rdsr2, write_status_16b_wrsr, 9 },
{ "XM25QU64A", 0x20, 0x3817, 0xFFFF, read_status_8b_xmc25qu64a, write_status_8b_xmc25qu64a, 6 },
{ "MXIC", 0xC2, 0x2000, 0xFF00, bootloader_read_status_8b_rdsr, bootloader_write_status_8b_wrsr, 6 },
{ "ISSI", 0x9D, 0x4000, 0xCF00, bootloader_read_status_8b_rdsr, bootloader_write_status_8b_wrsr, 6 }, /* IDs 0x40xx, 0x70xx */
{ "WinBond", 0xEF, 0x4000, 0xFF00, bootloader_read_status_16b_rdsr_rdsr2, bootloader_write_status_16b_wrsr, 9 },
{ "GD", 0xC8, 0x6000, 0xFF00, bootloader_read_status_16b_rdsr_rdsr2, bootloader_write_status_16b_wrsr, 9 },
{ "XM25QU64A", 0x20, 0x3817, 0xFFFF, bootloader_read_status_8b_xmc25qu64a, bootloader_write_status_8b_xmc25qu64a, 6 },
{ "TH", 0xcd, 0x6000, 0xFF00, bootloader_read_status_16b_rdsr_rdsr2, bootloader_write_status_16b_wrsr, 9 },
/* Final entry is default entry, if no other IDs have matched.
@ -96,13 +64,13 @@ const static qio_info_t chip_data[] = {
FM25Q32 (QOUT mode only, mfg ID 0xA1, flash IDs including 4016)
BY25Q32 (mfg ID 0x68, flash IDs including 4016)
*/
{ NULL, 0xFF, 0xFFFF, 0xFFFF, read_status_8b_rdsr2, write_status_8b_wrsr2, 1 },
{ NULL, 0xFF, 0xFFFF, 0xFFFF, bootloader_read_status_8b_rdsr2, bootloader_write_status_8b_wrsr2, 1 },
};
#define NUM_CHIPS (sizeof(chip_data) / sizeof(qio_info_t))
#define NUM_CHIPS (sizeof(bootloader_flash_qe_support_list) / sizeof(bootloader_qio_info_t))
static esp_err_t enable_qio_mode(read_status_fn_t read_status_fn,
write_status_fn_t write_status_fn,
static esp_err_t enable_qio_mode(bootloader_flash_read_status_fn_t read_status_fn,
bootloader_flash_write_status_fn_t write_status_fn,
uint8_t status_qio_bit);
/* Generic function to use the "user command" SPI controller functionality
@ -111,14 +79,6 @@ static esp_err_t enable_qio_mode(read_status_fn_t read_status_fn,
The command passed here is always the on-the-wire command given to the SPI flash unit.
*/
/* dummy_len_plus values defined in ROM for SPI flash configuration */
uint32_t bootloader_read_flash_id(void)
{
uint32_t id = bootloader_execute_flash_command(CMD_RDID, 0, 0, 24);
id = ((id & 0xff) << 16) | ((id >> 16) & 0xff) | (id & 0xff00);
return id;
}
void bootloader_enable_qio_mode(void)
{
uint32_t raw_flash_id;
@ -137,9 +97,9 @@ void bootloader_enable_qio_mode(void)
ESP_LOGD(TAG, "Manufacturer ID 0x%02x chip ID 0x%04x", mfg_id, flash_id);
for (i = 0; i < NUM_CHIPS - 1; i++) {
const qio_info_t *chip = &chip_data[i];
const bootloader_qio_info_t *chip = &bootloader_flash_qe_support_list[i];
if (mfg_id == chip->mfg_id && (flash_id & chip->id_mask) == (chip->flash_id & chip->id_mask)) {
ESP_LOGI(TAG, "Enabling QIO for flash chip %s", chip_data[i].manufacturer);
ESP_LOGI(TAG, "Enabling QIO for flash chip %s", bootloader_flash_qe_support_list[i].manufacturer);
break;
}
}
@ -147,16 +107,16 @@ void bootloader_enable_qio_mode(void)
if (i == NUM_CHIPS - 1) {
ESP_LOGI(TAG, "Enabling default flash chip QIO");
}
enable_qio_mode(chip_data[i].read_status_fn,
chip_data[i].write_status_fn,
chip_data[i].status_qio_bit);
enable_qio_mode(bootloader_flash_qe_support_list[i].read_status_fn,
bootloader_flash_qe_support_list[i].write_status_fn,
bootloader_flash_qe_support_list[i].status_qio_bit);
#if SOC_CACHE_SUPPORT_WRAP
bootloader_flash_wrap_set(FLASH_WRAP_MODE_DISABLE);
#endif
}
static esp_err_t enable_qio_mode(read_status_fn_t read_status_fn,
write_status_fn_t write_status_fn,
static esp_err_t enable_qio_mode(bootloader_flash_read_status_fn_t read_status_fn,
bootloader_flash_write_status_fn_t write_status_fn,
uint8_t status_qio_bit)
{
uint32_t status;
@ -204,37 +164,37 @@ static esp_err_t enable_qio_mode(read_status_fn_t read_status_fn,
return ESP_OK;
}
static unsigned read_status_8b_rdsr(void)
unsigned bootloader_read_status_8b_rdsr(void)
{
return bootloader_execute_flash_command(CMD_RDSR, 0, 0, 8);
}
static unsigned read_status_8b_rdsr2(void)
unsigned bootloader_read_status_8b_rdsr2(void)
{
return bootloader_execute_flash_command(CMD_RDSR2, 0, 0, 8);
}
static unsigned read_status_16b_rdsr_rdsr2(void)
unsigned bootloader_read_status_16b_rdsr_rdsr2(void)
{
return bootloader_execute_flash_command(CMD_RDSR, 0, 0, 8) | (bootloader_execute_flash_command(CMD_RDSR2, 0, 0, 8) << 8);
}
static void write_status_8b_wrsr(unsigned new_status)
void bootloader_write_status_8b_wrsr(unsigned new_status)
{
bootloader_execute_flash_command(CMD_WRSR, new_status, 8, 0);
}
static void write_status_8b_wrsr2(unsigned new_status)
void bootloader_write_status_8b_wrsr2(unsigned new_status)
{
bootloader_execute_flash_command(CMD_WRSR2, new_status, 8, 0);
}
static void write_status_16b_wrsr(unsigned new_status)
void bootloader_write_status_16b_wrsr(unsigned new_status)
{
bootloader_execute_flash_command(CMD_WRSR, new_status, 16, 0);
}
static unsigned read_status_8b_xmc25qu64a(void)
unsigned bootloader_read_status_8b_xmc25qu64a(void)
{
bootloader_execute_flash_command(CMD_OTPEN, 0, 0, 0); /* Enter OTP mode */
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
@ -243,7 +203,7 @@ static unsigned read_status_8b_xmc25qu64a(void)
return read_status;
}
static void write_status_8b_xmc25qu64a(unsigned new_status)
void bootloader_write_status_8b_xmc25qu64a(unsigned new_status)
{
bootloader_execute_flash_command(CMD_OTPEN, 0, 0, 0); /* Enter OTP mode */
esp_rom_spiflash_wait_idle(&g_rom_flashchip);

View File

@ -1,339 +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.
#include "sdkconfig.h"
#include "bootloader_flash_priv.h"
#include "bootloader_sha.h"
#include "bootloader_utility.h"
#include "esp_log.h"
#include "esp_image_format.h"
#include "esp_secure_boot.h"
#include "mbedtls/sha256.h"
#include "mbedtls/x509.h"
#include "mbedtls/md.h"
#include "mbedtls/platform.h"
#include "mbedtls/entropy.h"
#include "mbedtls/ctr_drbg.h"
#include <string.h>
#include <sys/param.h>
#include "esp_secure_boot.h"
#ifdef CONFIG_IDF_TARGET_ESP32S2
#include <esp32s2/rom/secure_boot.h>
#elif CONFIG_IDF_TARGET_ESP32C3
#include <esp32c3/rom/secure_boot.h>
#endif
#define DIGEST_LEN 32
#ifdef CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
static const char *TAG = "secure_boot_v1";
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");
#define SIGNATURE_VERIFICATION_KEYLEN 64
esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
{
uint8_t digest[DIGEST_LEN];
uint8_t verified_digest[DIGEST_LEN];
const esp_secure_boot_sig_block_t *sigblock;
ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
esp_err_t err = bootloader_sha256_flash_contents(src_addr, length, digest);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Digest calculation failed 0x%x, 0x%x", src_addr, length);
return err;
}
// Map the signature block and verify the signature
sigblock = (const esp_secure_boot_sig_block_t *)bootloader_mmap(src_addr + length, sizeof(esp_secure_boot_sig_block_t));
if (sigblock == NULL) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", src_addr + length, sizeof(esp_secure_boot_sig_block_t));
return ESP_FAIL;
}
err = esp_secure_boot_verify_ecdsa_signature_block(sigblock, digest, verified_digest);
bootloader_munmap(sigblock);
return err;
}
esp_err_t esp_secure_boot_verify_ecdsa_signature_block(const esp_secure_boot_sig_block_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest)
{
#if !(defined(CONFIG_MBEDTLS_ECDSA_C) && defined(CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED))
ESP_LOGE(TAG, "Signature verification requires ECDSA & SECP256R1 curve enabled");
return ESP_ERR_NOT_SUPPORTED;
#else
ptrdiff_t keylen;
/* Note: in IDF app image verification we don't add any fault injection resistance, boot-time checks only */
memset(verified_digest, 0, DIGEST_LEN);
keylen = signature_verification_key_end - signature_verification_key_start;
if (keylen != SIGNATURE_VERIFICATION_KEYLEN) {
ESP_LOGE(TAG, "Embedded public verification key has wrong length %d", keylen);
return ESP_FAIL;
}
if (sig_block->version != 0) {
ESP_LOGE(TAG, "image has invalid signature version field 0x%08x", sig_block->version);
return ESP_FAIL;
}
ESP_LOGD(TAG, "Verifying secure boot signature");
int ret;
mbedtls_mpi r, s;
mbedtls_mpi_init(&r);
mbedtls_mpi_init(&s);
/* Extract r and s components from RAW ECDSA signature of 64 bytes */
#define ECDSA_INTEGER_LEN 32
ret = mbedtls_mpi_read_binary(&r, &sig_block->signature[0], ECDSA_INTEGER_LEN);
if (ret != 0) {
ESP_LOGE(TAG, "Failed mbedtls_mpi_read_binary(1), err:%d", ret);
return ESP_FAIL;
}
ret = mbedtls_mpi_read_binary(&s, &sig_block->signature[ECDSA_INTEGER_LEN], ECDSA_INTEGER_LEN);
if (ret != 0) {
ESP_LOGE(TAG, "Failed mbedtls_mpi_read_binary(2), err:%d", ret);
mbedtls_mpi_free(&r);
return ESP_FAIL;
}
/* Initialise ECDSA context */
mbedtls_ecdsa_context ecdsa_context;
mbedtls_ecdsa_init(&ecdsa_context);
mbedtls_ecp_group_load(&ecdsa_context.grp, MBEDTLS_ECP_DP_SECP256R1);
size_t plen = mbedtls_mpi_size(&ecdsa_context.grp.P);
if (keylen != 2 * plen) {
ESP_LOGE(TAG, "Incorrect ECDSA key length %d", keylen);
ret = ESP_FAIL;
goto cleanup;
}
/* Extract X and Y components from ECDSA public key */
MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ecdsa_context.Q.X, signature_verification_key_start, plen));
MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ecdsa_context.Q.Y, signature_verification_key_start + plen, plen));
MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&ecdsa_context.Q.Z, 1));
ret = mbedtls_ecdsa_verify(&ecdsa_context.grp, image_digest, DIGEST_LEN, &ecdsa_context.Q, &r, &s);
ESP_LOGD(TAG, "Verification result %d", ret);
cleanup:
mbedtls_mpi_free(&r);
mbedtls_mpi_free(&s);
mbedtls_ecdsa_free(&ecdsa_context);
return ret == 0 ? ESP_OK : ESP_ERR_IMAGE_INVALID;
#endif // CONFIG_MBEDTLS_ECDSA_C && CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED
}
#elif CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME
static const char *TAG = "secure_boot_v2";
#define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
#define RSA_KEY_SIZE 384 /* RSA 3072 Bits */
#if SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS > 1
inline static bool digest_matches(const void *trusted, const void *computed)
{
if (trusted == NULL) {
return false;
}
// 'trusted' is probably a pointer to read-only efuse registers,
// which only support word reads. memcmp() cannot be guaranteed
// to do word reads, so we make a local copy here (we know that
// memcpy() will do word operations if it can).
uint8_t __attribute__((aligned(4))) trusted_local[ETS_DIGEST_LEN];
uint8_t __attribute__((aligned(4))) computed_local[ETS_DIGEST_LEN];
memcpy(trusted_local, trusted, ETS_DIGEST_LEN);
memcpy(computed_local, computed, ETS_DIGEST_LEN);
return memcmp(trusted_local, computed_local, ETS_DIGEST_LEN) == 0;
}
#endif /* SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS > 1 */
esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
{
uint8_t digest[DIGEST_LEN] = {0};
uint8_t verified_digest[DIGEST_LEN] = {0};
/* Rounding off length to the upper 4k boundary */
uint32_t padded_length = ALIGN_UP(length, FLASH_SECTOR_SIZE);
ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
esp_err_t err = bootloader_sha256_flash_contents(src_addr, padded_length, digest);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Digest calculation failed 0x%x, 0x%x", src_addr, padded_length);
return err;
}
const ets_secure_boot_signature_t *sig_block = bootloader_mmap(src_addr + padded_length, sizeof(ets_secure_boot_signature_t));
if (sig_block == NULL) {
ESP_LOGE(TAG, "Failed to mmap data at offset 0x%x", src_addr + padded_length);
return ESP_FAIL;
}
err = esp_secure_boot_verify_rsa_signature_block(sig_block, digest, verified_digest);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Secure Boot V2 verification failed.");
}
bootloader_munmap(sig_block);
return err;
}
esp_err_t esp_secure_boot_verify_rsa_signature_block(const ets_secure_boot_signature_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest)
{
uint8_t i = 0;
#if CONFIG_SECURE_BOOT_V2_ENABLED /* Verify key against efuse block */
uint8_t sig_block_key_digest[SECURE_BOOT_NUM_BLOCKS][DIGEST_LEN] = {0};
/* Note: in IDF verification we don't add any fault injection resistance, as we don't expect this to be called
during boot-time verification. */
memset(verified_digest, 0, DIGEST_LEN);
/* Generating the SHA of the public key components in the signature block */
for (i = 0; i < SECURE_BOOT_NUM_BLOCKS; i++) {
bootloader_sha256_handle_t sig_block_sha;
sig_block_sha = bootloader_sha256_start();
bootloader_sha256_data(sig_block_sha, &sig_block->block[i].key, sizeof(sig_block->block[i].key));
bootloader_sha256_finish(sig_block_sha, (unsigned char *)sig_block_key_digest[i]);
}
#if SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS == 1
uint8_t efuse_trusted_digest[DIGEST_LEN] = {0};
memcpy(efuse_trusted_digest, (uint8_t *) EFUSE_BLK2_RDATA0_REG, sizeof(efuse_trusted_digest));
if (memcmp(efuse_trusted_digest, sig_block_key_digest[0], DIGEST_LEN) != 0) {
const uint8_t zeroes[DIGEST_LEN] = {0};
/* Can't continue if secure boot is enabled, OR if a different digest is already written in efuse BLK2
(If BLK2 is empty and Secure Boot is disabled then we assume that it will be enabled later.)
*/
if (esp_secure_boot_enabled() || memcmp(efuse_trusted_digest, zeroes, DIGEST_LEN) != 0) {
ESP_LOGE(TAG, "Public key digest in eFuse BLK2 and the signature block don't match.");
return ESP_FAIL;
}
}
#elif SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS > 1
bool match = false;
ets_secure_boot_key_digests_t efuse_trusted_digest;
ETS_STATUS r;
r = ets_secure_boot_read_key_digests(&efuse_trusted_digest);
if (r != 0) {
ESP_LOGI(TAG, "Could not read secure boot digests!");
return ESP_FAIL;
}
#endif /* SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS */
#endif /* CONFIG_SECURE_BOOT_V2_ENABLED */
ESP_LOGI(TAG, "Verifying with RSA-PSS...");
int ret = 0;
mbedtls_rsa_context pk;
mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
unsigned char *sig_be = calloc(1, RSA_KEY_SIZE);
unsigned char *buf = calloc(1, RSA_KEY_SIZE);
if (sig_be == NULL || buf == NULL) {
return ESP_ERR_NO_MEM;
}
mbedtls_entropy_init(&entropy);
mbedtls_ctr_drbg_init(&ctr_drbg);
ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0);
if (ret != 0) {
ESP_LOGE(TAG, "mbedtls_ctr_drbg_seed returned -0x%04x\n", ret);
goto exit;
}
for (i = 0; i < SECURE_BOOT_NUM_BLOCKS; i++) {
#if SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS > 1
for (uint8_t j = 0; j < SECURE_BOOT_NUM_BLOCKS; j++) {
if (digest_matches(efuse_trusted_digest.key_digests[j], sig_block_key_digest[i])) {
ESP_LOGI(TAG, "eFuse key matches(%d) matches the application key(%d).", j, i);
match = true;
break;
}
}
if (match == false) {
continue; // Skip the public keys whose digests don't match.
}
# endif // SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS > 1
const mbedtls_mpi N = { .s = 1,
.n = sizeof(sig_block->block[i].key.n)/sizeof(mbedtls_mpi_uint),
.p = (void *)sig_block->block[i].key.n,
};
const mbedtls_mpi e = { .s = 1,
.n = sizeof(sig_block->block[i].key.e)/sizeof(mbedtls_mpi_uint), // 1
.p = (void *)&sig_block->block[i].key.e,
};
mbedtls_rsa_init(&pk, MBEDTLS_RSA_PKCS_V21, MBEDTLS_MD_SHA256);
ret = mbedtls_rsa_import(&pk, &N, NULL, NULL, NULL, &e);
if (ret != 0) {
ESP_LOGE(TAG, "Failed mbedtls_rsa_import, err: %d", ret);
goto exit;
}
ret = mbedtls_rsa_complete(&pk);
if (ret != 0) {
ESP_LOGE(TAG, "Failed mbedtls_rsa_complete, err: %d", ret);
goto exit;
}
ret = mbedtls_rsa_check_pubkey(&pk);
if (ret != 0) {
ESP_LOGI(TAG, "Key is not an RSA key -%0x", -ret);
goto exit;
}
/* Signature needs to be byte swapped into BE representation */
for (int j = 0; j < RSA_KEY_SIZE; j++) {
sig_be[RSA_KEY_SIZE- j - 1] = sig_block->block[i].signature[j];
}
ret = mbedtls_rsa_public( &pk, sig_be, buf);
if (ret != 0) {
ESP_LOGE(TAG, "mbedtls_rsa_public failed, err: %d", ret);
goto exit;
}
ret = mbedtls_rsa_rsassa_pss_verify( &pk, mbedtls_ctr_drbg_random, &ctr_drbg, MBEDTLS_RSA_PUBLIC, MBEDTLS_MD_SHA256, DIGEST_LEN,
image_digest, sig_be);
if (ret != 0) {
ESP_LOGE(TAG, "Failed mbedtls_rsa_rsassa_pss_verify, err: %d", ret);
} else {
ESP_LOGI(TAG, "Signature verified successfully!");
}
exit:
mbedtls_rsa_free(&pk);
if (ret == 0) {
break;
}
}
free(sig_be);
free(buf);
#if SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS == 1
return (ret != 0) ? ESP_ERR_IMAGE_INVALID: ESP_OK;
#elif SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS > 1
return (ret != 0 || match == false) ? ESP_ERR_IMAGE_INVALID: ESP_OK;
#endif /* CONFIG_IDF_TARGET_ESP32 */
}
#endif

View File

@ -0,0 +1,57 @@
// 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.
#include <strings.h>
#include "sdkconfig.h"
#include "esp_log.h"
#include "esp_efuse.h"
#include "esp_efuse_table.h"
#include "esp_secure_boot.h"
#ifndef BOOTLOADER_BUILD
static __attribute__((unused)) const char *TAG = "secure_boot";
#if CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME && CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT
static void rsa_check_signature_on_update_check(void)
{
// We rely on the keys used to sign this app to verify the next app on OTA, so make sure there is at
// least one to avoid a stuck firmware
esp_image_sig_public_key_digests_t digests = { 0 };
esp_err_t err = esp_secure_boot_get_signature_blocks_for_running_app(false, &digests);
if (err != ESP_OK || digests.num_digests == 0) {
ESP_LOGE(TAG, "This app is not signed, but check signature on update is enabled in config. It won't be possible to verify any update.");
abort();
}
#if CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT && SECURE_BOOT_NUM_BLOCKS > 1
if (digests.num_digests > 1) {
ESP_LOGW(TAG, "App has %d signatures. Only the first position of signature blocks is used to verify any update", digests.num_digests);
}
#endif
}
#endif // CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME && CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT
void esp_secure_boot_init_checks(void)
{
#if CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME && CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT
rsa_check_signature_on_update_check();
#endif // CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME && CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT
}
#endif // not BOOTLOADER_BUILD

View File

@ -0,0 +1,136 @@
// 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 "sdkconfig.h"
#include "bootloader_flash_priv.h"
#include "bootloader_sha.h"
#include "bootloader_utility.h"
#include "esp_log.h"
#include "esp_image_format.h"
#include "esp_secure_boot.h"
#include "mbedtls/sha256.h"
#include "mbedtls/x509.h"
#include "mbedtls/md.h"
#include "mbedtls/platform.h"
#include "mbedtls/entropy.h"
#include "mbedtls/ctr_drbg.h"
#include <string.h>
#include <sys/param.h>
#ifdef CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
static const char *TAG = "secure_boot_v1";
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");
#define SIGNATURE_VERIFICATION_KEYLEN 64
esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
{
uint8_t digest[ESP_SECURE_BOOT_DIGEST_LEN];
uint8_t verified_digest[ESP_SECURE_BOOT_DIGEST_LEN];
const esp_secure_boot_sig_block_t *sigblock;
ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
esp_err_t err = bootloader_sha256_flash_contents(src_addr, length, digest);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Digest calculation failed 0x%x, 0x%x", src_addr, length);
return err;
}
// Map the signature block and verify the signature
sigblock = (const esp_secure_boot_sig_block_t *)bootloader_mmap(src_addr + length, sizeof(esp_secure_boot_sig_block_t));
if (sigblock == NULL) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", src_addr + length, sizeof(esp_secure_boot_sig_block_t));
return ESP_FAIL;
}
err = esp_secure_boot_verify_ecdsa_signature_block(sigblock, digest, verified_digest);
bootloader_munmap(sigblock);
return err;
}
esp_err_t esp_secure_boot_verify_ecdsa_signature_block(const esp_secure_boot_sig_block_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest)
{
#if !(defined(CONFIG_MBEDTLS_ECDSA_C) && defined(CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED))
ESP_LOGE(TAG, "Signature verification requires ECDSA & SECP256R1 curve enabled");
return ESP_ERR_NOT_SUPPORTED;
#else
ptrdiff_t keylen;
/* Note: in IDF app image verification we don't add any fault injection resistance, boot-time checks only */
memset(verified_digest, 0, ESP_SECURE_BOOT_DIGEST_LEN);
keylen = signature_verification_key_end - signature_verification_key_start;
if (keylen != SIGNATURE_VERIFICATION_KEYLEN) {
ESP_LOGE(TAG, "Embedded public verification key has wrong length %d", keylen);
return ESP_FAIL;
}
if (sig_block->version != 0) {
ESP_LOGE(TAG, "image has invalid signature version field 0x%08x", sig_block->version);
return ESP_FAIL;
}
ESP_LOGD(TAG, "Verifying secure boot signature");
int ret;
mbedtls_mpi r, s;
mbedtls_mpi_init(&r);
mbedtls_mpi_init(&s);
/* Extract r and s components from RAW ECDSA signature of 64 bytes */
#define ECDSA_INTEGER_LEN 32
ret = mbedtls_mpi_read_binary(&r, &sig_block->signature[0], ECDSA_INTEGER_LEN);
if (ret != 0) {
ESP_LOGE(TAG, "Failed mbedtls_mpi_read_binary(1), err:%d", ret);
return ESP_FAIL;
}
ret = mbedtls_mpi_read_binary(&s, &sig_block->signature[ECDSA_INTEGER_LEN], ECDSA_INTEGER_LEN);
if (ret != 0) {
ESP_LOGE(TAG, "Failed mbedtls_mpi_read_binary(2), err:%d", ret);
mbedtls_mpi_free(&r);
return ESP_FAIL;
}
/* Initialise ECDSA context */
mbedtls_ecdsa_context ecdsa_context;
mbedtls_ecdsa_init(&ecdsa_context);
mbedtls_ecp_group_load(&ecdsa_context.grp, MBEDTLS_ECP_DP_SECP256R1);
size_t plen = mbedtls_mpi_size(&ecdsa_context.grp.P);
if (keylen != 2 * plen) {
ESP_LOGE(TAG, "Incorrect ECDSA key length %d", keylen);
ret = ESP_FAIL;
goto cleanup;
}
/* Extract X and Y components from ECDSA public key */
MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ecdsa_context.Q.X, signature_verification_key_start, plen));
MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ecdsa_context.Q.Y, signature_verification_key_start + plen, plen));
MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&ecdsa_context.Q.Z, 1));
ret = mbedtls_ecdsa_verify(&ecdsa_context.grp, image_digest, ESP_SECURE_BOOT_DIGEST_LEN, &ecdsa_context.Q, &r, &s);
ESP_LOGD(TAG, "Verification result %d", ret);
cleanup:
mbedtls_mpi_free(&r);
mbedtls_mpi_free(&s);
mbedtls_ecdsa_free(&ecdsa_context);
return ret == 0 ? ESP_OK : ESP_ERR_IMAGE_INVALID;
#endif // CONFIG_MBEDTLS_ECDSA_C && CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED
}
#endif // CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME

View File

@ -0,0 +1,100 @@
// 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 "sdkconfig.h"
#include "bootloader_flash_priv.h"
#include "bootloader_sha.h"
#include "bootloader_utility.h"
#include "esp_log.h"
#include "esp_image_format.h"
#include "esp_secure_boot.h"
#include "esp_spi_flash.h"
#include "esp_fault.h"
#include "esp32/rom/sha.h"
#include "uECC_verify_antifault.h"
#include <sys/param.h>
#include <string.h>
static const char *TAG = "secure_boot";
#ifdef CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
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");
#define SIGNATURE_VERIFICATION_KEYLEN 64
esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
{
uint8_t digest[ESP_SECURE_BOOT_DIGEST_LEN];
uint8_t verified_digest[ESP_SECURE_BOOT_DIGEST_LEN] = { 0 }; /* ignored in this function */
const esp_secure_boot_sig_block_t *sigblock;
ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
esp_err_t err = bootloader_sha256_flash_contents(src_addr, length, digest);
if (err != ESP_OK) {
return err;
}
// 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
err = esp_secure_boot_verify_ecdsa_signature_block(sigblock, digest, verified_digest);
// 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)
{
uint8_t verified_digest[ESP_SECURE_BOOT_DIGEST_LEN] = { 0 };
return esp_secure_boot_verify_ecdsa_signature_block(sig_block, image_digest, verified_digest);
}
esp_err_t esp_secure_boot_verify_ecdsa_signature_block(const esp_secure_boot_sig_block_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest)
{
ptrdiff_t keylen;
keylen = signature_verification_key_end - signature_verification_key_start;
if (keylen != SIGNATURE_VERIFICATION_KEYLEN) {
ESP_LOGE(TAG, "Embedded public verification key has wrong length %d", keylen);
return ESP_FAIL;
}
if (sig_block->version != 0) {
ESP_LOGE(TAG, "image has invalid signature version field 0x%08x", sig_block->version);
return ESP_FAIL;
}
ESP_LOGD(TAG, "Verifying secure boot signature");
bool is_valid;
is_valid = uECC_verify_antifault(signature_verification_key_start,
image_digest,
ESP_SECURE_BOOT_DIGEST_LEN,
sig_block->signature,
uECC_secp256r1(),
verified_digest);
ESP_LOGD(TAG, "Verification result %d", is_valid);
return is_valid ? ESP_OK : ESP_ERR_IMAGE_INVALID;
}
#endif // CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME

View File

@ -0,0 +1,295 @@
// 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 "sdkconfig.h"
#include "bootloader_flash_priv.h"
#include "bootloader_sha.h"
#include "bootloader_utility.h"
#include "esp_log.h"
#include "esp_image_format.h"
#include "mbedtls/sha256.h"
#include "mbedtls/x509.h"
#include "mbedtls/md.h"
#include "mbedtls/platform.h"
#include "mbedtls/entropy.h"
#include "mbedtls/ctr_drbg.h"
#include <string.h>
#include <sys/param.h>
#include "esp_secure_boot.h"
#include "esp_ota_ops.h"
// Secure boot V2 for app
_Static_assert(SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS == SECURE_BOOT_NUM_BLOCKS,
"Parts of this code rely on the max number of signatures appended to an image"
"being the same as the max number of trusted keys.");
#if CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME || CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT
static const char *TAG = "secure_boot_v2";
#define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
/* A signature block is valid when it has correct magic byte, crc. */
static esp_err_t validate_signature_block(const ets_secure_boot_sig_block_t *block)
{
if (block->magic_byte != ETS_SECURE_BOOT_V2_SIGNATURE_MAGIC
|| block->block_crc != esp_rom_crc32_le(0, (uint8_t *)block, CRC_SIGN_BLOCK_LEN)) {
return ESP_FAIL;
}
return ESP_OK;
}
esp_err_t esp_secure_boot_get_signature_blocks_for_running_app(bool digest_public_keys, esp_image_sig_public_key_digests_t *public_key_digests)
{
esp_image_metadata_t metadata;
const esp_partition_t* running_app_part = esp_ota_get_running_partition();
if (running_app_part == NULL) {
ESP_LOGE(TAG, "Cannot get running partition");
return ESP_FAIL;
}
const esp_partition_pos_t part_pos = {
.offset = running_app_part->address,
.size = running_app_part->size,
};
esp_err_t err = esp_image_get_metadata(&part_pos, &metadata);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Error reading metadata from running app (err=0x%x)", err);
return ESP_FAIL;
}
memset(public_key_digests, 0, sizeof(esp_image_sig_public_key_digests_t));
// Generating the SHA of the public key components in the signature block
// metadata.image_len doesn't include any padding to start of the signature sector, so pad it here
size_t sig_block_addr = metadata.start_addr + ALIGN_UP(metadata.image_len, FLASH_SECTOR_SIZE);
ESP_LOGD(TAG, "reading signatures for app address 0x%x sig block address 0x%x", part_pos.offset, sig_block_addr);
for (unsigned i = 0; i < SECURE_BOOT_NUM_BLOCKS; i++) {
ets_secure_boot_sig_block_t block;
size_t addr = sig_block_addr + sizeof(ets_secure_boot_sig_block_t) * i;
esp_err_t err = bootloader_flash_read(addr, &block, sizeof(ets_secure_boot_sig_block_t), true);
if (err == ESP_OK) {
if (validate_signature_block(&block) == ESP_OK) {
if (digest_public_keys) {
bootloader_sha256_handle_t sig_block_sha = bootloader_sha256_start();
bootloader_sha256_data(sig_block_sha, &block.key, sizeof(block.key));
bootloader_sha256_finish(sig_block_sha, public_key_digests->key_digests[i]);
}
public_key_digests->num_digests++;
}
} else {
ESP_LOGE(TAG, "Secure boot sign blocks cannot be read from a running app (err=0x%x)", err);
return ESP_FAIL;
}
}
if (public_key_digests->num_digests > 0) {
return ESP_OK;
}
ESP_LOGE(TAG, "No signatures were found for the running app");
return ESP_ERR_NOT_FOUND;
}
static esp_err_t get_secure_boot_key_digests(esp_image_sig_public_key_digests_t *public_key_digests)
{
#ifdef CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT
// Gets key digests from running app
ESP_LOGI(TAG, "Take trusted digest key(s) from running app");
return esp_secure_boot_get_signature_blocks_for_running_app(true, public_key_digests);
#elif CONFIG_SECURE_BOOT_V2_ENABLED
ESP_LOGI(TAG, "Take trusted digest key(s) from eFuse block(s)");
#if SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS > 1
// Read key digests from efuse
ets_secure_boot_key_digests_t efuse_trusted;
if (ets_secure_boot_read_key_digests(&efuse_trusted) == ETS_OK) {
for (unsigned i = 0; i < SECURE_BOOT_NUM_BLOCKS; i++) {
if (efuse_trusted.key_digests[i] != NULL) {
memcpy(public_key_digests->key_digests[i], (uint8_t *)efuse_trusted.key_digests[i], ESP_SECURE_BOOT_DIGEST_LEN);
public_key_digests->num_digests++;
}
}
}
if (public_key_digests->num_digests > 0) {
return ESP_OK;
}
return ESP_ERR_NOT_FOUND;
#else
memcpy(public_key_digests->key_digests[0], (uint8_t *)EFUSE_BLK2_RDATA0_REG, ESP_SECURE_BOOT_DIGEST_LEN);
public_key_digests->num_digests = 1;
return ESP_OK;
#endif // SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS
#endif // CONFIG_SECURE_BOOT_V2_ENABLED
}
esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
{
uint8_t digest[ESP_SECURE_BOOT_DIGEST_LEN] = {0};
uint8_t verified_digest[ESP_SECURE_BOOT_DIGEST_LEN] = {0};
/* Rounding off length to the upper 4k boundary */
uint32_t padded_length = ALIGN_UP(length, FLASH_SECTOR_SIZE);
ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
esp_err_t err = bootloader_sha256_flash_contents(src_addr, padded_length, digest);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Digest calculation failed 0x%x, 0x%x", src_addr, padded_length);
return err;
}
const ets_secure_boot_signature_t *sig_block = bootloader_mmap(src_addr + padded_length, sizeof(ets_secure_boot_signature_t));
if (sig_block == NULL) {
ESP_LOGE(TAG, "Failed to mmap data at offset 0x%x", src_addr + padded_length);
return ESP_FAIL;
}
err = esp_secure_boot_verify_rsa_signature_block(sig_block, digest, verified_digest);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Secure Boot V2 verification failed.");
}
bootloader_munmap(sig_block);
return err;
}
// This verify function is called only from app, during ota update.
// This function is compiled in case when CONFIG_SECURE_BOOT_V2_ENABLED==y or CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT==y.
// if CONFIG_SECURE_BOOT_V2_ENABLED==y and key digests from eFuse are missing, then FAIL (eFuse blocks should be set).
esp_err_t esp_secure_boot_verify_rsa_signature_block(const ets_secure_boot_signature_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest)
{
bool any_trusted_key = false;
/* Note: in IDF verification we don't add any fault injection resistance, as we don't expect this to be called
during boot-time verification. */
memset(verified_digest, 0, ESP_SECURE_BOOT_DIGEST_LEN);
esp_image_sig_public_key_digests_t trusted = {0};
if (get_secure_boot_key_digests(&trusted) != ESP_OK) {
ESP_LOGE(TAG, "Could not read secure boot digests!");
return ESP_FAIL;
}
int ret = 0;
mbedtls_rsa_context pk;
mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
const unsigned rsa_key_size = sizeof(sig_block->block[0].signature);
unsigned char *sig_be = calloc(1, rsa_key_size);
unsigned char *buf = calloc(1, rsa_key_size);
if (sig_be == NULL || buf == NULL) {
return ESP_ERR_NO_MEM;
}
mbedtls_entropy_init(&entropy);
mbedtls_ctr_drbg_init(&ctr_drbg);
ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0);
if (ret != 0) {
ESP_LOGE(TAG, "mbedtls_ctr_drbg_seed returned -0x%04x\n", ret);
goto exit_outer;
}
#ifdef CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT
const unsigned secure_boot_num_blocks = 1;
#else
const unsigned secure_boot_num_blocks = SECURE_BOOT_NUM_BLOCKS;
#endif
for (unsigned app_blk_idx = 0; app_blk_idx < secure_boot_num_blocks; app_blk_idx++) {
uint8_t app_blk_digest[ESP_SECURE_BOOT_DIGEST_LEN] = { 0 };
const ets_secure_boot_sig_block_t *app_blk = &sig_block->block[app_blk_idx];
const ets_secure_boot_sig_block_t *trusted_block = NULL;
if (validate_signature_block(app_blk) != ESP_OK) {
continue; // Skip invalid signature blocks
}
/* Generate the SHA of the public key components in the signature block */
bootloader_sha256_handle_t sig_block_sha = bootloader_sha256_start();
bootloader_sha256_data(sig_block_sha, &app_blk->key, sizeof(app_blk->key));
bootloader_sha256_finish(sig_block_sha, app_blk_digest);
/* Check if the key is one we trust */
for (unsigned trusted_key_idx = 0; trusted_key_idx < secure_boot_num_blocks; trusted_key_idx++) {
if (memcmp(app_blk_digest, trusted.key_digests[trusted_key_idx], ESP_SECURE_BOOT_DIGEST_LEN) == 0) {
ESP_LOGI(TAG, "#%d app key digest == #%d trusted key digest", app_blk_idx, trusted_key_idx);
trusted_block = app_blk;
any_trusted_key = true;
break;
}
ESP_LOGV(TAG, "not trusting app sig %d trust idx %d", app_blk_idx, trusted_key_idx);
}
if (trusted_block == NULL) {
continue; // Skip the signature blocks with no trusted digest
}
ESP_LOGI(TAG, "Verifying with RSA-PSS...");
const mbedtls_mpi N = { .s = 1,
.n = sizeof(trusted_block->key.n)/sizeof(mbedtls_mpi_uint),
.p = (void *)trusted_block->key.n,
};
const mbedtls_mpi e = { .s = 1,
.n = sizeof(trusted_block->key.e)/sizeof(mbedtls_mpi_uint), // 1
.p = (void *)&trusted_block->key.e,
};
mbedtls_rsa_init(&pk, MBEDTLS_RSA_PKCS_V21, MBEDTLS_MD_SHA256);
ret = mbedtls_rsa_import(&pk, &N, NULL, NULL, NULL, &e);
if (ret != 0) {
ESP_LOGE(TAG, "Failed mbedtls_rsa_import, err: %d", ret);
goto exit_inner;
}
ret = mbedtls_rsa_complete(&pk);
if (ret != 0) {
ESP_LOGE(TAG, "Failed mbedtls_rsa_complete, err: %d", ret);
goto exit_inner;
}
ret = mbedtls_rsa_check_pubkey(&pk);
if (ret != 0) {
ESP_LOGI(TAG, "Key is not an RSA key -%0x", -ret);
goto exit_inner;
}
/* Signature needs to be byte swapped into BE representation */
for (int j = 0; j < rsa_key_size; j++) {
sig_be[rsa_key_size - j - 1] = trusted_block->signature[j];
}
ret = mbedtls_rsa_public( &pk, sig_be, buf);
if (ret != 0) {
ESP_LOGE(TAG, "mbedtls_rsa_public failed, err: %d", ret);
goto exit_inner;
}
ret = mbedtls_rsa_rsassa_pss_verify( &pk, mbedtls_ctr_drbg_random, &ctr_drbg, MBEDTLS_RSA_PUBLIC, MBEDTLS_MD_SHA256, ESP_SECURE_BOOT_DIGEST_LEN,
image_digest, sig_be);
if (ret != 0) {
ESP_LOGE(TAG, "Failed mbedtls_rsa_rsassa_pss_verify, err: %d", ret);
} else {
ESP_LOGI(TAG, "Signature verified successfully!");
}
exit_inner:
mbedtls_rsa_free(&pk);
if (ret == 0) {
break;
}
}
exit_outer:
free(sig_be);
free(buf);
return (ret != 0 || any_trusted_key == false) ? ESP_ERR_IMAGE_INVALID: ESP_OK;
}
#endif // CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME || CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT

View File

@ -0,0 +1,175 @@
// 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 "sdkconfig.h"
#include <string.h>
#include "esp_fault.h"
#include "bootloader_flash_priv.h"
#include "bootloader_sha.h"
#include "bootloader_utility.h"
#include "esp_log.h"
#include "esp_image_format.h"
#include "esp_secure_boot.h"
// Secure boot V2 for bootloader.
#if CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME && CONFIG_SECURE_BOOT_V2_ENABLED
static const char* TAG = "secure_boot_v2";
#define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
{
uint8_t digest[ESP_SECURE_BOOT_DIGEST_LEN] = {0};
uint8_t verified_digest[ESP_SECURE_BOOT_DIGEST_LEN] = { 0 }; /* Note: this function doesn't do any anti-FI checks on this buffer */
/* Rounding off length to the upper 4k boundary */
uint32_t padded_length = ALIGN_UP(length, FLASH_SECTOR_SIZE);
ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
/* Calculate digest of main image */
esp_err_t err = bootloader_sha256_flash_contents(src_addr, padded_length, digest);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Digest calculation failed 0x%x, 0x%x", src_addr, padded_length);
return err;
}
const ets_secure_boot_signature_t *sig_block = bootloader_mmap(src_addr + padded_length, sizeof(ets_secure_boot_signature_t));
if (sig_block == NULL) {
ESP_LOGE(TAG, "Failed to mmap data at offset 0x%x", src_addr + padded_length);
return ESP_FAIL;
}
err = esp_secure_boot_verify_rsa_signature_block(sig_block, digest, verified_digest);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Secure Boot V2 verification failed.");
}
bootloader_munmap(sig_block);
return err;
}
/* A signature block is valid when it has correct magic byte, crc. */
static esp_err_t validate_signature_block(const ets_secure_boot_sig_block_t *block)
{
if (block->magic_byte != ETS_SECURE_BOOT_V2_SIGNATURE_MAGIC
|| block->block_crc != esp_rom_crc32_le(0, (uint8_t *)block, CRC_SIGN_BLOCK_LEN)) {
return ESP_FAIL;
}
return ESP_OK;
}
static esp_err_t get_secure_boot_key_digests(esp_image_sig_public_key_digests_t *public_key_digests)
{
#if SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS > 1
// Read key digests from efuse
ets_secure_boot_key_digests_t trusted_keys;
ets_secure_boot_key_digests_t trusted_key_copies[2];
ETS_STATUS ets_ret;
memset(&trusted_keys, 0, sizeof(ets_secure_boot_key_digests_t));
memset(trusted_key_copies, 0, 2 * sizeof(ets_secure_boot_key_digests_t));
ets_ret = ets_secure_boot_read_key_digests(&trusted_keys);
// Create the copies for FI checks (assuming result is ETS_OK, if it's not then it'll fail the fault check anyhow)
ets_secure_boot_read_key_digests(&trusted_key_copies[0]);
ets_secure_boot_read_key_digests(&trusted_key_copies[1]);
ESP_FAULT_ASSERT(memcmp(&trusted_keys, &trusted_key_copies[0], sizeof(ets_secure_boot_key_digests_t)) == 0);
ESP_FAULT_ASSERT(memcmp(&trusted_keys, &trusted_key_copies[1], sizeof(ets_secure_boot_key_digests_t)) == 0);
if (ets_ret == ETS_OK) {
for (unsigned i = 0; i < SECURE_BOOT_NUM_BLOCKS; i++) {
if (trusted_keys.key_digests[i] != NULL) {
memcpy(public_key_digests->key_digests[i], (uint8_t *)trusted_keys.key_digests[i], ESP_SECURE_BOOT_DIGEST_LEN);
public_key_digests->num_digests++;
}
}
if (public_key_digests->num_digests > 0) {
return ESP_OK;
}
}
return ESP_ERR_NOT_FOUND;
#else
bool all_zeroes = true;
uint32_t *reg = (uint32_t*)&public_key_digests->key_digests[0];
for (int i = 0; i < ESP_SECURE_BOOT_DIGEST_LEN / 4; i++) {
*(reg + i) = REG_READ(EFUSE_BLK2_RDATA0_REG + i * 4);
all_zeroes = all_zeroes && (*(reg + i) == 0);
}
if (all_zeroes) {
return ESP_ERR_NOT_FOUND;
}
public_key_digests->num_digests = 1;
return ESP_OK;
#endif // SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS
}
// if CONFIG_SECURE_BOOT_V2_ENABLED==y and key digests from eFuse are missing, then it is the first boot,
// trusted.key_digests are filled from app sig_block.
esp_err_t esp_secure_boot_verify_rsa_signature_block(const ets_secure_boot_signature_t *sig_block, const uint8_t *image_digest, uint8_t *verified_digest)
{
esp_image_sig_public_key_digests_t trusted = {0};
bool efuse_keys_are_not_set = false;
if (get_secure_boot_key_digests(&trusted) != ESP_OK) {
if (esp_secure_boot_enabled()) {
ESP_LOGE(TAG, "Could not read eFuse secure boot digests!");
return ESP_FAIL;
} else {
ESP_LOGI(TAG, "Secure boot V2 is not enabled yet and eFuse digest keys are not set");
efuse_keys_are_not_set = true;
ESP_FAULT_ASSERT(!esp_secure_boot_enabled());
}
}
if (!esp_secure_boot_enabled()) {
// It is the first boot. eFuse secure boot bit is not set yet. eFuse block(s) can be written or not.
// Generating the SHA of the public key components in the signature block
for (unsigned i = 0; i < SECURE_BOOT_NUM_BLOCKS; i++) {
if (validate_signature_block(&sig_block->block[i]) == ESP_OK) {
if (efuse_keys_are_not_set) {
// if efuse key digests are not in eFuse yet due to it is the first boot
// then use digests from app to skip error in ets_secure_boot_verify_signature().
bootloader_sha256_handle_t sig_block_sha = bootloader_sha256_start();
bootloader_sha256_data(sig_block_sha, &sig_block->block[i].key, sizeof(sig_block->block[i].key));
bootloader_sha256_finish(sig_block_sha, trusted.key_digests[i]);
}
}
}
ESP_FAULT_ASSERT(!esp_secure_boot_enabled());
}
ESP_LOGI(TAG, "Verifying with RSA-PSS...");
#if SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS == 1
int sb_result = ets_secure_boot_verify_signature(sig_block, image_digest, trusted.key_digests[0], verified_digest);
#else
ets_secure_boot_key_digests_t trusted_key_digests = {0};
for (unsigned i = 0; i < SECURE_BOOT_NUM_BLOCKS; i++) {
trusted_key_digests.key_digests[i] = &trusted.key_digests[i];
}
// Key revocation happens in ROM bootloader.
// Do NOT allow key revocation while verifying application
trusted_key_digests.allow_key_revoke = false;
int sb_result = ets_secure_boot_verify_signature(sig_block, image_digest, &trusted_key_digests, verified_digest);
#endif
if (sb_result != SB_SUCCESS) {
ESP_LOGE(TAG, "Secure Boot V2 verification failed.");
return ESP_ERR_IMAGE_INVALID;
} else {
ESP_LOGI(TAG, "Signature verified successfully!");
return ESP_OK;
}
}
#endif // CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME && CONFIG_SECURE_BOOT_V2_ENABLED

View File

@ -20,15 +20,24 @@ if(CONFIG_BT_ENABLED)
list(APPEND priv_include_dirs
common/btc/include
common/include)
list(APPEND include_dirs
common/api/include/api
common/btc/profile/esp/blufi/include
common/btc/profile/esp/include)
list(APPEND srcs "common/btc/core/btc_alarm.c"
"common/api/esp_blufi_api.c"
"common/btc/core/btc_manage.c"
"common/btc/core/btc_task.c"
"common/btc/profile/esp/blufi/blufi_prf.c"
"common/btc/profile/esp/blufi/blufi_protocol.c"
"common/osi/alarm.c"
"common/osi/allocator.c"
"common/osi/buffer.c"
"common/osi/config.c"
"common/osi/fixed_queue.c"
"common/osi/pkt_queue.c"
"common/osi/fixed_pkt_queue.c"
"common/osi/future.c"
"common/osi/hash_functions.c"
"common/osi/hash_map.c"
@ -57,7 +66,6 @@ if(CONFIG_BT_ENABLED)
host/bluedroid/external/sbc/decoder/include
host/bluedroid/external/sbc/encoder/include
host/bluedroid/external/sbc/plc/include
host/bluedroid/btc/profile/esp/blufi/include
host/bluedroid/btc/profile/esp/include
host/bluedroid/btc/profile/std/a2dp/include
host/bluedroid/btc/profile/std/hid/include
@ -81,7 +89,6 @@ if(CONFIG_BT_ENABLED)
list(APPEND srcs "host/bluedroid/api/esp_a2dp_api.c"
"host/bluedroid/api/esp_avrc_api.c"
"host/bluedroid/api/esp_blufi_api.c"
"host/bluedroid/api/esp_bt_device.c"
"host/bluedroid/api/esp_bt_main.c"
"host/bluedroid/api/esp_gap_ble_api.c"
@ -167,8 +174,6 @@ if(CONFIG_BT_ENABLED)
"host/bluedroid/btc/core/btc_sm.c"
"host/bluedroid/btc/core/btc_storage.c"
"host/bluedroid/btc/core/btc_util.c"
"host/bluedroid/btc/profile/esp/blufi/blufi_prf.c"
"host/bluedroid/btc/profile/esp/blufi/blufi_protocol.c"
"host/bluedroid/btc/profile/std/a2dp/bta_av_co.c"
"host/bluedroid/btc/profile/std/a2dp/btc_a2dp.c"
"host/bluedroid/btc/profile/std/a2dp/btc_a2dp_control.c"
@ -321,6 +326,7 @@ if(CONFIG_BT_ENABLED)
"host/bluedroid/stack/smp/smp_main.c"
"host/bluedroid/stack/smp/smp_utils.c")
list(APPEND srcs "common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c")
if(CONFIG_BLE_MESH)
list(APPEND srcs "esp_ble_mesh/mesh_core/bluedroid_host/mesh_bearer_adapt.c")
endif()
@ -540,6 +546,8 @@ if(CONFIG_BT_ENABLED)
"host/nimble/esp-hci/src/esp_nimble_hci.c"
"host/nimble/port/src/esp_nimble_mem.c")
list(APPEND srcs
"common/btc/profile/esp/blufi/nimble_host/esp_blufi.c")
if(CONFIG_BLE_MESH)
list(APPEND srcs "esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c")
endif()
@ -589,13 +597,15 @@ idf_component_register(SRCS "${srcs}"
if(CONFIG_BT_ENABLED)
target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-implicit-fallthrough -Wno-unused-const-variable)
if(CONFIG_IDF_TARGET_ESP32)
target_link_libraries(${COMPONENT_LIB} INTERFACE "-L${CMAKE_CURRENT_LIST_DIR}/controller/lib/esp32")
target_link_libraries(${COMPONENT_LIB} INTERFACE "-L${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32/esp32")
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
elseif(CONFIG_IDF_TARGET_ESP32C3)
target_link_libraries(${COMPONENT_LIB} INTERFACE "-L${CMAKE_CURRENT_LIST_DIR}/controller/lib/esp32c3")
target_link_libraries(${COMPONENT_LIB} INTERFACE
"-L${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32c3")
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app btbb)
elseif(CONFIG_IDF_TARGET_ESP32S3)
target_link_libraries(${COMPONENT_LIB} INTERFACE "-L${CMAKE_CURRENT_LIST_DIR}/controller/lib/esp32s3")
target_link_libraries(${COMPONENT_LIB} INTERFACE
"-L${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32s3")
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app btbb)
endif()
endif()

Some files were not shown because too many files have changed in this diff Show More