Commit graph

146 commits

Author SHA1 Message Date
Jeroen Domburg
86d8f63005 Per-CPU interrupt handlers and args 2016-11-10 17:59:46 +08:00
Wangjialin
ce9e73cd19 merge master 2016-11-01 10:34:13 +08:00
Jeroen Domburg
ffeffcd315 Merge branch 'feature/crosscore_int' into 'master'
Add cross-core int to accelerate task being awoken from another CPU.

This adds a per-CPU interrupt that can be used to poke the CPU to go do something. In this case all that is implemented is a request to yield the current task, used in case a CPU unblocks a task that runs on another CPU. This gets rid of the limitation that inter-CPU communication using queues, muxes etc can take up to a FreeRTOS tick to happen.

Specs!
Sending an in in a queue of length 1 (essentially a semaphore) as quickly as possible (just a small delay in the sender, to make sure the receiver task gets swapped out) for 10 seconds. Number indicates the amount of ints transferred

Old code:

CPU0->CPU0: 42986

CPU0->CPU1,: 2999

New code:

CPU0->CPU0: 42868

CPU0->CPU1: 62073

See merge request !155
2016-10-31 11:04:28 +08:00
Ivan Grokhotkov
38c6256db9 Merge branch 'feature/wdts' into 'master'
Feature/wdts

This adds two watchdogs to  esp-idf:

- An interrupt watchdog. Kicks in if the FreeRTOS timer interupt on either the PRO_CPU or (when configured) the APP CPU isn't called for a configurable time. Panics, displaying which CPU caused the problem and the registers that may lead to the offending code.
- A task watchdog. A task has to feed it every once in a while. If not, it will print the name of the offending tasks, as well as the tasks currently running on both CPUs, and optionally panic.

Also adds a panic reason to the panic call, as well as fixes the panic code a bit.

See merge request !148
2016-10-27 17:09:35 +08:00
Jeroen Domburg
b14faabfda Merge latest master in 2016-10-27 16:18:55 +08:00
Jeroen Domburg
3371083c16 Add checks for tasks woken up on other CPUs where needed, make xYieldPending and xPendingReadyList per-processor, add configurable ISR stack size to Kconfig, in general fix the entire wake-up-task-on-other-cpu-by-interrupt implementation 2016-10-27 16:07:47 +08:00
Ivan Grokhotkov
50bd28353d Merge branch 'master' into feature/freertos_static_buffers 2016-10-27 12:38:35 +08:00
Jeroen Domburg
fd887dbeea Merge remote-tracking branch 'origin/master' into feature/wdts 2016-10-27 10:25:23 +08:00
Jeroen Domburg
6d54fb004d Change inline to static inline functions. Ref Github issue 62. 2016-10-27 09:17:04 +08:00
Jeroen Domburg
d3d9a8bc28 Most code written. Interrupts still do not fire yet. 2016-10-26 21:09:55 +08:00
Jeroen Domburg
1ca97f5adb Move panic handler code from FreeRTOS to esp32 component 2016-10-26 11:06:53 +08:00
Jeroen Domburg
89f7752cdd Make CPU1 int wdt / idle task wdt configurable, panic now properly disables other cpu, tick handler now also is called on cpu1, task wdt prints currently running tasks. 2016-10-25 18:08:55 +08:00
Jeroen Domburg
75a11589a1 Disable brown-out WDT, fix thread WDT, add panic reason indication to _xt_panic() 2016-10-25 17:05:13 +08:00
Jeroen Domburg
d9005e739d Add bytebuffer support to ringbuf.c 2016-10-24 21:18:02 +08:00
Jeroen Domburg
53146799a0 Initial addition of wdt and brownout code 2016-10-21 17:59:57 +08:00
Jeroen Domburg
2d393f0530 Change inline assembly bits from macros to inline functions 2016-10-20 11:23:59 +08:00
Jeroen Domburg
0403d43b19 Optimize xPortGetCoreID to 2-instruction inline assembly. 2016-10-17 18:09:15 +08:00
Ivan Grokhotkov
8ee1a05914 Merge branch 'master' into feature/freertos_static_buffers
* master: (117 commits)
  build system: Add -fno-rtti when compiling C++ code
  FreeRTOS KConfig: Limit tick rate to 1000Hz
  bootloader: Fix accidental tabs introduced in !78
  build system: Print a WARNING if any submodule is out of date
  Fix stack overflow message format
  'make flash' targets: Print serial port when flashing
  lwip/esp32: support iperf
  Add data memory for RMT peripheral
  syscall write: Should return number of bytes written
  Also push relevant tags over
  esp32: add libsmartconfig.a to link libs
  esp32: not link wps
  esp32/lib: update wifi lib to a1e5f8b9
  esp32: remove esp_wps.h
  add smartconfig header files(merge this after updating libsmartconfig.a version v2.6.2)
  esp32/lib: update wifi lib to 3853d7ae
  Add Comments
  Modify spinlock error in periph_ctrl.c
  Define xcoreid offset, add warning in tcb struct wrt the need to also change that define when struct changes
  components/tcpip_adapter: add some comments
  ...

