Commit graph

204 commits

Author SHA1 Message Date
Mark Webb-Johnson 244fb94290 Merge remote-tracking branch 'remotes/espressif/release/v2.1' into release/v2.1 2017-11-17 09:04:16 +08:00
Stephen Casner c6b4555e6d Remove "pc" word from memory debug header 2017-11-01 18:32:17 -07:00
Stephen Casner eb9f77247a Revise memory diagnostics to use task handle not task name
In addition, aggregation of the sizes of blocks allocated by each task
to get a total is now done in new mem_debug_malloc_dump_totals() so it
is not necessary to dump info for each individual heap block into an
array for the app code.  Only the blocks belonging to specific tasks
will be dumped when those tasks are selected by the user for a
detailed list of blocks.

This change in the memory diagnostic API is indicated by a change in
the conditional configENABLE_MEMORY_DEBUG_DUMP from 1 to 2.
2017-11-01 00:32:39 -07:00
Stephen Casner 88ab5d4830 Return region tag in mem_debug_malloc_dump()
Also in mem_init_dog() avoid making a byte access to the task name in
the debug block because that fails for the IRAM heap region.
2017-10-22 00:25:10 -07:00
Stephen Casner 241ecad44e Return stack size and usage in task status array
These values are in place of the stack base pointer that was not being set.
2017-10-19 23:47:24 -07:00
Mark Webb-Johnson 1b7bdfaa0e Use OVMS section parameters to control FreeRtos memory and task debugging 2017-10-19 15:57:02 +08:00
Stephen Casner ab27c84cae Add heap debugging functions 2017-10-19 00:10:45 -07:00
Jeroen Domburg 65734a8344 Fix an assert that erroneously triggered when popping a zero-byte payload from the end of the ringbuffer 2017-09-26 00:02:52 +08:00
Ivan Grokhotkov 348825a438 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-09-25 23:53:19 +08:00
Ivan Grokhotkov 23d7dd8b8e freertos: place uxTopUsedPriority into DRAM
When debugging crashes caused by flash cache access errors, OpenOCD may
request the value of uxTopUsedPriority when cache is disabled. Placing
it into IRAM to avoid an error in such case.
2017-09-25 23:52:30 +08:00
Angus Gratton 99dbfb3539 Merge branch 'bugfix/minimal_stack_size' into 'master'
freertos: Bump idle stack size to 1KB, min stack to 768 bytes, make configurable

See merge request !979
2017-07-12 04:24:18 +08:00
Angus Gratton 1b3120615b stack sizes: Revert stack size increases added in 8d43859
Set min stack size to 2048 if AppTrace support is enabled, 512 bytes otherwise.
2017-07-04 15:29:33 +08: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
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
Angus Gratton b9fc5ecf68 freertos: Fix crash when waking task on CPU1 with scheduler disabled
xPendingReadyList[1] was never initialised correctly, so if a task is added to this list (ie by xSemaphoreGiveFromISR()
or similar) while scheduler is disabled, then it causes a null pointer dereference.

Bug produces stack traces similar to:
0x40086e87: vListInsertEnd at /home/gus/esp/32/idf/components/freertos/./list.c:130
0x40084ba3: xTaskRemoveFromEventList at /home/gus/esp/32/idf/components/freertos/./tasks.c:3439
0x40083c54: xQueueGiveFromISR at /home/gus/esp/32/idf/components/freertos/./queue.c:2034
0x400f50a0: timer_group0_isr at /home/gus/esp/32/idf/components/freertos/test/./test_suspend_scheduler.c:27
0x40081d7d: _xt_lowint1 at xtensa_vectors.o:?
2017-06-05 16:12:20 +10:00
Angus Gratton f40ae10a5d freertos: add test case for ISRs waking tasks when scheduler disabled 2017-06-05 16:12:20 +10:00
jack fc130fba86 fix bug that files missing commit in MR 773 2017-05-31 19:37:39 +08:00
Angus Gratton 4947c953d3 freertos: Mark uxTaskPriorityGet() as tested
Also adds some SMP-aware dynamic task priority unit tests
2017-05-29 16:19:00 +10:00
Angus Gratton 1ddf40feb7 Merge branch 'bugfix/freertos_larger_stacksize' into 'master'
Make internal stack size variables in FreeRTOS 32-bit instead of 16-bit

Stock FreeRTOS uses an uint16 to store stack sizes, making it impossible to allocate a stack >64K. This changes this into an uint32, allowing for larger stacks.

See merge request !677
2017-05-17 10:23:39 +08:00
Angus Gratton 304f0a399a freertos tests: Use CCOMPARE1 always in xPortInIsrContext() test
Mismatched CCOMPARE meant test would only run once.
2017-05-10 17:26:25 +10:00
Angus Gratton 895e7423a3 freertos: Preempt other CPU when deleting a task running on it
Includes related fix to preemption unit tests (delete a queue after deleting the task blocked on it.)
2017-05-10 17:23:33 +10:00
Jiang Jiang Jian c518325385 Merge branch 'bugfix/dualcore_dport' into 'master'
component/esp32 : fix dualcore bug

1. When dual core cpu run access DPORT register, must do protection.
2. If access DPORT register, must use DPORT_REG_READ/DPORT_REG_WRITE and DPORT_XXX register operation macro.

See merge request !742
2017-05-10 11:27:01 +08:00
Tian Hao 26a3cb93c7 component/soc : move dport access header files to soc
1. move dport access header files to soc
2. reduce dport register write protection. Only protect read operation
2017-05-09 18:06:00 +08:00
Tian Hao f7e8856520 component/esp32 : fix dualcore bug
1. When dual core cpu run access DPORT register, must do protection.
2. If access DPORT register, must use DPORT_REG_READ/DPORT_REG_WRITE and DPORT_XXX register operation macro.
2017-05-08 21:53:43 +08:00
Angus Gratton 72c7941b5e Unit tests: Add FreeRTOS timer tests 2017-05-05 14:38:15 +10:00
Ivan Grokhotkov e18f8da528 Merge branch 'bugfix/assert_on_pin_task_nonexistent_cpu' into 'master'
Assert when a new task is started on a nonexisting CPU

Previously, starting a task on a CPU ID higher than the amount of CPUs FreeRTOS is configured with would not start the task and possibly have unintended side effects due to some out-of-bounds array writes. Assert on this so the app aborts cleanly.

See merge request !701
2017-04-28 19:55:26 +08:00
Angus Gratton 66726ec166 freertos: Enable vTaskSuspend()/vTaskResume() API
Adds relevant unit tests.

TW11878
2017-04-26 12:50:20 +10:00
Jeroen Domburg aaeb2bd110 Assert when a new task is started on a nonexisting CPU 2017-04-25 17:47:25 +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
Alexey Gerenkov 55f1a63faf esp32: Adds functionality for application tracing over JTAG
- Implements application tracing module which allows to send arbitrary
   data to host over JTAG. This feature is useful for analyzing
   program modules behavior, dumping run-time application data etc.
 - Implements printf-like logging functions on top of apptrace module.
   This feature is a kind of semihosted printf functionality with lower
   overhead and impact on system behaviour as compared to standard printf.
2017-04-17 23:26:29 +03:00
Jeroen Domburg 0b79d07d34 add detection of invalid cache access
- fix level 4 interrupt vectors to produce correct backtrace
- initialize invalid cache access interrupt on startup
- handle invalid cache access in panic handler
2017-04-13 15:27:38 +08:00
Angus Gratton 0b57054ed3 freertos tests: Extend preemption test cases to cross-core wakeup 2017-04-04 10:10:08 +10:00
Angus Gratton bdbeaf97d6 freertos tests: Fix accidental "0 delay" in event group tests
Was a slight race condition where tasks on other CPU may not have finished waking up on BIT_CALL when the unity task
polled the event group state.
2017-04-04 10:10:08 +10: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
Jeroen Domburg 0e39b77d4e Fix finding location of ISR stack space for CPU1 2017-03-28 15:50:10 +08: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
Jeroen Domburg ab5bbfa74b Malloc test: tabs -> spaces, fix description 2017-03-08 19:44:57 +08:00
Jeroen Domburg 37d56b0e8a Add small testcase 2017-03-08 19:04:28 +08:00
Ivan Grokhotkov ccbc6183c3 Merge branch 'bugfix/freertos_event_groups' into 'master'
FreeRTOS: Fix cross-core event group sync

As above

Also includes fixes which allowed removing some semi-hacky bits from the event group unit tests - specifically, higher priority tasks will always be started immediately even if they run on the opposite core.

See merge request !535
2017-03-03 11:45:59 +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 2230b2c8bc freertos tests: Enable test_freertos_task_delete 2017-02-28 15:47:15 +11:00
Angus Gratton 8de26e434c freertos: Schedule tasks immediately when they are created on opposite core 2017-02-28 15:47:15 +11:00
Angus Gratton 20212ee823 freertos: Fix cross-core usage of event groups
Fixes & re-enabled broken unit tests
Adds per-event-group spinlock instead of single global lock
2017-02-28 12:06:36 +11:00
Angus Gratton d0f8fb9b93 freertos Kconfig: Thread local storage pointer feature required for WiFi or Ethernet 2017-02-28 10:59:23 +11:00
Angus Gratton 47a5851d45 freertos: Move the "set debug watchpoint as stack overflow check" out of debugging internals
Place it near the other stack overflow kconfig items, instead.
2017-02-27 11:49:46 +11: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