bindings generator
This commit is contained in:
parent
e1179c292d
commit
ae9a4029d0
@ -1,6 +0,0 @@
|
||||
|
||||
#include <FreeRTOS.h>
|
||||
#include <FreeRTOSConfig.h>
|
||||
#include <task.h>
|
||||
#include <list.h>
|
||||
#include "../../Source/tasks.c"
|
8
FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/bindings/bindgen.h
Normal file
8
FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/bindings/bindgen.h
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
#include <FreeRTOS.h>
|
||||
#include <FreeRTOSConfig.h>
|
||||
#include <task.h>
|
||||
#include <list.h>
|
||||
#include <queue.h>
|
||||
#include "../../../Source/queue.c"
|
||||
#include "../../../Source/tasks.c"
|
4
FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/bindings/header.rs
Normal file
4
FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/bindings/header.rs
Normal file
@ -0,0 +1,4 @@
|
||||
#![allow(non_camel_case_types,non_snake_case,non_upper_case_globals,deref_nullptr,unused)]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/*========== Start of generated Code =============*/
|
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
rm -f bindings.i bindings.rs _bindings.rs _header.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" \
|
||||
-- --target=armv7a-none-eabi > _bindings.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
|
||||
|
||||
rm -f bindings.i _bindings.rs _header.rs
|
@ -1,8 +0,0 @@
|
||||
// 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;
|
||||
|
@ -1,3 +0,0 @@
|
||||
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-z]*|\*const [A-Z:a-z_]*char" build/bindings.rs | sort | uniq)" > build/header.rs
|
Loading…
x
Reference in New Issue
Block a user