init Files

This commit is contained in:
2024-12-09 19:47:18 +01:00
parent b55a8cd2bc
commit 528e862838
3471 changed files with 1105029 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
LVGL_PATH := $(CURDIR)/../..
ARCH = x86_64
CC = clang
$(info LVGL_PATH is set to: $(LVGL_PATH))
include ../../lvgl.mk
CSRCS += test.c
CFLAGS = -Werror -I$(LVGL_PATH)/.. -I$(CURDIR) \
-target $(ARCH)-unknown-windows -ffreestanding -fshort-wchar -mno-red-zone -fno-stack-protector -fno-stack-check -mno-red-zone \
-DLV_CONF_SKIP=1 \
-DLV_BUILD_TEST=1 \
-DLV_BUILD_EXAMPLES=0 \
-DLV_COLOR_DEPTH=32 \
-DLV_USE_STDLIB_MALLOC=LV_STDLIB_BUILTIN \
-DLV_USE_STDLIB_STRING=LV_STDLIB_BUILTIN \
-DLV_USE_STDLIB_SPRINTF=LV_STDLIB_BUILTIN \
-DLV_STDINT_INCLUDE=\"efi.h\" \
-DLV_STDINT_INCLUDE=\"efi.h\" \
-DLV_STDDEF_INCLUDE=\"efi.h\" \
-DLV_STDBOOL_INCLUDE=\"efi.h\" \
-DLV_INTTYPES_INCLUDE=\"efi.h\" \
-DLV_LIMITS_INCLUDE=\"efi.h\" \
-DLV_STDARG_INCLUDE=\"efi.h\"
LDFLAGS = -target $(ARCH)-unknown-windows -nostdlib -Wl,-entry:efi_main -Wl,-subsystem:efi_application -fuse-ld=lld-link
COBJS := $(patsubst $(LVGL_PATH)%,objs/%, $(CSRCS:.c=.o))
test_file: $(COBJS)
$(CC) -o $@ $^ $(LDFLAGS)
objs/%.o: $(LVGL_PATH)%.c
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -o $@ -c $^
clean:
rm -r $(CURDIR)/objs
rm test_file

View File

