Skip to content

Commit

Permalink
Incorporate review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Icedude907 committed Nov 23, 2023
1 parent a0bf504 commit 7cf8b89
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
2 changes: 1 addition & 1 deletion gflib/malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
static void *sHeapStart;
static u32 sHeapSize;

__attribute__((section("__EWRAM_HEAP"))) u8 gHeap[HEAP_SIZE] = {0};
EWRAM_DATA u8 gHeap[HEAP_SIZE] = {0};

#define MALLOC_SYSTEM_ID 0xA3A3

Expand Down
3 changes: 1 addition & 2 deletions gflib/malloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

#define TRY_FREE_AND_SET_NULL(ptr) if (ptr != NULL) FREE_AND_SET_NULL(ptr)

// 122 KB. Max size of the heap without running into other data
#define HEAP_SIZE 0x1C000
extern u8 gHeap[];
extern u8 gHeap[HEAP_SIZE];

void *Alloc(u32 size);
void *AllocZeroed(u32 size);
Expand Down
6 changes: 2 additions & 4 deletions ld_script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ SECTIONS {
ewram 0x2000000 (NOLOAD) :
ALIGN(4)
{
*(__EWRAM_HEAP);

INCLUDE "sym_ewram.ld"
src/*.o(ewram_data); /**/
gflib/*.o(ewram_data); /**/
src/*.o(ewram_data);
gflib/*.o(ewram_data);

*libc.a:impure.o(.data);
*libc.a:locale.o(.data);
Expand Down
15 changes: 5 additions & 10 deletions ld_script_modern.ld
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ ENTRY(Start)
gNumMusicPlayers = 4;
gMaxLines = 0;

/* Memory Spaces */
MEMORY
{
EWRAM (rwx) : ORIGIN = 0x2000000, LENGTH = 256K
Expand All @@ -16,10 +15,8 @@ SECTIONS {
ewram 0x2000000 (NOLOAD) :
ALIGN(4)
{
*(__EWRAM_HEAP);

src/*.o(ewram_data); /**/
gflib/*.o(ewram_data); /**/
src/*.o(ewram_data);
gflib/*.o(ewram_data);
} > EWRAM

iwram 0x3000000 (NOLOAD) :
Expand All @@ -31,13 +28,11 @@ SECTIONS {
*libc.a:*.o(.bss*);
*libnosys.a:*.o(.bss*);

/* .bss.code starts at 0x3001AA8 */
src/m4a.o(.bss.code);

/* COMMON starts at 0x30022A8 */
src/*.o(COMMON); /**/
gflib/*.o(COMMON); /**/
*libc.a:*.o(COMMON);
src/*.o(COMMON);
gflib/*.o(COMMON);
*libc.a:*.o(COMMON);
*libnosys.a:*.o(COMMON);
} > IWRAM

Expand Down
1 change: 1 addition & 0 deletions sym_ewram.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.include "gflib/malloc.o"
.include "src/decompress.o"
.include "src/main.o"
.include "gflib/window.o"
Expand Down

0 comments on commit 7cf8b89

Please sign in to comment.