Commit Graph

596 Commits

Author SHA1 Message Date
Ivan Grokhotkov
c28612cd2b Merge branch 'bugfix/freertos_coproc_save_area_alignment' into 'master'
freertos: Apply upstream stack masking fix for xtensa/port.c (Github PR)

Closes IDFGH-5549

See merge request espressif/esp-idf!14379
2021-07-20 09:00:04 +00:00
Renz Bagaporo
7c22cccb9c esp32: cleanup build script 2021-07-16 20:14:27 +08:00
Axel Lin
6c2aa59b51 freertos: Apply upstream stack masking fix for xtensa/port.c
Link: 6a5784598a (diff-cfa9a8b71a9665b5610f59bd2f56cb81b3ee73beaa6cac3fc965884069588d47)
Signed-off-by: Axel Lin <axel.lin@gmail.com>

Merges https://github.com/espressif/esp-idf/pull/7274
2021-07-15 11:55:41 +02:00
Jakob Hasse
f6031d469b [cxx]: No ##__VA_ARGS__ in public header files
* ##__VA_ARGS__ is replaced by __VA_OPT__(,)
  and __VA_ARGS if C++20 is used.
* Affected header files are: esp_log.h,
  portmacro.h and esp_check.h

* Closes https://github.com/espressif/esp-idf/pull/6692
2021-07-15 17:05:57 +08:00
Vladimir Chistyakov
1d74652b5e Fix portGET_ARGUMENT_COUNT macro
portGET_ARGUMENT_COUNT uses a GCC extension ##__VA_ARGS__. It forces
the user to compile the code with GNU extensions enabled instead of ISO
language standard. The suggested change is to replace ##__VA_ARGS__ with
__VA_OPT__(,) __VA_ARGS__ which is supported by the current version of
GCC used in ESP-IDF for both C and C++ ISO standards.

This fix would enable ESP-IDF users to compile their code with ISO C++20
standard in future releases.

Signed-off-by: Jakob Hasse <jakob.hasse@espressif.com>
2021-07-15 17:01:31 +08:00
Shu Chen
ee23a489b9 esp32h2: code clean up 2021-07-01 19:53:50 +08:00
Shu Chen
6fce2930d0 esp32h2: enable more components to support esp32h2
Involved components:
 * app_trace
 * esp-tls
 * esp_adc_cal
 * esp_pm
 * esp_serial_slave_link
 * esp_timer
 * freertos
 * idf_test
 * log
 * mbedtls
 * newlib
 * perfmon
 * spi_flash
 * spiffs
 * ulp
 * unity
 * vfs
2021-07-01 19:53:11 +08:00
Angus Gratton
a413cbd784 Merge branch 'feature/esp_timer_with_skip_unhandled_events_does_not_wake_up' into 'master'
esp_timer: A timer with skip_unhandled_events won't wake up in light sleep mode

See merge request espressif/esp-idf!13219
2021-06-29 08:10:51 +00:00
Ivan Grokhotkov
d7928bf1db Merge branch 'feature/esp32c3_apptrace' into 'master'
apptrace: refactoring & esp32c3 support

See merge request espressif/esp-idf!11702
2021-06-28 06:00:24 +00:00
Alexey Gerenkov
20fd09728f apptrace: Adds ESP32-C3 support 2021-06-24 13:16:14 +03:00
Alexey Gerenkov
821869d98d apptrace: Refactors apptrace for better support various tracing HW 2021-06-24 13:16:13 +03:00
Fu Hanxi
cb46558c30 ci: update performance test key to db compatible format 2021-06-21 14:17:45 +08:00
KonstantinKondrashov
f9ad16bb66 esp_timer: Timers with skip_unhandled_events option won't wake up system from light sleep 2021-06-19 12:45:17 +08:00
Angus Gratton
dc6b950257 doc: Add performance guides for execuion speed, binary size, RAM usage
Closes https://github.com/espressif/esp-idf/issues/7007
Closes https://github.com/espressif/esp-idf/issues/6715
Closes https://github.com/espressif/esp-idf/issues/3781
Closes https://github.com/espressif/esp-idf/issues/2566
2021-06-03 13:55:34 +10:00
Ivan Grokhotkov
38d902f544 Merge branch 'feature/gdbstubs_rt' into 'master'
Extension of GDBStub component for handling GDB by serial port at runtime.

See merge request espressif/esp-idf!10312
2021-05-18 17:14:51 +00:00
Omar Chebib
dda7001c25 freertos: revert minimum stack size from 2304 to 1536 2021-05-14 11:12:28 +08:00
Dmitry
00a7ecb5a3 Code cleanup. Bugfix after rebase with master. Formating. 2021-05-13 15:03:40 +03:00
Angus Gratton
e02439f2de freertos: Add addition overflow check for stream buffer
Patch from upstream commit d05b9c123f2bf9090bce386a244fc934ae44db5b
2021-05-04 16:55:40 +10:00
Angus Gratton
b41d4b0a9c freertos: Check for arithmetic overflows on queue creation
Addition overflow check is from FreeRTOS kernel commit 47338393f1f79558f6144213409f09f81d7c4837
2021-05-04 16:55:20 +10:00
Angus Gratton
96c2acd9a8 Merge branch 'refactor/strip_systimer_hal_layer' into 'master'
refactor HAL driver of systimer to a common systimer_hal

Closes IDF-2996

See merge request espressif/esp-idf!13027
2021-04-23 07:45:31 +00:00
Ivan Grokhotkov
cfdfeed973 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-04-22 17:14:46 +02:00
morris
ec898b771e systimer: strip hal driver 2021-04-22 21:08:39 +08:00
Ivan Grokhotkov
0535195983 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-04-21 13:45:21 +02:00
Angus Gratton
c7328f1cc0 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 14:46:49 +10:00
Angus Gratton
191e649257 freertos: Add some comments about deleting tasks when using SMP
Some cases are not immediately obvious, so document them in comments.
2021-04-13 03:40:10 +00:00
Angus Gratton
f7b859ac84 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-13 03:40:10 +00:00
Angus Gratton
db7d272873 freertos: Add unit test for deleting task which may be blocking 2021-04-13 03:40:10 +00:00
Angus Gratton
94ac251091 Merge branch 'doc/general_notes' into 'master'
doc: Update docs about startup sequence and memory types

Closes IDF-2321, IDF-2409, and IDFGH-1540

See merge request espressif/esp-idf!12636
2021-04-05 23:51:25 +00:00
Angus Gratton
37acd13cdd doc: Add notes that vTaskStartScheduler() is called during startup
Closes https://github.com/espressif/esp-idf/issues/1457
2021-03-31 09:37:28 +11:00
Renz Bagaporo
8d32232899 esp_system: check early for single core variant 2021-03-29 06:50:47 +00:00
Angus Gratton
11e2620acc freertos docs: Specify that uxTaskGetStackHighWaterMark() returns bytes not words
As reported https://esp32.com/viewtopic.php?f=13&t=20043&p=73732
2021-03-25 00:08:24 +00:00
Angus Gratton
9122e530be Merge branch 'refactor/freertosconfig_h' into 'master'
freertos: common config header

Closes IDF-2389

See merge request espressif/esp-idf!12485
2021-03-22 09:04:41 +00:00
Angus Gratton
1581744c10 Merge branch 'feature/main_task_affinity_pr6627' into 'master'
Allow selection of different core for main task

Closes IDFGH-4828

See merge request espressif/esp-idf!12654
2021-03-22 06:46:24 +00:00
Renz Bagaporo
021cce3f56 freertos: formatting fixes for config file 2021-03-22 13:35:49 +08:00
Renz Bagaporo
39cf818838 freertos: common config header 2021-03-22 12:19:03 +08:00
Angus Gratton
fd164b82b6 Merge branch 'refactor/move_from_xtensa' into 'master'
Movements from xtensa

Closes IDF-2164

See merge request espressif/esp-idf!10556
2021-03-11 00:24:25 +00:00
0xFEEDC0DE64
6928db7670 Allow selection of different core for main task
Closes https://github.com/espressif/esp-idf/pull/6627
2021-03-09 10:13:28 +11:00
Angus Gratton
ef0bbc5baa 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-03-04 17:57:55 +11:00
Angus Gratton
9c73b80ee0 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-03-04 17:44:36 +11:00
Angus Gratton
3ddfe1e8ac Merge branch 'bugfix/asserts_disabled' into 'master'
core: Fix assert path embedding, warnings when asserts are disabled

Closes IDFGH-4477

See merge request espressif/esp-idf!12371
2021-03-03 08:20:54 +00:00
Angus Gratton
c786ba9186 Merge branch 'feature/re-enable_suspend_test_esp32c3' into 'master'
freertos: Workaround delay between interrupt request and trigger on RISC-V

Closes IDF-2588 and IDF-2226

See merge request espressif/esp-idf!12350
2021-03-03 03:41:05 +00:00
Angus Gratton
61b70c50a4 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-03-03 10:26:57 +11:00
Angus Gratton
d6f4d99d93 core system: Fix warnings in compilation when assertions are disabled
Adds a CI config for hello world that sets this, to catch future regressions
2021-03-03 10:26:57 +11:00
Renz Bagaporo
0f03f450ff esp_hw_support: create esp_cpu
Create a esp_cpu header that contains CPU-related functions and
utilities.
2021-02-26 13:34:29 +08:00
Wang Fang
776684fa84 docs: provide the link to pcb layout for ethernet board v1.2 and fix a typo in freetos/task 2021-02-26 10:35:21 +08:00
Omar Chebib
78a94dbb6c 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-02-25 06:57:59 +00:00
Marius Vikhammer
311a0fa5e8 freertos: add API for getting tick rate on C3 2021-02-23 12:05:52 +08:00
Marius Vikhammer
c36dd7834f 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-02-19 11:26:21 +08:00
Marius Vikhammer
eec2419390 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-18 15:38:30 +08:00
Marius Vikhammer
d294ac381f freertos: fix errors reported by PVS-Studio
Removed leftover code-paths that were never taken. Upstream freertos uses
vTaskSuspendAll() and xTaskResumeAll(), and therefor check if the task already
yielded.

In the IDF port of freertos we use critcal sections instead, so xAlreadyYielded
will never be set.

Partially addresses https://github.com/espressif/esp-idf/issues/6440
2021-02-11 03:15:04 +00:00