feat(ci): Add CI test for UEFI build (#5964)

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
Michael Simon 2024-04-20 20:49:56 +02:00 committed by GitHub
parent 2c469279f5
commit 7cb266c086
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 284 additions and 15 deletions

23
.github/workflows/makefile_uefi.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: Check Makefile for UEFI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
name: Build using Makefile for UEFI
steps:
- uses: actions/checkout@v4
- uses: ammaraskar/gcc-problem-matcher@master
- name: Install prerequisites
run: scripts/install-prerequisites.sh
- name: Install clang
run: sudo apt-get install clang lld
- name: Build
working-directory: tests/makefile_uefi
run: make -j

View File

@ -1,5 +1,4 @@
#include "../../lv_examples.h"
#include <stdio.h>
#if LV_BUILD_EXAMPLES
#if LV_USE_IMGFONT

View File

@ -1,5 +1,3 @@
#include <stdlib.h>
#include "../../lv_examples.h"
#if LV_USE_LIST && LV_BUILD_EXAMPLES
@ -102,8 +100,8 @@ static void event_handler_swap(lv_event_t * e)
uint32_t cnt = lv_obj_get_child_count(list1);
for(int i = 0; i < 100; i++)
if(cnt > 1) {
lv_obj_t * obj = lv_obj_get_child(list1, rand() % cnt);
lv_obj_move_to_index(obj, rand() % cnt);
lv_obj_t * obj = lv_obj_get_child(list1, lv_rand(0, cnt));
lv_obj_move_to_index(obj, lv_rand(0, cnt));
if(currentButton != NULL) {
lv_obj_scroll_to_view(currentButton, LV_ANIM_ON);
}

View File

@ -6,12 +6,12 @@
* INCLUDES
*********************/
#include "lv_nuttx_libuv.h"
#include <stdlib.h>
#include "../../../lvgl.h"
#include "../../lvgl_private.h"
#if LV_USE_NUTTX
#include <stdlib.h>
#if LV_USE_NUTTX_LIBUV
#include <uv.h>

View File

@ -5,10 +5,10 @@
extern "C" {
#endif
#include <stdint.h>
#include "../../misc/lv_fs.h"
#if LV_USE_GIF
#include <stdint.h>
typedef struct _gd_Palette {
int size;

View File

@ -30,10 +30,9 @@ freely, subject to the following restrictions:
extern "C" {
#endif
#include <string.h> /*for size_t*/
#include "../../../lvgl.h"
#if LV_USE_LODEPNG
#include LV_STDDEF_INCLUDE /*for size_t*/
LV_ATTRIBUTE_EXTERN_DATA extern const char * LODEPNG_VERSION_STRING;
/*

View File

@ -121,7 +121,7 @@ static lv_result_t decoder_info(lv_image_decoder_t * decoder, const void * src,
const uint32_t * size = ((uint32_t *)img_dsc->data) + 4;
const uint8_t magic[] = {0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a};
if(data_size < sizeof(magic)) return LV_RESULT_INVALID;
if(memcmp(magic, img_dsc->data, sizeof(magic))) return LV_RESULT_INVALID;
if(lv_memcmp(magic, img_dsc->data, sizeof(magic))) return LV_RESULT_INVALID;
header->cf = LV_COLOR_FORMAT_ARGB8888;

View File

@ -21,11 +21,13 @@
* Software.
*/
#include "qrcodegen.h"
#include "../../misc/lv_assert.h"
#if LV_USE_QRCODE
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include "qrcodegen.h"
#include "../../misc/lv_assert.h"
#ifndef QRCODEGEN_TEST
#define testable static // Keep functions private
@ -1111,3 +1113,4 @@ int qrcodegen_version2size(int version)
return ((version - 1) * 4 + 21);
}
#endif

View File

@ -23,6 +23,9 @@
#pragma once
#include "../../../lvgl.h"
#ifdef LV_USE_QRCODE
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
@ -317,3 +320,5 @@ int qrcodegen_getMinFitVersion(enum qrcodegen_Ecc ecl, size_t dataLen);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -26,6 +26,7 @@
#include "tjpgd.h"
#if LV_USE_TJPGD
#if JD_FASTDECODE == 2
#define HUFF_BIT 10 /* Bit length to apply fast huffman decode */
@ -1135,3 +1136,4 @@ JRESULT jd_decomp(
return rc;
}
#endif

View File

@ -8,7 +8,11 @@
extern "C" {
#endif
#include "../../lv_conf_internal.h"
#include "tjpgdcnf.h"
#if LV_USE_TJPGD
#include <string.h>
#include <stdint.h>
@ -95,6 +99,7 @@ JRESULT jd_mcu_output(JDEC * jd, int (*outfunc)(JDEC *, void *, JRECT *), unsign
JRESULT jd_restart(JDEC * jd, uint16_t rstn);
#endif
#ifdef __cplusplus
}

View File

@ -13,16 +13,17 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../../core/lv_obj.h"
#if LV_USE_SNAPSHOT
#include <stdint.h>
#include <stddef.h>
#include "../../core/lv_obj.h"
/*********************
* DEFINES
*********************/
#if LV_USE_SNAPSHOT
/**********************
* TYPEDEFS
**********************/

1
tests/makefile_uefi/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
test_file

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

160
tests/makefile_uefi/efi.h Normal 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