Problems with Bitmaps on TFT Display using GFX Library

I have installed Arduino IDE to check this.

Sketch with
only header

#ifndef SAMPLE_DATA_H
#define SAMPLE_DATA_H

#include <stdint.h>
#include <avr/pgmspace.h>

static const uint8_t PROGMEM data_array[1024] = { 1, 2, 3 };

#endif // SAMPLE_DATA_H

gives me following output:

Sketch uses 2554 bytes (7%) of program storage space. Maximum is 32256 bytes.
Global variables use 10 bytes (0%) of dynamic memory, leaving 2038 bytes for local variables. Maximum is 2048 bytes.


But with using of
header

#ifndef SAMPLE_DATA_H
#define SAMPLE_DATA_H

#include <stdint.h>
#include <avr/pgmspace.h>

extern const uint8_t PROGMEM data_array[1024];

#endif // SAMPLE_DATA_H

and
source

#include "sample_data.h"

const uint8_t PROGMEM data_array[1024] = { 1, 2, 3 };

gives me other output:

Sketch uses 1528 bytes (4%) of program storage space. Maximum is 32256 bytes.
Global variables use 10 bytes (0%) of dynamic memory, leaving 2038 bytes for local variables. Maximum is 2048 bytes.

Hence the obvious conclusion: your common practice (data in header files) is a bad way.

sketch_may19a-001-common-practice.zip (1.63 KB)

sketch_may19a-002-right-way.zip (1.85 KB)