Commit graph

117 commits

Author SHA1 Message Date
Michael Balzer e97f72ea24 Merge remote-tracking branch 'upstream/release/v3.3'
# Conflicts:
#	.gitlab-ci.yml
#	components/bootloader/project_include.cmake
#	components/bootloader_support/include/bootloader_common.h
#	components/bootloader_support/src/bootloader_common.c
#	components/bt/Kconfig
#	components/bt/bluedroid/btc/profile/std/include/btc_gap_ble.h
#	components/bt/bluedroid/stack/btm/btm_ble_gap.c
#	components/bt/bluedroid/stack/btm/btm_devctl.c
#	components/bt/bluedroid/stack/include/stack/hcidefs.h
#	components/bt/bluedroid/stack/smp/smp_act.c
#	components/bt/bt.c
#	components/bt/lib
#	components/driver/Kconfig
#	components/driver/include/driver/rmt.h
#	components/driver/test/test_spi_master.c
#	components/driver/uart.c
#	components/esp32/CMakeLists.txt
#	components/esp32/Kconfig
#	components/esp32/ld/esp32.project.ld.in
#	components/esp32/ld/esp32.spiram.rom-functions-dram.ld
#	components/esp32/ld/esp32.spiram.rom-functions-iram.ld
#	components/esp32/lib
#	components/esp32/spiram.c
#	components/esp32/spiram_psram.c
#	components/esp32/test/test_wifi.c
#	components/esp32/wifi_init.c
#	components/esp_http_server/include/esp_http_server.h
#	components/esp_http_server/src/esp_httpd_priv.h
#	components/esp_http_server/src/httpd_parse.c
#	components/esp_http_server/src/httpd_sess.c
#	components/esp_http_server/src/httpd_txrx.c
#	components/esp_http_server/src/httpd_uri.c
#	components/esp_http_server/test/test_http_server.c
#	components/esp_https_ota/src/esp_https_ota.c
#	components/ethernet/emac_main.c
#	components/freemodbus/Kconfig
#	components/idf_test/include/idf_performance.h
#	components/idf_test/integration_test/TC_IT_BLUEDROID_SMP.yml
#	components/lwip/Kconfig
#	components/newlib/test/test_time.c
#	components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py
#	components/spi_flash/Kconfig
#	components/ulp/cmake/CMakeLists.txt
#	components/ulp/component_ulp_common.cmake
#	components/vfs/vfs.c
#	docs/conf_common.py
#	docs/en/api-reference/provisioning/wifi_provisioning.rst
#	examples/mesh/internal_communication/main/Kconfig.projbuild
#	examples/protocols/aws_iot/subscribe_publish/main/CMakeLists.txt
#	examples/protocols/aws_iot/thing_shadow/main/CMakeLists.txt
#	examples/protocols/coap_client/README.md
#	examples/protocols/coap_server/README.md
#	examples/protocols/modbus_slave/main/Kconfig.projbuild
#	examples/protocols/mqtt/ssl/mqtt_ssl_example_test.py
#	examples/protocols/mqtt/tcp/main/Kconfig.projbuild
#	examples/protocols/mqtt/ws/mqtt_ws_example_test.py
#	examples/protocols/mqtt/wss/mqtt_wss_example_test.py
#	examples/wifi/iperf/components/iperf/iperf.c
#	requirements.txt
#	tools/ci/build_examples.sh
#	tools/ci/test_build_system_cmake.sh
#	tools/cmake/idf_functions.cmake
#	tools/cmake/kconfig.cmake
#	tools/cmake/scripts/expand_requirements.cmake
#	tools/esp_prov/README.md
#	tools/esp_prov/esp_prov.py
#	tools/esp_prov/transport/ble_cli.py
#	tools/idf.py
#	tools/kconfig_new/confgen.py
#	tools/mass_mfg/docs/README.rst
#	tools/mass_mfg/samples/sample_config.csv
#	tools/tiny-test-fw/DUT.py
#	tools/tiny-test-fw/IDF/IDFApp.py
#	tools/tiny-test-fw/IDF/IDFDUT.py
#	tools/tiny-test-fw/TinyFW.py
#	tools/unit-test-app/tools/UnitTestParser.py
#	tools/unit-test-app/unit_test.py
2019-07-20 22:11:10 +02:00
Michael Balzer 40f01ec30a Merge remote-tracking branch 'upstream/release/v3.2' 2019-07-20 15:22:14 +02:00
Konstantin Kondrashov 0be4deeb22 freertos: Fix xTaskIncrementTick for unwind the Tick for CPU1
xTaskIncrementTick have to unwind uxPendedTicks on CPU1 and CPU0.

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

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

Closes: IDF-183
2019-06-07 09:54:03 +00:00
Ivan Grokhotkov 8eb40bea51 freertos: pass TCB rather than the array to trace functions 2018-11-28 12:26:34 +08:00
Ivan Grokhotkov 3b3242cbae freertos: use xTaskQueueMutex to protect tick count
Having two different spinlocks is problematic due to possibly
different order in which the locks will be taken. Changing the order
would require significant restructuring of kernel code which is
undesirable.

An additional place where taking xTickCountMutex was needed was in
vApplicationSleep function. Not taking xTickCountMutex resulted in
other CPU sometimes possibly advancing tick count while light sleep
entry/exit was happening. Taking xTickCountMutex in addition to
xTaskQueueMutex has shown a problem that in different code paths,
these two spinlocks could be taken in different order, leading to
(unlikely, but possible) deadlocks.
2018-11-21 03:42:15 +00:00
Ivan Grokhotkov a10abd695b freertos: fix compilation warning in single core mode
When tickless idle is enabled
2018-11-21 03:42:15 +00:00
Ivan Grokhotkov 28f1e1597b Merge branch 'bugfix/tickless_idle_single_core' into 'master'
freertos, pm: fix tickless idle not entered in single core mode

See merge request idf/esp-idf!3584
2018-11-06 12:15:03 +08:00
Ivan Grokhotkov ae08bdcc31 freertos: fix compilation warning in single core mode
When tickless idle is enabled
2018-11-05 12:18:29 +08:00
Ivan Grokhotkov b7841ec313 freertos: use xTaskQueueMutex to protect tick count
Having two different spinlocks is problematic due to possibly
different order in which the locks will be taken. Changing the order
would require significant restructuring of kernel code which is
undesirable.

An additional place where taking xTickCountMutex was needed was in
vApplicationSleep function. Not taking xTickCountMutex resulted in
other CPU sometimes possibly advancing tick count while light sleep
entry/exit was happening. Taking xTickCountMutex in addition to
xTaskQueueMutex has shown a problem that in different code paths,
these two spinlocks could be taken in different order, leading to
(unlikely, but possible) deadlocks.
2018-11-05 03:08:26 +00:00
Jakob Löw f2fbfeca87 Merge branch 'master' of github.com:espressif/esp-idf 2018-10-20 23:32:01 +02:00
Mahavir Jain ff81dc16e0 freertos: cleanup tick/idle hook functionality
If CONFIG_FREERTOS_LEGACY_HOOKS is kept enabled then defining
idle/tick hooks will be applications responsibility as was the
case earlier.

Signed-off-by: Mahavir Jain <mahavir@espressif.com>
2018-09-17 17:05:17 +05:30
Darian Leung 977619f23c freertos: Add core ID to idle task names
This commit adds the core number to the name of each idle task.
2018-09-03 13:50:05 +08:00
Ivan Grokhotkov cffaa9f5b5 freertos: add configTASKLIST_INCLUDE_COREID 2018-07-17 10:57:26 +00:00
Dave McNaughton 0fb1945482 Added: display xCoreID in vTaskList
Merges https://github.com/espressif/esp-idf/pull/2064
2018-07-17 10:57:26 +00:00
Michael Balzer 0fb2019f2b Merge remote-tracking branch 'upstream/master' 2018-07-06 20:45:32 +02:00
Ivan Grokhotkov 028fbb58e8 freertos,esp32: automatic light sleep support 2018-05-18 03:14:46 +00:00
Michael Balzer 9d8e44e0f0 Merge branch 'master' of https://github.com/espressif/esp-idf 2018-05-11 08:47:18 +02:00
Mahavir Jain c65a08d2fb freertos: portCLEAN_UP_TCB should be performed before freeing tcb memory
Signed-off-by: Mahavir Jain <mahavir@espressif.com>
2018-04-19 18:28:55 +05:30
Stephen Casner 7f6161cd25 Fix stack size returned by uxTaskGetSystemState()
This code used to work, but as part of the toolchain update it looks
like there must have been a compiler change affecting the relative
precedence of '|=' and '-'.  Add parentheses to make the order
explicit.
2018-02-23 23:58:52 -08:00
Stephen Casner 59bc8ff062 Temporarily add poisoning header typedef
This is to be replaced an alternate way to obtain the stack block size
by calling one or more multi_heap helper functions.
2018-01-10 17:15:13 -08:00
Stephen Casner ae5a434f76 Return stack block size and current free space in TaskStatus
For some reason, the pxStackBase member is not set in the TaskStatus_t
struct as returned by uxTaskGetSystemState(), so we are expanding its
function by returning the total size of the stack block in the high 16
bits and the current amount of free stack space in the low 16 bits.
2018-01-10 12:51:11 -08:00
Darian Leung c41c02872f freertos: prvCheckTasksWaitingTermination bugfix
Bugfix to prevent a self deleting no affinity task's memory from being freed by the
idle task of the other core before the self deleting no affinity task is able to context
switch out.  prvCheckTasksWaitingTermination now checks if the task is still on
pxCurrentTCB before freeing task memory.
2017-12-26 19:03:49 +08:00
Darian Leung 38afa32cfb freertos/fix SMP bug with Idle task clean up
This commit backports vTaskDelete() behavior from FreeRTOS v9.0.0  which
allows for the immediate freeing of task memory if the task being deleted
is not currently running and not pinned to the other core. This commit also
fixes a bug in prvCheckTasksWaitingTermination which prevented the
Idle Task from cleaning up all tasks awaiting deletion. Each iteration of the Idle
Task should traverse the xTasksWaitingTermination list and clean up all tasks
not pinned to the other core. The previous implementation would cause
prvCheckTasksWaitingTermination to return when encountering a task
pinned to the other core whilst traversing the xTasksWaitingTermination list.

The test case for vTaskDelete() has been updated to test for the bugfix and
backported deletion behavior.
2017-12-05 18:13:56 +08:00
Krzysztof Bociurko 969911b7c2 freertos: enabled use of pxTaskGetStackStart and cleaned up it's implementation
Merges #1298
2017-11-22 11:01:42 +08:00
Darian Leung d1853dbbc0 FreeRTOS/make Queue Registry and Run Time Stats configurable
This commit makes the configQUEUE_REGISTRY_SIZE and
configGENERATE_RUN_TIME_STATS configurable in menuconfig.

- configQUEUE_REGISTRY_SIZE can now be set in menuconfig.
- The functions vQueueAddToRegistry() and vQueueUnregisterQueue() were made
  SMP compatbile
- pcQueueGetName() was backported from FreeRTOS v9.0.0
- Added test case for Queue Registry functions

- configGENERATE_RUN_TIME_STATS can now be enabled in menuconfig. CCOUNT or
  esp_timer can be selected as the FreeRTOS run time clock in menuconfig as
  well, although CCOUNT will overflow quickly.
- Run time stats collection (in vTaskSwitchContext) and generation (in
  uxTaskGetSystemState) have been made SMP compatible. Therefore
  vTaskGetRunTimeStats() now displays the run time usage of each task as a
  percentage of total runtime of both CPUs

Squash
2017-11-14 15:50:31 +08:00
Ivan Grokhotkov a45e9c806d Merge branch 'bugfix/new_task_watchdog_API_false_trigger' into 'master'
feat/New Task Watchdog API

See merge request !1380
2017-11-07 10:43:56 +08:00
Darian Leung 637ba2e8bb freertos: Test untested functions
Test cases were added for the following functions
- xTaskNotify(), xTaskNotifyGive(), xTaskNotifyFromISR(), vTaskNotifyGiveFromISR(),
- xTaskNotifyWait(), ulTaskNotifyTake()
- vTaskDelayUntil()

The following function was made smp compatible and tested as well
- eTaskGetState()
2017-11-06 15:31:01 +08:00
Darian Leung 9d63e1da4a New Task Watchdog API (Revert of Revert)
This commit reverts the revert on the new task watchdog API. It also
fixes the following bug which caused the reversion.

- sdkconfig TASK_WDT_TIMEOUT_S has been reverted from the unit of ms back to the
unit of seconds. Fixes bug where projects using the new API without rebuilding sdkconfig
would cause the old default value of 5 to be interpreted in ms.

This commit also adds the following features to the task watchdog

- Updated idle hook registration to be compatible with dual core hooks

- Updated dual core hooks to support deregistration for cpu

- Legacy mode has been removed and esp_task_wdt_feed() is now replaced by
  esp_task_wdt_reset().  esp_task_wdt_feed() is deprecated

- Idle hooks to reset are now registered/deregistered when the idle tasks are
  added/deleted from the Task Watchdog instead of at Task Watchdog init/deinit

- Updated example
2017-11-02 16:47:51 +08:00
Darian Leung a6854b72cd freertos/make trace facility configurable
This commit makes configUSE_TRACE_FACILITY and
configUSE_STATS_FORMATTING_FUNCTIONS configurable in kconfig. Test cases fro the
functions enabled by the two configurations above have also been added.

Test cases for the following functions have been added...

- uxTaskGetSystemState()
- uxTaskGetTaskNumber()
- vTaskSetTaskNumber()

- xEventGroupClearBitsFromISR()
- xEventGroupSetBitsFromISR()
- uxEventGroupGetNumber()

- uxQueueGetQueueNumber()
- vQueueSetQueueNumber()
- ucQueueGetQueueType()

Test cases for the following functions were not required...

- prvListTaskWithinSingleList()
- prvWriteNameToBuffer()
- vTaskList()
2017-10-20 15:17:17 +08:00
Angus Gratton 3234064b6a freertos: Idle task shouldn't hold xTaskQueueMutex while calling TLS destructors
If the callbacks use any blocking call (ie printf), this can otherwise trigger a deadlock.
2017-10-17 14:31:58 +08:00
Ivan Grokhotkov 468d90762a Merge branch 'bugfix/freertos_portmux_debug' into 'master'
freertos: fix compilation errors with portMUX debugging enabled

See merge request !1392
2017-10-17 04:44:04 +08:00
Ivan Grokhotkov 715d081341 freertos: fix compilation errors with portMUX debugging enabled
Fixes https://github.com/espressif/esp-idf/issues/1057

Ref TW15702.
2017-10-13 08:33:57 +08:00
Angus Gratton 353e81da63 freertos: Also test (& handle) the case where scheduler is disabled on other CPU...
ie CPU A has scheduler disabled and task blocked on Q. CPU B sends to Q (or gives mutex, etc.) Task on CPU A should be woken on scheduler resume.
2017-10-11 10:48:20 +11:00
Angus Gratton 3e62c2e052 freertos: When scheduler is disabled, tasks on other core should immediately resume
... if triggered by a SemaphoreGive/etc.

Previously they would resume after scheduler was resumed, on next
RTOS tick of other CPU.
2017-10-11 10:48:20 +11:00
Angus Gratton f2f9170abc freertos: Fix bug with xTaskResumeAll() not resuming all tasks
Previously if multiple tasks had been added to xPendingReadyList for the CPU, only the first one was resumed.

Includes a test case for resuming multiple (pending) tasks on xTaskResumeAll().

Document the limitation that while scheduler is suspended on one CPU, it can't wake tasks on either CPU.
2017-10-11 10:48:20 +11:00
Jeroen Domburg b6a2bd1184 Revert "esp32: New Task Watchdog API"
This reverts commit 616baa239d.
2017-09-30 18:07:19 +08:00
Darian Leung 616baa239d esp32: New Task Watchdog API
Legacy API of task watchdog used the same function esp_task_wdt_feed() to add
and feed a task. This caused issues of implicitly adding a task to the wdt list
if the function was used in shared code.

The new API introduces init, adding, feeding, deleting, deinit functions. Tasks
must now be explicitly added to the task watchdog using their handles. Deletion
must also be explicit using task handles. This resolves the issue of implicit
task additions to the task watchdog due to shared code calling
esp_task_wdt_feed().

Task watchdog is now fully configurable at runtime by calling the init and
deinit functions.

Also added functions to get the handles of idle tasks of the other core. This
helps when adding idle tasks to the watchdog at run time.

Configuring the task watchdog using menu config is still available, however
menu config will only result in calling the init and add functions for idle
tasks shortly after the scheduler starts.

Menu config also allows for using legacy behavior, however the legacy behavior
willcall the new API functions but with slight variations to make them legacy
compatible.

Documentation and example have also been updated

gcov_rtio.c headers updated to prevent error of freertos header files being
included in the wrong order.

Resolves issue TW#13265
2017-09-29 23:10:55 +08:00
Jeroen Domburg 740f8a79f0 Add logic to make external RAM usable with malloc() 2017-09-28 17:17:50 +08:00
Alexey Gerenkov 4e0c3a0415 esp32: Fixes crash during core dump.
Removes piece of debugging code introduced by 8d43859b.
2017-09-11 17:20:42 +03:00
Alexey Gerenkov 20942421c3 According to review comments 2017-09-06 10:30:23 +08:00
Alexey Gerenkov c631c6b358 1) Mux API was added
2) C++ test for threading and mux functions
2017-09-06 10:30:23 +08:00
Angus Gratton 4486d4cb10 portmux: Add vPortCPUAcquireMutexTimeout() function
Refactor app_trace locking to use this function.
2017-09-04 19:11:51 +10:00
Angus Gratton 5c996a1b29 freertos: Inline vPortCPUAcquireMutex/vPortCPUReleaseMutex into implementations
Further improves performance:
No contention -> 134 cycles
Recursion -> 117 cycles
Contention -> 323 cycles
2017-09-04 19:11:51 +10:00
Angus Gratton 4d42b2d100 freertos spinlock/portmux: Reduce spinlocking overhead
Ref TW7117

Microbenchmarks in unit tests:

(All numbers in cycles per benchmarked operation):

Release mode
No lock contention lock/unlock -       301 -> 167 (-45%)
Recursive no contention lock/unlock -  289 -> 148 (-49%)
Lock contention two CPUs (lock/unlock) 699 -> 400 (-43%)

Debug mode
No lock contention lock/unlock -       355 -> 203 (-43%)
Recursive no contention lock/unlock -  345 -> 188 (-46%)
Lock contention two CPUs (lock/unlock) 761 -> 483 (-36%)
2017-09-04 19:11:51 +10:00
Angus Gratton 3ad163e644 freertos: Bump idle stack size to 1KB, min stack to 768 bytes, make configurable
Reverts regression mentioned at
3fe0022efa (commitcomment-23013504)
2017-07-11 14:48:15 +08:00
Alexey Gerenkov 8d43859b6a esp32: SEGGER SystemView Tracing Support
Implements support for system level traces compatible with SEGGER
SystemView tool on top of ESP32 application tracing module.
That kind of traces can help to analyse program's behaviour.
SystemView can show timeline of tasks/ISRs execution, context switches,
statistics related to the CPUs' load distribution etc.

Also this commit adds useful feature to ESP32 application tracing module:
 - Trace data buffering is implemented to handle temporary peaks of events load
2017-06-27 20:52:43 +03:00
Ivan Grokhotkov 7ed8c66547 Merge branch 'bugfix/uxTaskGetSystemState_github_#12142' into 'master'
Bugfix for uxTaskGetSystemState

See merge request !883
2017-06-20 17:27:08 +08:00
Darian Leung 1c798b0eab BugFix: uxTaskGetSystemState test case update
Updated test case to include configASSERT cases (+1 squashed commits)

Squashed commits:

[871ec26f] Freertos:Bugfix uxTaskGetSystemState

Bug (github #12142) with uxTaskGetSystemState where
if called immediately after creating a bunch of tasks,
those tasks would be added twice into the TaskStatusArray.
Bug caused due to use old implementation using vTaskSuspendAll
which did not stop newly created task on other core from accessing the
read/waiting task lists whilst the list were being read by
uxTaskGetSystemState. Fixed bug by replacing vTaskSuspendAll
with taskENTER_CRITICAL and added test case for the bugfix
2017-06-16 16:00:54 +08:00
Jiang Jiang Jian 9a6b1c3b11 Merge branch 'bugfix/always_disable_ints_in_critical_region' into 'master'
Always disable interrupts in a critical region

See merge request !821
2017-06-16 11:36:27 +08:00
Angus Gratton 8bf675786a Merge branch 'feature/freertos_get_priority' into 'master'
freertos: Mark uxTaskPriorityGet() as tested, add SMP task priority unit tests

See merge request !794
2017-06-14 08:31:00 +08:00