Commit Graph

957 Commits

Author SHA1 Message Date
Angus Gratton
466ad65cf4 Merge branch 'bugfix/usb_console_critical_section' into 'master'
esp_system: fix incorrect critical section usage in usb_console

Closes IDF-2049

See merge request espressif/esp-idf!10826
2020-10-15 10:36:57 +08:00
Felipe Neves
dfa2d547a7 freertos: pin timer task in core 0 plus fixed in SMP race conditions
freertos: replace the freertos regular malloc to the specific malloc from xtensa port for tcb and stack allocations

freertos: avoid the cpu1 to unwind pended ticks when xTaskResumeAll is called insed of an ISR

freertos: protected the xPortGetCoreID functions with missing critical sections

tests: re-eanble the ignored tests that was failling before race-condition fixes
2020-10-14 16:11:49 +11:00
Felipe Neves
656b706ea4 freertos: added core-ID member to task status structure aloowing its tracing.
Closes https://github.com/espressif/esp-idf/issues/5763
2020-10-14 16:11:39 +11:00
Felipe Neves
f3783ba258 app_trace/sysview: fixed freertos tracing calling plus sync apptrace component with the master branch version
docs: remove reference to backported features in freertos 10 api-reference.
2020-10-13 23:52:03 +00:00
Ivan Grokhotkov
4dc1195ca5 esp_system: fix incorrect critical section usage in usb_console
spinlock_acquire does not disable interrupts, whereas
portENTER_CRITICAL does.

Closes IDF-2049
2020-10-13 17:39:31 +02:00
Angus Gratton
ff8d05466e Merge branch 'bugfix/deep_sleep_stub_heap_rtc_fast_mem' into 'master'
deep sleep: Calculate RTC CRC without using any stack or other RTC heap memory

Closes IDF-2242

See merge request espressif/esp-idf!10741
2020-10-13 06:17:50 +08:00
Angus Gratton
562ab01046 deep sleep: Calculate RTC CRC immediately before deep sleep, without using RAM
Fix for issues where RTC FAST memory is updated as part of going into deep
sleep. Very high risk if heaps are in RTC memory - in particular task stacks
may be in RTC memory, but also other variables.

Also fixes potential concurrency problems as RTC FAST memory is not accessible
by CPU during the CRC calculation itself.

Method:
- Disable interrupts (currently for single core only, will need update for S3)
- Load all registers before calculating CRC or going to sleep
2020-10-12 11:19:56 +11:00
Martin Vychodil
497b730e8f * memprot support for RTC_SLOW
* API upgrade
JIRA IDF-1636
2020-10-08 11:19:23 +08:00
Angus Gratton
e28cd68839 esp_system: Add test case for using deep sleep wake stub when stack is in RTC memory
This test currently fails on ESP32 & ESP32-S2, fix will be in next commit.
2020-10-08 11:17:27 +11:00
KonstantinKondrashov
7ae7adf16a newlib: Fix clock_getres() improves accuracy
Returns not rounded value of resolution for WITH_RTC and !WITH_FRC
2020-10-07 18:01:35 +08:00
Mahavir Jain
20af94ff53 Coredump config option rename throughout IDF 2020-09-30 20:22:27 +05:30
Mahavir Jain
bd19088125 esp_system: initialize coredump for ESP32-S2
This was regression introduced in recent refactoring changes
from startup code.
2020-09-30 20:22:27 +05:30
Felipe Neves
2e826b7a8f intr_alloc: split interrupt allocator into common-code and platform-code
esp_system: removed repeated interrupt allocator code and moved common code to esp_system

xtens: moved xtensa specific code from freertos to the xtensa component

hal/interrupt_controller: added interrupt controller hal and ll files

docs: update the doxyfile with new location of esp_itr_alloc.h file

xtensa: fixed dangerous relocation problem after moving xtensa interrupt files out of freertos

docs: removed Xtensa reference from intr_allocator api-reference

xtensa: pushed the interrupt function that manages non iram interrupts to the xtensa layer

