File tree 5 files changed +53
-1
lines changed 5 files changed +53
-1
lines changed Original file line number Diff line number Diff line change 16
16
steps :
17
17
- uses : actions/checkout@v2
18
18
- name : Build
19
- run : ./ci.sh
19
+ run : ./ci.sh
Original file line number Diff line number Diff line change
1
+ {
2
+ "arch" : " avr" ,
3
+ "atomic-cas" : false ,
4
+ "cpu" : " atmega328p" ,
5
+ "data-layout" : " e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8" ,
6
+ "eh-frame-header" : false ,
7
+ "exe-suffix" : " .elf" ,
8
+ "executables" : true ,
9
+ "late-link-args" : {
10
+ "gcc" : [
11
+ " -lgcc"
12
+ ]
13
+ },
14
+ "linker" : " avr-gcc" ,
15
+ "linker-is-gnu" : true ,
16
+ "llvm-target" : " avr-unknown-unknown" ,
17
+ "max-atomic-width" : 8 ,
18
+ "no-default-libraries" : false ,
19
+ "pre-link-args" : {
20
+ "gcc" : [
21
+ " -mmcu=atmega328p" ,
22
+ " -Wl,--as-needed"
23
+ ]
24
+ },
25
+ "target-c-int-width" : " 16" ,
26
+ "target-pointer-width" : " 16"
27
+ }
Original file line number Diff line number Diff line change 2
2
3
3
set -euxo pipefail
4
4
5
+ rustup toolchain install nightly-2021-01-07 --component rust-src
6
+ cargo +nightly-2021-01-07 build -Zbuild-std=core --target avr-specs/avr-atmega328p.json
7
+
5
8
cargo build
6
9
cargo build --target thumbv6m-none-eabi
7
10
cargo build --target thumbv7em-none-eabi
Original file line number Diff line number Diff line change @@ -8,4 +8,5 @@ targets = [
8
8
" thumbv7em-none-eabi" ,
9
9
" riscv32imc-unknown-none-elf" ,
10
10
" riscv32imac-unknown-none-elf" ,
11
+ " avr-specs/avr-atmpeg328p.json" ,
11
12
]
Original file line number Diff line number Diff line change 1
1
#![ cfg_attr( docsrs, feature( doc_cfg) ) ]
2
2
#![ no_std]
3
+ #![ cfg_attr( target_arch = "avr" , feature( llvm_asm) ) ]
4
+ #![ cfg_attr( target_arch = "avr" , feature( extended_key_value_attributes) ) ]
3
5
#![ doc = include_str ! ( "../README.md" ) ]
4
6
5
7
pub use bare_metal:: CriticalSection ;
@@ -118,6 +120,25 @@ cfg_if::cfg_if! {
118
120
cortex_m:: interrupt:: enable( )
119
121
}
120
122
}
123
+ } else if #[ cfg( target_arch = "avr" ) ] {
124
+ #[ no_mangle]
125
+ unsafe fn _critical_section_acquire( ) -> u8 {
126
+ let mut sreg: u8 ;
127
+ llvm_asm!(
128
+ "in $0, 0x3F
129
+ cli"
130
+ : "=r" ( sreg)
131
+ :: : "volatile"
132
+ ) ;
133
+ sreg
134
+ }
135
+
136
+ #[ no_mangle]
137
+ unsafe fn _critical_section_release( token: u8 ) {
138
+ if token & 0x80 == 0x80 {
139
+ llvm_asm!( "sei" :: :: "volatile" ) ;
140
+ }
141
+ }
121
142
} else if #[ cfg( target_arch = "riscv32" ) ] {
122
143
#[ no_mangle]
123
144
unsafe fn _critical_section_acquire( ) -> u8 {
You can’t perform that action at this time.
0 commit comments