feat: optimize startup and linking

This commit is contained in:
2026-07-05 17:27:26 +08:00
parent 423ff32b49
commit 7281df356f
11 changed files with 292 additions and 97 deletions

View File

@@ -1,7 +1,9 @@
TARGET = user-sample
MATMUL_GROUP_NUM ?= 5000
CFLAGS += -O3 -g -DMATMUL_GROUP_NUM=$(MATMUL_GROUP_NUM)
MATMUL_WRITEBACK_RESULTS ?= 0
MATMUL_FAST_START ?= 1
CFLAGS += -O3 -g -DMATMUL_GROUP_NUM=$(MATMUL_GROUP_NUM) -DMATMUL_WRITEBACK_RESULTS=$(MATMUL_WRITEBACK_RESULTS) -DMATMUL_FAST_START=$(MATMUL_FAST_START)
C_SRCS := $(wildcard ./*.c )
@@ -9,6 +11,14 @@ OBJDIR = obj
COMMON_DIR = ../../bsp
GCC_DIR=../../../toolchains/loongson-gnu-toolchain-8.3-x86_64-loongarch32r-linux-gnusf-v2.0
PICOLIBC_DIR=../../../toolchains/picolibc
ifeq ($(MATMUL_FAST_START),1)
LINKER_SCRIPT := script_matmul_fast.lds
BSP_STARTUP := start_matmul_fast.S
BSP_USE_TRAP := 0
BSP_USE_DRIVERS := 0
endif
include ../../bsp/common.mk
# Strip picolibc: no -lc -lm -lg -lsemihost, keep -lgcc only