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}/MemoryManagerBindings.h: src/lib.rs
cbindgen -c cbindgen.toml $? -o $@
${INTERFACES}/MemoryManagerBindings.h: src/lib.rs cbindgen.toml
cbindgen -c cbindgen.toml src/lib.rs -o $@

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,6 +2,10 @@ language = "C"
include_guard = "__TIMER_SERVICE_BINDINGS_H__"
autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
no_includes = true
includes = ["CamkesBindings.h"]
[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. */
#include "CamkesBindings.h"
#define RAW_OBJ_DESC_DATA_SIZE 2048
#define RAW_MEMORY_STATS_DATA_SIZE 100
@ -12,6 +14,7 @@ typedef enum MemoryManagerError {
MmeObjCountInvalid,
MmeObjTypeInvalid,
MmeObjCapInvalid,
MmeCapAllocFailed,
MmeSerializeFailed,
MmeDeserializeFailed,
MmeUnknownError,

View File

@ -3,6 +3,11 @@
/* 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 {
MlCoordOk,
InvalidModelId,

View File

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

View File

@ -3,6 +3,8 @@
/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
#include "CamkesBindings.h"
#define SECURITY_REPLY_DATA_SIZE 2048
typedef enum SecurityRequest {
@ -16,6 +18,7 @@ typedef enum SecurityRequest {
SrReadKey,
SrWriteKey,
SrDeleteKey,
SrTestMailbox,
} SecurityRequest;
typedef enum SecurityRequestError {
@ -43,6 +46,7 @@ typedef enum SecurityRequestError {
SreReadFailed,
SreWriteFailed,
SreDeleteFailed,
SreTestFailed,
} SecurityRequestError;
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. */
#include "CamkesBindings.h"
#define KEY_VALUE_DATA_SIZE 100
typedef enum StorageManagerError {

View File

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