# Conflicts:
#	components/freertos/queue.c
#	components/freertos/tasks.c
2016-10-10 23:34:45 -06:00
Jeroen Domburg
0383bc8599 Merge branch 'workaround/pin_noaffinity_task_to_core_when_fpu_used' into 'master'
Workaround: Automatically pin no-cpu-affinity task to a core when FPU is used

FPU status at the moment does not migrate cleanly between cores, so tasks without affinity that happen to migrate across FPUs will run into problems. As a workaround, this modification will automatically pin the task to the current CPU when FPU activity is detected. If anything, it's better than getting all kinds of weird and wonderful FPU corruption issues...

See merge request !124
2016-09-29 11:16:41 +08:00
Jeroen Domburg
a59897d656 Merge branch 'master' into feature/freertos_untested_feature_assert 2016-09-28 22:15:05 +08:00
Jeroen Domburg
b3309a03a3 Automatically pin no-cpu-affinity task to a core when FPU is used 2016-09-28 17:02:44 +08:00
Jeroen Domburg
a9502dffd3 Add ringbuf.c. This works like a FreeRTOS queue, but allows for variable-length items which in some cases is more memory efficient than a queue. 2016-09-28 12:43:35 +08:00
Jeroen Domburg
8db85d71b2 Fix UNTESTED_FUNCTION includes, remove unnecessary mux initialization in event groups 2016-09-27 11:50:46 +08:00
Jeroen Domburg
fc53bb6ed5 Add UNTESTED_FUNCTION() call to untested functions, make Kconfig option to enable that to map to assert() 2016-09-27 11:36:30 +08:00
daniel
01d17dd5f9 Backport the static allocation feature from FreeRTOS V9.0.0
This feature allows to use static buffers (or from a pool of memory which is not
controlled by FreeRTOS).
In order to reduce the impact of the changes, the static feature has only been added
to the queus (and in consequence to the semaphores and the mutexes) and the tasks.
The Timer task is always dynamically allocated and also the idle task(s), which in the
case of the ESP-IDF is ok, since we always need to have dynamic allocation enabled.
2016-09-22 13:41:21 +08:00
Ivan Grokhotkov
da69d6ad3c Merge branch 'master' into feature/menuconfig_cpu_frequency_option
* master: (57 commits)
  components/lwip: fix grammar
  components/lwip: make SO_REUSE configurable via menuconfig
  bootloader: remove trailing newlines from log messages
  components/freertos: override per-task __cleanup handler to close stdin, stdout, stderr
  components/esp32: move peripheral symbols to separate ld script
  components/log: regroup macros for better readability
  gitlab-ci: allow running tests for branches, triggered via API
  components/log: fix timestamp calculation
  components/log: set default runtime log level to ESP_LOG_VERBOSE
  components/log: fix error when using ESP_LOGx from C++ code
  components/log: fix bugs, add options to override log level for files, components, and bootloader
  fix ledc and spi typo
  remove prefix and postfix
  Enable SO_REUSEADDR in LWIP
  freertos: fix memory debug macro issue Define configENABLE_MEMORY_DEBUG according to CONFIG_ENABLE_MEMORY_DEBUG
  peripheral structure headers: move volatile keyword from members to typedef
  Adding -fstrict-volatile-bitfields to the CFLAGS/CXXFLAGS. Without this, gcc tries to access bitfields using the smallest possible methods (eg l8i to grab an 8-bit field from a 32-bit). Our hardware does not like that. This flag tells gcc that if a bitfield is volatile, it should always use the type the field is defined at (uint32_t in our case) to size its access to the field. This fixes accessing the hardware through the xxx_struct.h headers.
  add peripheral  module struct headers
  build system docs: Add note about no spaces in component names
  Docs: Add note about unusual submodule messages when cloning on Windows
  ...

