diff options
author | Keith Packard <keithpac@amazon.com> | 2023-03-02 11:48:13 -0800 |
---|---|---|
committer | Paul Bartell <paul.bartell@gmail.com> | 2023-03-30 12:32:55 -0700 |
commit | 84ad9250daf05b3799658c1ae9e99c652b9e27e7 (patch) | |
tree | 22d122b6adf2e98dd15e0f4d7fa3c2bf0c0064e9 | |
parent | bc1a95e9e7fd47d4a31ea4384e2ea895e4b04cbe (diff) | |
download | freertos-git-84ad9250daf05b3799658c1ae9e99c652b9e27e7.tar.gz |
Demo/RISC-V_RV32_QEMU_VIRT_GCC: Add option to build with picolibc
When built with PICOLIBC=1, selects picolibc as the C library, uses
semihosting to display messages and uses picolibc stdio for output.
Signed-off-by: Keith Packard <keithpac@amazon.com>
-rw-r--r-- | FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/build/gcc/Makefile | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/build/gcc/Makefile b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/build/gcc/Makefile index 4ea218cdf..e4d8ca958 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/build/gcc/Makefile +++ b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/build/gcc/Makefile @@ -11,11 +11,22 @@ MAKE = make CFLAGS += $(INCLUDE_DIRS) -DportasmHANDLE_INTERRUPT=handle_trap -fmessage-length=0 \ -march=rv32imac_zicsr -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections \ - --specs=nano.specs -fno-builtin-printf -Wno-unused-parameter -nostartfiles -g3 -Os + -Wno-unused-parameter -nostartfiles -g3 -Os +ifeq ($(PICOLIBC),1) +CFLAGS += --specs=picolibc.specs -DPICOLIBC_INTEGER_PRINTF_SCANF +else +CFLAGS += --specs=nano.specs -fno-builtin-printf +endif + LDFLAGS += -nostartfiles -Xlinker --gc-sections -Wl,-Map,$(OUTPUT_DIR)/RTOSDemo.map \ -T./fake_rom.ld -march=rv32imac -mabi=ilp32 -mcmodel=medlow -Xlinker \ - --defsym=__stack_size=350 -Wl,--start-group -Wl,--end-group -Wl,--wrap=malloc \ + --defsym=__stack_size=350 -Wl,--start-group -Wl,--end-group + +ifeq ($(PICOLIBC),1) +LDFLAGS += --specs=picolibc.specs --oslib=semihost --crt0=minimal -DPICOLIBC_INTEGER_PRINTF_SCANF +else +LDFLAGS += -Wl,--wrap=malloc \ -Wl,--wrap=free -Wl,--wrap=open -Wl,--wrap=lseek -Wl,--wrap=read -Wl,--wrap=write \ -Wl,--wrap=fstat -Wl,--wrap=stat -Wl,--wrap=close -Wl,--wrap=link -Wl,--wrap=unlink \ -Wl,--wrap=execve -Wl,--wrap=fork -Wl,--wrap=getpid -Wl,--wrap=kill -Wl,--wrap=wait \ @@ -24,6 +35,7 @@ LDFLAGS += -nostartfiles -Xlinker --gc-sections -Wl,-Map,$(OUTPUT_DIR)/RTOSDemo. -Wl,--wrap=_fstat -Wl,--wrap=_stat -Wl,--wrap=_close -Wl,--wrap=_link -Wl,--wrap=_unlink \ -Wl,--wrap=_execve -Wl,--wrap=_fork -Wl,--wrap=_getpid -Wl,--wrap=_kill -Wl,--wrap=_wait \ -Wl,--wrap=_isatty -Wl,--wrap=_times -Wl,--wrap=_sbrk -Wl,--wrap=__exit -Wl,--wrap=_puts +endif # -Wl,--wrap=_exit # @@ -92,7 +104,9 @@ SOURCE_FILES += (DEMO_PROJECT)/main_full.c SOURCE_FILES += (DEMO_PROJECT)/ns16550.c SOURCE_FILES += (DEMO_PROJECT)/riscv-virt.c # Lightweight print formatting to use in place of the heavier GCC equivalent. +ifneq ($(PICOLIBC),1) SOURCE_FILES += ./printf-stdarg.c +endif ASM_SOURCE_FILES += ./start.S ASM_SOURCE_FILES += ./RegTest.S ASM_SOURCE_FILES += ./vector.S |