Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
minrt 0.8.0: vram sections
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarLambda committed Feb 20, 2023
1 parent 51f07d2 commit a46eca8
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ make_dist() {
[ ! -d "$DIST" ] && mkdir "$DIST" || rm "$DIST"/*

(PROJECT=libseven VERSION=0.17.2 make_dist)
(PROJECT=minrt VERSION=0.7.3 make_dist)
(PROJECT=minrt VERSION=0.8.0 make_dist)
4 changes: 2 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
project('sdk-seven', 'c',
version: '0.19.5',
version: '0.20.0',
license: 'Zlib',
meson_version: '>=0.59.0',
default_options: ['warning_level=2', 'c_std=c99'])

libseven_version = '0.17.2'
minrt_version = '0.7.3'
minrt_version = '0.8.0'

cflags = [
'-mthumb',
Expand Down
47 changes: 47 additions & 0 deletions minrt/lib/ldscripts/gba.x
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ PHDRS
LOAD PT_LOAD FLAGS(5);
IWRAM PT_LOAD FLAGS(7);
EWRAM PT_LOAD FLAGS(7);
VRAM PT_LOAD FLAGS(7);
DATA PT_LOAD FLAGS(6);
PERSISTENT PT_LOAD FLAGS(6);
}
Expand Down Expand Up @@ -103,6 +104,34 @@ SECTIONS
.ewramF { *(.ewramF .ewramF.*) }
} >EWRAM AT>LOAD_REGION

/* VRAM code/data */

.vram :
{
*(SORT(.vram.sorted.*))
*(.vram .vram.*)
} >VRAM AT>LOAD_REGION :VRAM

OVERLAY : NOCROSSREFS
{
.vram0 { *(.vram0 .vram0.*) }
.vram1 { *(.vram1 .vram1.*) }
.vram2 { *(.vram2 .vram2.*) }
.vram3 { *(.vram3 .vram3.*) }
.vram4 { *(.vram4 .vram4.*) }
.vram5 { *(.vram5 .vram5.*) }
.vram6 { *(.vram6 .vram6.*) }
.vram7 { *(.vram7 .vram7.*) }
.vram8 { *(.vram8 .vram8.*) }
.vram9 { *(.vram9 .vram9.*) }
.vramA { *(.vramA .vramA.*) }
.vramB { *(.vramB .vramB.*) }
.vramC { *(.vramC .vramC.*) }
.vramD { *(.vramD .vramD.*) }
.vramE { *(.vramE .vramE.*) }
.vramF { *(.vramF .vramF.*) }
} >VRAM AT>LOAD_REGION

/* Standard data */

.data :
Expand Down Expand Up @@ -133,6 +162,13 @@ SECTIONS
*(.sbss .sbss.*)
} >EWRAM :NONE

/* VRAM zero-initialized data */

.vram_bss (NOLOAD) :
{
*(.vram_bss .vram_bss.*)
} >VRAM :NONE

/* Standard zero-initialized data */

.bss (NOLOAD) :
Expand Down Expand Up @@ -222,6 +258,7 @@ SECTIONS
.load_end : {} >LOAD_REGION
.iwram_end : {} >IWRAM
.ewram_end : {} >EWRAM
.vram_end : {} >VRAM

/* Section symbols */

Expand All @@ -240,6 +277,12 @@ SECTIONS

__ewram_overlay = ADDR(.ewram0);

__vram_vma = ADDR(.vram);
__vram_lma = LOADADDR(.vram);
__vram_len = SIZEOF(.vram);

__vram_overlay = ADDR(.vram0);

__data_vma = ADDR(.data);
__data_lma = LOADADDR(.data);
__data_len = SIZEOF(.data);
Expand All @@ -254,6 +297,9 @@ SECTIONS
__ewram_bss_vma = ADDR(.ewram_bss);
__ewram_bss_len = SIZEOF(.ewram_bss);

__vram_bss_vma = ADDR(.vram_bss);
__vram_bss_len = SIZEOF(.vram_bss);

__bss_vma = ADDR(.bss);
__bss_len = SIZEOF(.bss);

Expand All @@ -265,6 +311,7 @@ SECTIONS

__iwram_end = ADDR(.iwram_end);
__ewram_end = ADDR(.ewram_end);
__vram_end = ADDR(.vram_end);

/* libc-compatibility symbols */

Expand Down
1 change: 1 addition & 0 deletions minrt/lib/ldscripts/multiboot.mem
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ MEMORY
{
EWRAM : ORIGIN = 0x02000000, LENGTH = 256K
IWRAM : ORIGIN = 0x03000000, LENGTH = 32K - 512
VRAM : ORIGIN = 0x06000000, LENGTH = 96K
}

REGION_ALIAS("LOAD_REGION", EWRAM)
Expand Down
1 change: 1 addition & 0 deletions minrt/lib/ldscripts/rom.mem
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ MEMORY
{
EWRAM : ORIGIN = 0x02000000, LENGTH = 256K
IWRAM : ORIGIN = 0x03000000, LENGTH = 32K - 512
VRAM : ORIGIN = 0x06000000, LENGTH = 96K
ROM : ORIGIN = 0x08000000, LENGTH = 32M
}

Expand Down
21 changes: 18 additions & 3 deletions minrt/src/gba/crt0.s
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.cpu arm7tdmi

.section .pad,"aR",%progbits
.string "minrt 0.7.3"
.string "minrt 0.8.0"

.section .text._start_rom,"ax",%progbits
_start_rom:
Expand Down Expand Up @@ -74,6 +74,15 @@ _start:
bl memcpy
1:

@ .vram section
ldr r0, =__vram_vma
ldr r1, =__vram_lma
ldr r2, =__vram_len
cmp r2, 0
beq 1f
bl memcpy
1:

@ .data section
ldr r0, =__data_vma
ldr r1, =__data_lma
Expand All @@ -98,18 +107,24 @@ _start:
bl memcpy
1:

@ .iwram.bss section
@ .iwram_bss section
ldr r0, =__iwram_bss_vma
movs r1, 0
ldr r2, =__iwram_bss_len
bl memset

@ .ewram.bss section
@ .ewram_bss section
ldr r0, =__ewram_bss_vma
movs r1, 0
ldr r2, =__ewram_bss_len
bl memset

@ .vram_bss section
ldr r0, =__vram_bss_vma
movs r1, 0
ldr r2, =__vram_bss_len
bl memset

@ .bss section
ldr r0, =__bss_vma
movs r1, 0
Expand Down

0 comments on commit a46eca8

Please sign in to comment.