Fixed certain compilation issues on newer toolchains
This commit is contained in:
parent
15b3faeee6
commit
ed87416859
|
@ -2,4 +2,8 @@
|
|||
*.o
|
||||
*libmusl.a
|
||||
*liblwip.a
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
|
||||
.cache/
|
||||
compile_commands.json
|
||||
.clangd
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
# newer risc-v toolchain requires `zicsr` extension for csr-related ops
|
||||
export MARCH := rv32imac_zicsr
|
||||
# export MARCH := rv32imacxw_zicsr
|
||||
|
||||
export CFLAGS := -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -g
|
||||
export AFLAGS := -march=rv32imac -mabi=ilp32 -x assembler-with-cpp -ggdb
|
||||
export LFLAGS := -march=rv32imac -mabi=ilp32 -nostartfiles -Wl,--gc-sections,-Map=XiZi-ch32v208vct6.map,-cref,-u,_start -T $(BSP_ROOT)/link.ld
|
||||
export CFLAGS := -march=$(MARCH) -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -g
|
||||
export AFLAGS := -march=$(MARCH) -mabi=ilp32 -x assembler-with-cpp -ggdb
|
||||
export LFLAGS := -march=$(MARCH) -mabi=ilp32 -nostartfiles -Wl,--gc-sections,-Map=XiZi-ch32v208vct6.map,-cref,-u,_start -T $(BSP_ROOT)/link.ld
|
||||
|
||||
# export CFLAGS := -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -g -std=gnu99
|
||||
# export AFLAGS := -march=rv32imac -mabi=ilp32 -x assembler-with-cpp -ggdb
|
||||
# export LFLAGS := -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -g -T $(BSP_ROOT)/link.ld -nostartfiles -Xlinker --gc-sections -Wl,-Map,"XiZi-ch32v307vct6.map" --specs=nano.specs --specs=nosys.specs
|
||||
# export CFLAGS := -march=$(MARCH) -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -g -std=gnu99
|
||||
# export AFLAGS := -march=$(MARCH) -mabi=ilp32 -x assembler-with-cpp -ggdb
|
||||
# export LFLAGS := -march=$(MARCH) -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -g -T $(BSP_ROOT)/link.ld -nostartfiles -Xlinker --gc-sections -Wl,-Map,"XiZi-ch32v307vct6.map" --specs=nano.specs --specs=nosys.specs
|
||||
|
||||
export APPLFLAGS := -nostartfiles -Wl,--gc-sections,-Map=XiZi-app.map,-cref,-u, -T $(BSP_ROOT)/link_userspace.lds
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#ifndef __MODULECONFIG_H__
|
||||
#define __MODULECONFIG_H__
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
/*Address where configuration information is stored*/
|
||||
|
|
|
@ -30,15 +30,15 @@ CFLAGS += $(DEFINES)
|
|||
AFLAGS += $(DEFINES)
|
||||
CXXFLAGS += $(DEFINES)
|
||||
BUILD_DIR := $(KERNEL_ROOT)/build
|
||||
APP_DIR := Ubiquitous/XiZi
|
||||
APP_DIR := Ubiquitous/XiZi_IIoT
|
||||
|
||||
|
||||
.PHONY:COMPILER
|
||||
COMPILER:
|
||||
@if [ "${SRC_DIR_TEMP}" != "" ]; then \
|
||||
for dir in $(SRC_DIR_TEMP);do \
|
||||
$(MAKE) -C $$dir; \
|
||||
done; \
|
||||
for dir in $(SRC_DIR_TEMP); do \
|
||||
$(MAKE) -C $$dir; \
|
||||
done; \
|
||||
fi
|
||||
@/bin/echo -n $(OBJS) " " >> $(KERNEL_ROOT)/build/make.obj
|
||||
|
||||
|
@ -52,7 +52,7 @@ $(eval OBJS += $(LOCALC)) \
|
|||
$(if $(strip $(LOCALC)),$(eval $(LOCALC): $(1)
|
||||
@if [ ! -d $$(@D) ]; then mkdir -p $$(@D); fi
|
||||
@echo cc $$<
|
||||
@/bin/echo -n $(dir $(LOCALC)) >>$(KERNEL_ROOT)/build/make.dep
|
||||
@echo -n $(dir $(LOCALC)) >>$(KERNEL_ROOT)/build/make.dep
|
||||
@($(CROSS_COMPILE)gcc -MM $$(CFLAGS) -c $$<) >>$(KERNEL_ROOT)/build/make.dep
|
||||
@$(CROSS_COMPILE)gcc $$(CFLAGS) -c $$< -o $$@))
|
||||
endef
|
||||
|
@ -64,7 +64,7 @@ $(eval LOCALCPP := $(addprefix $(BUILD_DIR)/,$(COBJ))) \
|
|||
$(eval OBJS += $(LOCALCPP)) \
|
||||
$(if $(strip $(LOCALCPP)),$(eval $(LOCALCPP): $(1)
|
||||
@if [ ! -d $$(@D) ]; then mkdir -p $$(@D); fi
|
||||
@echo cc $$<
|
||||
@echo cpp $$<
|
||||
@/bin/echo -n $(dir $(LOCALCPP)) >>$(KERNEL_ROOT)/build/make.dep
|
||||
@$(CROSS_COMPILE)g++ -MM $$(CXXFLAGS) -c $$< >>$(KERNEL_ROOT)/build/make.dep
|
||||
@$(CROSS_COMPILE)g++ $$(CXXFLAGS) -c $$< -o $$@))
|
||||
|
@ -90,7 +90,7 @@ $(eval LOCALS := $(addprefix $(BUILD_DIR)/,$(SOBJ))) \
|
|||
$(eval OBJS += $(LOCALS)) \
|
||||
$(if $(strip $(LOCALS)),$(eval $(LOCALS): $(1)
|
||||
@if [ ! -d $$(@D) ]; then mkdir -p $$(@D); fi
|
||||
@echo cc $$<
|
||||
@echo asm $$<
|
||||
@/bin/echo -n $(dir $(LOCALC)) >>$(KERNEL_ROOT)/build/make.dep
|
||||
@$(CROSS_COMPILE)gcc -MM $$(CFLAGS) -c $$< >>$(KERNEL_ROOT)/build/make.dep
|
||||
@$(CROSS_COMPILE)gcc $$(AFLAGS) -c $$< -o $$@))
|
||||
|
@ -124,7 +124,7 @@ $(if $(SRCS),$(foreach f,$(SRCS),$(call add_S_file,$(addprefix $(CUR_DIR)/,$(f))
|
|||
SRCS := $(strip $(filter %.a,$(SRC_FILES)))
|
||||
$(if $(SRCS),$(foreach f,$(SRCS),$(call add_a_file,$(addprefix $(CUR_DIR)/,$(f)))))
|
||||
|
||||
COMPILER:$(OBJS)
|
||||
COMPILER:$(OBJS)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
SRC_FILES := stdio.c fs_syscalls.c time_syscalls.c mem_syscalls.c task_syscalls.c
|
||||
|
||||
$(eval _SDIDINIT_EXISTS := $(shell echo \
|
||||
'#include <sys/reent.h>\nint main() { (void)_GLOBAL_REENT->__sdidinit; return 0; }' \
|
||||
| $(CROSS_COMPILE)gcc $(CFLAGS) -x c -o /dev/null -c - 2>/dev/null && echo 1 || echo 0))
|
||||
|
||||
ifeq ($(_SDIDINIT_EXISTS), 1)
|
||||
CFLAGS += -D_SDIDINIT_EXISTS
|
||||
endif
|
||||
|
||||
include $(KERNEL_ROOT)/compiler.mk
|
||||
|
|
|
@ -106,7 +106,10 @@ int LibcStdioSetConsole(const char* device_name, int mode)
|
|||
_GLOBAL_REENT->_stderr = std_console;
|
||||
}
|
||||
/* set the __sdidinit as 1 */
|
||||
// this field is deprecated in newer versions of libc
|
||||
#ifdef _SDIDINIT_EXISTS
|
||||
_GLOBAL_REENT->__sdidinit = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (std_console)
|
||||
|
|
Loading…
Reference in New Issue