region `dram0_0_seg' overflowed

teckhaokoh
Posts: 34
Joined: Wed Sep 21, 2016 6:40 am

region `dram0_0_seg' overflowed

Postby teckhaokoh » Tue Sep 19, 2017 7:52 am

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.

ESP_Sprite
Posts: 9013
Joined: Thu Nov 26, 2015 4:08 am

Re: region `dram0_0_seg' overflowed

Postby ESP_Sprite » Tue Sep 19, 2017 8:52 am

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.

teckhaokoh
Posts: 34
Joined: Wed Sep 21, 2016 6:40 am

Re: region `dram0_0_seg' overflowed

Postby teckhaokoh » Wed Sep 20, 2017 3:03 am

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?

ESP_Sprite
Posts: 9013
Joined: Thu Nov 26, 2015 4:08 am

Re: region `dram0_0_seg' overflowed

Postby ESP_Sprite » Wed Sep 20, 2017 6:01 am

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.)

teckhaokoh
Posts: 34
Joined: Wed Sep 21, 2016 6:40 am

Re: region `dram0_0_seg' overflowed

Postby teckhaokoh » Thu Sep 21, 2017 4:08 am

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!

Who is online

Users browsing this forum: No registered users and 68 guests