repair the compiler error of the configuration with Seperating compiler or musl lib

This commit is contained in:
Wang_Weigen 2023-02-28 17:20:39 +08:00
parent ff78fcc100
commit 5ae31a37f3
18 changed files with 325 additions and 22 deletions

View File

@ -158,7 +158,7 @@ int CircularAreaAppRead(CircularAreaAppType circular_area, uint8_t *output_buffe
{
CA_PARAM_CHECK(circular_area);
CA_PARAM_CHECK(output_buffer);
CHECK(data_length > 0);
CA_CHECK(data_length > 0);
if(CircularAreaAppIsEmpty(circular_area)) {
return -1;
@ -199,7 +199,7 @@ int CircularAreaAppWrite(CircularAreaAppType circular_area, uint8_t *input_buffe
{
CA_PARAM_CHECK(circular_area);
CA_PARAM_CHECK(input_buffer);
CHECK(data_length > 0);
CA_CHECK(data_length > 0);
if(CircularAreaAppIsFull(circular_area) && (!b_force)) {
return -1;
@ -248,7 +248,7 @@ static struct CircularAreaAppOps CircularAreaAppOperations =
*/
CircularAreaAppType CircularAreaAppInit(uint32_t circular_area_length)
{
CHECK(circular_area_length > 0);
CA_CHECK(circular_area_length > 0);
circular_area_length = CA_ALIGN_DOWN(circular_area_length, 8);

View File

@ -29,11 +29,20 @@
extern "C" {
#endif
#define CA_CHECK(TRUE_CONDITION) \
do \
{ \
if(!(TRUE_CONDITION)) { \
printf("%s CHECK condition is false at line[%d] of [%s] func.\n", #TRUE_CONDITION, __LINE__, __func__);\
while(1); \
} \
}while (0)
#define CA_PARAM_CHECK(param) \
do \
{ \
if(param == NULL) { \
KPrintf("PARAM CHECK FAILED ...%s %d %s is NULL.\n", __func__, __LINE__, #param); \
printf("PARAM CHECK FAILED ...%s %d %s is NULL.\n", __func__, __LINE__, #param); \
while(1); \
} \
}while (0)

View File

@ -297,6 +297,8 @@ typedef struct
#define IOCTRL_CAMERA_SET_EFFECT (28) //set effect
#define IOCTRL_CAMERA_SET_EXPOSURE (29) //set auto exposure
/*********************shell***********************/
#ifndef SEPARATE_COMPILE
//for int func(int argc, char *agrv[])
#define PRIV_SHELL_CMD_MAIN_ATTR (SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN))
@ -313,6 +315,15 @@ typedef struct
#define PRIV_SHELL_CMD_FUNCTION(_func, _desc, _attr) \
SHELL_EXPORT_CMD(_attr, _func, _func, _desc)
#else
//for int func(int argc, char *agrv[])
#define PRIV_SHELL_CMD_MAIN_ATTR()
//for int func(int i, char ch, char *str)
#define PRIV_SHELL_CMD_FUNC_ATTR()
#define PRIV_SHELL_CMD_FUNCTION(_func, _desc, _attr)
#endif
/**********************mutex**************************/
int PrivMutexCreate(pthread_mutex_t *p_mutex, const pthread_mutexattr_t *attr);

View File

@ -60,6 +60,16 @@ extern "C" {
// PTHREAD_SCOPE_SYSTEM,
// };
// #define NULL_PARAM_CHECK(param) \
// do \
// { \
// if(param == NULL) { \
// printf("PARAM CHECK FAILED ...%s %d %s is NULL.\n", __func__, __LINE__, #param); \
// while(1); \
// } \
// }while (0)
typedef int pid_t;
// typedef int pthread_mutex_t ;

View File

@ -67,8 +67,8 @@ int pthread_attr_init(pthread_attr_t *attr)
int pthread_attr_setschedparam(pthread_attr_t *attr,
struct sched_param const *param)
{
NULL_PARAM_CHECK(attr != NULL);
NULL_PARAM_CHECK(param != NULL);
// NULL_PARAM_CHECK(attr);
// NULL_PARAM_CHECK(param);
attr->schedparam.sched_priority = param->sched_priority;

View File

@ -30,7 +30,7 @@
#ifdef SEPARATE_COMPILE
#include "../../../../../../Ubiquitous/XiZi/arch/kswitch.h"
#include "../../../../../../Ubiquitous/XiZi_IIoT/arch/kswitch.h"
#define TASK_INFO 1
#define MEM_INFO 2

View File

@ -1,4 +1,4 @@
menu "lib"
menu "app lib"
choice
prompt "chose a kind of lib for app"
default APP_SELECT_NEWLIB

View File

@ -1,5 +1,5 @@
# SRC_DIR := lvgl
SRC_DIR :=
ifeq ($(CONFIG_APP_SELECT_NEWLIB),y)
ifeq ($(CONFIG_SEPARATE_COMPILE),y)
SRC_DIR += app_newlib

View File

@ -117,10 +117,10 @@ COMPILE_KERNEL:
COMPILE_APP:
@echo $(SRC_APP_DIR)
@for dir in $(SRC_APP_DIR);do \
$(MAKE) -C $$dir USE_APP_INCLUDEPATH=y; \
$(MAKE) -C $$dir; \
done
@cp link.mk build/Makefile
@$(MAKE) -C build COMPILE_TYPE="_app" TARGET=XiZi-$(BOARD)_app.elf LINK_FLAGS=APPLFLAGS
@$(MAKE) -C build COMPILE_TYPE="_app" TARGET=XiZi-$(BOARD)_app.elf LINK_FLAGS=APPLFLAGS USE_APP_INCLUDEPATH=y
@rm build/Makefile build/make.obj
show_info:

View File

@ -4,6 +4,12 @@ export LFLAGS := -mcmodel=medany -march=rv64imafdc -mabi=lp64d -nostartfiles -Wl
export APPLFLAGS := -mcmodel=medany -march=rv64imafdc -mabi=lp64d -nostartfiles -Wl,--gc-sections,-Map=XiZi-app.map,-cref,-u, -T $(BSP_ROOT)/link_userspace.lds
ifeq ($(CONFIG_LIB_MUSLLIB), y)
export LFLAGS += -nostdlib -nostdinc -fno-builtin -nodefaultlibs
export LIBCC := -lgcc
export LINK_MUSLLIB := $(KERNEL_ROOT)/lib/musllib/libmusl.a
endif
export CXXFLAGS := -mcmodel=medany -march=rv64imafdc -mabi=lp64d -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -O0 -ggdb -Werror
export CROSS_COMPILE ?=/opt/gnu-mcu-eclipse/riscv-none-gcc/8.2.0-2.1-20190425-1021/bin/riscv-none-embed-

View File

@ -0,0 +1,255 @@
#
# Automatically generated file; DO NOT EDIT.
# XiZi_IIoT Project Configuration
#
CONFIG_BOARD_GD32VF103RVSTAR=y
CONFIG_ARCH_RISCV=y
#
# gd32vf103-rvstar feature
#
CONFIG_BSP_USING_GPIO=y
CONFIG_PIN_BUS_NAME="pin"
CONFIG_PIN_DRIVER_NAME="pin_drv"
CONFIG_PIN_DEVICE_NAME="pin_dev"
CONFIG_BSP_USING_SYSCLOCK=y
CONFIG_BSP_USING_UART=y
CONFIG_BSP_USING_UART4=y
CONFIG_SERIAL_BUS_NAME_4="uart4"
CONFIG_SERIAL_DRV_NAME_4="uart4_drv"
CONFIG_SERIAL_4_DEVICE_NAME_4="uart4_dev4"
#
# Hardware feature
#
CONFIG_RESOURCES_SERIAL=y
CONFIG_SERIAL_USING_DMA=y
CONFIG_SERIAL_RB_BUFSZ=64
CONFIG_RESOURCES_PIN=y
#
# Kernel feature
#
#
# separate compile(choose none for compile once)
#
# CONFIG_SEPARATE_COMPILE is not set
# CONFIG_COMPILER_APP is not set
# CONFIG_COMPILER_KERNEL is not set
#
# Memory Management
#
# CONFIG_KERNEL_MEMBLOCK is not set
CONFIG_MEM_ALIGN_SIZE=4
# CONFIG_MEM_EXTERN_SRAM is not set
CONFIG_MM_PAGE_SIZE=1024
#
# Using small memory allocator
#
CONFIG_KERNEL_SMALL_MEM_ALLOC=y
CONFIG_SMALL_NUMBER_32B=8
CONFIG_SMALL_NUMBER_64B=4
#
# Task feature
#
CONFIG_USER_APPLICATION=y
# CONFIG_TASK_ISOLATION is not set
#
# Inter-Task communication
#
# CONFIG_KERNEL_SEMAPHORE=y
# CONFIG_KERNEL_MUTEX=y
CONFIG_KERNEL_EVENT=y
CONFIG_KERNEL_MESSAGEQUEUE=y
CONFIG_KERNEL_SOFTTIMER=y
CONFIG_SCHED_POLICY_RR_REMAINSLICE=y
# CONFIG_SCHED_POLICY_RR is not set
# CONFIG_SCHED_POLICY_FIFO is not set
CONFIG_KTASK_PRIORITY_8=y
CONFIG_KTASK_PRIORITY_MAX=8
CONFIG_TICK_PER_SECOND=100
CONFIG_KERNEL_STACK_OVERFLOW_CHECK=y
CONFIG_IDLE_KTASK_STACKSIZE=512
CONFIG_ZOMBIE_KTASK_STACKSIZE=512
#
# Kernel Console
#
CONFIG_KERNEL_CONSOLE=y
CONFIG_KERNEL_BANNER=y
CONFIG_KERNEL_CONSOLEBUF_SIZE=128
#
# Kernel Hook
#
# CONFIG_KERNEL_HOOK is not set
#
# Command shell
#
CONFIG_TOOL_SHELL=y
CONFIG_SHELL_TASK_PRIORITY=20
CONFIG_SHELL_TASK_STACK_SIZE=2048
# CONFIG_SHELL_ENTER_CRLF is not set
#
# Set shell user control
#
CONFIG_SHELL_DEFAULT_USER="letter"
CONFIG_SHELL_DEFAULT_USER_PASSWORD=""
CONFIG_SHELL_LOCK_TIMEOUT=10000
CONFIG_SHELL_ENTER_CR_AND_LF=y
CONFIG_SHELL_ENTER_CR=y
CONFIG_SHELL_ENTER_LF=y
#
# Set shell config param
#
CONFIG_SHELL_MAX_NUMBER=5
CONFIG_SHELL_PARAMETER_MAX_NUMBER=8
CONFIG_SHELL_HISTORY_MAX_NUMBER=5
CONFIG_SHELL_PRINT_BUFFER=128
CONFIG_SHELL_HELP_SHOW_PERMISSION=y
# CONFIG_SHELL_HELP_LIST_USER is not set
CONFIG_SHELL_HELP_LIST_VAR=y
# CONFIG_SHELL_HELP_LIST_KEY is not set
#
# Kernel data structure Manage
#
CONFIG_KERNEL_QUEUEMANAGE=y
CONFIG_KERNEL_WORKQUEUE=y
CONFIG_WORKQUEUE_KTASK_STACKSIZE=256
CONFIG_WORKQUEUE_KTASK_PRIORITY=23
CONFIG_QUEUE_MAX=2
CONFIG_KERNEL_WAITQUEUE=y
CONFIG_KERNEL_DATAQUEUE=y
# CONFIG_KERNEL_CIRCULAR_AREA is not set
# CONFIG_KERNEL_AVL_TREE is not set
#
# Kernel components init
#
CONFIG_KERNEL_COMPONENTS_INIT=y
CONFIG_ENV_INIT_KTASK_STACK_SIZE=1024
CONFIG_KERNEL_USER_MAIN=y
CONFIG_NAME_NUM_MAX=32
# CONFIG_KERNEL_DEBUG is not set
# CONFIG_ARCH_SMP is not set
#
# hash table config
#
CONFIG_ID_HTABLE_SIZE=1
CONFIG_ID_NUM_MAX=4
# CONFIG_KERNEL_TEST is not set
#
# Kernel Lib
#
CONFIG_LIB=y
CONFIG_LIB_POSIX=y
CONFIG_LIB_NEWLIB=y
# CONFIG_LIB_MUSLLIB is not set
# CONFIG_LIB_OTHER is not set
#
# C++ features
#
# CONFIG_LIB_CPLUSPLUS is not set
#
# File system
#
CONFIG_FS_VFS=y
CONFIG_VFS_USING_WORKDIR=y
CONFIG_FS_VFS_DEVFS=y
CONFIG_FS_VFS_FATFS=y
# CONFIG_FS_CH376 is not set
# CONFIG_FS_LWEXT4 is not set
#
# APP_Framework
#
#
# Framework
#
CONFIG_TRANSFORM_LAYER_ATTRIUBUTE=y
CONFIG_ADD_XIZI_FETURES=y
# CONFIG_ADD_NUTTX_FETURES is not set
# CONFIG_ADD_RTTHREAD_FETURES is not set
# CONFIG_SUPPORT_SENSOR_FRAMEWORK is not set
# CONFIG_SUPPORT_CONNECTION_FRAMEWORK is not set
# CONFIG_SUPPORT_KNOWING_FRAMEWORK is not set
# CONFIG_SUPPORT_CONTROL_FRAMEWORK is not set
#
# Security
#
# CONFIG_CRYPTO is not set
# CONFIG_MBEDTLS is not set
#
# Applications
#
#
# config stack size and priority of main task
#
CONFIG_MAIN_KTASK_STACK_SIZE=1024
CONFIG_MAIN_KTASK_PRIORITY=16
#
# ota app
#
# CONFIG_APPLICATION_OTA is not set
#
# test app
#
# CONFIG_USER_TEST is not set
#
# connection app
#
# CONFIG_APPLICATION_CONNECTION is not set
#
# control app
#
#
# knowing app
#
# CONFIG_APPLICATION_KNOWING is not set
#
# sensor app
#
# CONFIG_APPLICATION_SENSOR is not set
# CONFIG_USING_EMBEDDED_DATABASE_APP is not set
# CONFIG_APP_USING_WEBNET is not set
#
# app lib
#
CONFIG_APP_SELECT_NEWLIB=y
# CONFIG_APP_SELECT_OTHER_LIB is not set
# CONFIG_LIB_USING_CJSON is not set
# CONFIG_LIB_USING_QUEUE is not set
# CONFIG_LIB_LV is not set
#
# LVGL configuration
#
# CONFIG_LV_CONF_MINIMAL is not set
# CONFIG_USING_EMBEDDED_DATABASE is not set

View File

@ -139,8 +139,8 @@ CONFIG_SHELL_USING_CMD_EXPORT=y
CONFIG_SHELL_HELP_SHOW_PERMISSION=y
# CONFIG_SHELL_HELP_LIST_VAR is not set
# CONFIG_SHELL_HELP_LIST_KEY is not set
#CONFIG_KERNEL_QUEUEMANAGE=y
# CONFIG_KERNEL_WORKQUEUE is not set
CONFIG_KERNEL_QUEUEMANAGE=y
CONFIG_KERNEL_WORKQUEUE=y
CONFIG_WORKQUEUE_KTASK_STACKSIZE=256
CONFIG_WORKQUEUE_KTASK_PRIORITY=2
CONFIG_QUEUE_MAX=2

View File

@ -225,7 +225,7 @@ CONFIG_FS_VFS_DEVFS=y
CONFIG_LIB=y
CONFIG_LIB_POSIX=y
CONFIG_LIB_NEWLIB=y
CONFIG_LIB_MUSLLIB=y
# CONFIG_LIB_MUSLLIB is not set
CONFIG_LITTLEVGL2RTT_USING_DEMO=y

View File

@ -4,6 +4,13 @@ export LFLAGS := -mcmodel=medany -march=rv64imafdc -mabi=lp64d -nostartfiles -Wl
export APPLFLAGS := -mcmodel=medany -march=rv64imafdc -mabi=lp64d -nostartfiles -Wl,--gc-sections,-Map=XiZi-app.map,-cref,-u, -T $(BSP_ROOT)/link_userspace.lds
ifeq ($(CONFIG_LIB_MUSLLIB), y)
export LFLAGS += -nostdlib -nostdinc -fno-builtin -nodefaultlibs
export LIBCC := -lgcc
export LINK_MUSLLIB := $(KERNEL_ROOT)/lib/musllib/libmusl.a
endif
export CXXFLAGS := -mcmodel=medany -march=rv64imafdc -mabi=lp64d -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -O0 -ggdb -Werror
export CROSS_COMPILE ?=/opt/gnu-mcu-eclipse/riscv-none-gcc/8.2.0-2.1-20190425-1021/bin/riscv-none-embed-

View File

@ -33,7 +33,7 @@ Modification:
#include "fsl_clock.h"
#include "fsl_enet.h"
#include "clock_config.h"
#include <xizi.h>
// #include <xizi.h>
#include <arch_interrupt.h>
#ifdef BSP_USING_LWIP

View File

@ -1,4 +1,4 @@
menu "Lib"
menu "Kernel Lib"
menuconfig LIB
bool "Enable libc APIs from toolchain"
@ -19,6 +19,10 @@ menuconfig LIB
config LIB_MUSLLIB
bool "use musllib as libc realization."
config LIB_OTHER
bool "use other lib"
endchoice
source "$KERNEL_DIR/lib/libcpp/Kconfig"

View File

@ -2,8 +2,12 @@
export APPPATHS :=-I$(BSP_ROOT) \
APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Applications/general_functions/list \
-I$(KERNEL_ROOT)/../../APP_Framework/lib/app_newlib/include \
-I$(KERNEL_ROOT)/../../APP_Framework/Framework/sensor #
-I$(KERNEL_ROOT)/../../APP_Framework/Framework/sensor #
ifeq ($(CONFIG_APP_SELECT_NEWLIB), y)
APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/lib/app_newlib/include #
endif
ifeq ($(CONFIG_ADD_XIZI_FETURES), y)
APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/transform_layer/xizi \

View File

@ -533,17 +533,14 @@ endif
ifeq ($(ARCH), risc-v)
# KERNELPATHS +=-I$(KERNEL_ROOT)/arch/risc-v/shared
ifeq ($(MCU), k210)
KERNELPATHS +=-I$(KERNEL_ROOT)/arch/risc-v/shared
ifeq ($(MCU), k210)
KERNELPATHS +=-I$(KERNEL_ROOT)/arch/risc-v/k210
endif
ifeq ($(MCU), FE310)
KERNELPATHS +=-I$(KERNEL_ROOT)/arch/risc-v/shared
KERNELPATHS +=-I$(KERNEL_ROOT)/arch/risc-v/fe310
endif
ifeq ($(MCU), GAP8)
KERNELPATHS +=-I$(KERNEL_ROOT)/arch/risc-v/shared
KERNELPATHS +=-I$(KERNEL_ROOT)/arch/risc-v/gap8
endif
ifeq ($(MCU), GD32VF103)