Commit Graph

247 Commits

Author SHA1 Message Date
Ivan Grokhotkov
24c20d188e 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-01-06 15:20:04 +01:00
Cao Sen Miao
d397464fc4 spi_flash: refactor spi_flash.h to esp_rom_spiflash.h but keep the content in spi_flash.h 2021-12-30 14:12:31 +08:00
morris
8e220f7bbe esp_rom: add README to describe the component layout 2021-12-30 14:05:12 +08:00
Cao Sen Miao
b0decda1e3 bootloader: move bootloader flash support to isolate folders 2021-12-30 14:05:12 +08:00
Cao Sen Miao
3a4db97cec spi_flash: move patch files to common rom patch folder 2021-12-30 14:05:12 +08:00
Cao Sen Miao
3dd1cfea18 spi_flash: refactor spi_flash.h to decline duplicated code 2021-12-30 14:05:12 +08:00
Simon
1c82e6eac7 Merge branch 'ci/8684_build_ci' into 'master'
CI: Enable ESP8684 build (2nd stage) CI on master (except example build)

Closes IDF-4388

See merge request espressif/esp-idf!16197
2021-12-14 11:12:10 +00:00
Jiang Jiang Jian
e3137693c1 Merge branch 'bugfix/fix_rx_fragment_error_issue' into 'master'
esp_wifi: fix fragment issue and PMF compatible for faulty APs

Closes WIFI-4218

See merge request espressif/esp-idf!16321
2021-12-13 12:32:33 +00:00
Cao Sen Miao
e81841318f CI: Enable ESP8684 build stage CI on master 2021-12-13 19:18:47 +08:00
Cao Sen Miao
463cf2cf1c ESP8684: Clean up ESP8684 code, remove useless code, update headers 2021-12-09 18:36:39 +08:00
Ivan Grokhotkov
c358aceb1b Merge branch 'feature/soc_caps_build_sys' into 'master'
build-system: parse soc caps and integrate into kconfig

Closes IDF-2223

See merge request espressif/esp-idf!15305
2021-12-09 06:54:08 +00:00
muhaidong
832123a5e1 esp_wifi: fix fragment plt loss and update header file
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
2021-12-08 19:39:14 +08:00
Marius Vikhammer
c6d60615c6 build-system: include soc_caps defines into kconfig
Adds gen_soc_caps_kconfig.py which parses the soc caps (soc_caps.h) into
a format that can be included in kconfig.
2021-12-06 12:37:07 +08:00
muhaidong
f9b2cb6f11 esp_wifi:compute packet length use lldesc length instead of rx_ctl sig_len in sniffer mode 2021-12-01 21:07:32 +08:00
Mahavir Jain
b9b55bc32b Merge branch 'contrib/github_pr_7971' into 'master'
bugfix: Conflicting declaration error when include<rom/secure_boot.h>

Closes IDFGH-6308

See merge request espressif/esp-idf!16202
2021-12-01 11:59:20 +00:00
Mahavir Jain
f667b1039b Fix copyright headers for few include files 2021-11-30 22:25:33 +05:30
lovyan03
cb91b51c52 bugfix: Conflicting declaration error with include<esp_efuse.h>, and Unified secure_boot.h include guard to "pragma once". 2021-11-30 15:46:49 +09:00
laokaiyao
f21020ce04 esp32h2: update reg and struct for beta2 2021-11-24 12:34:17 +08:00
wuzhenghui
388615add0 update esp32h2beta2 chip_id to 14 2021-11-24 12:30:43 +08:00
wuzhenghui
968c42d88c 822 FPGA rnv init 2021-11-24 12:30:17 +08:00
laokaiyao
b9a84b96ce esp32h2: add support for beta2 2021-11-24 12:30:17 +08:00
Roland Dobai
766aa57084 Build & config: Remove leftover files from the unsupported "make" build system 2021-11-11 15:32:36 +01:00
Cao Sen Miao
bf6fa70812 ESP8684: update bootloader, bootloader_support, esp_rom 2021-11-06 17:33:44 +08:00
Li Shuai
e8188e5d8f ci: replacing old header with new SPDX header style 2021-10-20 11:36:23 +08:00
Li Shuai
881e1b0fd5 deep sleep: add deep sleep support for esp32s3 2021-10-20 11:36:20 +08:00
Kapil Gupta
797c7144bd esp_wifi: Add support for GCMP and GMAC ciphers 2021-10-12 20:48:51 +08:00
Jiang Jiang Jian
3b48b7e663 Merge branch 'Fix/update_reset_reason' into 'master'
update reset reason for c3/s3/h2

See merge request espressif/esp-idf!14747
2021-09-18 07:03:50 +00:00
boarchuz
cda459672a 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-09-15 14:51:35 +08:00
wanglei
c3abbe3866 cache: Update cache.h and autoload api 2021-09-02 02:27:40 +08:00
SalimTerryLi
23e23b697c
rom/tjpgd: unify library & add rom patch
remove external tjpgd library inside example

enable tjpgd decoding on all chips
2021-09-01 14:42:17 +08:00
Mahavir Jain
d9fdb9dc3f 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-27 14:33:05 +05:30
Sachin Parekh
2d82560ed5 bootloader: Enable Secure boot V2 for ESP32-S3 2021-08-19 14:08:12 +05:30
wuzhenghui
f913a10a22 update reset reason for c3/s3/h2 2021-08-13 17:45:53 +08:00
Jakob Hasse
7029f0537e [build system]: Fixed common requirement for Linux 2021-08-13 16:50:29 +08:00
Jiang Jiang Jian
6e1f8a68b9 Merge branch 'feature/support_esp32s3_wifi_lightsleep' into 'master'
support esp32s3 wifi lightsleep

Closes IDF-1781

See merge request espressif/esp-idf!14569
2021-08-06 12:51:46 +00:00
Sachin Parekh
41973b761e 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-08-05 11:09:22 +05:30
Li Shuai
d73a09cd8b light sleep: add wifi mac sleep support for esp32s3 2021-08-04 21:58:33 +08:00
Jakob Hasse
4dd88329c1 [esp_rom]: Partially buildable for linux
The following files have been ported:
* esp_rom_crc.h
* esp_rom_sys.h
* esp_rom_efuse.h (mostly no-ops)
* esp_rom_md5.h

Integrated Linux-based rom implementation into log
and NVS component.

Added brief host tests for ROM to ensure basic
consistency on Linux.

Added ROM printf host unit tests.

Temporarily added reset reason for Linux in ROM.
2021-08-03 12:03:24 +08:00
Song Ruo Jing
5d82d7c6ee Merge branch 'typo_fix/fix-length-typo' into 'master'
docs: Fix length typo

Closes IDFGH-5272

See merge request espressif/esp-idf!14371
2021-08-02 09:35:15 +00:00
ChenJianxing
9e7d75cb95 esp_wifi: fix some wifi bugs
1. support config 80211 tx rate
2. fix 80211 tx crash issue
3. disable ampdu+amsdu bit
2021-07-31 18:02:20 +08:00
Ato Araki
aea865b360 Fix length typo
Closes https://github.com/espressif/esp-idf/pull/7037
2021-07-29 14:44:43 +08:00
Cao Sen Miao
c29b3e2e36 spi_flash: move the unlock patch to bootloader and add support for GD 2021-07-29 10:46:33 +08:00
Ivan Grokhotkov
7534c4467f rom, spi_flash: add a patch for esp_flash_erase_region for C3, S3, H2 2021-07-24 13:28:25 +02:00
morris
1560d6f1ba soc: add reset reasons in soc component 2021-07-13 10:45:38 +08:00
chenjianxing
564068d5af esp_wifi: support esp32s3 wifi and fix not tx 9M rate issue 2021-07-06 11:38:40 +08:00
Shu Chen
ee23a489b9 esp32h2: code clean up 2021-07-01 19:53:50 +08:00
Shu Chen
37f4cb8b4b esp32h2: add rom code for esp32h2 2021-07-01 19:53:11 +08:00
Angus Gratton
57fa883127 esp32s3: Remove APB frequency RTC register
Usage of this register changed between ESP32-S3 beta2 and the
final chip.
2021-06-29 17:38:46 +10:00
Michael (XIAO Xufeng)
afc2bc94b3 Merge branch 'feature/add_opi_flash_psram_support' into 'master'
spi flash: opi flash psram support and spi timing tuning  support on 727

Closes IDF-3097

See merge request espressif/esp-idf!12946
2021-06-28 01:59:19 +00:00
Armando
bc248278f8 spiflash: add octal spi psram support on 727 2021-06-25 19:41:57 +08:00
Jiang Jiang Jian
dd1352dec3 Merge branch 'bugfix/fix_amsdu_fragment_vulnerability' into 'master'
esp_wifi: fix amsdu & fragment vulnerabilities

Closes WIFI-3700 and WIFI-3733

See merge request espressif/esp-idf!13719
2021-06-22 13:00:42 +00:00
Ivan Grokhotkov
bdb01b8285 Merge branch 'bugfix/longjmp_s3' into 'master'
[esp_rom]: fixed S3 longjmp patch

Closes IDF-3391

See merge request espressif/esp-idf!13946
2021-06-22 04:00:51 +00:00
Jakob Hasse
e32831033a [esp_rom]: fixed S3 longjmp patch
* On S3, the placement of ROM functions is
  ECO-dependent. Hence, we don't jump into
  the middle of the longjmp function in ROM
  on S3 anymore.
  Instead, the whole longjump function is used
  in the patch.

* Also properly excluded the patch from
  bootloader build with Makefiles

Closes IDF-3391
2021-06-18 15:47:41 +08:00
Cao Sen Miao
f2fe0847d5 usb_serial_jtag: add initial support for S3 (including flashing, monitoring, writing, and reading) but console is not avaliable now 2021-06-18 12:42:41 +08:00
ChenJianxing
ef127ab9dd esp_wifi: fix amsdu & fragment vulnerabilities 2021-06-17 10:11:33 +08:00
Marius Vikhammer
f124536948 system: add support for reset reason hint on S3 2021-06-15 13:39:51 +08:00
Marius Vikhammer
79b5dedeb1 CI: minor testcases fixes and disable some cases that cant run on S3 2021-06-15 13:39:48 +08:00
Angus Gratton
bc4eb2071c Merge branch 'feature/toolchain_2021r1' into 'master'
Bring 2021r1 toolchains

Closes IDFGH-5009

See merge request espressif/esp-idf!13554
2021-06-09 05:06:23 +00:00
Anton Maklakov
b46b50eaa6 newlib: Add ESP_ROM_HAS_RETARGETABLE_LOCKING capability for C3 and S3 chips 2021-06-07 12:53:45 +07:00
Marius Vikhammer
19a492bc8d soc: add base support for ESP32-S3
Updates the following with changes from verification branches:

 * esp_rom linker files
 * rtc_cntl and system reg and struct headers

Also updates:
 * GDMA driver with new register layout
 * esptool submodule commit
2021-06-07 10:40:14 +08:00
liaowenhao
6bd7f30199 bugfix/fix crash when lmp flooding 2021-05-24 12:08:03 +08:00
Angus Gratton
9235754d4c esp_rom: Allow passing any type of data pointer to md5, remove unchecked size on digest pointer 2021-05-18 01:32:59 +00:00
Angus Gratton
ede477ea65 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-18 01:32:59 +00:00
Cao Sen Miao
8c5819dccb usb_serial_jtag: fix the bug that cannot write with usb_jtag 2021-05-13 13:40:01 +08:00
Michael (XIAO Xufeng)
a0d13a31ec uart: fix misleading files for UART2
Includes: header files, ld files and clk.c

ESP32-C3 only have UART0 and UART1.
2021-04-27 17:40:19 +08:00
Jakob Hasse
fc22e3c645 [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-04-23 15:55:31 +08:00
ChenJianxing
dd14e97375 esp_wifi: support esp32s3 beta3 wifi 2021-04-16 00:38:20 +08:00
Marius Vikhammer
b4d2fb56a0 ci: enable previously disabled unit tests 2021-03-29 18:36:41 +08:00
alex.li
55cbb541fc Support new section addr and wifi lib for ESP32C3-ECO3. 2021-03-29 10:27:10 +08:00
Marius Vikhammer
2aead8ba57 Support ESP32S3 Beta 3 target
Update ROM API. Port changes from bringup branch.
2021-03-18 10:24:22 +08:00
Angus Gratton
6a29b45bd4 secure boot v2: Fix issue checking multiple signature blocks on OTA update 2021-03-15 12:30:20 +00:00
KonstantinKondrashov
95564b4687 secure_boot: Secure Boot V2 verify app signature on update (without Secure boot)
- ESP32 ECO3, ESP32-S2/C3/S3
2021-03-15 12:30:20 +00:00
ChenJianxing
0a8ba88145 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-25 10:21:46 +00:00
dongyou
059ffa6daf change rom function for esp32c3 to fix eb lldesc size issue 2021-02-24 17:45:07 +08:00
morris
bf2480f62d efuse: can disable boot ROM log from Kconfig 2021-02-22 20:56:43 +08:00
morris
0f5d1c1c46 rtc: supported disable rom log temporarily 2021-02-22 20:56:43 +08:00
Angus Gratton
49c442b12f Merge branch 'feature/efuse_update_description' into 'master'
efuse: Updates description of uart_print_control efuse

Closes IDF-2705

See merge request espressif/esp-idf!12236
2021-02-09 11:02:26 +08:00
Xia Xiaotian
b71481093a esp_wifi: fix some Wi-Fi scan and coexist bugs
1. Fix the bug that Wi-Fi performance is impacted by BLE starting scan for a while in some scenarios on ESP32-C3.

2. Fix the bug that Wi-Fi performance is impacted when Bluetooth change state for a while in some scenarios on ESP32-C3.

3. Fix the bug that BLE performance is impacted by Wi-Fi scan on ESP32-C3.

4. Fix the bug that Wi-Fi scan fails when BLE is scanning on ESP32-C3.

5. Fix Wi-Fi ACK and CTS rate when low rate is disabled on ESP32-C3.
2021-02-08 21:20:09 +08:00
KonstantinKondrashov
43ebb8ea61 efuse: Updates description of uart_print_control efuse 2021-02-08 18:02:55 +08:00
Jiang Jiang Jian
d1cc9e98b7 Merge branch 'bugfix/fix_wifi_connect_fail' into 'master'
WiFi: fix the bug that wifi connect fail for ESP32C3

See merge request espressif/esp-idf!12308
2021-02-06 02:35:43 +08:00
Jack
2859c7ebd1 fix the bug that wifi connect fail 2021-02-06 00:12:37 +08:00
Cao Sen Miao
c1b41ece32 flash_encryption: Quick fixed the issue that block when flash_encryption_write, Related https://github.com/espressif/esp-idf/issues/6322, Related https://github.com/espressif/esp-idf/issues/6254 2021-02-05 20:10:42 +08:00
Jiang Jiang Jian
28faf93c51 Merge branch 'feature/esp32c3_power_down' into 'master'
esp32c3 : power down MAC and BB only if both Wi-Fi and BT power down

Closes FC3-99

See merge request espressif/esp-idf!12076
2021-01-28 23:27:19 +08:00
baohongde
eef66789d4 Mac BB power down in light sleep
components/bt: Do not use feature: timer support isr dispatch method

disable controller after wake up finished.

protect critical section of power down

choose clk in sleep

components/coex: mac bb power down in light sleep

components/coex: Macro changed

components/os: protect reserved interrupt number

update phy to phy_version 300,6e46ba7,Jan 25 2021

some bugfix
2021-01-28 22:28:04 +08:00
Ivan Grokhotkov
9a20283485 Merge branch 'bugfix/scan_test_missing_build_apps_without_tests' into 'master'
ci: bugfix: scan_test missing build apps without tests

See merge request espressif/esp-idf!12138
2021-01-28 17:48:24 +08:00
wangmengyang
51be1af028 add coexist hook functions and fix bugs for coexistence 2021-01-27 06:37:04 +00:00
Fu Hanxi
e4e375f488 fix: add spi_flash.h for s2, s3, c3 targets in cpu_start.c
update s2, s3, c3 ld files spi_flash_attach to esp_rom_spiflash_attach
2021-01-27 12:35:49 +08:00
Angus Gratton
fe8a891de9 Merge branch 'feature/support_esp32c3_master_cmake_secure_boot' into 'master'
bootloader/esp32c3: Support secure boot

Closes IDF-2115

See merge request espressif/esp-idf!11797
2021-01-21 08:42:49 +08:00
Li Shuai
27ddbf5fcc light sleep: libphy optimization for esp32c3 2021-01-20 13:28:30 +08:00
KonstantinKondrashov
98f726fa4b bootloader/esp32c3: Adds secure boot (not yet supported) 2021-01-19 20:51:13 +08:00
zwj
7c1c669799 component/bt: add BLE v5.0 feature for bluedroid host 2021-01-15 17:55:12 +08:00
Chen Jian Xing
5b44295cb9 esp_wifi: fix esp32c3 code issues
1. enable wifi clk and rm dport header
2.syn phy_init_data.h from esp32
2021-01-10 16:16:28 +08:00
Ivan Grokhotkov
b7b9ea4361 newlib: add _RETARGETABLE_LOCKING support
This adds support for the retargetable locking implementation in
newlib 3. This feature will be enabled in the future toolchain builds.
With the present version of the toolchain, this code doesn't get used.

When _RETARGETABLE_LOCKING gets enabled, newlib locking implementation
will be modified as follows:

- Legacy ESP-specific _lock_xxx functions are preserved. This is done
  because ROM copies of newlib in ESP32 and ESP32-S2 rely on these
  functions through the function pointer table. Also there is some
  code in IDF which still uses these locking functions.

- New __retarget_lock_xxx functions are introduced. Newlib expects
  these functions to be provided by the system. These functions work
  pretty much the same way as the ESP-specific _lock_xxx functions,
  except one major difference: _lock_acquire receives the lock pointer
  by value, and as such doesn't support lazy initialization.

- Static locks used by newlib are now explicitly initialized at
  startup. Since it is unlikely that these static locks are used at
  the same time, all compatible locks are set to point to the same
  mutex. This saves a bit of RAM. Note that there are still many locks
  not initialized statically, in particular those inside FILE
  structures.
2020-12-29 16:18:04 +01:00
Marius Vikhammer
4ff8c7ae98 esp_rom/esp_system: Add flag for ROM multiple UART output, esp32c3 console
From internal commit 6d894813
2020-12-24 14:18:01 +11:00
Angus Gratton
a5aac93051 esp_rom: Small changes for esp32c3 support
Updated from internal commit 6d894813
2020-12-24 13:40:01 +11:00
Angus Gratton
8929a9cdb1 Merge branch 'feature/aes_hal' into 'master'
AES: refactor and add HAL layer

See merge request espressif/esp-idf!10979
2020-12-11 15:39:49 +08:00
morris
c39476d699 esp_rom: added esp_rom_install_uart_printf 2020-12-11 11:45:10 +08:00
Marius Vikhammer
457ce080ae AES: refactor and add HAL layer
Refactor the AES driver and add HAL, LL and caps.

Add better support for running AES-GCM fully in hardware.
2020-12-10 09:04:47 +00:00
Angus Gratton
076be2b480 esp_rom: Refactor ROM CMakeLists.txt file
Reduce duplication and use a utility function for the "add ROM linker script"
pattern, move to a simple file structure of "one if block per target"
2020-11-30 15:23:15 +11:00
Angus Gratton
b68094199f esp_rom: Add initial ESP32-C3 support
From internal commit 7761d6e8
2020-11-30 11:12:56 +11:00