diff --git a/include/cdefs.h b/include/cdefs.h index 99658c3a..07c0a0a1 100644 --- a/include/cdefs.h +++ b/include/cdefs.h @@ -19,6 +19,8 @@ * scalar variable if you want it to be accessed with PC-relative addressing. * This saves 4 cycles / 2 bytes of instruction memory / 1 relocation. */ #define __code __attribute__((section(".text"))) +/* Annotate initialized variable to be put into memory section. */ +#define __data __attribute__((section(".data"))) /* Annotate initialized variable to be put into memory accessible * by custom chipset. */ #define __data_chip __attribute__((section(".datachip"))) diff --git a/lib/libpt/ptplayer.asm b/lib/libpt/ptplayer.asm index 7444f5c2..ffec6b1e 100644 --- a/lib/libpt/ptplayer.asm +++ b/lib/libpt/ptplayer.asm @@ -3139,7 +3139,7 @@ MasterVolTab64: ***************************************************************************** - section __MERGED,bss + section '.bss',bss rsreset ; Antiriad - put this at the start of mt_data to avoid alignment issues with the rs.b near the end diff --git a/tools/png2c.py b/tools/png2c.py index d7aa83ee..17358038 100755 --- a/tools/png2c.py +++ b/tools/png2c.py @@ -196,7 +196,7 @@ def do_bitmap(im, desc): if onlydata: return - print('%sconst BitmapT %s = {' % ('' if shared else 'static ', name)) + print('%sconst __data BitmapT %s = {' % ('' if shared else 'static ', name)) print(f' .width = {width},') print(f' .height = {height},') print(f' .depth = {depth},') @@ -295,7 +295,7 @@ def do_sprite(im, desc): sprites.append((sprite, attached_str)) if n > 1: - print(f'static SpriteT {name}[{n}] = {{') + print(f'static __data SpriteT {name}[{n}] = {{') for sprite, attached_str in sprites: print(' {') print(f' .sprdat = &{sprite}_sprdat,') @@ -304,7 +304,7 @@ def do_sprite(im, desc): print(' },') print('};') else: - print(f'static SpriteT {name} = {{') + print(f'static __data SpriteT {name} = {{') print(f' .sprdat = &{name}_sprdat,') print(f' .height = {height},') print(f' .attached = false,') @@ -380,7 +380,7 @@ def do_pixmap(im, desc): print('') if not onlydata: - print('static const PixmapT %s = {' % name) + print('static const __data PixmapT %s = {' % name) print(' .type = %s,' % pixeltype) print(' .width = %d,' % width) print(' .height = %d,' % height) @@ -420,7 +420,7 @@ def do_palette(im, desc): print("#define %s_count %d\n" % (name, len(cmap))) - print('%sconst PaletteT %s = {' % ('' if shared else 'static ', name)) + print('%sconst __data PaletteT %s = {' % ('' if shared else 'static ', name)) print(' .count = %d,' % len(cmap)) print(' .colors = {') for r, g, b in cmap: