From 7f6f906d4d8d6a0228bf9d5d54a9b39a6466468b Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Thu, 4 Feb 2021 20:37:51 +0000 Subject: [PATCH] Packtiles: explicitly put header assets in .data by default, provide _IMG_ASSET_SECTION macro to override. Regenerate font_8x8 with this change. --- software/assets/font_8x8.h | 6 +++++- software/scripts/packtiles | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/software/assets/font_8x8.h b/software/assets/font_8x8.h index b90084c..312608a 100644 --- a/software/assets/font_8x8.h +++ b/software/assets/font_8x8.h @@ -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, diff --git a/software/scripts/packtiles b/software/scripts/packtiles index 2d7c97d..56403e0 100755 --- a/software/scripts/packtiles +++ b/software/scripts/packtiles @@ -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: