kata-os-camkes: export C bindings for better CAmkES integration

In particular this exports the CAP_RELEASE flag so there is a single
source for it's definition and KataOS-specific support in the CAmkES
templates is enabled only for KataOS components.

Specific changes:
- adds cbindgen-generated CamkesBindings.h
- adds include of CamkesBindings.h in component cbindgen files
- add a dep on cbindgen.toml in all Makefiles
- update generated interface files

Change-Id: Ib6239d3ac0036b7a04bb36afccf25a05737b0e56
GitOrigin-RevId: af10117fa253f0c7c67969a5852ced9d992c6274
This commit is contained in:
Sam Leffler 2022-06-23 17:33:32 +00:00
parent f67ae5616c
commit 67442dc8f0
21 changed files with 85 additions and 19 deletions

View File

@ -1,4 +1,4 @@
INTERFACES=../../../interfaces INTERFACES=../../../interfaces
${INTERFACES}/MemoryManagerBindings.h: src/lib.rs ${INTERFACES}/MemoryManagerBindings.h: src/lib.rs cbindgen.toml
cbindgen -c cbindgen.toml $? -o $@ cbindgen -c cbindgen.toml src/lib.rs -o $@

View File

@ -2,6 +2,12 @@ language = "C"
include_guard = "__MEMORY_MANAGER_BINDINGS_H__" include_guard = "__MEMORY_MANAGER_BINDINGS_H__"
autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
no_includes = true no_includes = true
includes = ["CamkesBindings.h"]
[export] [export]
include = ["RawPageDescData", "RawMemoryStatsData", "MemoryManagerStats", "MemoryManagerError"] include = [
"RawPageDescData",
"RawMemoryStatsData",
"MemoryManagerStats",
"MemoryManagerError",
]

View File

@ -1,4 +1,4 @@
INTERFACES=../../../interfaces INTERFACES=../../../interfaces
${INTERFACES}/MlCoordBindings.h: src/lib.rs ${INTERFACES}/MlCoordBindings.h: src/lib.rs cbindgen.toml
cbindgen -c cbindgen.toml $? -o $@ cbindgen -c cbindgen.toml src/lib.rs -o $@

View File

@ -2,6 +2,9 @@ language = "C"
include_guard = "__ML_COORDINATOR_BINDINGS_H__" include_guard = "__ML_COORDINATOR_BINDINGS_H__"
autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
no_includes = true no_includes = true
includes = ["CamkesBindings.h"]
[export] [export]
include = ["MlCoordError"] include = [
"MlCoordError",
]

View File

@ -1,4 +1,4 @@
INTERFACES=../../../interfaces INTERFACES=../../../interfaces
${INTERFACES}/ProcessManagerBindings.h: src/lib.rs ${INTERFACES}/ProcessManagerBindings.h: src/lib.rs cbindgen.toml
cbindgen -c cbindgen.toml $? -o $@ cbindgen -c cbindgen.toml src/lib.rs -o $@

View File

@ -2,6 +2,10 @@ language = "C"
include_guard = "__PROCESS_MANAGER_BINDINGS_H__" include_guard = "__PROCESS_MANAGER_BINDINGS_H__"
autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
no_includes = true no_includes = true
includes = ["CamkesBindings.h"]
[export] [export]
include = ["RawBundleIdData", "ProcessManagerError"] include = [
"RawBundleIdData",
"ProcessManagerError",
]

View File

@ -1,4 +1,4 @@
INTERFACES=../../../interfaces INTERFACES=../../../interfaces
${INTERFACES}/SecurityCoordinatorBindings.h: src/lib.rs ${INTERFACES}/SecurityCoordinatorBindings.h: src/lib.rs cbindgen.toml
cbindgen -c cbindgen.toml $? -o $@ cbindgen -c cbindgen.toml src/lib.rs -o $@

View File

@ -2,6 +2,12 @@ language = "C"
include_guard = "__SECURITY_COORDINATOR_BINDINGS_H__" include_guard = "__SECURITY_COORDINATOR_BINDINGS_H__"
autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
no_includes = true no_includes = true
includes = ["CamkesBindings.h"]
[export] [export]
include = ["SecurityRequestData", "SecurityReplyData", "SecurityRequest", "SecurityRequestError"] include = [
"SecurityRequestData",
"SecurityReplyData",
"SecurityRequest",
"SecurityRequestError",
]

View File

@ -1,4 +1,4 @@
INTERFACES=../../../interfaces INTERFACES=../../../interfaces
${INTERFACES}/StorageManagerBindings.h: src/lib.rs ${INTERFACES}/StorageManagerBindings.h: src/lib.rs cbindgen.toml
cbindgen -c cbindgen.toml $? -o $@ cbindgen -c cbindgen.toml src/lib.rs -o $@

View File

@ -2,6 +2,10 @@ language = "C"
include_guard = "__STORAGE_MANAGER_BINDINGS_H__" include_guard = "__STORAGE_MANAGER_BINDINGS_H__"
autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
no_includes = true no_includes = true
includes = ["CamkesBindings.h"]
[export] [export]
include = ["KeyValueData", "StorageManagerError"] include = [
"KeyValueData",
"StorageManagerError",
]

View File

@ -1,4 +1,4 @@
INTERFACES=../../../interfaces INTERFACES=../../../interfaces
${INTERFACES}/TimerServiceBindings.h: src/lib.rs ${INTERFACES}/TimerServiceBindings.h: src/lib.rs cbindgen.toml
cbindgen -c cbindgen.toml $? -o $@ cbindgen -c cbindgen.toml src/lib.rs -o $@

View File

@ -2,6 +2,10 @@ language = "C"
include_guard = "__TIMER_SERVICE_BINDINGS_H__" include_guard = "__TIMER_SERVICE_BINDINGS_H__"
autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
no_includes = true no_includes = true
includes = ["CamkesBindings.h"]
[export] [export]
include = ["TimerServiceError", "TimerId"] include = [
"TimerServiceError",
"TimerId",
]

View File

@ -0,0 +1,4 @@
INTERFACES=../../../../interfaces
${INTERFACES}/CamkesBindings.h: src/lib.rs cbindgen.toml
cbindgen -c cbindgen.toml src/lib.rs -o $@

View File

@ -0,0 +1,9 @@
language = "C"
include_guard = "__CAMKES_BINDINGS_H__"
autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
no_includes = true
[export]
include = [
"CAP_RELEASE",
]

View File

@ -0,0 +1,8 @@
#ifndef __CAMKES_BINDINGS_H__
#define __CAMKES_BINDINGS_H__
/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
#define CAP_RELEASE 2147483648
#endif /* __CAMKES_BINDINGS_H__ */

View File

@ -3,6 +3,8 @@
/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
#include "CamkesBindings.h"
#define RAW_OBJ_DESC_DATA_SIZE 2048 #define RAW_OBJ_DESC_DATA_SIZE 2048
#define RAW_MEMORY_STATS_DATA_SIZE 100 #define RAW_MEMORY_STATS_DATA_SIZE 100
@ -12,6 +14,7 @@ typedef enum MemoryManagerError {
MmeObjCountInvalid, MmeObjCountInvalid,
MmeObjTypeInvalid, MmeObjTypeInvalid,
MmeObjCapInvalid, MmeObjCapInvalid,
MmeCapAllocFailed,
MmeSerializeFailed, MmeSerializeFailed,
MmeDeserializeFailed, MmeDeserializeFailed,
MmeUnknownError, MmeUnknownError,

View File

@ -3,6 +3,11 @@
/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
#include "CamkesBindings.h"
/**
* Errors that can occur when interacting with the MlCoordinator.
*/
typedef enum MlCoordError { typedef enum MlCoordError {
MlCoordOk, MlCoordOk,
InvalidModelId, InvalidModelId,

View File

@ -3,6 +3,8 @@
/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
#include "CamkesBindings.h"
#define RAW_BUNDLE_ID_DATA_SIZE 100 #define RAW_BUNDLE_ID_DATA_SIZE 100
#define DEFAULT_BUNDLE_ID_CAPACITY 64 #define DEFAULT_BUNDLE_ID_CAPACITY 64

View File

@ -3,6 +3,8 @@
/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
#include "CamkesBindings.h"
#define SECURITY_REPLY_DATA_SIZE 2048 #define SECURITY_REPLY_DATA_SIZE 2048
typedef enum SecurityRequest { typedef enum SecurityRequest {
@ -16,6 +18,7 @@ typedef enum SecurityRequest {
SrReadKey, SrReadKey,
SrWriteKey, SrWriteKey,
SrDeleteKey, SrDeleteKey,
SrTestMailbox,
} SecurityRequest; } SecurityRequest;
typedef enum SecurityRequestError { typedef enum SecurityRequestError {
@ -43,6 +46,7 @@ typedef enum SecurityRequestError {
SreReadFailed, SreReadFailed,
SreWriteFailed, SreWriteFailed,
SreDeleteFailed, SreDeleteFailed,
SreTestFailed,
} SecurityRequestError; } SecurityRequestError;
typedef uint8_t SecurityReplyData[SECURITY_REPLY_DATA_SIZE]; typedef uint8_t SecurityReplyData[SECURITY_REPLY_DATA_SIZE];

View File

@ -3,6 +3,8 @@
/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
#include "CamkesBindings.h"
#define KEY_VALUE_DATA_SIZE 100 #define KEY_VALUE_DATA_SIZE 100
typedef enum StorageManagerError { typedef enum StorageManagerError {

View File

@ -3,12 +3,14 @@
/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
#include "CamkesBindings.h"
typedef enum TimerServiceError { typedef enum TimerServiceError {
TimerOk = 0, TimerOk = 0,
NoSuchTimer, NoSuchTimer,
TimerAlreadyExists, TimerAlreadyExists,
} TimerServiceError; } TimerServiceError;
typedef uintptr_t TimerId; typedef uint32_t TimerId;
#endif /* __TIMER_SERVICE_BINDINGS_H__ */ #endif /* __TIMER_SERVICE_BINDINGS_H__ */