# Conflicts:
#	components/esp32/cpu_start.c
#	components/esp32/include/soc/cpu.h
2016-09-20 17:22:18 +08:00
liuzhifu
4c74ec9415 freertos: fix memory debug macro issue
Define configENABLE_MEMORY_DEBUG according to CONFIG_ENABLE_MEMORY_DEBUG
2016-09-18 15:35:42 +08:00
Ivan Grokhotkov
5ab769516d components/esp32: add CPU frequency selection in menuconfig
Note that with WiFi stack enabled, system_init will reset frequency to 240MHz.
To make this setting useful, esp32-wifi-libs submodule needs to be updated.
2016-09-14 17:54:34 +08:00
Jeroen Domburg
9664de6867 Add working portASSERT_IF_IN_ISR function, fix enter_critical thing even better. 2016-09-09 17:15:50 +08:00
liuzhifu
b21d2dfa6b FreeRTOS: temporary solution for memory canaries and memory debug
1. This is just a temporary solution, it will be removed when umm_malloc is ready
2. Support memory canaries mechanism
2. Add debug code to show allocated memory info
2016-09-07 21:52:24 +08:00
liuzhifu
6f122928f0 fix socket compile error 2016-08-26 19:03:50 +08:00
Angus Gratton
00ea21f736 FreeRTOS: Convert portMUX_DEBUG to a configuration item 2016-08-25 16:43:59 +08:00
Angus Gratton
e6bc527dfb Merge branch 'master' into feature/newlib_locking 2016-08-25 12:09:21 +08:00
Angus Gratton
580fd635e5 FreeRTOS: Change tskNO_AFFINITY value to not match CPU 1 when UNICORE is set 2016-08-25 11:30:24 +08:00
Angus Gratton
a04b510a21 Merge branch 'master' into feature/newlib_locking 2016-08-25 11:11:35 +08:00
Jeroen Domburg
95f547025b Undo two empty lines 2016-08-24 18:34:04 +08:00
Angus Gratton
f5715ac28d FreeRTOS: Add xQueueGetMutexHolder support
Enables it as a config option, but there's no overhead at all if the
function is not called anywhere.
2016-08-24 18:13:10 +08:00
Angus Gratton
93c92f7a5b FreeRTOS: Configure configASSERT fail behaviour, abort() by default 2016-08-24 18:13:10 +08:00
Jeroen Domburg
bdf4b27e38 Add symbol needed for OpenOCD to detect FreeRTOS, add feature to break execution when the scheduler is initially started. 2016-08-24 17:32:20 +08:00
Jeroen Domburg
a44c45e63e Add files I forgot (FreeRTOS-openocd.c and panic.h) 2016-08-24 17:30:53 +08:00
Jeroen Domburg
29c2e58c75 'Merge branch 'thread_local_storage_delete_callbacks' into 'master'
The thread-local-storage feature in FreeRTOS attaches an application-usable array of pointers to a thread control block. These pointers usually point to a structure the thread allocates. When a thread gets (voluntarily or involuntarily) destroyed, this memory can leak. This merge adds a matching second array of user-settable pointers to destructor routines. As soon as the task gets cleaned up (which happens in the idle thread), the destructors get called and the memory can be freed.

See merge request !19
2016-08-24 13:30:30 +08:00
Angus Gratton
eeb0811088 Merge branch 'default_freq' into 'master'
rtos: change XT_CLOCK_FREQ from 13MHz to 80MHz

Freq has been change to `80MHz` in system_init, otherwise system tick will not be accurate now.

Maybe we can config freq by menuconfig.

See merge request !8
2016-08-22 17:38:00 +08:00
Jeroen Domburg
f34110009a Add C99-style named field in initialisation struct 2016-08-22 17:45:46 +08:00
Jeroen Domburg
925fbb587e Add static initializers for muxes, add mutex init to vPortCPUAcquireMutex 2016-08-22 17:36:32 +08:00
Wu Jian Gang
893ce242a1 rtos: change XT_CLOCK_FREQ from 13MHz to 80MHz
Freq has been change to 80MHz in system_init
2016-08-22 12:04:14 +08:00
Ivan Grokhotkov
bd6ea4393c Initial public version 2016-08-17 23:08:22 +08:00