Packtiles: explicitly put header assets in .data by default, provide _IMG_ASSET_SECTION macro to override. Regenerate font_8x8 with this change.

two-pixels-per-word
Luke Wren 2021-02-04 20:37:51 +00:00
rodzic 6dbb99dbe7
commit 7f6f906d4d
2 zmienionych plików z 11 dodań i 2 usunięć

Wyświetl plik

@ -1,4 +1,8 @@
static char __attribute__((aligned(4))) font_8x8[] = {
#ifndef _IMG_ASSET_SECTION
#define _IMG_ASSET_SECTION ".data"
#endif
static const char __attribute__((aligned(4), section(_IMG_ASSET_SECTION ".font_8x8"))) font_8x8[] = {
0x00, 0x18, 0x66, 0x2c, 0x08, 0x42, 0x38, 0x18, 0x30, 0x08, 0x36, 0x00, 0x00, 0x00, 0x00, 0x40,
0x3c, 0x10, 0x3c, 0x3c, 0x38, 0x7e, 0x3c, 0x7e, 0x3c, 0x3c, 0x00, 0x00, 0x20, 0x00, 0x0c, 0x1c,
0x3c, 0x70, 0x1e, 0x3c, 0x3e, 0x7c, 0x7c, 0x3c, 0x62, 0x38, 0x70, 0x62, 0x06, 0x3f, 0x3e, 0x3c,

Wyświetl plik

@ -30,7 +30,12 @@ class BinHeader:
arrayname = filename.split(".")[0]
self.f = open(filename, "w")
self.out_count = 0
self.f.write("static char __attribute__((aligned(4))) {}[] = {{\n\t".format(arrayname))
self.f.write(
"#ifndef _IMG_ASSET_SECTION\n" \
"#define _IMG_ASSET_SECTION \".data\"\n" \
"#endif\n\n" \
f"static const char __attribute__((aligned(4), section(_IMG_ASSET_SECTION \".{arrayname}\"))) {arrayname}[] = {{\n\t"
)
def write(self, bs):
for b in bs: