add rust bindings

This commit is contained in:
Alwin Berger 2022-01-28 10:31:28 +01:00
parent 2737938bff
commit c276778a1c
4 changed files with 31 additions and 0 deletions

View File

@ -111,3 +111,16 @@ ${BUILD_DIR}/%.o : %.c Makefile
clean:
-rm -rf build
${BUILD_DIR}/bindgen.i : bindgen.h
$(CC) -E bindgen.h -o $(BUILD_DIR)/bindgen.i $(CFLAGS) $(CPPFLAGS)
${BUILD_DIR}/bindgen.rs : ${BUILD_DIR}/bindgen.i
bindgen --allowlist-type "List_t|TaskHandle_t|TaskStatus_t|TCB_t" ${BUILD_DIR}/bindgen.i -o ${BUILD_DIR}/bindings.rs
sed -i -f transform.sed build/bindings.rs
cat typeheader.rs build/bindings.rs > build/bindings_2.rs
# --ctypes-prefix compat_types
# bindgen --new-type-alias void --default-alias-style new_type --allowlist-type "List_t|TaskHandle_t|TaskStatus_t|TCB_t" ${BUILD_DIR}/bindgen.i -o ${BUILD_DIR}/bindings.rs
binder:
bindgen --ignore-methods --no-include-path-detection --allowlist-type "List_t|TaskHandle_t|TaskStatus_t|TCB_t" bindgen.h -o ${BUILD_DIR}/bindings.rs -- $(CC) $(CFLAGS) $(CPPFLAGS) -I/nix/store/2f638ck7i6161b9vhgbdw7fp1r4k643v-gcc-arm-embedded-10.3.1/lib/gcc/arm-none-eabi/10.3.1/include -I/nix/store/2f638ck7i6161b9vhgbdw7fp1r4k643v-gcc-arm-embedded-10.3.1/arm-none-eabi/include/ -MMD

View File

@ -0,0 +1,6 @@
#include <FreeRTOS.h>
#include <FreeRTOSConfig.h>
#include <task.h>
#include <list.h>
#include "../../Source/tasks.c"

View File

@ -0,0 +1,4 @@
s@::c_ulong@::c_uint@
s@*mut ::std::os::raw::c_void@void_ptr@
s@*const ::std::os::raw::c_char@char_ptr@
s@*mut \([A-Z,_,a-z]*\),@\1_ptr,@

View File

@ -0,0 +1,8 @@
// Manual Types
pub type xLIST_ITEM_ptr = ::std::os::raw::c_uint;
pub type xLIST_ptr = ::std::os::raw::c_uint;
pub type ListItem_t_ptr = ::std::os::raw::c_uint;
pub type StackType_t_ptr = ::std::os::raw::c_uint;
pub type char_ptr = ::std::os::raw::c_uint;
pub type void_ptr = ::std::os::raw::c_uint;