Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
maybe it is a bit offtopic, because it tends to be some STM know how problem.
I just began trying to add USB hub support to the Cube library. But I am new to the STM32 controllers and therefore don't understand all the memory types of the STM.
My problem is, I am running out of DTCMRAM.
I have to add a field of five USBH_HandleTypeDef's variables in usbh_conf.c and extend the structure USBH_HandleTypeDef in usbh_def.h by to __IO uint8_t members. After that I get an error:
`._user_heap_stack' will not fit in region `DTCMRAM' region `DTCMRAM' overflowed by 1984 bytes
I found that DTCMRAM is defined in STM32H743II_FLASH.ld as an 128k block of memory at address 0x20000000.
The question is: why do I overflow it by such a small change?
1. 128k are a lot, how can I overflow by 1984 bytes by only adding five times a structure which is not so big. 2. How can I see how much DTCMRAM is used without my changes? 3. Is it possible to place the field elsewhere in memory and how? 4. If CMM2's firmware has already nearly filled up the DTCMRAM, is it possible to somehow reduce some memory used by the firmware. Maybe by reducing some cache spaces or something?
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10582
Posted: 08:57am 14 Oct 2020
Copy link to clipboard
Print this post
You can see what is using memory in the map file produced in the release folder. To give a bit more space in DTCMRAM reduce the size of CONSOLE_TX_BUF_SIZE or reduce the size of the stack. I think USB uses heap so you may need to increase that