Commit graph

148 commits

Author SHA1 Message Date
Tian Hao
c599d7aa49 fix bug that semaphore may schedule out in Critical Section
1. Since BLE full-scan feature for BLE mesh change the controller code cause this problem,
it cause coex semaphore take in "interrupt disable", then it may cause task schedule
and cause crash in freertos
2. Fix newlib lock ISR context and critical section check
3. Fix bt controller ISR context and critical section check
2019-10-25 12:01:06 +08:00
suda-morris
9351ae7dc9 freertos: remove semicolon in xTaskNotifyGive 2019-10-17 08:06:57 +00:00
Roland Dobai
64c2aa15aa Rename Kconfig options (components/freertos) 2019-05-21 09:09:01 +02:00
Sachin Parekh
e6a714480d unit-test-app: freertos_compliance config added
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-05-13 16:39:19 +05:30
Sachin Parekh
5c6b9adf11 freertos: port*_CRITICAL_SAFE API added
port*_CRITICAL_SAFE API calls port*_CRITICAL or port*_CRITICAL_ISR
depending on the context (Non-ISR or ISR respectively).

FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE Kconfig option added

Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
2019-05-13 16:39:19 +05:30
Michael (XIAO Xufeng)
562af8f65e global: move the soc component out of the common list
This MR removes the common dependency from every IDF components to the SOC component.

Currently, in the ``idf_functions.cmake`` script, we include the header path of SOC component by default for all components.
But for better code organization (or maybe also benifits to the compiling speed), we may remove the dependency to SOC components for most components except the driver and kernel related components.

In CMAKE, we have two kinds of header visibilities (set by include path visibility):

(Assume component A --(depends on)--> B, B is the current component)

1. public (``COMPONENT_ADD_INCLUDEDIRS``): means this path is visible to other depending components (A) (visible to A and B)
2. private (``COMPONENT_PRIV_INCLUDEDIRS``): means this path is only visible to source files inside the component (visible to B only)

and we have two kinds of depending ways:

(Assume component A --(depends on)--> B --(depends on)--> C, B is the current component)

1. public (```COMPONENT_REQUIRES```): means B can access to public include path of C. All other components rely on you (A) will also be available for the public headers. (visible to A, B)
2. private (``COMPONENT_PRIV_REQUIRES``): means B can access to public include path of C, but don't propagate this relation to other components (A). (visible to B)

1. remove the common requirement in ``idf_functions.cmake``, this makes the SOC components invisible to all other components by default.
2. if a component (for example, DRIVER) really needs the dependency to SOC, add a private dependency to SOC for it.
3. some other components that don't really depends on the SOC may still meet some errors saying "can't find header soc/...", this is because it's depended component (DRIVER) incorrectly include the header of SOC in its public headers. Moving all this kind of #include into source files, or private headers
4. Fix the include requirements for some file which miss sufficient #include directives. (Previously they include some headers by the long long long header include link)

This is a breaking change. Previous code may depends on the long include chain.
You may need to include the following headers for some files after this commit:

- soc/soc.h
- soc/soc_memory_layout.h
- driver/gpio.h
- esp_sleep.h

The major broken include chain includes:

1. esp_system.h no longer includes esp_sleep.h. The latter includes driver/gpio.h and driver/touch_pad.h.
2. ets_sys.h no longer includes soc/soc.h
3. freertos/portmacro.h no longer includes soc/soc_memory_layout.h

some peripheral headers no longer includes their hw related headers, e.g. rom/gpio.h no longer includes soc/gpio_pins.h and soc/gpio_reg.h

