File tree 5 files changed +69
-0
lines changed
5 files changed +69
-0
lines changed Original file line number Diff line number Diff line change 85
85
RUSTFLAGS : " -C link-arg=-Tlink.x"
86
86
CARGO_TARGET_THUMBV7M_NONE_EABI_RUNNER : " qemu-system-arm -cpu cortex-m3 -machine mps2-an385 -nographic -semihosting-config enable=on,target=native -kernel"
87
87
run : cd embedded/with-allocator && cargo run --target thumbv7m-none-eabi
88
+
89
+ EmbeddedNoAlloc :
90
+ name : no_std no alloc
91
+ runs-on : ubuntu-latest
92
+ strategy :
93
+ steps :
94
+ - uses : actions/checkout@v2
95
+ - uses : actions-rs/toolchain@v1
96
+ with :
97
+ profile : minimal
98
+ toolchain : stable
99
+ override : true
100
+ - uses : actions-rs/cargo@v1
101
+ with :
102
+ command : rustc
103
+ args : -- -C link-arg=-nostartfiles
Original file line number Diff line number Diff line change 2
2
* .o
3
3
/Cargo.lock
4
4
5
+ /embedded /no-allocator /Cargo.lock
6
+ /embedded /no-allocator /.cargo
5
7
/embedded /with-allocator /Cargo.lock
6
8
/embedded /with-allocator /.cargo
Original file line number Diff line number Diff line change
1
+ [package ]
2
+ authors = [
" Tobin C. Harding <[email protected] >" ]
3
+ edition = " 2018"
4
+ readme = " README.md"
5
+ name = " no-allocator"
6
+ version = " 0.1.0"
7
+
8
+ [profile .dev ]
9
+ panic = " abort"
10
+
11
+ [profile .release ]
12
+ panic = " abort"
13
+
14
+ [dependencies ]
15
+ bech32 = { path = " ../../" , default_features = false }
Original file line number Diff line number Diff line change
1
+ # no_std test crate without an allocator
2
+
3
+ This crate is based on the blog post found at:
4
+
5
+ https://blog.dbrgn.ch/2019/12/24/testing-for-no-std-compatibility/
6
+
7
+ Its purpose is to test that the ` rust-bech32 ` library can be built in a ` no_std ` environment without
8
+ a global allocator.
9
+
10
+ Build with: ` cargo rustc -- -C link-arg=-nostartfiles ` .
Original file line number Diff line number Diff line change
1
+ //! Test `no_std` build of `bech32`.
2
+ //!
3
+ //! Build with: `cargo rustc -- -C link-arg=-nostartfiles`.
4
+ //!
5
+
6
+ #![ no_std]
7
+ #![ no_main]
8
+
9
+ use core:: panic:: PanicInfo ;
10
+
11
+ // Note: `#[global_allocator]` is NOT set.
12
+
13
+ #[ allow( unused_imports) ]
14
+ use bech32;
15
+
16
+ /// This function is called on panic, defining this ensures build will fail if `std` is enabled
17
+ /// because `panic` will be defined twice.
18
+ #[ panic_handler]
19
+ fn panic ( _info : & PanicInfo ) -> ! {
20
+ loop { }
21
+ }
22
+
23
+ #[ no_mangle]
24
+ pub extern "C" fn _start ( ) -> ! {
25
+ loop { }
26
+ }
You can’t perform that action at this time.
0 commit comments