Linker issues? const appears multiple times in rodata.
Posted: Sat May 01, 2021 1:28 pm
Hi all,
I have posted this on the platformio forums but thought it made perhaps more sense here.
We have been working on a project for quite a while now and we just recently discovered that the compiled binary seems to contain several copies of some variables.
We are using the widely used OLED library for SSD1306 displays :
https://github.com/ThingPulse/esp8266-oled-ssd1306
The repeated elements in the memory are the fonts. Here is what the beginning of the font file looks like:
I found out by using the Inspect tool of PlatformIO and confirmed it by using binwalk on the binary from a terminal to check if it contained the initial bytes of the fonts. It does have them; binwalk returns the exact same number of results as the font appears on the results of the Inspect tool.
This is chewing quite a bit of flash. Why would this be happening? What is the solution?
Thank you
I have posted this on the platformio forums but thought it made perhaps more sense here.
We have been working on a project for quite a while now and we just recently discovered that the compiled binary seems to contain several copies of some variables.
We are using the widely used OLED library for SSD1306 displays :
https://github.com/ThingPulse/esp8266-oled-ssd1306
The repeated elements in the memory are the fonts. Here is what the beginning of the font file looks like:
Code: Select all
#ifndef OLEDDISPLAYFONTS_h
#define OLEDDISPLAYFONTS_h
const uint8_t ArialMT_Plain_10[] PROGMEM = {
0x0A, // Width: 10
0x0D, // Height: 13
0x20, // First Char: 32
0xE0, // Numbers of Chars: 224
// Jump Table:
0xFF, 0xFF, 0x00, 0x03, // 32:65535
0x00, 0x00, 0x04, 0x03, // 33:0
0x00, 0x04, 0x05, 0x04, // 34:4
0x00, 0x09, 0x09, 0x06, // 35:9
0x00, 0x12, 0x0A, 0x06, // 36:18
0x00, 0x1C, 0x10, 0x09, // 37:28
0x00, 0x2C, 0x0E, 0x07, // 38:44
0x00, 0x3A, 0x01, 0x02, // 39:58
This is chewing quite a bit of flash. Why would this be happening? What is the solution?
Thank you