Skip to content
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

Add 2 mcu examples #42

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@

[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

[target.thumbv7m-none-eabi]
#runner = 'arm-none-eabi-gdb'
runner = "gdb-multiarch -q -x openocd.gdb"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't personally use openocd but, it has to be here right (like, there's no way of having this be per-user really)?

you might like to check out probe-run (and defmt) if you haven't come across them yet, a bit of work to get going but a pretty neat dev experience.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are alternatives to openocd. I started playing a bit with cargo-embed https://probe.rs/guide/1_tools/cargo-embed/ and probe-rs https://probe.rs/. I'm not sure if/how it is related to probe-run. It does not seem to need the memory.x file so would remove the need for build.rs, but I don't yet understand how it links without a memory map. It seems like there may be a few developments on this front. Would you prefer to just build and not to provide a way to run? Maybe just give some suggestions of ways to do it?

defmt I only know through the problems caused by its use of a link, which reduces version flexibility. That got passed through in bxcan and breaks multi-HAL testing, see
stm32-rs/stm32f7xx-hal#114 (comment). This has resulted in me having to file several issues and a couple of PRs. Not a very positive introduction, but I should figure out what it does.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After looking at this a bit more I think the best approach is to just build and not attempt to provide linking/flashing/debugging capabilities. That avoids committing to changing tools and possibly conflicting with users needs and preferences. The build.rs is only to provide the memory.x file for openocd. So this would remove the need for the build.rs file and the examples/memoryMaps directory. The no_std sections of .cargo/config can either be removed or commented out. (Preferences?) Comments in examples/lora_spi_send would need to be adjusted and might point to different alternatives for linking/flashing/debugging.

I'll go ahead on this if you think it sounds good.

rustflags = [
"-C", "link-arg=-Tlink.x",
]

[target.thumbv7em-none-eabi]
#runner = 'arm-none-eabi-gdb'
runner = "gdb-multiarch -q -x openocd.gdb"
rustflags = [
"-C", "link-arg=-Tlink.x",
]

[target.thumbv7em-none-eabihf]
#runner = 'arm-none-eabi-gdb'
runner = "gdb-multiarch -q -x openocd.gdb"
rustflags = [
"-C", "link-arg=-Tlink.x",
]

[target.riscv32imac-unknown-none-elf]
#runner = 'riscv64-unknown-elf-gdb -x openocd.gdb'
runner = "gdb-multiarch -q -x openocd.gdb"
rustflags = [
#"-C", "link-arg=-memory-CB.x",
"-C", "link-arg=-Tlink.x",
]
55 changes: 52 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Rust

on:
push:
branches: [ master ]
branches: [ master]
tags: [ 'v*' ]
pull_request:
branches: [ master ]
Expand All @@ -26,12 +26,15 @@ jobs:
use_cross: false
experimental: false
args: --features util,driver-pal/hal-cp2130,driver-pal/hal-linux
- target: armv7-unknown-linux-gnueabihf

# probably want next three targets on master, but they are time consuming when testing examples
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
output: sx127x-util
use_cross: false
experimental: true
args: --features util,driver-pal/hal-cp2130,driver-pal/hal-linux

- target: x86_64-apple-darwin
os: macos-latest
output: sx127x-util
Expand Down Expand Up @@ -92,7 +95,8 @@ jobs:
with:
key: ${{ matrix.os }}-${{ matrix.target }}
path: $VCPKG_DIRECTORY


# probably want next 4 name sections on master, but not on forks and branches
- name: Build release
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -121,6 +125,51 @@ jobs:
tag: ${{ github.ref }}
overwrite: true

test_examples:
name: Test examples
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
mcu: [stm32f103, stm32f411 ]
include:
- mcu: stm32f103
hal: "stm32f1xx"
trg: "thumbv7m-none-eabi"
- mcu: stm32f411
hal: "stm32f4xx"
trg: "thumbv7em-none-eabihf"
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
#- name: Build
# uses: actions-rs/cargo@v1
# with:
# command: build
# args: --no-default-features --release --target ${{ matrix.trg }} --features ${{ matrix.mcu }},compat
- name: Build example lora_spi_send
uses: actions-rs/cargo@v1
with:
command: build
args: --no-default-features --release --target ${{ matrix.trg }} --features ${{ matrix.hal }},${{ matrix.mcu }},compat --example lora_spi_send
use-cross: true
- name: Build example lora_spi_receive
uses: actions-rs/cargo@v1
with:
command: build
args: --no-default-features --release --target ${{ matrix.trg }} --features ${{ matrix.hal }},${{ matrix.mcu }},compat --example lora_spi_receive
use-cross: true
- name: Build example lora_spi_gps
uses: actions-rs/cargo@v1
with:
command: build
args: --no-default-features --release --target ${{ matrix.trg }} --features ${{ matrix.hal }},${{ matrix.mcu }},compat --example lora_spi_gps
use-cross: true

# probably want release on master, but not on forks and branches
release:
name: Create release
runs-on: ubuntu-latest
Expand Down
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

Loading