Skip to content

Commit 5c04ae8

Browse files
committed
update linux bindings
1 parent 0f66a22 commit 5c04ae8

File tree

3 files changed

+29
-248
lines changed

3 files changed

+29
-248
lines changed

stm32cubeprogrammer-sys/justfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ shebang := if os() == 'windows' {
99

1010
bindgen_header := "include/wrapper.h"
1111

12-
bindgen_output := if os() == 'windows' {
13-
"src/bindings_windows.rs"
14-
} else {
15-
"src/bindings_unix.rs"
16-
}
12+
bindings_windows := "src/bindings_windows.rs"
13+
target_windows := "x86_64-pc-windows-msvc"
14+
15+
bindings_linux := "src/bindings_linux.rs"
16+
target_linux := "x86_64-unknown-linux-gnu"
17+
1718

1819
target := if os() == 'windows' {
1920
x86_64-pc-windows-msvc
@@ -22,5 +23,7 @@ target := if os() == 'windows' {
2223
}
2324

2425
# Generate bindings for the CubeProgrammer API dynamic library
26+
# Both the `x86_64-pc-windows-msvc` and `x86_64-unknown-linux-gnu` targets are need to be installed to run this command
2527
generate-bindings:
26-
bindgen {{source_directory()}}/{{bindgen_header}} --dynamic-loading CubeProgrammer_API --output {{source_directory()}}/{{bindgen_output}} -- -x c++ -target {{target}}
28+
bindgen {{source_directory()}}/{{bindgen_header}} --dynamic-loading CubeProgrammer_API --output {{source_directory()}}/{{bindings_windows}} -- -x c++ -target {{target_windows}}
29+
bindgen {{source_directory()}}/{{bindgen_header}} --dynamic-loading CubeProgrammer_API --output {{source_directory()}}/{{bindings_linux}} -- -x c++ -target {{target_linux}}

stm32cubeprogrammer-sys/src/bindings_unix.rs renamed to stm32cubeprogrammer-sys/src/bindings_linux.rs

Lines changed: 19 additions & 241 deletions
Original file line numberDiff line numberDiff line change
@@ -1,249 +1,27 @@
1-
/* automatically generated by rust-bindgen 0.70.1 */
1+
/* automatically generated by rust-bindgen 0.71.1 */
22

3-
pub const _STDINT_H: u32 = 1;
4-
pub const _FEATURES_H: u32 = 1;
5-
pub const _ISOC95_SOURCE: u32 = 1;
6-
pub const _ISOC99_SOURCE: u32 = 1;
7-
pub const _ISOC11_SOURCE: u32 = 1;
8-
pub const _ISOC23_SOURCE: u32 = 1;
9-
pub const _POSIX_SOURCE: u32 = 1;
10-
pub const _POSIX_C_SOURCE: u32 = 200809;
11-
pub const _XOPEN_SOURCE: u32 = 700;
12-
pub const _XOPEN_SOURCE_EXTENDED: u32 = 1;
13-
pub const _LARGEFILE64_SOURCE: u32 = 1;
14-
pub const _DEFAULT_SOURCE: u32 = 1;
15-
pub const _ATFILE_SOURCE: u32 = 1;
16-
pub const _DYNAMIC_STACK_SIZE_SOURCE: u32 = 1;
17-
pub const __GLIBC_USE_ISOC23: u32 = 1;
18-
pub const __USE_ISOC11: u32 = 1;
19-
pub const __USE_ISOC99: u32 = 1;
20-
pub const __USE_ISOC95: u32 = 1;
21-
pub const __USE_ISOCXX11: u32 = 1;
22-
pub const __USE_POSIX: u32 = 1;
23-
pub const __USE_POSIX2: u32 = 1;
24-
pub const __USE_POSIX199309: u32 = 1;
25-
pub const __USE_POSIX199506: u32 = 1;
26-
pub const __USE_XOPEN2K: u32 = 1;
27-
pub const __USE_XOPEN2K8: u32 = 1;
28-
pub const __USE_XOPEN: u32 = 1;
29-
pub const __USE_XOPEN_EXTENDED: u32 = 1;
30-
pub const __USE_UNIX98: u32 = 1;
31-
pub const _LARGEFILE_SOURCE: u32 = 1;
32-
pub const __USE_XOPEN2K8XSI: u32 = 1;
33-
pub const __USE_XOPEN2KXSI: u32 = 1;
34-
pub const __USE_LARGEFILE: u32 = 1;
35-
pub const __USE_LARGEFILE64: u32 = 1;
36-
pub const __WORDSIZE: u32 = 64;
37-
pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
38-
pub const __SYSCALL_WORDSIZE: u32 = 64;
39-
pub const __TIMESIZE: u32 = 64;
40-
pub const __USE_TIME_BITS64: u32 = 1;
41-
pub const __USE_MISC: u32 = 1;
42-
pub const __USE_ATFILE: u32 = 1;
43-
pub const __USE_DYNAMIC_STACK_SIZE: u32 = 1;
44-
pub const __USE_GNU: u32 = 1;
45-
pub const __USE_FORTIFY_LEVEL: u32 = 0;
46-
pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
47-
pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
48-
pub const __GLIBC_USE_C23_STRTOL: u32 = 1;
49-
pub const _STDC_PREDEF_H: u32 = 1;
50-
pub const __STDC_IEC_559__: u32 = 1;
51-
pub const __STDC_IEC_60559_BFP__: u32 = 201404;
52-
pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
53-
pub const __STDC_IEC_60559_COMPLEX__: u32 = 201404;
54-
pub const __STDC_ISO_10646__: u32 = 201706;
55-
pub const __GNU_LIBRARY__: u32 = 6;
56-
pub const __GLIBC__: u32 = 2;
57-
pub const __GLIBC_MINOR__: u32 = 40;
58-
pub const _SYS_CDEFS_H: u32 = 1;
59-
pub const __glibc_c99_flexarr_available: u32 = 1;
60-
pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0;
61-
pub const __HAVE_GENERIC_SELECTION: u32 = 0;
62-
pub const __GLIBC_USE_LIB_EXT2: u32 = 1;
63-
pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 1;
64-
pub const __GLIBC_USE_IEC_60559_BFP_EXT_C23: u32 = 1;
65-
pub const __GLIBC_USE_IEC_60559_EXT: u32 = 1;
66-
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 1;
67-
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C23: u32 = 1;
68-
pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 1;
69-
pub const _BITS_TYPES_H: u32 = 1;
70-
pub const _BITS_TYPESIZES_H: u32 = 1;
71-
pub const __OFF_T_MATCHES_OFF64_T: u32 = 1;
72-
pub const __INO_T_MATCHES_INO64_T: u32 = 1;
73-
pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1;
74-
pub const __STATFS_MATCHES_STATFS64: u32 = 1;
75-
pub const __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64: u32 = 1;
76-
pub const __FD_SETSIZE: u32 = 1024;
77-
pub const _BITS_TIME64_H: u32 = 1;
78-
pub const _BITS_WCHAR_H: u32 = 1;
79-
pub const _BITS_STDINT_INTN_H: u32 = 1;
80-
pub const _BITS_STDINT_UINTN_H: u32 = 1;
81-
pub const _BITS_STDINT_LEAST_H: u32 = 1;
82-
pub const INT8_MIN: i32 = -128;
83-
pub const INT16_MIN: i32 = -32768;
84-
pub const INT32_MIN: i32 = -2147483648;
85-
pub const INT8_MAX: u32 = 127;
86-
pub const INT16_MAX: u32 = 32767;
87-
pub const INT32_MAX: u32 = 2147483647;
88-
pub const UINT8_MAX: u32 = 255;
89-
pub const UINT16_MAX: u32 = 65535;
90-
pub const UINT32_MAX: u32 = 4294967295;
91-
pub const INT_LEAST8_MIN: i32 = -128;
92-
pub const INT_LEAST16_MIN: i32 = -32768;
93-
pub const INT_LEAST32_MIN: i32 = -2147483648;
94-
pub const INT_LEAST8_MAX: u32 = 127;
95-
pub const INT_LEAST16_MAX: u32 = 32767;
96-
pub const INT_LEAST32_MAX: u32 = 2147483647;
97-
pub const UINT_LEAST8_MAX: u32 = 255;
98-
pub const UINT_LEAST16_MAX: u32 = 65535;
99-
pub const UINT_LEAST32_MAX: u32 = 4294967295;
100-
pub const INT_FAST8_MIN: i32 = -128;
101-
pub const INT_FAST16_MIN: i64 = -9223372036854775808;
102-
pub const INT_FAST32_MIN: i64 = -9223372036854775808;
103-
pub const INT_FAST8_MAX: u32 = 127;
104-
pub const INT_FAST16_MAX: u64 = 9223372036854775807;
105-
pub const INT_FAST32_MAX: u64 = 9223372036854775807;
106-
pub const UINT_FAST8_MAX: u32 = 255;
107-
pub const UINT_FAST16_MAX: i32 = -1;
108-
pub const UINT_FAST32_MAX: i32 = -1;
109-
pub const INTPTR_MIN: i64 = -9223372036854775808;
110-
pub const INTPTR_MAX: u64 = 9223372036854775807;
111-
pub const UINTPTR_MAX: i32 = -1;
112-
pub const PTRDIFF_MIN: i64 = -9223372036854775808;
113-
pub const PTRDIFF_MAX: u64 = 9223372036854775807;
114-
pub const SIG_ATOMIC_MIN: i32 = -2147483648;
115-
pub const SIG_ATOMIC_MAX: u32 = 2147483647;
116-
pub const SIZE_MAX: i32 = -1;
117-
pub const WINT_MIN: u32 = 0;
118-
pub const WINT_MAX: u32 = 4294967295;
119-
pub const INT8_WIDTH: u32 = 8;
120-
pub const UINT8_WIDTH: u32 = 8;
121-
pub const INT16_WIDTH: u32 = 16;
122-
pub const UINT16_WIDTH: u32 = 16;
123-
pub const INT32_WIDTH: u32 = 32;
124-
pub const UINT32_WIDTH: u32 = 32;
125-
pub const INT64_WIDTH: u32 = 64;
126-
pub const UINT64_WIDTH: u32 = 64;
127-
pub const INT_LEAST8_WIDTH: u32 = 8;
128-
pub const UINT_LEAST8_WIDTH: u32 = 8;
129-
pub const INT_LEAST16_WIDTH: u32 = 16;
130-
pub const UINT_LEAST16_WIDTH: u32 = 16;
131-
pub const INT_LEAST32_WIDTH: u32 = 32;
132-
pub const UINT_LEAST32_WIDTH: u32 = 32;
133-
pub const INT_LEAST64_WIDTH: u32 = 64;
134-
pub const UINT_LEAST64_WIDTH: u32 = 64;
135-
pub const INT_FAST8_WIDTH: u32 = 8;
136-
pub const UINT_FAST8_WIDTH: u32 = 8;
137-
pub const INT_FAST16_WIDTH: u32 = 64;
138-
pub const UINT_FAST16_WIDTH: u32 = 64;
139-
pub const INT_FAST32_WIDTH: u32 = 64;
140-
pub const UINT_FAST32_WIDTH: u32 = 64;
141-
pub const INT_FAST64_WIDTH: u32 = 64;
142-
pub const UINT_FAST64_WIDTH: u32 = 64;
143-
pub const INTPTR_WIDTH: u32 = 64;
144-
pub const UINTPTR_WIDTH: u32 = 64;
145-
pub const INTMAX_WIDTH: u32 = 64;
146-
pub const UINTMAX_WIDTH: u32 = 64;
147-
pub const PTRDIFF_WIDTH: u32 = 64;
148-
pub const SIG_ATOMIC_WIDTH: u32 = 32;
149-
pub const SIZE_WIDTH: u32 = 64;
150-
pub const WCHAR_WIDTH: u32 = 32;
151-
pub const WINT_WIDTH: u32 = 32;
1523
pub const R_ACCESS: u32 = 0;
1534
pub const W_ACCESS: u32 = 1;
1545
pub const RW_ACCESS: u32 = 2;
1556
pub const RWE_ACCESS: u32 = 3;
156-
pub type __u_char = ::std::os::raw::c_uchar;
157-
pub type __u_short = ::std::os::raw::c_ushort;
158-
pub type __u_int = ::std::os::raw::c_uint;
159-
pub type __u_long = ::std::os::raw::c_ulong;
160-
pub type __int8_t = ::std::os::raw::c_schar;
161-
pub type __uint8_t = ::std::os::raw::c_uchar;
162-
pub type __int16_t = ::std::os::raw::c_short;
163-
pub type __uint16_t = ::std::os::raw::c_ushort;
164-
pub type __int32_t = ::std::os::raw::c_int;
165-
pub type __uint32_t = ::std::os::raw::c_uint;
166-
pub type __int64_t = ::std::os::raw::c_long;
167-
pub type __uint64_t = ::std::os::raw::c_ulong;
168-
pub type __int_least8_t = __int8_t;
169-
pub type __uint_least8_t = __uint8_t;
170-
pub type __int_least16_t = __int16_t;
171-
pub type __uint_least16_t = __uint16_t;
172-
pub type __int_least32_t = __int32_t;
173-
pub type __uint_least32_t = __uint32_t;
174-
pub type __int_least64_t = __int64_t;
175-
pub type __uint_least64_t = __uint64_t;
176-
pub type __quad_t = ::std::os::raw::c_long;
177-
pub type __u_quad_t = ::std::os::raw::c_ulong;
178-
pub type __intmax_t = ::std::os::raw::c_long;
179-
pub type __uintmax_t = ::std::os::raw::c_ulong;
180-
pub type __dev_t = ::std::os::raw::c_ulong;
181-
pub type __uid_t = ::std::os::raw::c_uint;
182-
pub type __gid_t = ::std::os::raw::c_uint;
183-
pub type __ino_t = ::std::os::raw::c_ulong;
184-
pub type __ino64_t = ::std::os::raw::c_ulong;
185-
pub type __mode_t = ::std::os::raw::c_uint;
186-
pub type __nlink_t = ::std::os::raw::c_ulong;
187-
pub type __off_t = ::std::os::raw::c_long;
188-
pub type __off64_t = ::std::os::raw::c_long;
189-
pub type __pid_t = ::std::os::raw::c_int;
190-
#[repr(C)]
191-
#[derive(Debug, Copy, Clone)]
192-
pub struct __fsid_t {
193-
pub __val: [::std::os::raw::c_int; 2usize],
194-
}
195-
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
196-
const _: () = {
197-
["Size of __fsid_t"][::std::mem::size_of::<__fsid_t>() - 8usize];
198-
["Alignment of __fsid_t"][::std::mem::align_of::<__fsid_t>() - 4usize];
199-
["Offset of field: __fsid_t::__val"][::std::mem::offset_of!(__fsid_t, __val) - 0usize];
200-
};
201-
pub type __clock_t = ::std::os::raw::c_long;
202-
pub type __rlim_t = ::std::os::raw::c_ulong;
203-
pub type __rlim64_t = ::std::os::raw::c_ulong;
204-
pub type __id_t = ::std::os::raw::c_uint;
205-
pub type __time_t = ::std::os::raw::c_long;
206-
pub type __useconds_t = ::std::os::raw::c_uint;
207-
pub type __suseconds_t = ::std::os::raw::c_long;
208-
pub type __suseconds64_t = ::std::os::raw::c_long;
209-
pub type __daddr_t = ::std::os::raw::c_int;
210-
pub type __key_t = ::std::os::raw::c_int;
211-
pub type __clockid_t = ::std::os::raw::c_int;
212-
pub type __timer_t = *mut ::std::os::raw::c_void;
213-
pub type __blksize_t = ::std::os::raw::c_long;
214-
pub type __blkcnt_t = ::std::os::raw::c_long;
215-
pub type __blkcnt64_t = ::std::os::raw::c_long;
216-
pub type __fsblkcnt_t = ::std::os::raw::c_ulong;
217-
pub type __fsblkcnt64_t = ::std::os::raw::c_ulong;
218-
pub type __fsfilcnt_t = ::std::os::raw::c_ulong;
219-
pub type __fsfilcnt64_t = ::std::os::raw::c_ulong;
220-
pub type __fsword_t = ::std::os::raw::c_long;
221-
pub type __ssize_t = ::std::os::raw::c_long;
222-
pub type __syscall_slong_t = ::std::os::raw::c_long;
223-
pub type __syscall_ulong_t = ::std::os::raw::c_ulong;
224-
pub type __loff_t = __off64_t;
225-
pub type __caddr_t = *mut ::std::os::raw::c_char;
226-
pub type __intptr_t = ::std::os::raw::c_long;
227-
pub type __socklen_t = ::std::os::raw::c_uint;
228-
pub type __sig_atomic_t = ::std::os::raw::c_int;
229-
pub type int_least8_t = __int_least8_t;
230-
pub type int_least16_t = __int_least16_t;
231-
pub type int_least32_t = __int_least32_t;
232-
pub type int_least64_t = __int_least64_t;
233-
pub type uint_least8_t = __uint_least8_t;
234-
pub type uint_least16_t = __uint_least16_t;
235-
pub type uint_least32_t = __uint_least32_t;
236-
pub type uint_least64_t = __uint_least64_t;
237-
pub type int_fast8_t = ::std::os::raw::c_schar;
238-
pub type int_fast16_t = ::std::os::raw::c_long;
239-
pub type int_fast32_t = ::std::os::raw::c_long;
240-
pub type int_fast64_t = ::std::os::raw::c_long;
241-
pub type uint_fast8_t = ::std::os::raw::c_uchar;
242-
pub type uint_fast16_t = ::std::os::raw::c_ulong;
243-
pub type uint_fast32_t = ::std::os::raw::c_ulong;
244-
pub type uint_fast64_t = ::std::os::raw::c_ulong;
245-
pub type intmax_t = __intmax_t;
246-
pub type uintmax_t = __uintmax_t;
7+
pub type int_least64_t = i64;
8+
pub type uint_least64_t = u64;
9+
pub type int_fast64_t = i64;
10+
pub type uint_fast64_t = u64;
11+
pub type int_least32_t = i32;
12+
pub type uint_least32_t = u32;
13+
pub type int_fast32_t = i32;
14+
pub type uint_fast32_t = u32;
15+
pub type int_least16_t = i16;
16+
pub type uint_least16_t = u16;
17+
pub type int_fast16_t = i16;
18+
pub type uint_fast16_t = u16;
19+
pub type int_least8_t = i8;
20+
pub type uint_least8_t = u8;
21+
pub type int_fast8_t = i8;
22+
pub type uint_fast8_t = u8;
23+
pub type intmax_t = ::std::os::raw::c_long;
24+
pub type uintmax_t = ::std::os::raw::c_ulong;
24725
#[doc = " \\struct bankSector.\n \\brief This stucture indicates the sectors parameters."]
24826
#[repr(C)]
24927
#[derive(Debug, Copy, Clone)]

stm32cubeprogrammer-sys/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
include!("bindings_windows.rs");
1111

1212
#[cfg(unix)]
13-
include!("bindings_unix.rs");
13+
include!("bindings_linux.rs");
1414

1515
// Re-export libloading so that the user doesn't have to depend on it
1616
pub use libloading;

0 commit comments

Comments
 (0)