Skip to content

Commit

Permalink
Move various data structures to data section (backported from e6934a5)
Browse files Browse the repository at this point in the history
  • Loading branch information
cahirwpz committed Dec 16, 2023
1 parent c255c3f commit 4363035
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions include/cdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")))
Expand Down
2 changes: 1 addition & 1 deletion lib/libpt/ptplayer.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions tools/png2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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},')
Expand Down Expand Up @@ -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,')
Expand All @@ -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,')
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4363035

Please sign in to comment.