From f2e48833e2fac5e7a51276925ec121694d378667 Mon Sep 17 00:00:00 2001 From: YuzukiTsuru Date: Sat, 3 Feb 2024 21:08:13 +0800 Subject: [PATCH] [arch] inbond stdinc --- cmake/board/100ask-ros.cmake | 2 +- cmake/board/100ask-t113i.cmake | 4 +-- cmake/board/100ask-t113s3.cmake | 4 +-- cmake/board/bingpi-m1.cmake | 4 +-- cmake/board/dongshanpi-aict.cmake | 4 +-- cmake/board/longanpi-3h.cmake | 2 +- cmake/board/longanpi-4b.cmake | 2 +- cmake/board/lt527x.cmake | 2 +- cmake/board/project-yosemite.cmake | 4 +-- cmake/board/tinyvision.cmake | 4 +-- cmake/board/yuzukicivi.cmake | 2 +- cmake/board/yuzukilizard.cmake | 4 +-- cmake/lib/generic_sun8iw21.cmake | 4 +-- include/arch/arm32/io.h | 2 +- include/arch/arm32/limits.h | 29 +++++++++++++++++++ include/arch/arm32/mmu.h | 2 +- include/arch/arm32/stdarg.h | 34 ++++++++++++++++++++++ include/arch/arm32/stdbool.h | 21 ++++++++++++++ include/arch/arm32/stddef.h | 43 ++++++++++++++++++++++++++++ include/arch/arm32/stdint.h | 45 ++++++++++++++++++++++++++++++ include/arch/arm32/stdlib.h | 0 include/arch/arm32/timer.h | 2 +- include/arch/arm32/types.h | 13 +-------- include/arch/riscv64/io.h | 2 +- include/common.h | 9 ++---- include/drivers/sys-gpio.h | 1 - src/cli/commands.c | 4 +-- 27 files changed, 202 insertions(+), 47 deletions(-) create mode 100644 include/arch/arm32/limits.h create mode 100644 include/arch/arm32/stdarg.h create mode 100644 include/arch/arm32/stdbool.h create mode 100644 include/arch/arm32/stddef.h create mode 100644 include/arch/arm32/stdint.h create mode 100644 include/arch/arm32/stdlib.h diff --git a/cmake/board/100ask-ros.cmake b/cmake/board/100ask-ros.cmake index 15918422..4acb8bdc 100644 --- a/cmake/board/100ask-ros.cmake +++ b/cmake/board/100ask-ros.cmake @@ -24,7 +24,7 @@ set(CROSS_COMPILE ${CROSS_COMPILE} CACHE STRING "CROSS_COMPILE Toolchain") set(CMAKE_C_COMPILER "${CROSS_COMPILE}gcc") set(CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++") -set(CMAKE_COMMON_FLAGS "-nostdlib -Os -mcpu=cortex-a53 -mno-unaligned-access") +set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -Os -mcpu=cortex-a53 -mno-unaligned-access") # Disable specific warning flags for C and C++ compilers set(CMAKE_C_DISABLE_WARN_FLAGS "-Wno-int-to-pointer-cast -Wno-discarded-qualifiers -Wno-implicit-function-declaration") diff --git a/cmake/board/100ask-t113i.cmake b/cmake/board/100ask-t113i.cmake index 6373f963..881de0ae 100644 --- a/cmake/board/100ask-t113i.cmake +++ b/cmake/board/100ask-t113i.cmake @@ -23,9 +23,9 @@ set(CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++") # Configure compiler flags based on ENABLE_HARDFP option if(ENABLE_HARDFP) - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") else() - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") endif() # Disable specific warning flags for C and C++ compilers diff --git a/cmake/board/100ask-t113s3.cmake b/cmake/board/100ask-t113s3.cmake index cf048122..652ee2b7 100644 --- a/cmake/board/100ask-t113s3.cmake +++ b/cmake/board/100ask-t113s3.cmake @@ -23,9 +23,9 @@ set(CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++") # Configure compiler flags based on ENABLE_HARDFP option if(ENABLE_HARDFP) - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") else() - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") endif() # Disable specific warning flags for C and C++ compilers diff --git a/cmake/board/bingpi-m1.cmake b/cmake/board/bingpi-m1.cmake index 0ae337bb..90404f06 100644 --- a/cmake/board/bingpi-m1.cmake +++ b/cmake/board/bingpi-m1.cmake @@ -25,9 +25,9 @@ set(CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++") # Configure compiler flags based on ENABLE_HARDFP option if(ENABLE_HARDFP) - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") else() - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") endif() # Disable specific warning flags for C and C++ compilers diff --git a/cmake/board/dongshanpi-aict.cmake b/cmake/board/dongshanpi-aict.cmake index b7966b17..8de49a58 100644 --- a/cmake/board/dongshanpi-aict.cmake +++ b/cmake/board/dongshanpi-aict.cmake @@ -23,9 +23,9 @@ set(CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++") # Configure compiler flags based on ENABLE_HARDFP option if(ENABLE_HARDFP) - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") else() - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") endif() # Disable specific warning flags for C and C++ compilers diff --git a/cmake/board/longanpi-3h.cmake b/cmake/board/longanpi-3h.cmake index 590867b0..807fb3d6 100644 --- a/cmake/board/longanpi-3h.cmake +++ b/cmake/board/longanpi-3h.cmake @@ -24,7 +24,7 @@ set(CROSS_COMPILE ${CROSS_COMPILE} CACHE STRING "CROSS_COMPILE Toolchain") set(CMAKE_C_COMPILER "${CROSS_COMPILE}gcc") set(CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++") -set(CMAKE_COMMON_FLAGS "-nostdlib -Os -mcpu=cortex-a53 -mno-unaligned-access") +set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -Os -mcpu=cortex-a53 -mno-unaligned-access") # Disable specific warning flags for C and C++ compilers set(CMAKE_C_DISABLE_WARN_FLAGS "-Wno-int-to-pointer-cast -Wno-discarded-qualifiers -Wno-implicit-function-declaration") diff --git a/cmake/board/longanpi-4b.cmake b/cmake/board/longanpi-4b.cmake index 1bd5351a..e2395ef4 100644 --- a/cmake/board/longanpi-4b.cmake +++ b/cmake/board/longanpi-4b.cmake @@ -24,7 +24,7 @@ set(CROSS_COMPILE ${CROSS_COMPILE} CACHE STRING "CROSS_COMPILE Toolchain") set(CMAKE_C_COMPILER "${CROSS_COMPILE}gcc") set(CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++") -set(CMAKE_COMMON_FLAGS "-nostdlib -Os -mcpu=cortex-a55") +set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -Os -mcpu=cortex-a55") # Disable specific warning flags for C and C++ compilers set(CMAKE_C_DISABLE_WARN_FLAGS "-Wno-int-to-pointer-cast -Wno-implicit-function-declaration -Wno-discarded-qualifiers") diff --git a/cmake/board/lt527x.cmake b/cmake/board/lt527x.cmake index fb14bd01..e42a17e6 100644 --- a/cmake/board/lt527x.cmake +++ b/cmake/board/lt527x.cmake @@ -24,7 +24,7 @@ set(CROSS_COMPILE ${CROSS_COMPILE} CACHE STRING "CROSS_COMPILE Toolchain") set(CMAKE_C_COMPILER "${CROSS_COMPILE}gcc") set(CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++") -set(CMAKE_COMMON_FLAGS "-nostdlib -Os -mcpu=cortex-a55") +set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -Os -mcpu=cortex-a55") # Disable specific warning flags for C and C++ compilers set(CMAKE_C_DISABLE_WARN_FLAGS "-Wno-int-to-pointer-cast -Wno-implicit-function-declaration -Wno-discarded-qualifiers") diff --git a/cmake/board/project-yosemite.cmake b/cmake/board/project-yosemite.cmake index 5852ca04..a08dd10b 100644 --- a/cmake/board/project-yosemite.cmake +++ b/cmake/board/project-yosemite.cmake @@ -23,9 +23,9 @@ set(CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++") # Configure compiler flags based on ENABLE_HARDFP option if(ENABLE_HARDFP) - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") else() - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") endif() # Disable specific warning flags for C and C++ compilers diff --git a/cmake/board/tinyvision.cmake b/cmake/board/tinyvision.cmake index de71af13..80d3b6bf 100644 --- a/cmake/board/tinyvision.cmake +++ b/cmake/board/tinyvision.cmake @@ -25,9 +25,9 @@ set(CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++") # Configure compiler flags based on ENABLE_HARDFP option if(ENABLE_HARDFP) - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") else() - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") endif() # Disable specific warning flags for C and C++ compilers diff --git a/cmake/board/yuzukicivi.cmake b/cmake/board/yuzukicivi.cmake index 424a1d62..c2768993 100644 --- a/cmake/board/yuzukicivi.cmake +++ b/cmake/board/yuzukicivi.cmake @@ -24,7 +24,7 @@ set(CROSS_COMPILE ${CROSS_COMPILE} CACHE STRING "CROSS_COMPILE Toolchain") set(CMAKE_C_COMPILER "${CROSS_COMPILE}gcc") set(CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++") -set(CMAKE_COMMON_FLAGS "-nostdlib -Os -mcpu=cortex-a53 -mno-unaligned-access") +set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -Os -mcpu=cortex-a53 -mno-unaligned-access") # Disable specific warning flags for C and C++ compilers set(CMAKE_C_DISABLE_WARN_FLAGS "-Wno-int-to-pointer-cast -Wno-discarded-qualifiers -Wno-implicit-function-declaration") diff --git a/cmake/board/yuzukilizard.cmake b/cmake/board/yuzukilizard.cmake index ac6a43a3..bd3c7a2b 100644 --- a/cmake/board/yuzukilizard.cmake +++ b/cmake/board/yuzukilizard.cmake @@ -23,9 +23,9 @@ set(CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++") # Configure compiler flags based on ENABLE_HARDFP option if(ENABLE_HARDFP) - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") else() - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") endif() # Disable specific warning flags for C and C++ compilers diff --git a/cmake/lib/generic_sun8iw21.cmake b/cmake/lib/generic_sun8iw21.cmake index 5a47d30b..6c8c65d1 100644 --- a/cmake/lib/generic_sun8iw21.cmake +++ b/cmake/lib/generic_sun8iw21.cmake @@ -22,9 +22,9 @@ set(CMAKE_CXX_COMPILER "${CROSS_COMPILE}g++") # Configure compiler flags based on ENABLE_HARDFP option if(ENABLE_HARDFP) - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=hard") else() - set(CMAKE_COMMON_FLAGS "-nostdlib -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") + set(CMAKE_COMMON_FLAGS "-nostdlib -nostdinc -g -ggdb -O3 -mcpu=cortex-a7 -mthumb-interwork -mthumb -mno-unaligned-access -mfpu=neon-vfpv4 -mfloat-abi=softfp") endif() # Disable specific warning flags for C and C++ compilers diff --git a/include/arch/arm32/io.h b/include/arch/arm32/io.h index c5a72cc9..c96c58f4 100644 --- a/include/arch/arm32/io.h +++ b/include/arch/arm32/io.h @@ -3,7 +3,7 @@ #ifndef __IO_H__ #define __IO_H__ -#include "types.h" +#include #define BIT(x) (1 << x) #define clrsetbits_le32(addr, clear, set) \ diff --git a/include/arch/arm32/limits.h b/include/arch/arm32/limits.h new file mode 100644 index 00000000..346beb27 --- /dev/null +++ b/include/arch/arm32/limits.h @@ -0,0 +1,29 @@ +#ifndef __LIMITS_H__ +#define __LIMITS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define INT8_MIN (-1 - 0x7f) +#define INT16_MIN (-1 - 0x7fff) +#define INT32_MIN (-1 - 0x7fffffff) +#define INT64_MIN (-1 - 0x7fffffffffffffff) + +#define INT8_MAX (0x7f) +#define INT16_MAX (0x7fff) +#define INT32_MAX (0x7fffffff) +#define INT64_MAX (0x7fffffffffffffff) + +#define INT_MAX (0x7fffffff) + +#define UINT8_MAX (0xff) +#define UINT16_MAX (0xffff) +#define UINT32_MAX (0xffffffffU) +#define UINT64_MAX (0xffffffffffffffffU) + +#ifdef __cplusplus +} +#endif + +#endif// __LIMITS_H__ \ No newline at end of file diff --git a/include/arch/arm32/mmu.h b/include/arch/arm32/mmu.h index b099c0d4..3c7e393f 100644 --- a/include/arch/arm32/mmu.h +++ b/include/arch/arm32/mmu.h @@ -7,7 +7,7 @@ extern "C" { #endif -#include + #include "timer.h" diff --git a/include/arch/arm32/stdarg.h b/include/arch/arm32/stdarg.h new file mode 100644 index 00000000..09361fee --- /dev/null +++ b/include/arch/arm32/stdarg.h @@ -0,0 +1,34 @@ +#ifndef __STDARG_H__ +#define __STDARG_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef __builtin_va_list va_list; + +/* + * prepare to access variable args + */ +#define va_start(v, l) __builtin_va_start(v, l) + +/* + * the caller will get the value of current argument + */ +#define va_arg(v, l) __builtin_va_arg(v, l) + +/* + * end for variable args + */ +#define va_end(v) __builtin_va_end(v) + +/* + * copy variable args + */ +#define va_copy(d, s) __builtin_va_copy(d, s) + +#ifdef __cplusplus +} +#endif + +#endif /* __STDARG_H__ */ \ No newline at end of file diff --git a/include/arch/arm32/stdbool.h b/include/arch/arm32/stdbool.h new file mode 100644 index 00000000..b8fbdf3b --- /dev/null +++ b/include/arch/arm32/stdbool.h @@ -0,0 +1,21 @@ +#ifndef __STDBOOL_H__ +#define __STDBOOL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +enum { + false = 0, + true = 1, +}; + +typedef uint8_t bool; + +#ifdef __cplusplus +} +#endif + +#endif // __STDBOOL_H__ \ No newline at end of file diff --git a/include/arch/arm32/stddef.h b/include/arch/arm32/stddef.h new file mode 100644 index 00000000..9067ab87 --- /dev/null +++ b/include/arch/arm32/stddef.h @@ -0,0 +1,43 @@ +#ifndef __STDDEF_H__ +#define __STDDEF_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__cplusplus) +#define NULL (0) +#else +#define NULL ((void *) 0) +#endif + +#if (defined(__GNUC__) && (__GNUC__ >= 4)) +#define offsetof(type, member) __builtin_offsetof(type, member) +#else +#define offsetof(type, field) ((size_t) (&((type *) 0)->field)) +#endif +#define container_of(ptr, type, member) ({const typeof(((type *)0)->member) *__mptr = (ptr); (type *)((char *)__mptr - offsetof(type,member)); }) + +#if (defined(__GNUC__) && (__GNUC__ >= 3)) +#define likely(expr) (__builtin_expect(!!(expr), 1)) +#define unlikely(expr) (__builtin_expect(!!(expr), 0)) +#else +#define likely(expr) (!!(expr)) +#define unlikely(expr) (!!(expr)) +#endif + +#define min(a, b) (((a) < (b)) ? (a) : (b)) +#define max(a, b) (((a) > (b)) ? (a) : (b)) + +#define clamp(v, a, b) min(max(a, v), b) + +#define ifloor(x) ((x) > 0 ? (int) (x) : (int) ((x) -0.9999999999)) +#define iround(x) ((x) > 0 ? (int) ((x) + 0.5) : (int) ((x) -0.5)) +#define iceil(x) ((x) > 0 ? (int) ((x) + 0.9999999999) : (int) (x)) +#define idiv255(x) ((((int) (x) + 1) * 257) >> 16) + +#ifdef __cplusplus +} +#endif + +#endif /* __STDDEF_H__ */ \ No newline at end of file diff --git a/include/arch/arm32/stdint.h b/include/arch/arm32/stdint.h new file mode 100644 index 00000000..78383ef7 --- /dev/null +++ b/include/arch/arm32/stdint.h @@ -0,0 +1,45 @@ +#ifndef __STDINT_H__ +#define __STDINT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef signed char s8_t; +typedef unsigned char u8_t; + +typedef signed short s16_t; +typedef unsigned short u16_t; + +typedef signed int s32_t; +typedef unsigned int u32_t; + +typedef signed long long s64_t; +typedef unsigned long long u64_t; + +typedef signed long long intmax_t; +typedef unsigned long long uintmax_t; + +typedef signed long long ptrdiff_t; +typedef signed long long intptr_t; +typedef unsigned long int uintptr_t; + +typedef s8_t int8_t; +typedef u8_t uint8_t; + +typedef s16_t int16_t; +typedef u16_t uint16_t; + +typedef s32_t int32_t; +typedef u32_t uint32_t; + +typedef s64_t int64_t; +typedef u64_t uint64_t; + +#ifdef __cplusplus +} +#endif + +#endif /* __STDINT_H__ */ \ No newline at end of file diff --git a/include/arch/arm32/stdlib.h b/include/arch/arm32/stdlib.h new file mode 100644 index 00000000..e69de29b diff --git a/include/arch/arm32/timer.h b/include/arch/arm32/timer.h index 2937d5f3..81ac51d4 100644 --- a/include/arch/arm32/timer.h +++ b/include/arch/arm32/timer.h @@ -7,7 +7,7 @@ #include #include #include -#include + #include #include "log.h" diff --git a/include/arch/arm32/types.h b/include/arch/arm32/types.h index 014d110a..b70a5d03 100644 --- a/include/arch/arm32/types.h +++ b/include/arch/arm32/types.h @@ -4,6 +4,7 @@ #define __ASM_ARM_TYPES_H typedef unsigned short umode_t; +typedef unsigned long size_t; /* * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the @@ -43,18 +44,6 @@ typedef unsigned long long u64; typedef float f32; typedef double f64; -typedef signed char int8_t; -typedef unsigned char uint8_t; - -typedef signed short int16_t; -typedef unsigned short uint16_t; - -typedef signed int int32_t; -typedef unsigned int uint32_t; - -typedef signed long long int64_t; -typedef unsigned long long uint64_t; - #ifdef CONFIG_ARM64 #define BITS_PER_LONG 64 #else /* CONFIG_ARM64 */ diff --git a/include/arch/riscv64/io.h b/include/arch/riscv64/io.h index 0eea9113..cb79dca0 100644 --- a/include/arch/riscv64/io.h +++ b/include/arch/riscv64/io.h @@ -3,7 +3,7 @@ #ifndef __IO_H__ #define __IO_H__ -#include + #define BIT(x) (1 << x) #define clrsetbits_le32(addr, clear, set) \ diff --git a/include/common.h b/include/common.h index 32799815..59f48b37 100644 --- a/include/common.h +++ b/include/common.h @@ -9,17 +9,14 @@ #include #ifdef __cplusplus -extern "C" { -#endif // __cplusplus +extern "C" { +#endif// __cplusplus #define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) #define ALIGN(size, align) (((size) + (align) -1) & (~((align) -1))) #define OF_ALIGN(size) ALIGN(size, 4) -#define min(a, b) (((a) < (b)) ? (a) : (b)) -#define max(a, b) (((a) > (b)) ? (a) : (b)) - #ifndef NULL #define NULL 0 #endif @@ -46,6 +43,6 @@ void show_banner(void); #ifdef __cplusplus } -#endif // __cplusplus +#endif// __cplusplus #endif// __COMMON_H__ \ No newline at end of file diff --git a/include/drivers/sys-gpio.h b/include/drivers/sys-gpio.h index d42d6a3f..c10f52dc 100644 --- a/include/drivers/sys-gpio.h +++ b/include/drivers/sys-gpio.h @@ -3,7 +3,6 @@ #ifndef __SYS_GPIO_H__ #define __SYS_GPIO_H__ -#include #include #include #include diff --git a/src/cli/commands.c b/src/cli/commands.c index 927ac27c..6f855554 100644 --- a/src/cli/commands.c +++ b/src/cli/commands.c @@ -1,6 +1,4 @@ /* SPDX-License-Identifier: Apache-2.0 */ - -#include #include #include @@ -93,7 +91,7 @@ static int cmd_read32(int argc, const char **argv) { static int cmd_write32(int argc, const char **argv) { if (argc < 3) { - printf("Usage: write32 [address] [data]\n"); + printk(LOG_LEVEL_MUTE, "Usage: write32 [address] [data]\n"); return -1; } uint32_t addr = (uint32_t) simple_strtoul(argv[1], NULL, 16);