-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support ESP32S2 #12
Merged
Merged
Support ESP32S2 #12
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#![no_std] | ||
#![no_main] | ||
|
||
use core::fmt::Write; | ||
|
||
use esp32s2_hal::{pac::Peripherals, prelude::*, Serial, Timer}; | ||
use nb::block; | ||
use panic_halt as _; | ||
use xtensa_lx_rt::entry; | ||
|
||
#[entry] | ||
fn main() -> ! { | ||
let peripherals = Peripherals::take().unwrap(); | ||
|
||
let mut timer0 = Timer::new(peripherals.TIMG0); | ||
let mut serial0 = Serial::new(peripherals.UART0).unwrap(); | ||
|
||
// Disable watchdog timer | ||
timer0.disable(); | ||
|
||
timer0.start(40_000_000u64); | ||
|
||
loop { | ||
writeln!(serial0, "Hello world!").unwrap(); | ||
block!(timer0.wait()).unwrap(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#![no_std] | ||
#![no_main] | ||
|
||
use core::fmt::Write; | ||
|
||
use esp32s2_hal::{ | ||
pac::{Peripherals, UART0}, | ||
prelude::*, | ||
ram, | ||
Serial, | ||
Timer, | ||
}; | ||
use nb::block; | ||
use panic_halt as _; | ||
use xtensa_lx_rt::entry; | ||
|
||
#[ram(rtc_fast)] | ||
static mut SOME_INITED_DATA: [u8; 2] = [0xaa, 0xbb]; | ||
|
||
#[ram(rtc_fast, uninitialized)] | ||
static mut SOME_UNINITED_DATA: [u8; 2] = [0; 2]; | ||
|
||
#[ram(rtc_fast, zeroed)] | ||
static mut SOME_ZEROED_DATA: [u8; 8] = [0; 8]; | ||
|
||
#[entry] | ||
fn main() -> ! { | ||
let peripherals = Peripherals::take().unwrap(); | ||
|
||
let mut timer0 = Timer::new(peripherals.TIMG0); | ||
let mut serial0 = Serial::new(peripherals.UART0).unwrap(); | ||
|
||
// Disable watchdog timer | ||
timer0.disable(); | ||
|
||
timer0.start(10_000_000u64); | ||
|
||
writeln!( | ||
serial0, | ||
"IRAM function located at {:p}", | ||
function_in_ram as *const () | ||
) | ||
.unwrap(); | ||
unsafe { | ||
writeln!(serial0, "SOME_INITED_DATA {:x?}", SOME_INITED_DATA).unwrap(); | ||
writeln!(serial0, "SOME_UNINITED_DATA {:x?}", SOME_UNINITED_DATA).unwrap(); | ||
writeln!(serial0, "SOME_ZEROED_DATA {:x?}", SOME_ZEROED_DATA).unwrap(); | ||
|
||
SOME_INITED_DATA[0] = 0xff; | ||
SOME_ZEROED_DATA[0] = 0xff; | ||
|
||
writeln!(serial0, "SOME_INITED_DATA {:x?}", SOME_INITED_DATA).unwrap(); | ||
writeln!(serial0, "SOME_UNINITED_DATA {:x?}", SOME_UNINITED_DATA).unwrap(); | ||
writeln!(serial0, "SOME_ZEROED_DATA {:x?}", SOME_ZEROED_DATA).unwrap(); | ||
|
||
if SOME_UNINITED_DATA[0] != 0 { | ||
SOME_UNINITED_DATA[0] = 0; | ||
SOME_UNINITED_DATA[1] = 0; | ||
} | ||
|
||
if SOME_UNINITED_DATA[1] == 0xff { | ||
SOME_UNINITED_DATA[1] = 0; | ||
} | ||
|
||
writeln!(serial0, "Counter {}", SOME_UNINITED_DATA[1]).unwrap(); | ||
SOME_UNINITED_DATA[1] += 1; | ||
} | ||
|
||
writeln!( | ||
serial0, | ||
"RTC_FAST function located at {:p}", | ||
function_in_rtc_ram as *const () | ||
) | ||
.unwrap(); | ||
writeln!(serial0, "Result {}", function_in_rtc_ram()).unwrap(); | ||
|
||
loop { | ||
function_in_ram(&mut serial0); | ||
block!(timer0.wait()).unwrap(); | ||
} | ||
} | ||
|
||
#[ram] | ||
fn function_in_ram(serial0: &mut Serial<UART0>) { | ||
writeln!(serial0, "Hello world!").unwrap(); | ||
} | ||
|
||
#[ram(rtc_fast)] | ||
fn function_in_rtc_ram() -> u32 { | ||
42 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
PROVIDE(level1_interrupt = DefaultHandler); | ||
PROVIDE(level2_interrupt = DefaultHandler); | ||
PROVIDE(level3_interrupt = DefaultHandler); | ||
PROVIDE(level4_interrupt = DefaultHandler); | ||
PROVIDE(level5_interrupt = DefaultHandler); | ||
PROVIDE(level6_interrupt = DefaultHandler); | ||
PROVIDE(level7_interrupt = DefaultHandler); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These
# FIXME
comments were originally referring to thextensa-lx-rt
feature being applied, so these should be removed now to avoid further confusion.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yes 🤦