Commit graph

112 commits

Author SHA1 Message Date
Ivan Grokhotkov cda22d9aaf docs: add FreeRTOS API docs
- Use `code` tags instead of a mix of `<pre></pre>` and
  `@verbatim .. @endverbatim`
- Remove manually added function prototypes from comment blocks
- Remove of grouping (`\defgroup`) — some extra work is needed
  to make groups compatible with the way we auto-generate API
  reference from Doxygen XML files. It's pretty easy to add the
  grouping directives back if/when we implement support for
  Doxygen groups in the later stages of documentation build
  process.
- Hide private APIs under `@cond .. @endcond`
- Convert some comments into Doxygen-compatible ones
- Fix various documentation issues: missing documentation for
  some parameters, mismatch between parameter names in comment
  block and in function prototype.
- Add doxygen comments for functions which didn't have them
  (thread local storage).
- Add [out] param tags where necessary
- Redefine `xTaskCreate` and `xTaskCreateStatic` as inline
  functions instead of macros.
2017-12-07 12:01:14 +08:00
Ivan Grokhotkov 9e530fd063 Merge branch 'bugfix/allow_external_stack' into 'master'
freertos: fix a bug for incorrect check of allow-external-stack

See merge request !1596
2017-11-27 16:31:27 +08:00
Kedar Sovani e7743d090d freertos: fix a bug for incorrect check of allow-external-stack 2017-11-24 09:53:47 +05:30
Angus Gratton 02304ad83e Merge branch 'feature/freertos_backported_functions' into 'master'
freertos/backport and test v9.0.0 functions

See merge request !1515
2017-11-24 08:49:59 +08:00
Darian Leung c1d101dd41 freertos/backport and test v9.0.0 functions
This commit backports the following features from FreeRTOS v9.0.0
- uxSemaphoreGetCount()
- vTimerSetTimerId(), xTimerGetPeriod(), xTimerGetExpiryTime()
- xTimerCreateStatic()
- xEventGroupCreateStatic()
- uxSemaphoreGetCount()

Functions backported previously
- xTaskCreateStatic()
- xQueueCreateStatic()
- xSemaphoreCreateBinaryStatic(), xSemaphoreCreateCountingStatic()
- xSemaphoreCreateMutexStatic(), xSemaphoreCreateRecursiveMutexStatic()
- pcQueueGetName()
- vTaskSetThreadLocalStoragePointer()
- pvTaskGetThreadLocalStoragePointer()

Unit tests were also written for the functions above (except for pcQueueGetName
which is tested in a separate Queue Registry MR). The original tlsp and del cb test case
was deleted and integrated into the test cases of this MR.
2017-11-23 14:18:09 +08:00
Ivan Grokhotkov 597ce3b800 Merge branch 'bugfix/ringbuf_buflen_bugfix' into 'master'
Bugfix/ringbuf buflen bugfix

See merge request !1562
2017-11-22 22:30:11 +08:00
Ivan Grokhotkov cf47012111 Merge branch 'feature/prs_from_github' into 'master'
PRs from Github

See merge request !1578
2017-11-22 22:26:40 +08:00
Ivan Grokhotkov 5fe91ae7cd Merge branch 'bugfix/cpp_guards' into 'master'
Add C++ guards to freertos/ringbuf.h, heap headers

See merge request !1552
2017-11-22 22:26:26 +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
Adrián Paníček 0b48d5978e ringbuf.h: Add anti name-mangling definition
When using CPP and C combination this particular file threw error on linking.

Merges https://github.com/espressif/esp-idf/pull/1249

(Amended to add INC_FREERTOS_H guard, comment on #endif)
2017-11-22 10:08:15 +11:00
Piyush Shah 7dd9c4f57f ringbuf: Fixes to header files for better understanding
1. Usage of this module required applications to include additional
files. What files to include is not very intuitive. Instead, it is
better for the header file itself to include other files as required.
2. Even though it may seem logical, it is better to explicitly mention
that an item needs to be "Returned" after a Receive

Signed-off-by: Piyush Shah <piyush@espressif.com>
2017-11-21 17:16:04 +05:30
Krzysztof Bociurko 4da90f09e7 freertos: minor issue in documentation snippet of queue.
taskYIELD was used in ISR context, but portYIELD_FROM_ISR should instead.

Merges https://github.com/espressif/esp-idf/pull/1187
2017-11-17 10:44:19 +11: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 5f9ac5fadb Merge branch 'doc/freertos_port_comments' into 'master'
freertos: Update comments in "port" section (portMUX/etc)

See merge request !1431
2017-11-07 19:31:21 +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
Ivan Grokhotkov 59b7d98fec Merge branch 'feature/dfs' into 'master'
Dynamic frequency scaling

See merge request !1189
2017-10-22 12:34:11 +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 b10e1a92b6 freertos: Update comments in "port" section (portMUX/etc)
Some comments had fallen out of date.
2017-10-20 11:17:44 +08:00
Ivan Grokhotkov 373d85dd9f freertos: fix error when including xtensa-timer.h from other components 2017-10-18 14:37:22 +08:00
Ivan Grokhotkov bfeecd2b56 freertos: deprecate XT_CLOCK_FREQ
- freertos: add deprecated definition for XT_CLOCK_FREQ
- flash_ops: don't use XT_CLOCK_FREQ
- unity: don't use XT_CLOCK_FREQ
- hw_random: don't use XT_CLOCK_FREQ
- core_dump: don't use XT_CLOCK_FREQ
- app_trace: don't use XT_CLOCK_FREQ
- xtensa_init: init xt_tick_divisor
2017-10-18 14:19:19 +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 ca7485cc9a freertos: Remove "stop program on scheduler start when JTAG/OCD is detected" option
No longer used with new dual core target & JTAG instructions.
2017-10-13 10:54:02 +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
Angus Gratton 1c7b8aa3a5 Heap tracing support 2017-09-07 16:32:05 +10: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 db58a2732b freertos: vPortCPUReleaseMutex() no longer returns a value
Unlocking a never-locked mutex is an assertion failure in debug mode.

In release mode, this further improves performance:
No-Contention ->  153 cycles
Recursion No-Contention -> 138 cycles
Contention -> 378 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
Ivan Grokhotkov eb1b4f971b freertos: make sure xPortGetCoreID is placed into IRAM
In some cases, xPortGetCoreID was not inlined, and ended up in flash.
Since this function is used in many situations when cache is disabled,
that caused exceptions. Adding IRAM attribute to fix that.
2017-08-29 08:31:36 +08:00
Angus Gratton 7ae93f271c Merge branch 'feature/multi_heap' into 'master'
Separate the heap implementation from FreeRTOS

See merge request !731
2017-07-12 10:53:37 +08: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
Angus Gratton 71c70cb15c heap: Refactor heap regions/capabilities out of FreeRTOS
Remove tagged heap API, rename caps_xxx to heap_caps_xxx

Also includes additional heap_caps_xxx inspection functions.
2017-07-10 17:46:03 +08:00
Angus Gratton 5ee49fd311 heap: Add new multi_heap heap implementation to replace FreeRTOS-based tagged heaps 2017-07-10 17:46:03 +08:00
Angus Gratton 3fe0022efa stack sizes: Revert stack size increases added in 8d43859
Set min stack size to 2048 if AppTrace support is enabled, 512 bytes otherwise.
2017-06-29 14:57:13 +10: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
Jeroen Domburg d4b0f85eb4 Make portENTER_CRITICAL and portENTER_CRITICAL_ISR the same, plus some changes to fix an issue this causes 2017-06-05 15:57:42 +08:00
jack fc130fba86 fix bug that files missing commit in MR 773 2017-05-31 19:37:39 +08:00
Jeroen Domburg b209c6dcbb Make internal stack size variables in FreeRTOS 32-bit instead of 16-bit 2017-04-19 10:47:19 +08:00
Angus Gratton 45581dbaca freertos: Delay context switch from queue/task APIs until exiting critical section
Closes #374: https://github.com/espressif/esp-idf/issues/374
2017-04-04 10:10:08 +10:00
Daniel Campora 01ad387ac8 freertos: Add config parameters to customize FreeRTOS behaviour.
The options are:
    - SUPPORT_STATIC_ALLOCATION
    - ENABLE_STATIC_TASK_CLEAN_UP_HOOK
    - TIMER_TASK_PRIORITY
    - TIMER_TASK_STACK_DEPTH
    - TIMER_QUEUE_LENGTH

Merges #444 https://github.com/espressif/esp-idf/pull/444
2017-03-22 15:21:38 +08:00
Ivan Grokhotkov 7a186ba1b0 Merge branch 'feature/freertos_kconfig' into 'master'
freertos kconfig: Add max task length name, move task stack overflow watchpoint

* Allow setting task name length via kconfig
* Move task stack overflow watchpoint out of internals debugging submenu, place next to other stack overflow checks.
* Thread local pointer feature should depend on Ethernet or WiFi

See merge request !531
2017-03-03 11:29:05 +08:00
Jeroen Domburg 6739d5b99f Add xPortInIsrContext function + unit test. This function returns true when the current CPU runs in an interrupt handler context. 2017-03-02 17:00:32 +08:00
Angus Gratton 3050f06a8d FreeRTOS: Support setting task name max length
Ref: https://esp32.com/viewtopic.php?f=13&t=1297&p=5762
2017-02-27 11:46:16 +11:00
XiaXiaotian eb14284c92 disable PHY and RF when stop WiFi and disable BT
1. Add disable PHY and RF when WiFi and BT are both disabled(including call sniffer disable API).

2. Do not init PHY and RF when cpu start. Init PHY and RF when call Wifi or BT start APIs(including sniffer enable API).

3. Add a temporary lib: librtc_clk.a and will delete it when CPU frequency switching function is done.

4. Add an function to get OS tick rate.

5. Do not put the whole pp.a in iram0, only put lmac.o, ieee80211_misc.o, ets_time.o and wdev.o in iram0.
2017-02-17 10:24:54 +08:00
Jeroen Domburg 3168ad10e7 Core timer 2 is unusable for FreeRTOS ticks because it triggers a high-level interrupt. This commit deletes the option to select it. 2017-01-15 11:11:58 +08:00
Alexey Gerenkov ad66fbe5ad esp32: Fixes issues discussed during code review of MR!341
The following issues mentioned during MR!341 review were fixed:
1) Core dump test application description
2) Usage of CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH and CONFIG_ESP32_ENABLE_COREDUMP_TO_UART
3) FLASH_GUARD_START macro usage is fixed in flash API
4) Core dump module logging facility
5) cache util functions doc updated
6) interactive delay before print core dump to uart
7) core dump partion support in build system
2017-01-12 19:38:19 +03:00