diff --git a/.gitmodules b/.gitmodules index f49f7022..b05b4be7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,3 @@ - [submodule "tools/gvsoc"] path = tools/gvsoc - url = https://github.com/gvsoc/gvsoc.git + url = git@github.com:Scheremo/gvsoc.git diff --git a/rtos/pmsis/pmsis_bsp/rules/pulp_sdk.mk b/rtos/pmsis/pmsis_bsp/rules/pulp_sdk.mk index a18c4d87..c385de55 100644 --- a/rtos/pmsis/pmsis_bsp/rules/pulp_sdk.mk +++ b/rtos/pmsis/pmsis_bsp/rules/pulp_sdk.mk @@ -8,7 +8,7 @@ export VEGA_SRC all: ifdef PULPOS make -f rules/pulpos.mk build install -endif +endif clean: ifdef PULPOS @@ -21,5 +21,5 @@ ifdef PULPOS endif ifdef SRC mkdir -p $(TARGET_INSTALL_DIR)/src/pmsis_bsp - cp -r bsp camera display flash ram fs include zephyr $(TARGET_INSTALL_DIR)/src/pmsis_bsp -endif \ No newline at end of file + cp -r bsp partition camera display flash ram fs include zephyr $(TARGET_INSTALL_DIR)/src/pmsis_bsp +endif diff --git a/rtos/pmsis/pmsis_bsp/rules/pulpos/src.mk b/rtos/pmsis/pmsis_bsp/rules/pulpos/src.mk index a44bae5e..b377533b 100644 --- a/rtos/pmsis/pmsis_bsp/rules/pulpos/src.mk +++ b/rtos/pmsis/pmsis_bsp/rules/pulpos/src.mk @@ -50,6 +50,7 @@ CONFIG_HYPER = 1 endif ifeq '$(CONFIG_READFS)' '1' +PULP_SRCS += $(BSP_FLASH_SRC) PULP_SRCS += $(BSP_READFS_SRC) CONFIG_FS = 1 endif diff --git a/rtos/pulpos/common/kernel/crt0.S b/rtos/pulpos/common/kernel/crt0.S index e347be0c..c8ba4429 100644 --- a/rtos/pulpos/common/kernel/crt0.S +++ b/rtos/pulpos/common/kernel/crt0.S @@ -20,7 +20,7 @@ #include "archi/pulp.h" - .section .text_l2 + .section .text_l2, "ax", %progbits .global pos_init_entry pos_init_entry: diff --git a/rtos/pulpos/common/kernel/irq_asm.S b/rtos/pulpos/common/kernel/irq_asm.S index 9631f701..e97e8a04 100644 --- a/rtos/pulpos/common/kernel/irq_asm.S +++ b/rtos/pulpos/common/kernel/irq_asm.S @@ -19,7 +19,7 @@ # - .section .text_l2 + .section .text_l2, "ax", %progbits .global pos_irq_call_external_c_function pos_irq_call_external_c_function: diff --git a/rtos/pulpos/common/kernel/soc_event_v2_itc.S b/rtos/pulpos/common/kernel/soc_event_v2_itc.S index bc22b974..3f853c66 100644 --- a/rtos/pulpos/common/kernel/soc_event_v2_itc.S +++ b/rtos/pulpos/common/kernel/soc_event_v2_itc.S @@ -21,7 +21,7 @@ #include - .section .text_l2 + .section .text_l2, "ax", %progbits # # SOC event handler entry diff --git a/rtos/pulpos/common/kernel/task_asm.S b/rtos/pulpos/common/kernel/task_asm.S index fde391c3..734a6c2e 100644 --- a/rtos/pulpos/common/kernel/task_asm.S +++ b/rtos/pulpos/common/kernel/task_asm.S @@ -20,7 +20,7 @@ #include - .section .text_l2 + .section .text_l2, "ax", %progbits .global pos_task_push_asm pos_task_push_asm: diff --git a/rtos/pulpos/common/kernel/time_asm.S b/rtos/pulpos/common/kernel/time_asm.S index 692f3444..12ce39cc 100644 --- a/rtos/pulpos/common/kernel/time_asm.S +++ b/rtos/pulpos/common/kernel/time_asm.S @@ -20,7 +20,7 @@ #include - .section .text_l2 + .section .text_l2, "ax", %progbits .global pos_time_timer_handler_asm pos_time_timer_handler_asm: diff --git a/rtos/pulpos/common/rules/pulpos/default_rules.mk b/rtos/pulpos/common/rules/pulpos/default_rules.mk index 26e803ef..2988b301 100644 --- a/rtos/pulpos/common/rules/pulpos/default_rules.mk +++ b/rtos/pulpos/common/rules/pulpos/default_rules.mk @@ -189,20 +189,40 @@ override config_args += $(foreach file, $(HOSTFS_FILES), --config-opt=flash/cont define declare_app -$(eval PULP_APP_SRCS_$(1) += $(PULP_APP_SRCS) $(PULP_APP_FC_SRCS) $(PULP_SRCS) $(PULP_APP_CL_SRCS) $(PULP_CL_SRCS)) -$(eval PULP_APP_ASM_SRCS_$(1) += $(PULP_APP_ASM_SRCS) $(PULP_ASM_SRCS) $(PULP_APP_CL_ASM_SRCS) $(PULP_CL_ASM_SRCS)) +$(eval PULP_SDK_SRCS_SDK = $(PULP_CL_SRCS) $(PULP_SRCS)) +$(eval PULP_SDK_ASM_SRCS_SDK = $(PULP_ASM_SRCS) $(PULP_CL_ASM_SRCS)) +$(eval PULP_SDK_OBJS_SDK += $(patsubst %.c,$(TARGET_BUILD_DIR)/SDK/%.o,$(PULP_SDK_SRCS_SDK))) +$(eval PULP_SDK_OBJS_SDK += $(patsubst %.S,$(TARGET_BUILD_DIR)/SDK/%.o,$(PULP_SDK_ASM_SRCS_SDK))) +$(eval PULP_APP_CFLAGS_SDK += $(PULP_ARCH_CFLAGS) $(PULP_CFLAGS) $(PULP_APP_CFLAGS) -fno-inline-functions) + +$(eval PULP_APP_SRCS_$(1) += $(PULP_APP_SRCS) $(PULP_APP_FC_SRCS) $(PULP_APP_CL_SRCS)) +$(eval PULP_APP_ASM_SRCS_$(1) += $(PULP_APP_ASM_SRCS) $(PULP_APP_CL_ASM_SRCS)) $(eval PULP_APP_OBJS_$(1) += $(patsubst %.c,$(TARGET_BUILD_DIR)/$(1)/%.o,$(PULP_APP_SRCS_$(1)))) $(eval PULP_APP_OBJS_$(1) += $(patsubst %.S,$(TARGET_BUILD_DIR)/$(1)/%.o,$(PULP_APP_ASM_SRCS_$(1)))) - $(eval PULP_APP_CFLAGS_$(1) += $(PULP_ARCH_CFLAGS) $(PULP_CFLAGS) $(PULP_APP_CFLAGS)) $(eval PULP_APP_LDFLAGS_$(1) += $(PULP_ARCH_LDFLAGS) $(PULP_LDFLAGS) $(PULP_APP_LDFLAGS)) -include $(PULP_APP_OBJS_$(1):.o=.d) +$(TARGET_BUILD_DIR)/SDK/%.o: %.c + @echo "CC $$<" + $(V)mkdir -p `dirname $$@` + $(V)$(PULP_CC) -c $$< -o $$@ -MMD -MP -fno-inline-functions $(PULP_APP_CFLAGS_SDK) + +$(TARGET_BUILD_DIR)/SDK/%.o: %.cpp + @echo "CXX $$<" + $(V)mkdir -p `dirname $$@` + $(V)$(PULP_CC) -c $< -o $@ -MMD -MP $(PULP_APP_CFLAGS_SDK) + +$(TARGET_BUILD_DIR)/SDK/%.o: %.S + @echo "CC $$<" + $(V)mkdir -p `dirname $$@` + $(V)$(PULP_CC) -c $$< -o $$@ -MMD -MP -DLANGUAGE_ASSEMBLY $(PULP_APP_CFLAGS_SDK) + $(TARGET_BUILD_DIR)/$(1)/%.o: %.c @echo "CC $$<" $(V)mkdir -p `dirname $$@` - $(V)$(PULP_CC) -c $$< -o $$@ -MMD -MP $(PULP_APP_CFLAGS_$(1)) + $(V)$(PULP_CC) -c $$< -o $$@ -MMD -MP -fno-inline-functions $(PULP_APP_CFLAGS_$(1)) $(TARGET_BUILD_DIR)/$(1)/%.o: %.cpp @echo "CXX $$<" @@ -214,7 +234,7 @@ $(TARGET_BUILD_DIR)/$(1)/%.o: %.S $(V)mkdir -p `dirname $$@` $(V)$(PULP_CC) -c $$< -o $$@ -MMD -MP -DLANGUAGE_ASSEMBLY $(PULP_APP_CFLAGS_$(1)) -$(TARGET_BUILD_DIR)/$(1)/$(1): $(PULP_APP_OBJS_$(1)) +$(TARGET_BUILD_DIR)/$(1)/$(1): $(PULP_APP_OBJS_$(1)) $(PULP_SDK_OBJS_SDK) @echo "LD $$@" $(V)mkdir -p `dirname $$@` $(V)$(PULP_LD) -o $$@ $$^ -MMD -MP $(PULP_APP_LDFLAGS_$(1)) diff --git a/rtos/pulpos/pulp/kernel/chips/pulp/link.ld b/rtos/pulpos/pulp/kernel/chips/pulp/link.ld index ea407353..e34436ae 100644 --- a/rtos/pulpos/pulp/kernel/chips/pulp/link.ld +++ b/rtos/pulpos/pulp/kernel/chips/pulp/link.ld @@ -249,7 +249,7 @@ SECTIONS *(.data_tiny_l1.*) *(.data_alias_l1) *(.data_alias_l1.*) - } > L1_aliased AT> L2 + } > L2_aliased AT> L2 .l1cluster_g (ORIGIN(L1) + SIZEOF(.data_tiny_l1)): { . = ALIGN(4); diff --git a/rtos/pulpos/pulp/rules/pulpos/targets/pulp.mk b/rtos/pulpos/pulp/rules/pulpos/targets/pulp.mk index f4951b83..e961bc88 100644 --- a/rtos/pulpos/pulp/rules/pulpos/targets/pulp.mk +++ b/rtos/pulpos/pulp/rules/pulpos/targets/pulp.mk @@ -11,19 +11,22 @@ ifdef PULP_RISCV_GCC_TOOLCHAIN PULP_ARCH_CFLAGS ?= -march=rv32imcxgap9 -mPE=$(CONFIG_NB_CLUSTER_PE) -mFC=1 PULP_ARCH_LDFLAGS ?= -march=rv32imcxgap9 -mPE=$(CONFIG_NB_CLUSTER_PE) -mFC=1 PULP_ARCH_OBJDFLAGS ?= -Mmarch=rv32imcxgap9 +PULP_LDFLAGS += -nostartfiles -nostdlib -Wl,--gc-sections -L$(PULP_EXT_LIBS) -L$(PULPOS_PULP_HOME)/kernel -Tchips/pulp/link.ld -lgcc endif ifdef PULP_RISCV_LLVM_TOOLCHAIN -PULP_ARCH_CFLAGS ?= -target riscv32-unknown-elf -march=rv32imcxpulpv2 --sysroot=${PULP_RISCV_LLVM_TOOLCHAIN}/riscv32-unknown-elf -ffreestanding +PULP_ARCH_CFLAGS ?= -target riscv32-unknown-elf -march=rv32imcxpulpv2 --sysroot=${PULP_RISCV_LLVM_TOOLCHAIN}/picolibc/riscv -ffreestanding -ffunction-sections -fdata-sections -mno-relax PULP_ARCH_LDFLAGS ?= -march=rv32imcxpulpv2 PULP_ARCH_OBJDFLAGS ?= -Mmarch=rv32imcxpulpv2 +PULP_LDFLAGS += -z norelro -target riscv32-unknown-elf -march=rv32imcxpulpv2 --sysroot=${PULP_RISCV_LLVM_TOOLCHAIN}/picolibc/riscv -fuse-ld=lld -nostartfiles -L$(PULP_EXT_LIBS) -L$(PULPOS_PULP_HOME)/kernel -T$(PULPOS_PULP_HOME)/kernel/chips/pulp/link.ld +PULP_LD ?= clang endif PULP_CFLAGS += -fdata-sections -ffunction-sections -include pos/chips/pulp/config.h -I$(PULPOS_PULP_HOME)/include/pos/chips/pulp -I$(PULP_EXT_LIBS)/include ifeq '$(CONFIG_OPENMP)' '1' PULP_CFLAGS += -fopenmp -mnativeomp endif -PULP_LDFLAGS += -nostartfiles -nostdlib -Wl,--gc-sections -L$(PULP_EXT_LIBS) -L$(PULPOS_PULP_HOME)/kernel -Tchips/pulp/link.ld -lgcc + PULP_CC = riscv32-unknown-elf-gcc PULP_AR ?= riscv32-unknown-elf-ar diff --git a/tools/dpi-models/models/jtag/proxy/proxy.cpp b/tools/dpi-models/models/jtag/proxy/proxy.cpp index 5185191e..8d8752de 100644 --- a/tools/dpi-models/models/jtag/proxy/proxy.cpp +++ b/tools/dpi-models/models/jtag/proxy/proxy.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/tools/dpi-models/src/dpi.cpp b/tools/dpi-models/src/dpi.cpp index 88704c46..e3593b95 100644 --- a/tools/dpi-models/src/dpi.cpp +++ b/tools/dpi-models/src/dpi.cpp @@ -33,8 +33,6 @@ #include "dpi/tb_driver.h" - - // NOTE for DPI models integration with Questasim. // // As vsim does not export symbols to dynamically loaded modules, we need @@ -334,7 +332,11 @@ void *dpi_model_load(void *config, void *handle) if (periph_api == NULL) { +#if !(__APPLE__) void *libperiph = dlopen("libpulpperiph.so", RTLD_NOW | RTLD_GLOBAL | RTLD_DEEPBIND); +#else + void *libperiph = dlopen("libpulpperiph.dylib", RTLD_NOW | RTLD_GLOBAL); +#endif if (libperiph == NULL) { dpi_print(NULL, "ERROR, Failed to open Pulp periph models library with error:"); diff --git a/tools/dpi-models/src/models.cpp b/tools/dpi-models/src/models.cpp index 1c59d0a2..26fca7d2 100644 --- a/tools/dpi-models/src/models.cpp +++ b/tools/dpi-models/src/models.cpp @@ -329,7 +329,11 @@ extern "C" void *model_load(void *_config, void *handle) std::string module_name = module_config->get_str(); +#if (!__APPLE__) void *module = dlopen(module_name.c_str(), RTLD_NOW | RTLD_GLOBAL | RTLD_DEEPBIND); +#else + void *module = dlopen(module_name.c_str(), RTLD_NOW | RTLD_GLOBAL); +#endif if (module == NULL) { dpi_fatal_stub(handle, "ERROR, Failed to open periph model (%s) with error: %s", module_name.c_str(), dlerror()); diff --git a/tools/dpi-models/src/telnet_proxy.cpp b/tools/dpi-models/src/telnet_proxy.cpp index a5bb32e7..8bb38d68 100644 --- a/tools/dpi-models/src/telnet_proxy.cpp +++ b/tools/dpi-models/src/telnet_proxy.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/tools/gvsoc b/tools/gvsoc index 22a6eb6e..b243d07a 160000 --- a/tools/gvsoc +++ b/tools/gvsoc @@ -1 +1 @@ -Subproject commit 22a6eb6e85f681ef1c84070dc4c5a194ffb18a06 +Subproject commit b243d07af47eee3e57cbd7db88bed5ef9d48dc58