Skip to content

Commit

Permalink
Fix C API example, run it in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nickray committed Jul 6, 2023
1 parent c77de13 commit d91862d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,19 @@ jobs:
sudo apt-get install -qq qemu-system-arm >/dev/null
qemu-system-arm --version
- uses: actions-rs/toolchain@v1
name: Install Rust stable/thumbv7em-none-eabihf
with:
profile: minimal
toolchain: stable
target: thumbv7em-none-eabihf

- uses: actions-rs/toolchain@v1
name: Install Rust stable/thumbv8m.main-none-eabi
with:
profile: minimal
toolchain: stable
target: thumbv8m.main-none-eabi
override: true

- name: Run all of the tests, including QEMU tests
run: make test
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ test:
cargo test
# Test on QEMU
make -C qemu-tests test
# Test C API
make -C c-api test

fmt:
cargo fmt --all
Expand Down
2 changes: 2 additions & 0 deletions c-api/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
libsalty.a
libsalty-asm.a
libsalty-debug.a
12 changes: 7 additions & 5 deletions c-api/Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
TARGET = thumbv7em-none-eabi
TARGET = thumbv7em-none-eabihf
build:
cargo build --release --target $(TARGET)
cp target/$(TARGET)/release/build/salty-*/out/libsalty-asm.a libsalty-asm.a
cp target/$(TARGET)/release/libsalty_c_api.a libsalty.a
cp ../target/$(TARGET)/release/build/salty-*/out/libsalty-asm.a libsalty-asm.a
cp ../target/$(TARGET)/release/libsalty_c_api.a libsalty.a
cargo build --target $(TARGET)
cp target/$(TARGET)/debug/libsalty_c_api.a libsalty-debug.a
cp ../target/$(TARGET)/debug/libsalty_c_api.a libsalty-debug.a

deep-clean: clean

clean:
cargo clean
make -C example clean

test: run-example

c-bindings:
cbindgen --config cbindgen.toml --lang c --output salty.h

libopencm3/lib/libopencm3_stm32f4.a:
$(MAKE) -C libopencm3

example/example.elf: libopencm3/lib/libopencm3_stm32f4.a
example/example.elf: build libopencm3/lib/libopencm3_stm32f4.a
$(MAKE) -C example

build-example: example/example.elf
Expand Down

0 comments on commit d91862d

Please sign in to comment.