ESP32 drom0_0_seg overflowed Error Help

jedisonic124
Posts: 1
Joined: Wed Aug 21, 2024 11:44 am

ESP32 drom0_0_seg overflowed Error Help

Postby jedisonic124 » Wed Aug 21, 2024 2:12 pm

I have a ESP32-S3 Dev board with a display attached and I'm trying to store and upload multiple bitmap images to the board. The board has 16mb of memory and I'm using a partition that should use all of it.
Partition I'm using:
# Name Type SubType Offset Size Flags
nvs data nvs 0x9000 0x5000
otadata data ota 0xe000 0x2000
app0 app ota_0 0x10000 0xc00000
spiffs data spiffs 0xc10000 0xe0000
coredump data coredump 0xcf0000 0x310000
My current code (Not finished)
  1. #include <TFT_eSPI.h>
  2. #include <Arduino.h>
  3. #include "Mustang_Running_1st.h"
  4. #include "Mustang_Running_2nd.h"
  5. #include "Mustang_Running_3rd.h"
  6. #include "Mustang_Running_4th.h"
  7. #include "Mustang_Running_5th.h"
  8. #include "Mustang_Running_Rev.h"
  9. #include "Mustang_Neutral.h"
  10.  
  11. TFT_eSPI tft = TFT_eSPI();
  12.  
  13. void setup() {
  14.   // put your setup code here, to run once:
  15.   Serial.begin(115200);
  16.   pinMode(15, INPUT);
  17.  
  18.   tft.begin();
  19.   tft.setRotation(0);
  20.   tft.fillScreen(TFT_BLACK);
  21.   tft.setSwapBytes(true);
  22.   tft.setTextFont(2);
  23. }
  24.  
  25. int inc = 0;
  26.  
  27. void loop() {
  28.   // put your main code here, to run repeatedly:
  29.   char currentGear = 'N';
  30.  
  31.   int hallValue0 = analogRead(15);
  32.   int hallValue1 = analogRead(16);
  33.   int hallValue2 = analogRead(17);
  34.   int hallValue3 = analogRead(18);
  35.   Serial.println(hallValue0);
  36.   Serial.println(hallValue1);
  37.   Serial.println(hallValue2);
  38.   Serial.println(hallValue3);
  39.  
  40.   if (hallValue0 >= 2285 && hallValue0 <=2350){
  41.     currentGear = '1';
  42.     tft.pushImage(0, 0, 240, 240, epd_bitmap_1st_Gear_Run[inc]);
  43.     inc++;
  44.     if (inc >= 12){
  45.       inc = 0;
  46.     }
  47.     delay(20);
  48.   }
  49.   else if (hallValue1 >= 1880 && hallValue1 <= 2050){
  50.     currentGear = '2';
  51.     tft.pushImage(0, 0, 240, 240, epd_bitmap_2nd_Gear_Run[inc]);
  52.     inc++;
  53.     if (inc >= 12){
  54.       inc = 0;
  55.     }
  56.     delay(20);
  57.   }
  58.   else if ((hallValue0 >= 2200 && hallValue0 < 2285) && (hallValue3 >= 2300 && hallValue3 < 2700)){
  59.     currentGear = '3';
  60.     tft.pushImage(0, 0, 240, 240, epd_bitmap_3rd_Gear_Run[inc]);
  61.     inc++;
  62.     if (inc >= 12){
  63.       inc = 0;
  64.     }
  65.     delay(20);
  66.   }
  67.   else if (hallValue1 >= 2120 && (hallValue2 >= 2000 && hallValue2 <= 2020)){
  68.     currentGear = '4';
  69.     tft.pushImage(0, 0, 240, 240, epd_bitmap_4th_Gear_Run[inc]);
  70.     inc++;
  71.     if (inc >= 12){
  72.       inc = 0;
  73.     }
  74.     delay(20);
  75.   }
  76.   else if (hallValue3 >= 2700){
  77.     currentGear = '5';
  78.     tft.pushImage(0, 0, 240, 240, epd_bitmap_5th_Gear_Run[inc]);
  79.     inc++;
  80.     if (inc >= 12){
  81.       inc = 0;
  82.     }
  83.     delay(20);
  84.   }
  85.   else if (hallValue2 <= 1910){
  86.     currentGear = 'R';
  87.     tft.pushImage(0, 0, 240, 240, epd_bitmap_Rev_Gear_Run[inc]);
  88.     inc++;
  89.     if (inc >= 12){
  90.       inc = 0;
  91.     }
  92.     delay(20);
  93.   }
  94.   else {
  95.     currentGear = 'N';
  96.     tft.pushImage(0, 0, 240, 240, epd_bitmap_Neutral_Gear[0]);
  97.     delay(20);
  98.   }
  99.  
  100.  
  101.   tft.drawNumber(hallValue0, 50, 50);
  102.   tft.drawNumber(hallValue3, 150, 50);
  103.   tft.drawNumber(hallValue1, 50, 150);
  104.   tft.drawNumber(hallValue2, 150, 150);
  105.   tft.drawChar(currentGear, 120, 120, 4);
  106. }
I currently have 6 .h bitmap files for the pictures I'm using. 5 of the bitmap files are bitmap arrays. All 6 of them are placed in PROGMEM and have a total size of 4.5mb. When I try to upload it to the board I get the error drom0_0_seg overflowed by 500,000 bytes or so. I've read around and found that the board apparently has a data read only memory (drom) limit of 4mb, and that I can just place some things in the SPIFFS, however the SPIFFS isn't large enough no matter what partition I use, I'm unable to make a custom partition with working SPIFFS because it gives me an error about a string. The largest SPIFFS preset only has 1mb for the app and I need a lot more than that for the app itself.

If I end up commenting out one of the bitmap arrays in the main loop, the program runs and says it's only using 47% of available memory, so uncommenting the bitmap array shouldn't use up all of the memory. Is it possible to increase the drom limit size, or does anyone know how to make a custom partition with working spiffs bigger than 3mb so I can just upload the bitmaps to SPIFFS instead. I'm also confused about why, if all of the bitmaps are being stored in PROGMEM flash, can I not use the full 16mb of flash. Any help is appreciated

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

Re: ESP32 drom0_0_seg overflowed Error Help

Postby ESP_Sprite » Thu Aug 22, 2024 1:26 am

It's the difference between the amount of flash that can be physically connected to the ESP32 at the same time (16MiB I think) and the amount of flash that can be mapped into memory (to be used e.g. as an application) at the same time (which is limited to 4MiB). Can confirm the way to go here is probably to figure out how to increase the spiffs size and dump the images in there; I'm not sure how to do that under Arduino however.

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP32 drom0_0_seg overflowed Error Help

Postby lbernstone » Thu Aug 22, 2024 2:27 am

I would strongly recommend LittleFS rather than SPIFFS. Please explain what isn't working with custom partitions. You absolutely must get your math correct in the partitions.csv or it will use the default. If you have psram on your device, you could load the files into strings on the psram, which should give you a bit faster access than off a file system.
Here's an example of a custom partition scheme.
You can load files into the partition using the extension. Note that this only works in Arduino 1.8.x!! Platformio has it's own plugin.

chegewara
Posts: 2375
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 drom0_0_seg overflowed Error Help

Postby chegewara » Thu Aug 22, 2024 4:59 am

For very long time i didnt see any reference to HIMEM on esp32, not sure if its still supported tho.

It was quite a nice mechanism allowing to switch between 2 "pages" and map one at the time to memory map.
IIRC mr Sprite has quite a good knowledge about it.

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP32 drom0_0_seg overflowed Error Help

Postby lbernstone » Sat Aug 24, 2024 4:11 am

Himem is for esp32 variant only. S3 can directly map 8MB of psram, so the page switching that himem provides is not necessary.

chegewara
Posts: 2375
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 drom0_0_seg overflowed Error Help

Postby chegewara » Sat Aug 24, 2024 11:27 pm

Yeah,
i missed the fact it is S3. (title is confusing :?:)

Who is online

Users browsing this forum: No registered users and 128 guests