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

View File

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

View File

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

View File

@ -40,28 +40,28 @@
******************************************************************************/ ******************************************************************************/
/* /*
* errno is defined in <errno.h> so that it uses the thread local version * errno is defined in <errno.h> so that it uses the thread local version
* stored in the location pointed to by "_impure_ptr". This means that the * stored in the location pointed to by "_impure_ptr". This means that the
* accesses to errno within the HAL library can cause the entirety of * accesses to errno within the HAL library can cause the entirety of
* of the structure pointed to by "_impure_ptr" to be added to the * of the structure pointed to by "_impure_ptr" to be added to the
* users application. This can be undesirable in very small footprint systems. * users application. This can be undesirable in very small footprint systems.
* *
* To avoid this happening, the HAL uses the macro ALT_ERRNO, defined below, * To avoid this happening, the HAL uses the macro ALT_ERRNO, defined below,
* to access errno, rather than accessing it directly. This macro will only * to access errno, rather than accessing it directly. This macro will only
* use the thread local version if some other code has already caused it to be * use the thread local version if some other code has already caused it to be
* included into the system, otherwise it will use the global errno value. * included into the system, otherwise it will use the global errno value.
* *
* This causes a slight increases in code size where errno is accessed, but * This causes a slight increases in code size where errno is accessed, but
* can lead to significant overall benefits in very small systems. The * can lead to significant overall benefits in very small systems. The
* increase is inconsequential when compared to the size of the structure * increase is inconsequential when compared to the size of the structure
* pointed to by _impure_ptr. * pointed to by _impure_ptr.
* *
* Note that this macro accesses __errno() using an externally declared * Note that this macro accesses __errno() using an externally declared
* function pointer (alt_errno). This is done so that the function call uses the * function pointer (alt_errno). This is done so that the function call uses the
* subroutine call instruction via a register rather than an immediate address. * subroutine call instruction via a register rather than an immediate address.
* This is important in the case that the code has been linked for a high * This is important in the case that the code has been linked for a high
* address, but __errno() is not being used. In this case the weak linkage * address, but __errno() is not being used. In this case the weak linkage
* would have resulted in the instruction: "call 0" which would fail to link. * would have resulted in the instruction: "call 0" which would fail to link.
*/ */
extern int* (*alt_errno) (void); extern int* (*alt_errno) (void);
@ -73,9 +73,9 @@ extern int* (*alt_errno) (void);
#include "alt_types.h" #include "alt_types.h"
#undef errno /*#undef errno
extern int errno; extern int errno;*/
static ALT_INLINE int* alt_get_errno(void) static ALT_INLINE int* alt_get_errno(void)
{ {

View File

@ -19,7 +19,7 @@ SPACE := $(empty) $(empty)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# The adjust-path macro # The adjust-path macro
# #
# If COMSPEC is defined, Make is launched from Windows through # If COMSPEC is defined, Make is launched from Windows through
# Cygwin. This adjust-path macro will call 'cygpath -u' on all # Cygwin. This adjust-path macro will call 'cygpath -u' on all
# paths to ensure they are readable by Make. # paths to ensure they are readable by Make.
@ -78,26 +78,26 @@ OBJ_DIR := ./obj
# utilize the BSP settings mechanism to do so. # utilize the BSP settings mechanism to do so.
# #
# Note that most variable assignments in this section have a corresponding BSP # Note that most variable assignments in this section have a corresponding BSP
# setting that can be changed by using the nios2-bsp-create-settings or # setting that can be changed by using the nios2-bsp-create-settings or
# nios2-bsp-update-settings command before nios2-bsp-generate-files; if you # nios2-bsp-update-settings command before nios2-bsp-generate-files; if you
# want any variable set to a specific value when this Makefile is re-generated # want any variable set to a specific value when this Makefile is re-generated
# (to prevent hand-edits from being over-written), use the BSP settings # (to prevent hand-edits from being over-written), use the BSP settings
# facilities above. # facilities above.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
#START MANAGED #START MANAGED
# The following TYPE comment allows tools to identify the 'type' of target this # The following TYPE comment allows tools to identify the 'type' of target this
# makefile is associated with. # makefile is associated with.
# TYPE: BSP_PRIVATE_MAKEFILE # TYPE: BSP_PRIVATE_MAKEFILE
# This following VERSION comment indicates the version of the tool used to # This following VERSION comment indicates the version of the tool used to
# generate this makefile. A makefile variable is provided for VERSION as well. # generate this makefile. A makefile variable is provided for VERSION as well.
# ACDS_VERSION: 17.1 # ACDS_VERSION: 17.1
ACDS_VERSION := 17.1 ACDS_VERSION := 17.1
# This following BUILD_NUMBER comment indicates the build number of the tool # This following BUILD_NUMBER comment indicates the build number of the tool
# used to generate this makefile. # used to generate this makefile.
# BUILD_NUMBER: 590 # BUILD_NUMBER: 590
SETTINGS_FILE := settings.bsp SETTINGS_FILE := settings.bsp
@ -105,52 +105,52 @@ SOPC_FILE := ../../sys.sopcinfo
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# TOOL & COMMAND DEFINITIONS # TOOL & COMMAND DEFINITIONS
# #
# The base command for each build operation are expressed here. Additional # The base command for each build operation are expressed here. Additional
# switches may be expressed here. They will run for all instances of the # switches may be expressed here. They will run for all instances of the
# utility. # utility.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Archiver command. Creates library files. # 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. # 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 # 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 # directly passed to the archiver rather than the more standard "ARFLAGS". The
# reason for this is that GNU Make assumes some default content in ARFLAGS. # reason for this is that GNU Make assumes some default content in ARFLAGS.
# This setting defines the value of BSP_ARFLAGS in Makefile. # This setting defines the value of BSP_ARFLAGS in Makefile.
BSP_ARFLAGS = -src BSP_ARFLAGS = -src
# Custom flags only passed to the assembler. This setting defines the value of # Custom flags only passed to the assembler. This setting defines the value of
# BSP_ASFLAGS in Makefile. # BSP_ASFLAGS in Makefile.
BSP_ASFLAGS = -Wa,-gdwarf2 BSP_ASFLAGS = -Wa,-gdwarf2
# C/C++ compiler optimization level. "-O0" = no optimization,"-O2" = "normal" # C/C++ compiler optimization level. "-O0" = no optimization,"-O2" = "normal"
# optimization, etc. "-O0" is recommended for code that you want to debug since # optimization, etc. "-O0" is recommended for code that you want to debug since
# compiler optimization can remove variables and produce non-sequential # compiler optimization can remove variables and produce non-sequential
# execution of code while debugging. This setting defines the value of # execution of code while debugging. This setting defines the value of
# BSP_CFLAGS_OPTIMIZATION in Makefile. # BSP_CFLAGS_OPTIMIZATION in Makefile.
BSP_CFLAGS_OPTIMIZATION = -Os BSP_CFLAGS_OPTIMIZATION = -Os
# C/C++ compiler warning level. "-Wall" is commonly used.This setting defines # C/C++ compiler warning level. "-Wall" is commonly used.This setting defines
# the value of BSP_CFLAGS_WARNINGS in Makefile. # the value of BSP_CFLAGS_WARNINGS in Makefile.
BSP_CFLAGS_WARNINGS = -Wall BSP_CFLAGS_WARNINGS = -Wall
# C compiler command. # C compiler command.
CC = riscv32-unknown-elf-gcc -xc CC = riscv64-unknown-elf-gcc -xc
# C++ compiler command. # C++ compiler command.
CXX = riscv32-unknown-elf-gcc -xc++ CXX = riscv64-unknown-elf-gcc -xc++
# Command used to remove files during 'clean' target. # Command used to remove files during 'clean' target.
RM = rm -f RM = rm -f
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# BUILD PRE & POST PROCESS COMMANDS # BUILD PRE & POST PROCESS COMMANDS
# #
# The following variables are treated as shell commands in the rule # The following variables are treated as shell commands in the rule
# definitions for each file-type associated with the BSP build, as well as # definitions for each file-type associated with the BSP build, as well as
# commands run at the beginning and end of the entire BSP build operation. # commands run at the beginning and end of the entire BSP build operation.
@ -158,7 +158,7 @@ RM = rm -f
# a command defined in the "CC_PRE_PROCESS" variable executes before the C # a command defined in the "CC_PRE_PROCESS" variable executes before the C
# compiler for building .c files), while post-process commands are executed # compiler for building .c files), while post-process commands are executed
# immediately afterwards. # immediately afterwards.
# #
# You can view each pre/post-process command in the "Build Rules: All & # You can view each pre/post-process command in the "Build Rules: All &
# Clean", "Pattern Rules to Build Objects", and "Library Rules" sections of # Clean", "Pattern Rules to Build Objects", and "Library Rules" sections of
# this Makefile. # this Makefile.
@ -167,33 +167,33 @@ RM = rm -f
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# BSP SOURCE BUILD SETTINGS (FLAG GENERATION) # BSP SOURCE BUILD SETTINGS (FLAG GENERATION)
# #
# Software build settings such as compiler optimization, debug level, warning # Software build settings such as compiler optimization, debug level, warning
# flags, etc., may be defined in the following variables. The variables below # flags, etc., may be defined in the following variables. The variables below
# are concatenated together in the 'Flags' section of this Makefile to form # are concatenated together in the 'Flags' section of this Makefile to form
# final variables of flags passed to the build tools. # final variables of flags passed to the build tools.
# #
# These settings are considered private to the BSP and apply to all library & # These settings are considered private to the BSP and apply to all library &
# driver files in it; they do NOT automatically propagate to, for example, the # driver files in it; they do NOT automatically propagate to, for example, the
# build settings for an application. # build settings for an application.
# # For additional detail and syntax requirements, please refer to GCC help # # For additional detail and syntax requirements, please refer to GCC help
# (example: "nios2-elf-gcc --help --verbose"). # (example: "nios2-elf-gcc --help --verbose").
# #
# Unless indicated otherwise, multiple entries in each variable should be # Unless indicated otherwise, multiple entries in each variable should be
# space-separated. # space-separated.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Altera HAL alt_sys_init.c generated source file # Altera HAL alt_sys_init.c generated source file
GENERATED_C_FILES := $(ABS_BSP_ROOT)/alt_sys_init.c GENERATED_C_FILES := $(ABS_BSP_ROOT)/alt_sys_init.c
GENERATED_C_LIB_SRCS += alt_sys_init.c GENERATED_C_LIB_SRCS += alt_sys_init.c
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# BSP SOURCE FILE LISTING # BSP SOURCE FILE LISTING
# #
# All source files that comprise the BSP are listed here, along with path # All source files that comprise the BSP are listed here, along with path
# information to each file expressed relative to the BSP root. The precise # information to each file expressed relative to the BSP root. The precise
# list and location of each file is derived from the driver, operating system, # list and location of each file is derived from the driver, operating system,
# or software package source file declarations. # or software package source file declarations.
# #
# Following specification of the source files for each component, driver, etc., # Following specification of the source files for each component, driver, etc.,
@ -202,10 +202,10 @@ GENERATED_C_LIB_SRCS += alt_sys_init.c
# used to build each file. # used to build each file.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# altera_avalon_jtag_uart_driver sources root # altera_avalon_jtag_uart_driver sources root
altera_avalon_jtag_uart_driver_SRCS_ROOT := drivers altera_avalon_jtag_uart_driver_SRCS_ROOT := drivers
# altera_avalon_jtag_uart_driver sources # altera_avalon_jtag_uart_driver sources
altera_avalon_jtag_uart_driver_C_LIB_SRCS := \ altera_avalon_jtag_uart_driver_C_LIB_SRCS := \
$(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_init.c \ $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_init.c \
$(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_read.c \ $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_read.c \
@ -213,14 +213,14 @@ altera_avalon_jtag_uart_driver_C_LIB_SRCS := \
$(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_ioctl.c \ $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_ioctl.c \
$(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_fd.c $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_fd.c
# altera_avalon_pio_driver sources root # altera_avalon_pio_driver sources root
altera_avalon_pio_driver_SRCS_ROOT := drivers altera_avalon_pio_driver_SRCS_ROOT := drivers
# altera_avalon_pio_driver sources # altera_avalon_pio_driver sources
# altera_avalon_timer_driver sources root # altera_avalon_timer_driver sources root
altera_avalon_timer_driver_SRCS_ROOT := drivers altera_avalon_timer_driver_SRCS_ROOT := drivers
# altera_avalon_timer_driver sources # altera_avalon_timer_driver sources
altera_avalon_timer_driver_C_LIB_SRCS := \ altera_avalon_timer_driver_C_LIB_SRCS := \
$(altera_avalon_timer_driver_SRCS_ROOT)/src/altera_avalon_timer_ts.c \ $(altera_avalon_timer_driver_SRCS_ROOT)/src/altera_avalon_timer_ts.c \
$(altera_avalon_timer_driver_SRCS_ROOT)/src/altera_avalon_timer_vars.c $(altera_avalon_timer_driver_SRCS_ROOT)/src/altera_avalon_timer_vars.c
@ -232,10 +232,10 @@ altera_epcq_controller2_driver_SRCS_ROOT := drivers
altera_epcq_controller2_driver_C_LIB_SRCS := \ altera_epcq_controller2_driver_C_LIB_SRCS := \
$(altera_epcq_controller2_driver_SRCS_ROOT)/src/altera_epcq_controller2.c $(altera_epcq_controller2_driver_SRCS_ROOT)/src/altera_epcq_controller2.c
# altera_nios2_gen2_hal_driver sources root # altera_nios2_gen2_hal_driver sources root
altera_nios2_gen2_hal_driver_SRCS_ROOT := HAL altera_nios2_gen2_hal_driver_SRCS_ROOT := HAL
# altera_nios2_gen2_hal_driver sources # altera_nios2_gen2_hal_driver sources
altera_nios2_gen2_hal_driver_C_LIB_SRCS := \ altera_nios2_gen2_hal_driver_C_LIB_SRCS := \
$(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_usleep.c \ $(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_usleep.c \
$(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_printf.c \ $(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_printf.c \
@ -251,28 +251,28 @@ altera_nios2_gen2_hal_driver_C_LIB_SRCS := \
$(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_do_ctors.c \ $(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_do_ctors.c \
$(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_do_dtors.c $(altera_nios2_gen2_hal_driver_SRCS_ROOT)/src/alt_do_dtors.c
# hal sources root # hal sources root
hal_SRCS_ROOT := HAL hal_SRCS_ROOT := HAL
# hal sources # hal sources
hal_C_LIB_SRCS := \ hal_C_LIB_SRCS := \
$(hal_SRCS_ROOT)/src/alt_dev_llist_insert.c \ $(hal_SRCS_ROOT)/src/alt_dev_llist_insert.c \
$(hal_SRCS_ROOT)/src/alt_errno.c \ $(hal_SRCS_ROOT)/src/alt_errno.c \
$(hal_SRCS_ROOT)/src/alt_flash_dev.c \ $(hal_SRCS_ROOT)/src/alt_flash_dev.c \
$(hal_SRCS_ROOT)/src/alt_main.c $(hal_SRCS_ROOT)/src/alt_main.c
# i2c_opencores_driver sources root # i2c_opencores_driver sources root
i2c_opencores_driver_SRCS_ROOT := drivers i2c_opencores_driver_SRCS_ROOT := drivers
# i2c_opencores_driver sources # i2c_opencores_driver sources
i2c_opencores_driver_C_LIB_SRCS := \ i2c_opencores_driver_C_LIB_SRCS := \
$(i2c_opencores_driver_SRCS_ROOT)/src/i2c_opencores.c $(i2c_opencores_driver_SRCS_ROOT)/src/i2c_opencores.c
# nios2_hw_crc32_driver sources root # nios2_hw_crc32_driver sources root
nios2_hw_crc32_driver_SRCS_ROOT := drivers nios2_hw_crc32_driver_SRCS_ROOT := drivers
# Assemble all component C source files # Assemble all component C source files
COMPONENT_C_LIB_SRCS += \ COMPONENT_C_LIB_SRCS += \
$(altera_avalon_jtag_uart_driver_C_LIB_SRCS) \ $(altera_avalon_jtag_uart_driver_C_LIB_SRCS) \
$(altera_avalon_timer_driver_C_LIB_SRCS) \ $(altera_avalon_timer_driver_C_LIB_SRCS) \
@ -282,11 +282,11 @@ COMPONENT_C_LIB_SRCS += \
$(i2c_opencores_driver_C_LIB_SRCS) \ $(i2c_opencores_driver_C_LIB_SRCS) \
$(nios2_hw_crc32_driver_C_LIB_SRCS) $(nios2_hw_crc32_driver_C_LIB_SRCS)
# Assemble all component assembly source files # Assemble all component assembly source files
COMPONENT_ASM_LIB_SRCS += \ COMPONENT_ASM_LIB_SRCS += \
$(altera_nios2_gen2_hal_driver_ASM_LIB_SRCS) $(altera_nios2_gen2_hal_driver_ASM_LIB_SRCS)
# Assemble all component C++ source files # Assemble all component C++ source files
COMPONENT_CPP_LIB_SRCS += \ COMPONENT_CPP_LIB_SRCS += \
#END MANAGED #END MANAGED
@ -306,7 +306,7 @@ COMPONENT_CPP_LIB_SRCS += \
# purpose of this variable is to allow an external Makefile to append on # purpose of this variable is to allow an external Makefile to append on
# path information to precisely locate paths expressed in public.mk # path information to precisely locate paths expressed in public.mk
# Since this is the BSP Makefile, we set ALT_LIBRARY_ROOT_DIR to point right # Since this is the BSP Makefile, we set ALT_LIBRARY_ROOT_DIR to point right
# here ("."), at the BSP root. # here ("."), at the BSP root.
# #
# ALT_LIBRARY_ROOT_DIR must always be set before public.mk is included. # ALT_LIBRARY_ROOT_DIR must always be set before public.mk is included.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -332,13 +332,14 @@ BSP_CFLAGS += \
$(BSP_CFLAGS_WARNINGS) \ $(BSP_CFLAGS_WARNINGS) \
$(BSP_CFLAGS_USER_FLAGS) \ $(BSP_CFLAGS_USER_FLAGS) \
$(ALT_CFLAGS) \ $(ALT_CFLAGS) \
$(CFLAGS) $(CFLAGS)
# Make ready the final list of include directories and other C pre-processor # Make ready the final list of include directories and other C pre-processor
# flags. Each include path is made ready by prefixing it with "-I". # flags. Each include path is made ready by prefixing it with "-I".
BSP_CPPFLAGS += \ BSP_CPPFLAGS += \
$(addprefix -I, $(BSP_INC_DIRS)) \ $(addprefix -I, $(BSP_INC_DIRS)) \
$(addprefix -I, $(ALT_INCLUDE_DIRS)) \ $(addprefix -I, $(ALT_INCLUDE_DIRS)) \
$(addprefix -I, /usr/lib/picolibc/riscv64-unknown-elf/include) \
$(ALT_CPPFLAGS) \ $(ALT_CPPFLAGS) \
$(CPPFLAGS) $(CPPFLAGS)
@ -408,7 +409,7 @@ DEPS = $(OBJS:.o=.d)
# Rules to force your project to rebuild or relink # Rules to force your project to rebuild or relink
# .force_relink file will cause any application that depends on this project to relink # .force_relink file will cause any application that depends on this project to relink
# .force_rebuild file will cause this project to rebuild object files # .force_rebuild file will cause this project to rebuild object files
# .force_rebuild_all file will cause this project and any project that depends on this project to rebuild object files # .force_rebuild_all file will cause this project and any project that depends on this project to rebuild object files
@ -691,7 +692,7 @@ endif
ifneq ($(NEWLIB_DIR),) ifneq ($(NEWLIB_DIR),)
$(NEWLIB_DIR): $(NEWLIB_DIR):
@$(ECHO) Creating $(NEWLIB_DIR)... @$(ECHO) Creating $(NEWLIB_DIR)...
nios2-newlib-gen --no-multilib $(NEWLIB_DIR)-build-tmp $(NEWLIB_DIR) --custom "$(NEWLIB_FLAGS)" nios2-newlib-gen --no-multilib $(NEWLIB_DIR)-build-tmp $(NEWLIB_DIR) --custom "$(NEWLIB_FLAGS)"
@$(ECHO) Removing $(NEWLIB_DIR)-build-tmp... @$(ECHO) Removing $(NEWLIB_DIR)-build-tmp...
@$(RM) -rf $(NEWLIB_DIR)-build-tmp @$(RM) -rf $(NEWLIB_DIR)-build-tmp
endif endif