bindings generator++

This commit is contained in:
Alwin Berger 2025-05-06 11:17:05 +00:00
parent ae9a4029d0
commit 969ca1886d

View File

@ -1,17 +1,20 @@
#!/bin/sh
set -e
rm -f bindings.i bindings.rs _bindings.rs _header.rs
rm -f bindings.i bindings.rs _bindings.rs _header.rs _config.rs
arm-none-eabi-gcc -E bindgen.h \
-I ../../../Source/include -I ../../../Source/portable/GCC/ARM_CM3 -I .. > bindings.i
bindgen bindings.i --ignore-functions --no-layout-tests \
--allowlist-type "TaskStatus_t|List_t|QueueHandle_t|Queue_t|TCB_t" \
--allowlist-type "TaskStatus_t|List_t|QueueRegistryItem_t|QueueHandle_t|Queue_t|TCB_t" \
-- --target=armv7a-none-eabi > _bindings.rs
bindgen ../FreeRTOSConfig.h --ignore-functions --no-layout-tests > _config.rs
while IFS= read -r line; do
echo pub type $line = "::std::os::raw::c_uint;" | sed -f transform.sed
done <<< "$(grep -oE "\*mut [A-Z:_a-z0-9]*|\*const [A-Z:a-z_]*char" _bindings.rs | sort | uniq)" > _header.rs
cat header.rs _header.rs _bindings.rs | sed -f transform.sed > bindings.rs
cat header.rs _header.rs _config.rs _bindings.rs | sed -f transform.sed > bindings.rs
rm -f bindings.i _bindings.rs _header.rs
rm -f bindings.i _bindings.rs _header.rs _config.rs