Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3-rs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flow3r
flow3-rs
Commits
66e94a27
Commit
66e94a27
authored
1 year ago
by
zdmx
Browse files
Options
Downloads
Patches
Plain Diff
Add executor on second core
parent
a3a5f103
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/runtime.rs
+23
-15
23 additions, 15 deletions
src/runtime.rs
with
23 additions
and
15 deletions
src/runtime.rs
+
23
−
15
View file @
66e94a27
...
@@ -3,7 +3,7 @@ use embassy_time::{Duration, Timer};
...
@@ -3,7 +3,7 @@ use embassy_time::{Duration, Timer};
use
esp_println
::
println
;
use
esp_println
::
println
;
use
hal
::{
use
hal
::{
clock
::{
ClockControl
,
Clocks
},
clock
::{
ClockControl
,
Clocks
},
cpu_control
::
CpuControl
,
cpu_control
::
{
CpuControl
,
AppCoreGuard
},
embassy
,
embassy
,
gdma
::
Gdma
,
gdma
::
Gdma
,
i2c
::
I2C
,
i2c
::
I2C
,
...
@@ -11,7 +11,7 @@ use hal::{
...
@@ -11,7 +11,7 @@ use hal::{
peripherals
::{
Peripherals
,
I2C0
},
peripherals
::{
Peripherals
,
I2C0
},
prelude
::
*
,
prelude
::
*
,
systimer
::
SystemTimer
,
systimer
::
SystemTimer
,
timer
::
TimerGroup
,
Rng
,
Rtc
,
Spi
,
Uart
,
IO
,
uart
::{
self
,
TxRxPins
},
gpio
::{
Gpio6
,
Unknown
,
Gpio4
,
Gpio7
,
Gpio5
},
Rmt
,
timer
::
TimerGroup
,
Rng
,
Rtc
,
Spi
,
Uart
,
IO
,
uart
::{
self
,
TxRxPins
},
Rmt
,
};
};
use
static_cell
::
StaticCell
;
use
static_cell
::
StaticCell
;
...
@@ -30,7 +30,9 @@ const READ_BUF_SIZE: usize = 64;
...
@@ -30,7 +30,9 @@ const READ_BUF_SIZE: usize = 64;
static
RNG
:
StaticCell
<
Rng
>
=
StaticCell
::
new
();
static
RNG
:
StaticCell
<
Rng
>
=
StaticCell
::
new
();
static
EXECUTOR
:
StaticCell
<
Executor
>
=
StaticCell
::
new
();
static
EXECUTOR
:
StaticCell
<
Executor
>
=
StaticCell
::
new
();
//static APP_CORE_EXECUTOR: StaticCell<Executor> = StaticCell::new();
static
APP_CORE_EXECUTOR
:
StaticCell
<
Executor
>
=
StaticCell
::
new
();
static
APP_CORE_GUARD
:
StaticCell
<
AppCoreGuard
>
=
StaticCell
::
new
();
static
APP_CORE_FN
:
StaticCell
<
fn
()
>
=
StaticCell
::
new
();
static
CLOCKS
:
StaticCell
<
Clocks
>
=
StaticCell
::
new
();
static
CLOCKS
:
StaticCell
<
Clocks
>
=
StaticCell
::
new
();
pub
fn
start_runtime
()
->
!
{
pub
fn
start_runtime
()
->
!
{
...
@@ -40,18 +42,22 @@ pub fn start_runtime() -> ! {
...
@@ -40,18 +42,22 @@ pub fn start_runtime() -> ! {
});
});
}
}
#[embassy_executor::task]
fn
start_app_core
()
{
async
fn
start_app_core
(
mut
cpu_control
:
CpuControl
)
->
!
{
let
executor
=
APP_CORE_EXECUTOR
.init
(
Executor
::
new
());
let
mut
app_core_function
=
||
{
/*let executor = APP_CORE_EXECUTOR.init(Executor::new());
executor
.run
(|
spawner
|
{
executor
.run
(|
spawner
|
{
spawner.spawn(display_refresh()).ok();
spawner
.spawn
(
init_second_core
())
.ok
();
})*/
});
};
}
let
_guard
=
cpu_control
.start_app_core
(
&
mut
app_core_function
)
.unwrap
();
#[embassy_executor::task]
async
fn
init_second_core
()
{
loop
{
loop
{
Timer
::
after
(
Duration
::
from_secs
(
100
))
.await
;
println!
(
"second core running"
);
Timer
::
after
(
Duration
::
from_millis
(
1000
))
.await
;
}
}
}
}
#[embassy_executor::task]
#[embassy_executor::task]
...
@@ -83,7 +89,9 @@ async fn init_runtime() {
...
@@ -83,7 +89,9 @@ async fn init_runtime() {
embassy
::
init
(
&
clocks
,
SystemTimer
::
new
(
peripherals
.SYSTIMER
));
embassy
::
init
(
&
clocks
,
SystemTimer
::
new
(
peripherals
.SYSTIMER
));
let
_cpu_control
=
CpuControl
::
new
(
system
.cpu_control
);
let
app_core_fn
=
APP_CORE_FN
.init
(
start_app_core
);
let
mut
cpu_control
=
CpuControl
::
new
(
system
.cpu_control
);
let
_
=
APP_CORE_GUARD
.init
(
cpu_control
.start_app_core
(
app_core_fn
)
.unwrap
());
// Async requires the GPIO interrupt to wake futures
// Async requires the GPIO interrupt to wake futures
hal
::
interrupt
::
enable
(
hal
::
interrupt
::
enable
(
...
@@ -195,7 +203,7 @@ async fn init_runtime() {
...
@@ -195,7 +203,7 @@ async fn init_runtime() {
// Init Flow3r components
// Init Flow3r components
let
mut
badgelink
=
BadgeLink
::
new
(
i2c_busmanager
.acquire_i2c
());
let
badgelink
=
BadgeLink
::
new
(
i2c_busmanager
.acquire_i2c
());
let
imu
=
ImuHandler
::
new
(
i2c_busmanager
.acquire_i2c
());
let
imu
=
ImuHandler
::
new
(
i2c_busmanager
.acquire_i2c
());
let
inputs
=
InputHandler
;
let
inputs
=
InputHandler
;
let
captouch
=
CaptouchHandler
;
let
captouch
=
CaptouchHandler
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment