Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-esp32
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-esp32
Commits
fa74767b
Commit
fa74767b
authored
Apr 13, 2019
by
me-no-dev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow selecting in IDF the running core for Arduino's core tasks
parent
d922557e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
95 additions
and
15 deletions
+95
-15
Kconfig.projbuild
Kconfig.projbuild
+64
-0
cores/esp32/esp32-hal-misc.c
cores/esp32/esp32-hal-misc.c
+18
-0
cores/esp32/esp32-hal.h
cores/esp32/esp32-hal.h
+10
-0
cores/esp32/main.cpp
cores/esp32/main.cpp
+1
-7
libraries/AsyncUDP/src/AsyncUDP.cpp
libraries/AsyncUDP/src/AsyncUDP.cpp
+1
-1
libraries/WiFi/src/WiFiGeneric.cpp
libraries/WiFi/src/WiFiGeneric.cpp
+1
-7
No files found.
Kconfig.projbuild
View file @
fa74767b
...
...
@@ -19,6 +19,70 @@ config AUTOSTART_ARDUINO
If disabled, you can call initArduino() to run any preparations
required by the framework
choice ARDUINO_RUNNING_CORE
bool "Core on which Arduino's setup() and loop() are running"
default ARDUINO_RUN_CORE1
help
Select on which core Arduino's setup() and loop() functions run
config ARDUINO_RUN_CORE0
bool "CORE 0"
config ARDUINO_RUN_CORE1
bool "CORE 1"
config ARDUINO_RUN_NO_AFFINITY
bool "BOTH"
endchoice
config ARDUINO_RUNNING_CORE
int
default 0 if ARDUINO_RUN_CORE0
default 1 if ARDUINO_RUN_CORE1
default -1 if ARDUINO_RUN_NO_AFFINITY
choice ARDUINO_EVENT_RUNNING_CORE
bool "Core on which Arduino's event handler is running"
default ARDUINO_EVENT_RUN_CORE1
help
Select on which core Arduino's WiFi.onEvent() run
config ARDUINO_EVENT_RUN_CORE0
bool "CORE 0"
config ARDUINO_EVENT_RUN_CORE1
bool "CORE 1"
config ARDUINO_EVENT_RUN_NO_AFFINITY
bool "BOTH"
endchoice
config ARDUINO_EVENT_RUNNING_CORE
int
default 0 if ARDUINO_EVENT_RUN_CORE0
default 1 if ARDUINO_EVENT_RUN_CORE1
default -1 if ARDUINO_EVENT_RUN_NO_AFFINITY
choice ARDUINO_UDP_RUNNING_CORE
bool "Core on which Arduino's UDP is running"
default ARDUINO_UDP_RUN_CORE1
help
Select on which core Arduino's UDP run
config ARDUINO_UDP_RUN_CORE0
bool "CORE 0"
config ARDUINO_UDP_RUN_CORE1
bool "CORE 1"
config ARDUINO_UDP_RUN_NO_AFFINITY
bool "BOTH"
endchoice
config ARDUINO_UDP_RUNNING_CORE
int
default 0 if ARDUINO_UDP_RUN_CORE0
default 1 if ARDUINO_UDP_RUN_CORE1
default -1 if ARDUINO_UDP_RUN_NO_AFFINITY
config DISABLE_HAL_LOCKS
bool "Disable mutex locks for HAL"
default "n"
...
...
cores/esp32/esp32-hal-misc.c
View file @
fa74767b
...
...
@@ -111,6 +111,24 @@ void disableCore1WDT(){
}
#endif
BaseType_t
xTaskCreateUniversal
(
TaskFunction_t
pxTaskCode
,
const
char
*
const
pcName
,
const
uint32_t
usStackDepth
,
void
*
const
pvParameters
,
UBaseType_t
uxPriority
,
TaskHandle_t
*
const
pxCreatedTask
,
const
BaseType_t
xCoreID
){
#ifndef CONFIG_FREERTOS_UNICORE
if
(
xCoreID
>=
0
&&
xCoreID
<
2
)
{
return
xTaskCreatePinnedToCore
(
pxTaskCode
,
pcName
,
usStackDepth
,
pvParameters
,
uxPriority
,
pxCreatedTask
,
xCoreID
);
}
else
{
#endif
return
xTaskCreate
(
pxTaskCode
,
pcName
,
usStackDepth
,
pvParameters
,
uxPriority
,
pxCreatedTask
);
#ifndef CONFIG_FREERTOS_UNICORE
}
#endif
}
unsigned
long
IRAM_ATTR
micros
()
{
return
(
unsigned
long
)
(
esp_timer_get_time
());
...
...
cores/esp32/esp32-hal.h
View file @
fa74767b
...
...
@@ -90,6 +90,16 @@ void enableCore1WDT();
void
disableCore1WDT
();
#endif
//if xCoreID < 0 or CPU is unicore, it will use xTaskCreate, else xTaskCreatePinnedToCore
//allows to easily handle all possible situations without repetitive code
BaseType_t
xTaskCreateUniversal
(
TaskFunction_t
pxTaskCode
,
const
char
*
const
pcName
,
const
uint32_t
usStackDepth
,
void
*
const
pvParameters
,
UBaseType_t
uxPriority
,
TaskHandle_t
*
const
pxCreatedTask
,
const
BaseType_t
xCoreID
);
unsigned
long
micros
();
unsigned
long
millis
();
void
delay
(
uint32_t
);
...
...
cores/esp32/main.cpp
View file @
fa74767b
...
...
@@ -7,12 +7,6 @@ TaskHandle_t loopTaskHandle = NULL;
#if CONFIG_AUTOSTART_ARDUINO
#if CONFIG_FREERTOS_UNICORE
#define ARDUINO_RUNNING_CORE 0
#else
#define ARDUINO_RUNNING_CORE 1
#endif
bool
loopTaskWDTEnabled
;
void
loopTask
(
void
*
pvParameters
)
...
...
@@ -30,7 +24,7 @@ extern "C" void app_main()
{
loopTaskWDTEnabled
=
false
;
initArduino
();
xTaskCreate
PinnedToCore
(
loopTask
,
"loopTask"
,
8192
,
NULL
,
1
,
&
loopTaskHandle
,
ARDUINO_RUNNING_CORE
);
xTaskCreate
Universal
(
loopTask
,
"loopTask"
,
8192
,
NULL
,
1
,
&
loopTaskHandle
,
CONFIG_
ARDUINO_RUNNING_CORE
);
}
#endif
libraries/AsyncUDP/src/AsyncUDP.cpp
View file @
fa74767b
...
...
@@ -150,7 +150,7 @@ static bool _udp_task_start(){
}
}
if
(
!
_udp_task_handle
){
xTaskCreate
(
_udp_task
,
"async_udp"
,
4096
,
NULL
,
3
,
(
TaskHandle_t
*
)
&
_udp_task_handle
);
xTaskCreate
Universal
(
_udp_task
,
"async_udp"
,
4096
,
NULL
,
3
,
(
TaskHandle_t
*
)
&
_udp_task_handle
,
CONFIG_ARDUINO_UDP_RUNNING_CORE
);
if
(
!
_udp_task_handle
){
return
false
;
}
...
...
libraries/WiFi/src/WiFiGeneric.cpp
View file @
fa74767b
...
...
@@ -50,12 +50,6 @@ extern "C" {
#include "sdkconfig.h"
#if CONFIG_FREERTOS_UNICORE
#define ARDUINO_RUNNING_CORE 0
#else
#define ARDUINO_RUNNING_CORE 1
#endif
static
xQueueHandle
_network_event_queue
;
static
TaskHandle_t
_network_event_task_handle
=
NULL
;
static
EventGroupHandle_t
_network_event_group
=
NULL
;
...
...
@@ -96,7 +90,7 @@ static bool _start_network_event_task(){
}
}
if
(
!
_network_event_task_handle
){
xTaskCreate
PinnedToCore
(
_network_event_task
,
"network_event"
,
4096
,
NULL
,
ESP_TASKD_EVENT_PRIO
-
1
,
&
_network_event_task_handle
,
ARDUINO
_RUNNING_CORE
);
xTaskCreate
Universal
(
_network_event_task
,
"network_event"
,
4096
,
NULL
,
ESP_TASKD_EVENT_PRIO
-
1
,
&
_network_event_task_handle
,
CONFIG_ARDUINO_EVENT
_RUNNING_CORE
);
if
(
!
_network_event_task_handle
){
log_e
(
"Network Event Task Start Failed!"
);
return
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment