Page 1 of 1
region `dram0_0_seg' overflowed
Posted: Tue Sep 19, 2017 7:52 am
by teckhaokoh
Hi,
I added new driver into my code, then compile my project and got the overflowed error.
##############################
/home/user/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/user/esp/esp-idf/examples/limidea/build/limidea.elf section `.dram0.bss' will not fit in region `dram0_0_seg'
/home/user/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: region `dram0_0_seg' overflowed by 127200 bytes
##############################
Any suggestion on how should I free up the memory for the overflowed part?
I"ve tried to use heap_caps_malloc(sizeof(n),MALLOC_CAP_32BIT ), to allocate the memory for the structure I created, but it doesn't improve anything.
Re: region `dram0_0_seg' overflowed
Posted: Tue Sep 19, 2017 8:52 am
by ESP_Sprite
This is because you have an (uininitialized) statically allocated variable that is too large. It has nothing to do with malloc or heap_alloc_caps, those aren't looked at at compile time.
Re: region `dram0_0_seg' overflowed
Posted: Wed Sep 20, 2017 3:03 am
by teckhaokoh
ESP_Sprite wrote:This is because you have an (uininitialized) statically allocated variable that is too large. It has nothing to do with malloc or heap_alloc_caps, those aren't looked at at compile time.
Thanks for the response.
Any example of the declaration/definition variables/codes that may contribute to the indicated overflowed amount of memory (for my case 127200 bytes as shown from the error message)?
Does this means there are no way I can remain those variables/codes in my project?
Any workaround?
Re: region `dram0_0_seg' overflowed
Posted: Wed Sep 20, 2017 6:01 am
by ESP_Sprite
You can look at build/[your-project-name].map to see what the memory use is. The file is kind-of dense, but it gives your all the info you should need. In your case, dram0.bss is too big, so search for the line that starts with '.dram0.bss'. Here, you'll find all variables that are stashed in this region. After this are a bunch of lines indicating which variables are where for this section (in this case, the lines starting with .bss) The fields here are '.bss.variable_name address_of_variable size_of_variable_in_hex object_file_variable_is_in'.
If you look at this in your project, you'll probably see a line where the size in hex is very large (more than 0x20000, I suspect). That's the one you want to reduce. (Ofcourse it's also possible your memory gets filled up with a lot of smaller variables... but the mapfile should show that as well.)
Re: region `dram0_0_seg' overflowed
Posted: Thu Sep 21, 2017 4:08 am
by teckhaokoh
ESP_Sprite wrote:You can look at build/[your-project-name].map to see what the memory use is. The file is kind-of dense, but it gives your all the info you should need. In your case, dram0.bss is too big, so search for the line that starts with '.dram0.bss'. Here, you'll find all variables that are stashed in this region. After this are a bunch of lines indicating which variables are where for this section (in this case, the lines starting with .bss) The fields here are '.bss.variable_name address_of_variable size_of_variable_in_hex object_file_variable_is_in'.
If you look at this in your project, you'll probably see a line where the size in hex is very large (more than 0x20000, I suspect). That's the one you want to reduce. (Ofcourse it's also possible your memory gets filled up with a lot of smaller variables... but the mapfile should show that as well.)
Thank you very much, this is very helpful!!!
I found it and reduced it!