Hi Kevin, nice catch :-) Does that (disabling DMA) has impact on efficiency? Maybe this variable should be kconfig configurable with detailed explanation on what it does? :-)
-- CeDeROM, SQ7MHZ, http://www.tomek.cedro.info On Fri, Jul 25, 2025, 16:31 Kevin Witteveen <kevinwit1...@gmail.com> wrote: > Hi NuttX, > > *Days of debugging, out of memory problems when opening files.* > Last couple days I've struggled with an annoying problem where opening > files were throwing out-of-memory errors even when I have way more than > enough memory left. > > After changing the config, changing code and uploading atleast 100 times, > trying new things, I have discovered that I could specifically only open 8 > files before the ENOMEM error. > > So I started digging and found out that a couple boards such as > STMF429ZI have a source file called {arch here}_dma_alloc.c with a #define > called "BOARD_DMA_ALLOC_POOL_SIZE". > This is a constant set to 8 * 512. > Interesting... This is used for the granule allocator and is enabled by > configuring CONFIG_GRAN and CONFIG_FAT_DMAMEMORY. > > After disabling these, it worked. I can make many files now without errors. > > *TLDR* > opening multiple files returns *unexplained* -ENOMEM (out of memory) when > there is plenty of memory left. > Caused by constant CONFIG_FAT_DMAMEMORY (8*512) in multiple board's > {arch}_dma_alloc.c granular allocator. > Fixed by disabling CONFIG_FAT_DMAMEMORY > > *My hardware* > STM32H743 custom board > SD card with 4 wide SDIO > USB MSC master > > > *Solution?*I'm sure there is a brilliant reason why > BOARD_DMA_ALLOC_POOL_SIZE is specifically set to 8*512, but I think it is > very important to document this. > Another great addition would be to throw a specific error message when this > out of memory problem happens. Something hinting towards > BOARD_DMA_ALLOC_POOL_SIZE, FAT_DMAMEMORY or similar. > > What do we think? > > Best, > > Kevin (Keever50 or Martinimarter at github) >