Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ if(DMBOOT_FLASH_DMD_FILES OR DMBOOT_MAIN_MODULE OR DMBOOT_SHELL)
COMMAND ${DMF_GET} -d "${DMBOOT_COMBINED_FLASH_DMD}" -o "${DMBOOT_MODULES_OUT_DIR}" -t "${DMOD_TOOLS_NAME}" --cpu-family "${DMBOOT_MCU_SERIES}" -y --type "${DMBOOT_MODULE_TYPE}" --config-dir "${DMBOOT_CONFIG_DIR}" --config-map "${DMBOOT_CONFIG_MAP}" --views-dir "${DMBOOT_EVIEWS_DIR}"
)
endif()
if(DMBOOT_EMULATION)
# Renode's USART cannot be served by DMA: the UARTs receive by interrupt
list(APPEND _FLASH_DOWNLOAD_COMMANDS
COMMAND ${CMAKE_COMMAND} -DDMUART_CONFIG_DIR=${DMBOOT_CONFIG_DIR}/drivers/dmuart
-P "${CMAKE_SOURCE_DIR}/scripts/emulation_uart_config.cmake"
)
endif()
list(APPEND _FLASH_DOWNLOAD_COMMANDS
COMMAND ${CMAKE_COMMAND} -E touch "${DMBOOT_MODULES_MARKER_FILE}"
)
Expand Down
18 changes: 18 additions & 0 deletions scripts/emulation_uart_config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Emulation: the UARTs receive by interrupt.
#
# Renode's STM32F7 USART has no DMA request line, so a UART that receives by
# DMA (dmuart's default) gets nothing there - the console would not read a
# key. dmuart's `rx_dma=0` makes it receive by interrupt, which the model
# serves; the hardware keeps the DMA. Run on the driver configuration the
# modules brought (DMBOOT_CONFIG_DIR/drivers/dmuart/*.ini):
#
# cmake -DDMUART_CONFIG_DIR=<dir> -P emulation_uart_config.cmake
#
file(GLOB DMUART_INIS "${DMUART_CONFIG_DIR}/*.ini")
foreach(INI ${DMUART_INIS})
file(READ "${INI}" CONTENT)
if(CONTENT MATCHES "driver_name=dmuart" AND NOT CONTENT MATCHES "(^|\n)rx_dma=")
string(REGEX REPLACE "(\n[ \t]*rx_ring_size=[^\n]*)" "\\1\nrx_dma=0" CONTENT "${CONTENT}")
file(WRITE "${INI}" "${CONTENT}")
endif()
endforeach()
Loading