BREAKING CHANGE
2019-04-16 13:21:15 +08:00
Alexey Gerenkov
c0f37a324e apptrace: Fixes tracing xQueueGiveFromISR 2019-04-01 15:56:13 +03:00
morris
a2f07b0806 move common include files from esp32 into esp_common 2019-03-26 11:57:03 +08:00
morris
c159984264 separate rom from esp32 component to esp_rom
1. separate rom include files and linkscript to esp_rom
2. modefiy "include rom/xxx.h" to "include esp32/rom/xxx.h"
3. Forward compatible
4. update mqtt
2019-03-21 18:51:45 +08:00
Per Malmberg
36c73e6d70 Easier use of -Wsign-conversion warnings needs changes.
Merges https://github.com/espressif/esp-idf/pull/3129
2019-03-21 15:08:04 +08:00
Ivan Grokhotkov
13523c95b4 freertos: check that mutex is released by owner task
Mutex type semaphores should be acquired and released by the same task.
Add a check to xQueueGenericSend for this condition.
2019-03-11 14:40:54 +00:00
Darian Leung
3576e54d79 freertos: Make xPortGetCoreID() volatile
When xPortGetCoreID() is called twice within a function,
it might only be called once after compilation. This
commit makes the inline assembly of the function volatile.

Closes #3093
2019-02-26 20:59:49 +08:00
Alexey Gerenkov
a55cc99f50 esp32: Replaces magic numbers with CRC for core dump in flash 2018-11-15 06:13:48 +00:00
Darian Leung
6f91640690 FreeRTOS: Update API reference from words to bytes
This commit updates some of the API references in task.h so
that stack sizes are referred to in bytes rather than words as
found in the vanilla version.

Closes #2528
2018-10-09 20:49:19 +08:00
Ivan Grokhotkov
91f7a9a9e7 Merge branch 'feature/lwip_task_affinity' into 'master'
lwip: allow setting LwIP tasks affinity via sdkconfig

See merge request idf/esp-idf!2913
2018-09-18 15:10:17 +08: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
Mahavir Jain
152043d469 esp_ringbuf: move ringbuf to seperate component
Signed-off-by: Mahavir Jain <mahavir@espressif.com>
2018-09-17 17:04:57 +05:30
Ivan Grokhotkov
5bcb7e26d7 freertos: add Kconfig FREERTOS_NO_AFFINITY constant
Use in place of tskNO_AFFINITY in Kconfig files
2018-09-17 18:17:52 +08:00
Angus Gratton
c5d6845c5a freertos: Expose TCB & Stack memory capabilities as macro, fix task delete test
Test was failing if task was allocating TCB & Stack memory from DMA only pool
which is not MALLOC_CAP_DEFAULT.
2018-08-21 12:19:33 +10: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
Mahavir Jain
4e43c920d8 freertos: make task{ENTER/EXIT} macros deprecated for external use
Signed-off-by: Mahavir Jain <mahavir@espressif.com>
2018-06-12 11:19:39 +05:30
Stefan Profanter
18533346b8 Fix compile error using asm
In function 'xPortGetCoreID':
error: expected ')' before ':' token
         :"=r"(id));

Merges https://github.com/espressif/esp-idf/pull/1965
2018-06-04 16:44:35 +10:00
Ivan Grokhotkov
834c056234 xtensa: remove unused header files 2018-05-31 02:21:36 +00:00
Angus Gratton
21e085d235 Merge branch 'feature/xRingBufferCanRead_pr1672' into 'master'
freeRTOS/Re-factor ring buffers and add xRingbufferCanRead, xRingbufferCanWrite

See merge request idf/esp-idf!2214
2018-05-23 15:09:40 +08:00
Darian Leung
4bfa30967f freeRTOS/Re-factor ring buffers
This fixes multiple bugs with ring buffers and re-factors the code. The public
API has not changed, however the underlying implementation have various private
functions have been changed. The following behavioral changes have been made

-   Size of ring buffers for No-Split/Allow-Split buffers will not be rounded
    up to the nearest 32-bit aligned size. This was done to simplify the
    implementation

-   Item size for No-Split/Allow-Split buffers will also be rounded up to the
    nearest 32-bit aligned size.

The following bugs have been fixed

-   In copyItemToRingbufAllowSplit(), when copying an item where the aligned
    size is smaller than the remaining length, the function does not consider
    the case where the true size of the item is less than 4 bytes.

-   The copy functions will automatically wrap around the write pointers when
    the remaining length of the buffer is not large enough to fit a header, but
    does not consider if wrapping around will cause an overlap with the read
    pointer. This will make a full buffer be mistaken for an empty buffer

closes #1711
-   xRingbufferSend() can get stuck in a infinite loop when the size of the
    free memory is larger than the needed_size, but too small to fit in the ring
    buffer due to alignment and extra overhead of wrapping around.

closes #1846
-   Fixed documentation with ring buffer queue set API

-   Adding and removing from queue set does not consider the case where the
    read/write semaphores actually hold a value.

The following functions have been deprecated
    - xRingbufferIsNextItemWrapped() due to lack of thread safety
    - xRingbufferAddToQueueSetWrite() and xRingbufferRemoveFromQueueSetWrite()
    as adding the queue sets only work under receive operations.

The following functions have been added
    - xRingbufferReceiveSplit() and xRingbufferReceiveSplitFromISR() as a thread
    safe way to receive from allow-split buffers
    - vRingbufferGetInfo()

Documentation for ring buffers has also been added.
2018-05-21 01:04:58 +00:00
Ing. Jaroslav Safka
32e838ddb6 Add xRingbufferCanRead, xRingbufferCanWrite
Add function xRingbufferCanRead & xRingbufferCanWrite
to be able use queue sets. Without it is not possible
to check to which ringbuffer returned semaphore belongs.
2018-05-21 01:04:58 +00:00
Ivan Grokhotkov
028fbb58e8 freertos,esp32: automatic light sleep support 2018-05-18 03:14:46 +00:00
Ivan Grokhotkov
417ef19084 Merge branch 'feature/tls_support' into 'master'
FreeRTOS TLS support

See merge request idf/esp-idf!1902
2018-02-09 12:34:20 +08:00
Alexey Gerenkov
f8c42369f1 freertos: Adds C11 TLS support 2018-02-07 18:46:57 +03:00
Jeroen Domburg
70ab924dbb Especially when internal memory fills up, some FreeRTOS structures (queues etc) get allocated in psram. These structures also contain a spinlock, which needs an atomic-compare-swap operation to work. The psram hardware, however, does not support this operation. As a workaround, this patch detects these spinlocks and will, instead of S32C1I, use equivalent C-code to simulate the behaviour, with an (internal) mux for atomicity. 2018-02-02 17:11:06 +08:00
Jack
624828ce83 Dump the frame of the other core when interrupt watchdog happens 2018-01-18 23:10:29 +00:00
JoveToo
6746d31620 fix typo
Merges https://github.com/espressif/esp-idf/pull/1430
2018-01-03 10:50:50 +11:00
Piyush Shah
91968ef464 freertos/ringbuf: Added an API xRingbufferCreateNoSplit()
This is a wrapper API for creating a Ring Buffer, which ensures that
the ringbuffer can hold the given number of items, each item being of the
same given length.

Signed-off-by: Piyush Shah <piyush@espressif.com>
2017-12-07 17:04:23 +05:30
Piyush Shah
3c199b0de6 freertos/ringbuf: Add an API xRingbufferIsNextItemWrapped()
Useful to check if the next item to receive is wrapped or not.
This is valid only if the ring buffer is initialised with type
RINGBUF_TYPE_ALLOWSPLIT.

This is as per the feature request here:
https://github.com/espressif/esp-idf/issues/806

Signed-off-by: Piyush Shah <piyush@espressif.com>
2017-12-07 17:04:18 +05:30
Piyush Shah
cd5fb054c7 freertos/ringbuf: Add an API xRingbufferGetCurFreeSize() to fetch current free size available
The earlier available API (xRingbufferGetMaxItemSize())just gives
a static max entry value possible for given ring buffer.
There was a feature request for an API which could provide
a real time available buffer size. See below:

https://github.com/espressif/esp-idf/issues/806

Signed-off-by: Piyush Shah <piyush@espressif.com>
2017-12-07 17:04:12 +05:30
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