Skip to content

Commit

Permalink
feat: add thumbv7em-none-eabihf for cortex-m floating point processors
Browse files Browse the repository at this point in the history
  • Loading branch information
richardapeters committed Oct 31, 2024
1 parent 09fe055 commit e144c9a
Show file tree
Hide file tree
Showing 6 changed files with 298 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .devcontainer/rust/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ ENV CARGO_HOME=/usr/local/cargo \
RUN rustup set profile minimal \
&& rustup default ${RUST_VERSION} \
&& rustup component add clippy llvm-tools rustfmt \
&& rustup target add thumbv7em-none-eabi
&& rustup target add thumbv7em-none-eabi \
&& rustup target add thumbv7em-none-eabihf

# Install bats
RUN batstmp="$(mktemp -d /tmp/bats-core-${BATS_VERSION}.XXXX)" \
Expand Down
2 changes: 2 additions & 0 deletions .devcontainer/rust/test/cortex-mf/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
target = "thumbv7em-none-eabihf"
257 changes: 257 additions & 0 deletions .devcontainer/rust/test/cortex-mf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .devcontainer/rust/test/cortex-mf/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "hello-cortex"
version = "0.1.0"
edition = "2021"

[dependencies]
cortex-m = "0.6.0"
cortex-m-rt = "0.6.10"
panic-halt = "0.2.0"
15 changes: 15 additions & 0 deletions .devcontainer/rust/test/cortex-mf/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#![no_std]
#![no_main]

use panic_halt as _;

use cortex_m::asm;
use cortex_m_rt::entry;

#[entry]
fn main() -> ! {
asm::nop();

loop {
}
}
13 changes: 13 additions & 0 deletions .devcontainer/rust/test/testsuite.bats
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ teardown() {
popd
}

@test "valid code input should result in working elf executable targeting the cortex-mf architecture" {
pushd cortex-mf

cargo build

run cargo readobj --bin hello-cortex -- --file-headers
assert_output --partial "Class: ELF32"
assert_output --partial "Type: EXEC"
assert_output --partial "Machine: ARM"

popd
}

@test "using cargo run should result in working executable" {
pushd cargo

Expand Down

0 comments on commit e144c9a

Please sign in to comment.