diff --git a/CMakeLists.txt b/CMakeLists.txt index aa9705c..dc67ea2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") @@ -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 diff --git a/README.md b/README.md index 309d81c..20b9dc8 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/configs/board/stm32f746g-disco/flash.dmd b/configs/board/stm32f746g-disco/flash.dmd index 2a51133..43f4c9d 100644 --- a/configs/board/stm32f746g-disco/flash.dmd +++ b/configs/board/stm32f746g-disco/flash.dmd @@ -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 diff --git a/configs/mcu/STM32F746ZG.cmake b/configs/mcu/STM32F746ZG.cmake index f9f87cd..0142021 100644 --- a/configs/mcu/STM32F746ZG.cmake +++ b/configs/mcu/STM32F746ZG.cmake @@ -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 # ====================================================================== diff --git a/configs/mcu/STM32F746xG.cmake b/configs/mcu/STM32F746xG.cmake index 4b34842..d3995f6 100644 --- a/configs/mcu/STM32F746xG.cmake +++ b/configs/mcu/STM32F746xG.cmake @@ -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 # ====================================================================== diff --git a/lib/dmheap b/lib/dmheap index 35c23ad..ccab941 160000 --- a/lib/dmheap +++ b/lib/dmheap @@ -1 +1 @@ -Subproject commit 35c23ad9972b527c5598929f6c944f0109b81920 +Subproject commit ccab9410ae07ec4eed2e01c7249255df112b471d diff --git a/lib/dmod b/lib/dmod index cefe9a3..84ea95f 160000 --- a/lib/dmod +++ b/lib/dmod @@ -1 +1 @@ -Subproject commit cefe9a33874e2049d1cf1cb0be2074ed8840e583 +Subproject commit 84ea95f2336cb6e040534e1766553c9361ddb283 diff --git a/src/main.c b/src/main.c index b042cd5..21ac75d 100644 --- a/src/main.c +++ b/src/main.c @@ -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)