change compiler and libc to optimize size

This commit is contained in:
marqs 2023-10-08 01:27:53 +03:00
parent 9af171947a
commit 2725351039
6 changed files with 89 additions and 84 deletions

View File

@ -190,7 +190,7 @@ CREATE_ELF_DERIVED_FILES := 0
CREATE_LINKER_MAP := 1
# Common arguments for ALT_CFLAGSs
APP_CFLAGS_DEFINED_SYMBOLS :=
APP_CFLAGS_DEFINED_SYMBOLS := -DPICOLIBC_INTEGER_PRINTF_SCANF
ifeq ($(ENABLE_AUDIO),y)
APP_CFLAGS_DEFINED_SYMBOLS += -DENABLE_AUDIO
endif
@ -216,6 +216,7 @@ SYS_LIB :=
BSP_ROOT_DIR := ../sys_controller_bsp/
# List of application specific include directories, library directories and library names
APP_INCLUDE_DIRS += /usr/lib/picolibc/riscv64-unknown-elf/include
APP_INCLUDE_DIRS += it6613
APP_INCLUDE_DIRS += tvp7002
APP_INCLUDE_DIRS += ths7353
@ -396,7 +397,7 @@ APP_ASFLAGS := $(APP_ASM_INC_DIRS) \
$(ASFLAGS)
# Arguments only for the linker.
APP_LDFLAGS := $(APP_LDFLAGS_USER) --specs=nano.specs -nostartfiles
APP_LDFLAGS := $(APP_LDFLAGS_USER) --specs=picolibc.specs -nostartfiles
ifneq ($(LINKER_SCRIPT),)
APP_LDFLAGS += -T'$(LINKER_SCRIPT)'
@ -657,11 +658,11 @@ build_post_process :
# included makefile fragment.
#
ifeq ($(DEFAULT_CROSS_COMPILE),)
DEFAULT_CROSS_COMPILE := riscv32-unknown-elf-
DEFAULT_CROSS_COMPILE := riscv64-unknown-elf-
endif
ifeq ($(DEFAULT_STACKREPORT),)
DEFAULT_STACKREPORT := riscv32-unknown-elf-size
DEFAULT_STACKREPORT := riscv64-unknown-elf-size
endif
ifeq ($(DEFAULT_DOWNLOAD),)
@ -715,7 +716,7 @@ AR := $(CROSS_COMPILE)ar
endif
ifeq ($(origin LD),default)
LD := $(CROSS_COMPILE)g++
LD := $(CROSS_COMPILE)gcc
endif
ifeq ($(origin RM),default)
@ -760,7 +761,7 @@ ifeq ($(MKDIR),)
MKDIR := $(DEFAULT_MKDIR)
endif
RV_OBJCOPY = riscv32-unknown-elf-objcopy
RV_OBJCOPY = riscv64-unknown-elf-objcopy
#------------------------------------------------------------------------------
# PATTERN RULES TO BUILD OBJECTS

View File

@ -2,6 +2,6 @@
OUTPUT_ARCH(riscv)
/* required to correctly link newlib */
GROUP( -lc -lgloss -lgcc -lsupc++ )
GROUP( -lc -lgcc )
INCLUDE link.common.ld

View File

@ -25,6 +25,7 @@
#define SD_SPI_BASE I2C_OPENCORES_1_BASE
#ifndef DEBUG
#include <stdio.h>
#define OS_PRINTF(...)
#define ErrorF(...)
#define printf(...)
@ -38,6 +39,8 @@
#define printf dd_printf
#endif
#define sniprintf snprintf
#define WAITLOOP_SLEEP_US 10000
#endif /* SYSCONFIG_H_ */

View File

@ -73,9 +73,9 @@ extern int* (*alt_errno) (void);
#include "alt_types.h"
#undef errno
/*#undef errno
extern int errno;
extern int errno;*/
static ALT_INLINE int* alt_get_errno(void)
{

View File

@ -112,10 +112,10 @@ SOPC_FILE := ../../sys.sopcinfo
#-------------------------------------------------------------------------------
# Archiver command. Creates library files.
AR = riscv32-unknown-elf-ar
AR = riscv64-unknown-elf-ar
# Assembler command. Note that CC is used for .S files.
AS = riscv32-unknown-elf-gcc
AS = riscv64-unknown-elf-gcc
# Custom flags only passed to the archiver. This content of this variable is
# directly passed to the archiver rather than the more standard "ARFLAGS". The
@ -139,10 +139,10 @@ BSP_CFLAGS_OPTIMIZATION = -Os
BSP_CFLAGS_WARNINGS = -Wall
# C compiler command.
CC = riscv32-unknown-elf-gcc -xc
CC = riscv64-unknown-elf-gcc -xc
# C++ compiler command.
CXX = riscv32-unknown-elf-gcc -xc++
CXX = riscv64-unknown-elf-gcc -xc++
# Command used to remove files during 'clean' target.
RM = rm -f
@ -339,6 +339,7 @@ BSP_CFLAGS += \
BSP_CPPFLAGS += \
$(addprefix -I, $(BSP_INC_DIRS)) \
$(addprefix -I, $(ALT_INCLUDE_DIRS)) \
$(addprefix -I, /usr/lib/picolibc/riscv64-unknown-elf/include) \
$(ALT_CPPFLAGS) \
$(CPPFLAGS)