Skip to content

Commit ab6d85f

Browse files
committed
bump all to latest
1 parent 5e44b00 commit ab6d85f

File tree

7 files changed

+82
-90
lines changed

7 files changed

+82
-90
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,21 @@
11
name: ci
22

3-
on: [push]
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
47

58
jobs:
6-
compile:
9+
build:
710
runs-on: ubuntu-latest
811

9-
strategy:
10-
matrix:
11-
include:
12-
- rust: stable
13-
# - rust: nightly
14-
1512
steps:
16-
- uses: actions/checkout@v2
17-
- uses: actions-rs/toolchain@v1
18-
with:
19-
toolchain: ${{ matrix.rust }}
20-
components: llvm-tools-preview
21-
22-
- name: install cargo-binutils
23-
uses: actions-rs/cargo@v1
24-
with:
25-
command: install
26-
args: cargo-binutils
27-
toolchain: ${{ matrix.rust }}
13+
- uses: actions/checkout@v4
14+
- uses: dtolnay/rust-toolchain@stable
15+
- run: cargo install cargo-binutils
2816

29-
- name: program size
30-
uses: actions-rs/cargo@v1
31-
with:
32-
command: size
33-
args: --release
34-
toolchain: ${{ matrix.rust }}
17+
- run: cargo build
18+
- run: cargo size
3519

36-
- name: lint
37-
uses: actions-rs/clippy-check@v1
38-
with:
39-
token: ${{ secrets.GITHUB_TOKEN }}
20+
- name: Annotate commit with clippy warnings
21+
uses: giraffate/clippy-action@v1

Cargo.lock

Lines changed: 46 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ version = "0.1.0"
55
authors = ["Damjan Georgievski <gdamjan@gmail.com>"]
66

77
[dependencies]
8-
cortex-m-rt = "0.6.15" # can't upgrade higher until g0xx-hal catches up
9-
stm32g0xx-hal = { version = "0.1.2", features = ["stm32g031", "rt"] }
10-
rtt-target = { version = "0.3.1", features = ["cortex-m"] }
8+
stm32g0xx-hal = { version = "0.2", features = ["stm32g031", "rt"] }
9+
cortex-m-rt = "0.7.4"
10+
panic-halt = "0.2.0"
11+
rtt-target = "0.5.0"
1112

1213
[profile.release]
1314
debug = true # "true" is ok, symbols reside on the host, not the target

Embed.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
[default.general]
2+
chip = "STM32G031J6Mx"
3+
14
[default.rtt]
25
enabled = true

README.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,14 @@ a quite small 8pin mcu, which has only 8KB ram and 32KB flash.
1111

1212
### Setup tooling:
1313

14-
- install cortex-m0 support for rust: `rustup target add thumbv6m-none-eabi`
15-
16-
- install [cargo-flash](https://probe.rs/docs/tools/cargo-flash/):
17-
`cargo install cargo-flash`
18-
19-
- on Linux make sure udev rules allow non-root access, see
20-
[probe setup](https://probe.rs/docs/getting-started/probe-setup/).
21-
22-
- `arm-none-eabi-binutils` and `arm-none-eabi-gdb` are recommended, but not
23-
mandatory
24-
25-
- optional, for advanced debugging with RTT see [cargo embed](https://probe.rs/docs/tools/cargo-embed/)
26-
and/or the [vscode extension](https://probe.rs/docs/tools/vscode/).
14+
- [`rustup`](https://rustup.rs/) - is recommended to install rust and its components
15+
- `cargo install cargo-binutils` - for `cargo size` and `cargo objdump -- --disassemble`, etc…
16+
- `cargo install cargo-embed` - flash and debug using the [`probe-rs project`](https://probe.rs/)
2717

2818
### Compile and flash:
2919

3020
```
31-
cargo flash --release --chip stm32g031j6mx
21+
cargo embed --release
3222
```
3323

3424
## Notes:

rust-toolchain.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
[toolchain]
2+
channel = "stable"
23
targets = ["thumbv6m-none-eabi"]
4+
components = [ "rust-src", "rustfmt", "llvm-tools" ]

src/main.rs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,29 @@
33
#![no_main]
44
#![no_std]
55

6-
use core::panic::PanicInfo;
7-
use rtt_target::{rprintln, rtt_init_print};
8-
6+
use panic_halt as _;
97
use stm32g0xx_hal as hal;
108

119
use hal::prelude::*;
1210
use hal::rcc::Config;
1311
use hal::stm32;
1412

13+
use rtt_target::{rprintln, rtt_init_print};
14+
1515
#[cortex_m_rt::entry]
1616
fn main() -> ! {
1717
rtt_init_print!();
18+
rprintln!("Hello, world!");
19+
1820
let dp = stm32::Peripherals::take().expect("cannot take peripherals");
19-
let mut rcc = dp.RCC.freeze(Config::lsi()); // configure clocks
20-
let mut delay = dp.TIM16.delay(&mut rcc); // and now we can have a working delay
21+
let mut rcc = dp.RCC.freeze(Config::lsi());
22+
let mut delay = dp.TIM16.delay(&mut rcc);
2123

22-
let gpioa = dp.GPIOA.split(&mut rcc); // get gpio port A
23-
let mut led = gpioa.pa12.into_push_pull_output(); // the led is on 12th pin
24+
let gpioa = dp.GPIOA.split(&mut rcc);
25+
let mut led = gpioa.pa5.into_push_pull_output();
2426

25-
rprintln!("Hello, world!");
2627
loop {
27-
// led.toggle().unwrap();
28-
led.set_high().unwrap();
29-
delay.delay(150.ms());
30-
led.set_low().unwrap();
31-
delay.delay(850.ms());
28+
led.toggle().unwrap();
29+
delay.delay(500.millis());
3230
}
3331
}
34-
35-
#[inline(never)]
36-
#[panic_handler]
37-
fn panic(info: &PanicInfo) -> ! {
38-
rprintln!("{}", info);
39-
loop {}
40-
}

0 commit comments

Comments
 (0)