mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Koen Zandberg
0a6c9c4ec0
RISC-V support semihosting in very similar way as the cortex-m microcontrollers. The code calls a breakpoint instruction and the attached debugger reads/writes registers and memory for stdio. The RISC-V architecture doesn't support a call number with the EBREAK instruction, to allow the debugger to detect a semihosting break point, the EBREAK instruction is wrapped in a SLLI and SRAI instruction. These use x0 as output register, making them NOP instructions. One caveat when using this is that the RISC-V core traps the EBREAK instruction with trap code 3 when no debugger is attached. Restarting the application with the debugger attached avoids this.
58 lines
1.3 KiB
Makefile
58 lines
1.3 KiB
Makefile
STDIO_MODULES = \
|
|
slipdev_stdio \
|
|
stdio_cdc_acm \
|
|
stdio_ethos \
|
|
stdio_null \
|
|
stdio_rtt \
|
|
stdio_semihosting \
|
|
stdio_uart \
|
|
#
|
|
|
|
ifneq (,$(filter newlib picolibc,$(USEMODULE)))
|
|
ifeq (,$(filter $(STDIO_MODULES),$(USEMODULE)))
|
|
USEMODULE += stdio_uart
|
|
endif
|
|
endif
|
|
|
|
ifneq (,$(filter stdio_cdc_acm,$(USEMODULE)))
|
|
USEMODULE += usbus_cdc_acm
|
|
USEMODULE += isrpipe
|
|
endif
|
|
|
|
ifneq (,$(filter stdio_rtt,$(USEMODULE)))
|
|
USEMODULE += xtimer
|
|
endif
|
|
|
|
ifneq (,$(filter stdio_ethos,$(USEMODULE)))
|
|
USEMODULE += ethos
|
|
USEMODULE += stdin
|
|
USEMODULE += stdio_uart
|
|
endif
|
|
|
|
ifneq (,$(filter stdin,$(USEMODULE)))
|
|
ifneq (,$(filter stdio_uart,$(USEMODULE)))
|
|
USEMODULE += stdio_uart_rx
|
|
endif
|
|
endif
|
|
|
|
ifneq (,$(filter stdio_uart_rx,$(USEMODULE)))
|
|
USEMODULE += isrpipe
|
|
USEMODULE += stdio_uart
|
|
endif
|
|
|
|
ifneq (,$(filter stdio_uart,$(USEMODULE)))
|
|
FEATURES_REQUIRED += periph_uart
|
|
endif
|
|
|
|
ifneq (,$(filter stdio_semihosting,$(USEMODULE)))
|
|
USEMODULE += xtimer
|
|
FEATURES_REQUIRED_ANY += cpu_core_cortexm|arch_riscv
|
|
endif
|
|
|
|
# enable stdout buffering for modules that benefit from sending out buffers in larger chunks
|
|
ifneq (,$(filter picolibc,$(USEMODULE)))
|
|
ifneq (,$(filter stdio_cdc_acm stdio_ethos slipdev_stdio stdio_semihosting,$(USEMODULE)))
|
|
USEMODULE += picolibc_stdout_buffered
|
|
endif
|
|
endif
|