Skip to content
This repository was archived by the owner on Aug 9, 2022. It is now read-only.

Commit 751b3dd

Browse files
authored
Merge pull request #48 from esp-rs/pre-release-fixes
Pre 0.1.0 fixes
2 parents 8463b83 + d679ed5 commit 751b3dd

File tree

6 files changed

+44
-21
lines changed

6 files changed

+44
-21
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ rt = ["esp32/rt", "xtensa-lx6-rt"]
3232
[dependencies]
3333
esp32-hal-proc-macros = { path = "procmacros" }
3434

35-
xtensa-lx6-rt = { version = "0.3.0", optional = true }
35+
xtensa-lx6-rt = { version = "0.4.0", optional = true }
3636
xtensa-lx6 = "0.2.0"
3737
esp32 = { version = "0.7.0", default-features = false }
3838
bare-metal = "0.2"
3939
nb = "0.1.2"
4040
embedded-hal = { version = "0.2.3", features = ["unproven"] }
41-
linked_list_allocator = { version = "0.8.4", optional = true, default-features = false, features = ["alloc_ref"] }
41+
linked_list_allocator = { version = "=0.8.4", optional = true, default-features = false, features = ["alloc_ref"] }
4242
void = { version = "1.0.2", default-features = false }
4343

4444
[dev-dependencies]

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
11
# esp32-hal
22

3-
A experimental hardware abstraction layer for the [esp32](https://en.wikipedia.org/wiki/ESP32) written in Rust.
3+
A hardware abstraction layer for the [esp32](https://en.wikipedia.org/wiki/ESP32) written in Rust.
44

55
Contributions are welcome :)
66

77
Join in on the discussion: https://matrix.to/#/#esp-rs:matrix.org!
88

9+
## Running examples
10+
11+
There are currently two ways to flash the esp32:
12+
13+
* The `flash` script using `esptool`
14+
- If you are familiar with the esp ecosystem, there is a `flash` script in this repo which utilizes the espressif esptool to flash the esp32 over usb.
15+
Example usage:
16+
```rust
17+
./flash -p /dev/ttyUSB0 -e blinky --release
18+
```
19+
20+
* The [`espflash`](https://github.com/icewind1991/espflash) cargo subcommand
21+
- A Rust rewrite of the esptool, with a cargo subcommand. Example usage:
22+
```rust
23+
cargo espflash --example blinky --release /dev/ttyUSB0
24+
```
25+
926
## License
1027

1128
Licensed under either of

examples/alloc.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use esp32_hal::alloc::{
1818
use esp32_hal::clock_control::{sleep, ClockControl};
1919
use esp32_hal::dport::Split;
2020
use esp32_hal::dprintln;
21-
use esp32_hal::serial::{config::Config, NoRx, NoTx, Serial};
21+
use esp32_hal::serial::{config::Config, Serial};
2222
use esp32_hal::target;
2323

2424
#[macro_use]
@@ -59,7 +59,7 @@ fn main() -> ! {
5959
// we will do it manually on startup
6060
disable_timg_wdts(&mut timg0, &mut timg1);
6161

62-
let (mut dport, dport_clock_control) = dp.DPORT.split();
62+
let (_, dport_clock_control) = dp.DPORT.split();
6363

6464
// setup clocks & watchdog
6565
let clock_control = ClockControl::new(
@@ -74,13 +74,19 @@ fn main() -> ! {
7474

7575
watchdog.start(15.s());
7676

77+
let gpios = dp.GPIO.split();
78+
7779
// setup serial controller
78-
let mut uart0 = Serial::uart0(
80+
let mut uart0: Serial<_, _, _> = Serial::new(
7981
dp.UART0,
80-
(NoTx, NoRx),
82+
esp32_hal::serial::Pins {
83+
tx: gpios.gpio1,
84+
rx: gpios.gpio3,
85+
cts: None,
86+
rts: None,
87+
},
8188
Config::default(),
8289
clock_control_config,
83-
&mut dport,
8490
)
8591
.unwrap();
8692

examples/blinky.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn main() -> ! {
3030
disable_rtc_wdt(&mut rtccntl);
3131

3232
let pins = dp.GPIO.split();
33-
let mut led = pins.gpio2.into_open_drain_output();
33+
let mut led = pins.gpio2.into_push_pull_output();
3434

3535
loop {
3636
led.set_high().unwrap();

examples/mem.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ use esp32_hal::clock_control::{sleep, CPUSource::PLL, ClockControl, ClockControl
1414
use esp32_hal::dport::Split;
1515
use esp32_hal::dprintln;
1616
use esp32_hal::mem::{memcmp, memcpy, memcpy_reverse, memset};
17-
use esp32_hal::serial::{config::Config, NoRx, NoTx, Serial};
17+
use esp32_hal::serial::{config::Config, Serial};
1818
use esp32_hal::target;
1919

20-
use xtensa_lx6::get_cycle_count;
20+
use xtensa_lx6::timer::get_cycle_count;
2121

2222
#[macro_use]
2323
extern crate alloc;
@@ -37,7 +37,7 @@ fn main() -> ! {
3737
// we will do it manually on startup
3838
disable_timg_wdts(&mut timg0, &mut timg1);
3939

40-
let (mut dport, dport_clock_control) = dp.DPORT.split();
40+
let (_, dport_clock_control) = dp.DPORT.split();
4141

4242
// setup clocks & watchdog
4343
let mut clock_control = ClockControl::new(
@@ -57,13 +57,19 @@ fn main() -> ! {
5757

5858
watchdog.start(20.s());
5959

60+
let gpios = dp.GPIO.split();
61+
6062
// setup serial controller
61-
let mut uart0 = Serial::uart0(
63+
let mut uart0: Serial<_, _, _> = Serial::new(
6264
dp.UART0,
63-
(NoTx, NoRx),
65+
esp32_hal::serial::Pins {
66+
tx: gpios.gpio1,
67+
rx: gpios.gpio3,
68+
cts: None,
69+
rts: None,
70+
},
6471
Config::default(),
6572
clock_control_config,
66-
&mut dport,
6773
)
6874
.unwrap();
6975

memory.x

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@ INCLUDE "alias.x"
5959

6060
/* esp32 specific regions */
6161
SECTIONS {
62-
.rwtext :
63-
{
64-
. = ALIGN(4);
65-
*(.rwtext.literal .rwtext .rwtext.literal.* .rwtext.*)
66-
} > iram_seg AT > RODATA
67-
6862
.rtc_fast.text : {
6963
. = ALIGN(4);
7064
*(.rtc_fast.literal .rtc_fast.text .rtc_fast.literal.* .rtc_fast.text.*)

0 commit comments

Comments
 (0)