esp_system/test: fixed platform dependent setting for intr_allocator tests

hal: rename the functions used to manage non iram interrupt mask.
2020-09-30 07:44:12 +08:00
Renz Bagaporo
fb749440fd esp_pm: create pm init function 2020-09-25 05:24:10 +00:00
Renz Bagaporo
6462f9bfe1 esp32, esp32s2: create esp_pm component 2020-09-25 05:24:10 +00:00
Jiang Jiang Jian
e093eb064c Merge branch 'feature/run_esp32c3_code_on_esp32_and_esp32s2' into 'master'
Feature/run esp32c3 code on esp32 and esp32s2

See merge request espressif/esp-idf!10213
2020-09-24 13:27:47 +08:00
Xia Xiaotian
bdbe74693f esp_wifi: refactor wifi code in order to adapter to new chips 2020-09-24 10:15:50 +08:00
jiangguangming
28145e0894 support flash instr and rodata copy to SPIRAM 2020-09-22 15:15:03 +08:00
morris
61f89b97c6 bringup esp32-s3 on FPGA 2020-09-22 15:15:03 +08:00
chenjianqiang
f19cabb7e4 psram: support psram for esp32s3 2020-09-22 15:15:03 +08:00
morris
6225932201 bootloader_support: add esp32-s3 initial support 2020-09-22 15:15:03 +08:00
Felipe Neves
e8a276d641 esp_system: revert the esp_system_abort to the IRAM section 2020-09-18 22:18:30 -03:00
Michael (XIAO Xufeng)
3c283b490a Merge branch 'feature/async_memcpy' into 'master'
async_mcp: support async memory copy on esp32s2 and esp32s3

See merge request espressif/esp-idf!10242
2020-09-17 16:54:28 +08:00
morris
a3cc43485f async memcpy: support async memcopy on esp32s2/s3
Added async memory copy API:
on esp32-s2, the implementation is based on CP_DMA
on esp32-s3, the implementation is based on GDMA
2020-09-16 21:30:54 +08:00
Felipe Neves
e67162a7ea startup: namespaced start_app and start_app_other_core to avoid user code collision 2020-09-15 16:05:19 -03:00
Felipe Neves
a1e5dd58b2 startup: moved init core functions out of iram memory 2020-09-15 16:02:12 -03:00
Michael (XIAO Xufeng)
1a1e1911f9 Merge branch 'bugfix/spi_dma_close_before_cpu_reset' into 'master'
spi: fix issue with closing DMA before CPU reset

Closes FCS-484

See merge request espressif/esp-idf!9844
2020-09-14 23:02:05 +08:00
Ivan Grokhotkov
77afbd51ae sleep: fix esp32 light sleep duration
Commit aa43ed8 was fixing the light sleep overhead calculation for
ESP32-S2. However it also changed the overhead values for ESP32,
resulting in incorrect light sleep time. This caused regression in
light sleep example test.

Revert the original values for the ESP32, keep different set of values
for each chip.
2020-09-09 23:34:54 +02:00
ninh
aa43ed8bb8 fix reboot or crash when enable lightsleep on esp32s2 2020-09-07 15:38:00 +08:00
Ivan Grokhotkov
9d3add538b Merge branch 'feature/toolchain_2020r3' into 'master'
Update toolchain to esp-2020r3

See merge request espressif/esp-idf!10250
2020-09-04 14:07:24 +08:00
Anton Maklakov
f63bbc169e toolchain: fix the C++ exception workaround for new toolchains that don't have such hook 2020-09-03 13:50:54 +07:00
Mahavir Jain
7f5b6d1843 Merge branch 'bugfix/time_spinlock' into 'master'
newlib: revert back from spinlocks to using newlib locks for time.h

Closes IDFGH-3858

See merge request espressif/esp-idf!10130
2020-09-03 12:34:29 +08:00
Marius Vikhammer
6fb996b1ac newlib: revert back from spinlocks to using newlib locks for time.h
Spinlocks from spinlock.h do not disable the scheduler and thus cannot safely
be directly used as a locking mechanism. A task holding the lock can get
pre-empted, and at that point the new running task will also be allowed to
take the spinlock and access whatever it was protecting.

Another issue is that the task holding a spinlock could migrate to a different
core which in turn would cause the application to fail asserts. The current
implementation assumes the core that takes the lock is also the core that
releases it.

Closes https://github.com/espressif/esp-idf/issues/5762
2020-09-03 09:56:02 +08:00
Michael (XIAO Xufeng)
9e7eda9770 Merge branch 'feat/spi_flash_override_size' into 'master'
spi_flash: add config option to override flash size in bootloader header

See merge request espressif/esp-idf!10131
2020-09-03 02:57:31 +08:00
Michael (XIAO Xufeng)
37423083bb spi_flash: add config option to override flash size in bootloader header
Sometimes the flash size read from bootloader is not correct. This may
forbid SPI Flash driver from reading the the area larger than the size
in bootloader header.

When the new config option is enabled, the latest configured
ESPTOOLPY_FLAHSIZE in the app header will be used to override the value
read from bootloader header.
2020-09-02 00:35:53 +08:00
KonstantinKondrashov
b1e667cdcc esp_system: Disable UTs for ESP32-S2 linked to sleep mode
- disable source trigger behavior
- light sleep followed by deep sleep
- wake up from light sleep using timer
2020-09-01 17:10:28 +08:00
me-no-dev
0aa1c13027 Fix USB CLK always reset and USB with swapped pins not working 2020-08-25 10:59:59 +03:00
Armando
aa93347972 spi: remove spi4 related macros and codes 2020-08-17 21:32:15 +08:00
Renz Bagaporo
3f6e366f56 esp_system: force RTC_SLEEP_PD_XTAL on ESP32 via get pdflags
Based on the original code (`esp32/sleep_modes.c`), `RTC_SLEEP_PD_XTAL`
is always given as an argument to `esp_sleep_start`. Enforce this in
function to get power down flags to avoid redundancy.
2020-08-17 19:09:24 +08:00
Renz Bagaporo
0db3edd490 esp32: move sleep test to esp_system 2020-08-17 19:09:24 +08:00
Renz Bagaporo
fe65bf00b1 esp_system: use ext0, ext1, ulp wakeup prepare hal 2020-08-17 19:09:24 +08:00
Renz Bagaporo
4f5135030f esp_system: remove register level operations for timer wakeup 2020-08-17 19:09:24 +08:00
Renz Bagaporo
b30522f701 esp32, esp32s2: move sleep modes code to esp_system 2020-08-17 19:09:23 +08:00
Angus Gratton
62c4b569ad Merge branch 'refactor/timekeeping_init' into 'master'
Timekeeping refactor

Closes IDF-1864

See merge request espressif/esp-idf!7824
2020-08-17 08:13:44 +08:00
liu zhifu
6ed4dd65a4 esp_wifi: optimize WiFi debug log
1. Add esp_wifi_statis_dump()
2. Optimize WiFi related debug log
2020-08-15 11:35:10 +08:00
Angus Gratton
1a47f025e9 Merge branch 'bugfix/cpu_start_build' into 'master'
esp_system: fix bootloader wdt enabled build issue

Closes IDFGH-3717

See merge request espressif/esp-idf!9816
2020-08-13 16:52:31 +08:00
Renz Bagaporo
c70c227591 esp_system: private system time functions for now 2020-08-11 17:52:36 +08:00
Renz Bagaporo
da88671491 esp_system: link time, not runtime, dependency on esp_timer 2020-08-11 17:52:36 +08:00
Renz Bagaporo
346cf4430d esp_system: introduce system time functions
- Introduce system time function and concept of system time provider.
esp_timer is system time provider when present.
- Set the reference point for system time, g_startup_time.
- Use the system time functions in newlib instead of calling esp_timer
functions directly
2020-08-10 15:12:38 +08:00
Renz Bagaporo
5785e4dfb6 newlib: move some functions to soc, esp32, esp32s2 2020-08-10 15:11:38 +08:00
Ivan Grokhotkov
5ff9cd495e panic: skip over the first invalid PC in case of InstrFetchProhibited
InstrFetchProhibited usually occurs because of a jump to an invalid
pointer. In this case, PC in the exception frame is the address of
the jump destination. 'esp_ptr_executable' check in print_backtrace
function recognizes the first frame as invalid, and the backtrace is
interrupted. This prevents the user from finding the location where
the invalid pointer is dereferenced.

