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
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ endif()

include(configs/mcu/${TARGET}.cmake)

# The heaps' names - dmheap tags: kinds of memory, separated by commas, that
# drivers find a heap by (dmheap_get_context_by_name("dma")) and modules ask
# for (Dmod_MallocTagged("fast", ...)). After the MCU configuration, which
# says what its memories are.
set(DMBOOT_DMA_HEAP_TAGS "dma" CACHE STRING "Tags of the DMA heap (linker region dma): dma, and e.g. fast where it is fast internal RAM")
set(DMBOOT_MAIN_HEAP_TAGS "main" CACHE STRING "Tags of the main heap (linker region ram)")

# Splash logo - after the board configuration, which picks the asset
set(DMBOOT_SPLASH_LOGO "" CACHE STRING "Splash logo the display driver shows at start: name of an asset in assets/splash/ (e.g. dmodos_logo_128) or a path to a .dmvi file; empty: no logo")
set(DMBOOT_SPLASH_LOGO_PATH "/eviews/splash_logo.dmvir" CACHE STRING "Path of the splash logo (.dmvir) on the target, passed to the display driver in the SPLASH_LOGO environment variable; empty: not set")
Expand Down Expand Up @@ -184,6 +191,8 @@ target_compile_definitions(${MODULE_NAME}.elf
DMBOOT_SHELL_STRING="${DMBOOT_SHELL}"
DMBOOT_MAIN_MODULE_ARGS_STRING="${DMBOOT_MAIN_MODULE_ARGS}"
DMBOOT_SPLASH_LOGO_PATH_STRING="${DMBOOT_SPLASH_LOGO_PATH}"
DMBOOT_DMA_HEAP_TAGS_STRING="${DMBOOT_DMA_HEAP_TAGS}"
DMBOOT_MAIN_HEAP_TAGS_STRING="${DMBOOT_MAIN_HEAP_TAGS}"
)

target_link_options(${MODULE_NAME}.elf
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,17 @@ dmlcdtft), the `dma` heap is the DTCM, which is never cached, and the module
loader calls `Dmod_SyncCode()` once a module is in place, so its code
reaches the instruction fetch.

### Heaps and their tags

A heap's name is the list of its tags - kinds of memory (dmheap): drivers find
the DMA heap by a tag (`dmheap_get_context_by_name("dma")`), modules ask for
memory of a kind with `Dmod_MallocTagged("fast", ...)` and get the default
memory when there is none. `DMBOOT_DMA_HEAP_TAGS` and `DMBOOT_MAIN_HEAP_TAGS`
name the heaps (`dma`, `main` by default); an MCU's configuration says what its
memories are - the STM32F746's DMA heap is the DTCM, `dma,fast,dtcm`: the
fastest RAM there is, given to what is worked on all the time (dmmp3's decoder
state: 70 % of the CPU in the SDRAM, 15 % there).

### `monitor-gdb`
Monitor logs from the firmware in real-time via GDB server. This target:
- Automatically builds the `dmlog_monitor` tool for the host architecture
Expand Down
6 changes: 6 additions & 0 deletions configs/board/stm32f746g-disco/flash.dmd
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,9 @@ dmview@>=0.10 rules=dmview.rules
# files of the card's music/ directory through dmaudio.
#
carhmi service=carhmi.ini
#
# The decoders of the album covers carhmi makes of the MP3 files' pictures:
# dmimg finds them by name, so they are not in carhmi's dependencies.
#
dmimg_jpeg
dmimg_png
9 changes: 9 additions & 0 deletions configs/mcu/STM32F746ZG.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ set(OPENOCD_TARGET "target/stm32f7x.cfg" CACHE STRING "OpenOCD target configurat
# Name of the target cpu (if empty, the target is generic)
set(DMOD_CPU_NAME ${DMBOOT_MCU_NAME} CACHE STRING "Name of the target cpu, if empty, the target is generic")

# ======================================================================
# Heaps
# ======================================================================
# The DMA heap is the DTCM: reached by DMA through the core's AHBS port, never
# in the data cache - and the fastest RAM there is (no wait states, beside the
# cache): also what modules get when they ask for "fast" memory (e.g. dmmp3's
# decoder state - 70 % of the CPU in the SDRAM, 15 % here)
set(DMBOOT_DMA_HEAP_TAGS "dma,fast,dtcm" CACHE STRING "Tags of the DMA heap (linker region dma)")

# ======================================================================
# Renode Configuration
# ======================================================================
Expand Down
9 changes: 9 additions & 0 deletions configs/mcu/STM32F746xG.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ set(OPENOCD_TARGET "target/stm32f7x.cfg" CACHE STRING "OpenOCD target configurat
set(DMOD_CPU_NAME ${DMBOOT_MCU_NAME} CACHE STRING "Name of the target cpu, if empty, the target is generic")
set(DMBOOT_IRQ_COUNT 98 CACHE STRING "Number of external IRQ lines for this MCU")

# ======================================================================
# Heaps
# ======================================================================
# The DMA heap is the DTCM: reached by DMA through the core's AHBS port, never
# in the data cache - and the fastest RAM there is (no wait states, beside the
# cache): also what modules get when they ask for "fast" memory (e.g. dmmp3's
# decoder state - 70 % of the CPU in the SDRAM, 15 % here)
set(DMBOOT_DMA_HEAP_TAGS "dma,fast,dtcm" CACHE STRING "Tags of the DMA heap (linker region dma)")

# ======================================================================
# Renode Configuration
# ======================================================================
Expand Down
2 changes: 1 addition & 1 deletion lib/dmheap
4 changes: 2 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,10 +595,10 @@ int main(int argc, char** argv)
dmlog_set_as_default(ctx);

// Initialize the DMA-capable heap (named "dma"), if the target defines one
init_heap(&__dma_start__, &__dma_end__, "dma", false);
init_heap(&__dma_start__, &__dma_end__, DMBOOT_DMA_HEAP_TAGS_STRING, false);

// Initialize the main heap; a failure here is unrecoverable
init_heap(&__heap_start__, &__heap_end__, "main", true);
init_heap(&__heap_start__, &__heap_end__, DMBOOT_MAIN_HEAP_TAGS_STRING, true);

dmenv_ctx_t dmenv_ctx = dmenv_create(NULL);
if(dmenv_ctx == NULL)
Expand Down
Loading