From 1d5c22cd8a08273b197b566d9af90f0537e80f16 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 25 Mar 2026 03:04:46 -0400 Subject: [PATCH] sdk: Add initial SDK sources Signed-off-by: Ian Moffett --- src/m1x/kern/Makefile | 1 + src/sdk/include/_null.h | 14 ++++++ src/sdk/include/stdint.h | 95 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 src/sdk/include/_null.h create mode 100644 src/sdk/include/stdint.h diff --git a/src/m1x/kern/Makefile b/src/m1x/kern/Makefile index d4299e0..b02dce6 100644 --- a/src/m1x/kern/Makefile +++ b/src/m1x/kern/Makefile @@ -12,6 +12,7 @@ CFLAGS = \ $(SYS_CFLAGS) \ -D_KERNEL \ -MMD \ + -I../../sdk/include/ \ -DPRINTF_DISABLE_SUPPORT_PTRDIFF_T \ -DPRINTF_DISABLE_SUPPORT_FLOAT diff --git a/src/sdk/include/_null.h b/src/sdk/include/_null.h new file mode 100644 index 0000000..4f21f9a --- /dev/null +++ b/src/sdk/include/_null.h @@ -0,0 +1,14 @@ +#ifndef _SDK_NULL_H_ +#define _SDK_NULL_H_ 1 + +#if !defined(__cplusplus) +#define NULL ((void *)0) +#else +#if __cplusplus >= 201103L +#define NULL nullptr +#else +#define NULL ((void *)0) +#endif /* __cplusplus >= 201103L */ +#endif /* __cplusplus */ + +#endif /* !_SDK_NULL_H_ */ diff --git a/src/sdk/include/stdint.h b/src/sdk/include/stdint.h new file mode 100644 index 0000000..d00c024 --- /dev/null +++ b/src/sdk/include/stdint.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2026, Mirocom Laboratories + * Provided under the BSD-3 clause + */ + +#ifndef _SDK_STDINT_H_ +#define _SDK_STDINT_H_ 1 + +#if defined(_KERNEL) || defined(_M1X_SOURCE) +#include <_null.h> + +#ifndef bool +typedef _Bool bool; +#endif /* !bool */ + +#ifndef true +#define true 1 +#endif /* !true */ + +#ifndef false +#define false 0 +#endif /* !false */ + +#endif /* !_KERNEL || _M1X_SOURCE */ + +/* Unsigned types */ +typedef unsigned char __uint8_t; +typedef unsigned short __uint16_t; +typedef unsigned int __uint32_t; +typedef unsigned long long __uint64_t; +typedef __uint64_t __size_t; +typedef __uint64_t __uintptr_t; + +/* Signed types */ +typedef int __int8_t; +typedef short __int16_t; +typedef int __int32_t; +typedef long long __int64_t; +typedef __int64_t __ssize_t; +typedef __ssize_t __off_t; + +#if defined(_KERNEL) || defined(_M1X_SOURCE) +#ifndef uint8_t +typedef __uint8_t uint8_t; +#endif /* !uint8_t */ + +#ifndef uint16_t +typedef __uint16_t uint16_t; +#endif /* !uint16_t */ + +#ifndef uint32_t +typedef __uint32_t uint32_t; +#endif /* !uint32_t */ + +#ifndef uint64_t +typedef __uint64_t uint64_t; +#endif /* !uint64_t */ + +#ifndef uintptr_t +typedef __uint64_t uintptr_t; +#endif /* !uintptr_t */ + +#ifndef size_t +typedef __size_t size_t; +#endif /* !size_t */ + +#ifndef int8_t +typedef __int8_t int8_t; +#endif /* !int8_t */ + +#ifndef int16_t +typedef __int16_t int16_t; +#endif /* !int16_t */ + +#ifndef int16_t +typedef __int32_t int32_t; +#endif /* !int32_t */ + +#ifndef int64_t +typedef __int64_t int64_t; +#endif /* !int64_t */ + +#ifndef ssize_t +typedef __ssize_t ssize_t; +#endif /* !ssize_t */ + +#ifndef intmax_t +typedef __ssize_t intmax_t; +#endif /* !intmax_t */ + +#endif /* !_KERNEL || _M1X_SOURCE */ + +typedef int pid_t; + +#endif /* !_SDK_STDINT_H_ */