Bypass the 'esp_ptr_executable' check if the exception cause is
InstrFetchProhibited. Update the test case to no longer ignore this
issue.
2020-08-05 12:00:50 +02:00
Renz Bagaporo
43af455457 esp_system: fix bootloader wdt enabled build issue
Closes https://github.com/espressif/esp-idf/issues/5643
2020-08-05 10:39:12 +08:00
Jiang Jiang Jian
d1f9a238f3 Merge branch 'bugfix/sys_fix_build_error_about_livelock' into 'master'
components/sys: Fix build error about livelock when intwdt is disable

See merge request espressif/esp-idf!9312
2020-07-31 16:43:22 +08:00
Angus Gratton
75402afcae Merge branch 'feature/esp32s3_clk_memory_layout' into 'master'
esp32s3: memory layout

See merge request espressif/esp-idf!9753
2020-07-29 13:48:25 +08:00
Ivan Grokhotkov
8ac56e904b Merge branch 'bugfix/coredump_esp_panic_reason' into 'master'
Coredump ESP panic reason

See merge request espressif/esp-idf!9072
2020-07-28 23:49:10 +08:00
Ivan Grokhotkov
16c73edc67 Merge branch 'refactor/add_alias_name_for_ets_common_api' into 'master'
esp_rom: extract common ets apis into esp_rom_sys.h

See merge request espressif/esp-idf!9701
2020-07-28 15:04:55 +08:00
Alexey Gerenkov
21091c6b0e coredump: Fixes ESP-specific panic reasons handling 2020-07-27 21:38:33 +03:00
morris
2917651478 esp_rom: extract common ets apis into esp_rom_sys.h 2020-07-27 15:27:01 +08:00
morris
19761e3113 esp32s3: clk, memory layout 2020-07-27 13:05:22 +08:00
baohongde
acb835d86f components/sys: Fix build error about livelock when intwdt is disable 2020-07-23 02:21:32 +00:00
Renz Bagaporo
837052c86f esp_system: restore deleted no stack check flag
Restores the change of startup refactor changes removed the no stack
check protection flag when compiling the source file that contains
execution of constructors - which contains function to setup stack
guard. Restore that and update the source file, since this is in the 2nd
stage of the startup now.

Closes https://github.com/espressif/esp-idf/issues/5617
2020-07-22 11:57:18 +08:00
Angus Gratton
442736c5d6 Merge branch 'refactor/common_rom_uart_apis' into 'master'
esp_rom: extract common uart apis into esp_rom_uart.h

See merge request espressif/esp-idf!9313
2020-07-21 15:24:21 +08:00
Angus Gratton
3755fb6597 Merge branch 'feature/add_esp32s3_bootloader_ld_file' into 'master'
move part of esp32-s3 codes to master (bootloader linker, esp32s3 empty componnet)

See merge request espressif/esp-idf!9608
2020-07-21 14:51:04 +08:00
Angus Gratton
5c58564f90 Merge branch 'feature/support_for_esp32_pico_v3_02' into 'master'
psram: support for esp32-pico-v3-02

See merge request espressif/esp-idf!9405
2020-07-21 13:28:26 +08:00
chenjianqiang
bff6b5b70e bugfix(psram): configure MMU after PSRAM initialization 2020-07-20 12:21:32 +08:00
morris
d066c3ab2c esp_system: add panic high interrupt handler for esp32s3 2020-07-20 11:15:24 +08:00
morris
6316e6eba2 esp_system: add CONFIG_ESP_SYSTEM_RTC_EXT_CRYS 2020-07-20 11:15:24 +08:00
Ivan Grokhotkov
c943516c96 esp_system: fix compilation error when security features are enabled
affects CONFIG_SECURE_DISABLE_ROM_DL_MODE, CONFIG_SECURE_ENABLE_SECURE_ROM_DL_MODE
2020-07-17 21:04:08 +02:00
morris
345606e7f3 esp_rom: extract common uart apis into esp_rom_uart.h 2020-07-17 16:00:59 +08:00
morris
458b14a8ea esp_rom: extract common efuse apis into esp_rom_efuse.h 2020-07-15 10:40:50 +08:00
Angus Gratton
24e49cc21d Merge branch 'refactor/panic_handler_follow_ups' into 'master'
Panic handler follow ups

See merge request espressif/esp-idf!7732
2020-07-15 08:21:09 +08:00
Shubham Kulkarni
d4ce5de16e Include header file soc/cpu.h in memprot.c and system_api.c
This fixes build issues with Vanilla FreeRTOS
2020-07-10 13:56:42 +05:30
Renz Christian Bagaporo
08ad0f8194 esp_system: remove usage of CONFIG_FREERTOS_UNICORE from panic handler 2020-07-06 15:33:56 +08:00
xiehang
8b523efc6f esp_wifi: Add API to get available internal heap size. 2020-06-30 21:51:00 +08:00
Darian Leung
97721d469c TWAI: Add ESP32-S2 support
This commit adds TWAI driver support for the
ESP32-S2. The following features were added:

- Expanded BRP support
- Expanded CLKOUT Divider Support
- Updated example READMEs
2020-06-30 16:56:03 +08:00
Ivan Grokhotkov
45fff86e05 Merge branch 'feature/usb_console_ig' into 'master'
add USB CDC as a console option

Closes IDF-1620

See merge request espressif/esp-idf!8459
2020-06-29 05:16:15 +08:00
Ivan Grokhotkov
e94848556b esp32, esp32s2: update console initialization 2020-06-26 15:38:49 +02:00
Ivan Grokhotkov
34f441249b esp32s2: add internal usb_console API 2020-06-26 15:38:49 +02:00
Jakob Hasse
f4c2f680f7 toolchain: C++ exception workarounds
* enable C++ exception crash workaround
* disable C++ crash workaround

Closes https://github.com/espressif/esp-idf/issues/5360
Closes IDF-1128
Closes IDF-1301
Closes IDF-1804
2020-06-24 17:55:35 +08:00
Renz Bagaporo
98f4ccaef5 esp_system: fix other core init issue
Core 1 was not being stopped when in single core mode resulting to GDB
timing out.
2020-06-19 18:40:10 +10:00
Renz Bagaporo
98dc1b0188 esp_system: introduce intermediary function to call after system init
This MR uses an intermediary function `start_app` to call after system
initialization instead of `app_main`.

In RTOS builds, freertos provides `start_app` and calls `app_main`.
In non-RTOS builds, user provides `start_app` directly.
2020-06-19 18:40:10 +10:00
Renz Bagaporo
08cbfa6187 esp_system: fix various review issues 2020-06-19 18:40:10 +10:00
Renz Christian Bagaporo
67983d5c1c esp_system: restore order of some init functions 2020-06-19 18:40:10 +10:00
Renz Christian Bagaporo
4d094eccca esp_system: move brownout init due to dependency issue 2020-06-19 18:40:10 +10:00
Renz Christian Bagaporo
ef2a44d251 esp_system: introduce single core mode proxy config 2020-06-19 18:40:10 +10:00
Renz Christian Bagaporo
c53ad56515 esp_system: startup flow modifications
Changes the startup flow to the ff:

hardware -> core libraries init  -> other libraries init -> os
init (optional) -> app_main

- hardware init resides in the port layer, and is the entry point

- core libraries init executes init functions of core components

- other libraries init executes init functions of other components (weak
references)

- after other lib is init, the app_main function is called, however,

 an OS can wrap the real call to app_main to init its own stuff, and
 *then* call the real app_main
2020-06-19 18:40:09 +10:00
Renz Christian Bagaporo
0f43a2620d esp_system: component init functions macro
Allows components to declare initialization function, such that the
startup code does not have direct dependency on the component.
2020-06-19 18:40:09 +10:00
Renz Bagaporo
bb5535ca5d esp32, esp32s2: move startup code into esp_system 2020-06-19 18:40:09 +10:00
Renz Christian Bagaporo
62ef63e835 esp32, esp32s2: move clk init functions to esp_system 2020-06-19 18:40:09 +10:00
Jiang Jiang Jian
c3e6689777 Merge branch 'bugfix/customer_baidu_int_wdt_master' into 'master'
system: add soft solution for esp32 eco3 live lock issue

See merge request espressif/esp-idf!8968
2020-06-17 11:53:25 +08:00
morris
067b1b91c2 global: add new target name: esp32-s3
add target name, chip ID, toochain descriptions for ESP32-S3
2020-06-11 21:40:08 +08:00
Li Shuai
72f583dfa7 add soft solution for esp32 eco3 live lock issue 2020-06-05 06:04:18 +00:00
Sachin Parekh
46d914ff45 gdb: Modify PC in case of invalid PC
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2020-05-08 18:34:52 +05:30
Ivan Grokhotkov
c5f664d4ac esp_system: remove duplicated esp_digital_reset function
esp_digital_reset was defined both in system_api.c and panic_handler.c
2020-05-04 10:13:14 +00:00
Ivan Grokhotkov
8bdfb265a4 panic handler: fix cache error handling 2020-05-04 10:13:14 +00:00
Ivan Grokhotkov
0a389b1764 esp_system: restore weak esp_reset_reason functions 2020-05-04 10:13:14 +00:00
Renz Bagaporo
5abb4f6455 esp_system, esp_common: fixes to some panic handler refactor issues 2020-04-24 16:34:15 +08:00
Martin Vychodil
7491ea677a esp32s2: IRAM/DRAM memory protection
* new mem_prot API
* mem_prot on & locked by default (see Kconfig)
* feature activated in start_cpu0_default()

JIRA IDF-1355
2020-04-21 15:10:58 +02:00
David Cermak
06c46837ce panic: ignore deliberate null dereference to pass static analysis 2020-03-27 19:18:40 +01:00
Darian Leung
91841a53ff WDT: Add LL and HAL for watchdog timers
This commit updates the watchdog timers (MWDT and RWDT)
in the following ways:

- Add seprate LL for MWDT and RWDT.
- Add a combined WDT HAL for all Watchdog Timers
- Update int_wdt.c and task_wdt.c to use WDT HAL
- Remove most dependencies on LL or direct register access
  in other components. They will now use the WDT HAL
- Update use of watchdogs (including RTC WDT) in bootloader and
  startup code to use the HAL layer.
2020-03-26 02:14:02 +08:00
Renz Bagaporo
ee519634a5 esp_system: retain backtrace no space 2020-03-10 19:56:24 +08:00
Renz Bagaporo
7cc8cb68bd esp_system: suppress reason display on software abort panic 2020-03-10 19:56:24 +08:00
Renz Bagaporo
890510aecd esp32, esp32s2: move reset reason source to esp_system 2020-03-10 19:56:24 +08:00
Renz Christian Bagaporo
29ebfc3f46 esp_system: let panic handler break on debug mode on software abort 2020-03-10 19:56:24 +08:00
Renz Christian Bagaporo
af9b1131a3 esp_system: share abort panic with port layer 2020-03-10 19:56:24 +08:00
Renz Christian Bagaporo
2855bb6f0a newlib: move abort to newlib 2020-03-10 19:56:24 +08:00
Renz Christian Bagaporo
2b100789b7 esp32, esp32s2: move panic handling code to new component 2020-03-10 19:56:24 +08:00