@@ -0,0 +1,160 @@
#ifndef __LVGL_TESTS_MAKEFILE_UEFI_EFI_H__
#define __LVGL_TESTS_MAKEFILE_UEFI_EFI_H__
#ifndef __clang__
#error This file is only for use with the clang compiler
#endif
/*************************************
* TYPES
*************************************/
#if defined(__x86_64__)
typedef unsigned long long UINT64;
typedef long long INT64;
typedef unsigned int UINT32;
typedef int INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef signed char INT8;
typedef UINT64 UINTN;
typedef INT64 INTN;
typedef INT64 INTMAX;
#elif defined(__i386__)
typedef unsigned long long UINT64;
typedef long long INT64;
typedef unsigned int UINT32;
typedef int INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef signed char INT8;
typedef UINT32 UINTN;
typedef INT32 INTN;
typedef INT64 INTMAX;
#elif defined(__aarch64__)
typedef unsigned long long UINT64;
typedef long long INT64;
typedef unsigned int UINT32;
typedef int INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef signed char INT8;
typedef UINT64 UINTN;
typedef INT64 INTN;
typedef INT64 INTMAX;
#else
#error Architecture is not supported
#endif
typedef UINT8 uint8_t;
typedef UINT16 uint16_t;
typedef UINT32 uint32_t;
typedef UINT64 uint64_t;
typedef INT8 int8_t;
typedef INT16 int16_t;
typedef INT32 int32_t;
typedef INT64 int64_t;
typedef void VOID;
typedef uint32_t uint_fast32_t;
typedef UINTN uintptr_t;
typedef UINTN size_t;
typedef INTN intptr_t;
typedef INTMAX intmax_t;
typedef INTN ptrdiff_t;
typedef UINT8 bool;
/*************************************
* DEFINES
*************************************/
#define false 0
#define true 1
#define NULL ((void*)0)
#define PRId8 "d"
#define PRId16 "d"
#define PRId32 "d"
#define PRId64 "d"
#define PRIu8 "u"
#define PRIu16 "u"
#define PRIu32 "u"
#define PRIu64 "u"
#define PRIx8 "x"
#define PRIx16 "x"
#define PRIx32 "x"
#define PRIx64 "x"
#define PRIX8 "X"
#define PRIX16 "X"
#define PRIX32 "X"
#define PRIX64 "X"
#define offsetof(TYPE, Field) ((UINTN) __builtin_offsetof(TYPE, Field))
/*************************************
* LIMITS
*************************************/
#define INT8_MAX (0x7F)
#define UINT8_MAX (0xFF)
#define INT16_MAX (0x7FFF)
#define UINT16_MAX (0xFFFF)
#define INT32_MAX (0x7FFFFFFF)
#define UINT32_MAX (0xFFFFFFFF)
#define INT64_MAX (0x7FFFFFFFFFFFFFFFULL)
#define UINT64_MAX (0xFFFFFFFFFFFFFFFFULL)
#define INT_MAX (0x7FFFFFFFFFFFFFFFULL)
#define UINT_MAX (0xFFFFFFFFFFFFFFFFULL)
///
/// Minimum values for the signed UEFI Data Types
///
#define INT8_MIN (( -127) - 1)
#define INT16_MIN (( -32767) - 1)
#define INT32_MIN (( -2147483647) - 1)
#define INT64_MIN (( -9223372036854775807LL) - 1)
#define SIZE_MAX (0xFFFFFFFF)
#define LONG_MAX (0x7FFFFFFF)
#define CHAR_BIT 8
/*************************************
* VA_ARG
*************************************/
typedef __builtin_va_list va_list;
#define va_start(Marker, Parameter) __builtin_va_start (Marker, Parameter)
#define va_arg(Marker, TYPE) ((sizeof (TYPE) < sizeof (UINTN)) ? (TYPE)(__builtin_va_arg (Marker, UINTN)) : (TYPE)(__builtin_va_arg (Marker, TYPE)))
#define va_end(Marker) __builtin_va_end (Marker)
#define va_copy(Dest, Start) __builtin_va_copy (Dest, Start)
/*************************************
* VERIFICATION
*************************************/
_Static_assert(sizeof(bool) == 1, "Size check for 'bool' failed.");
_Static_assert(sizeof(int8_t) == 1, "Size check for 'int8_t' failed.");
_Static_assert(sizeof(uint8_t) == 1, "Size check for 'uint8_t' failed.");
_Static_assert(sizeof(int16_t) == 2, "Size check for 'int16_t' failed.");
_Static_assert(sizeof(uint16_t) == 2, "Size check for 'uint16_t' failed.");
_Static_assert(sizeof(int32_t) == 4, "Size check for 'int32_t' failed.");
_Static_assert(sizeof(uint32_t) == 4, "Size check for 'uint32_t' failed.");
_Static_assert(sizeof(uint_fast32_t) == 4, "Size check for 'uint_fast32_t' failed.");
_Static_assert(sizeof(int64_t) == 8, "Size check for 'int64_t' failed.");
_Static_assert(sizeof(uint64_t) == 8, "Size check for 'uint64_t' failed.");
_Static_assert(sizeof(intptr_t) == sizeof(void *), "Size check for 'intptr_t' failed.");
_Static_assert(sizeof(ptrdiff_t) == sizeof(void *), "Size check for 'ptrdiff_t' failed.");
_Static_assert(sizeof(uintptr_t) == sizeof(void *), "Size check for 'uintptr_t' failed.");
#endif

View File

@@ -0,0 +1,35 @@
#if LV_BUILD_TEST
#include "../../lvgl.h"
int efi_main(void * image_handle, void * system_table)
{
lv_init();
return 0;
}
// memcpy is required as symbol for the clang compiler
void * memcpy(void * s, const void * ct, size_t n)
{
const uint8_t * ct_8 = (const uint8_t *) ct;
uint8_t * s_8 = (uint8_t *) s;
while(n-- > 0) {
*s_8++ = *ct_8++;
}
return s;
}
// memset is required as symbol for the clang compiler
void * memset(void * s, int c, size_t n)
{
uint8_t * s_8 = (uint8_t *)s;
while(n-- > 0) {
*s_8++ = (uint8_t)c;
}
return s;
}
#endif