Successfully tested on real hardware on multiple optimization levels. I knew in the previous commit that __attribute__((aligned(32))) did not actually align to 32-bytes. However, at -Os specifically, and only with that exact code, GCC was coincidentally generating a 32-byte alignment. When the code or optimization level changed, this changed the alignment of the "scene" buffer, which caused CH2-DMA to perform incomplete copies of the TA parameters, which in turn variously caused the TA to generate incomplete/nonsensical/nonexistent object lists. This also fixes an unrelated issue with the background ISP/TSP parameters. This "worked" in flycast but not on real hardware by complete accident (a coincidence of the specific timing that the ISP/TSP parameters are read in each Dreamcast implementation). The issue is that the TSP parameters are 60 bytes long, which is greater than the 32 bytes were previously being allocated. After changing the allocation to 64 bytes, the background color is now drawn on real hardware as expected. In addition, though this did not cause issues yet, I corrected the length of p1ram/p2ram in the linker script, to prevent future issues where GCC's memory allocations wrap around past the end of the system memory address space.
68 lines
1.0 KiB
Plaintext
68 lines
1.0 KiB
Plaintext
OUTPUT_FORMAT("elf32-shl", "elf32-shl", "elf32-shl")
|
|
MEMORY
|
|
{
|
|
p1ram : ORIGIN = 0xac020000, LENGTH = 0xff0000
|
|
}
|
|
SECTIONS
|
|
{
|
|
. = 0xac020000;
|
|
|
|
.text ALIGN(4) : SUBALIGN(4)
|
|
{
|
|
KEEP(*(.text.start))
|
|
*(.text.startup.*)
|
|
*(.text.*)
|
|
*(.text)
|
|
} > p1ram
|
|
|
|
.data ALIGN(4) : SUBALIGN(4)
|
|
{
|
|
*(.data)
|
|
*(.data.*)
|
|
} > p1ram
|
|
|
|
.rodata ALIGN(4) : SUBALIGN(4)
|
|
{
|
|
*(.rodata)
|
|
*(.rodata.*)
|
|
} > p1ram
|
|
|
|
.ctors ALIGN(4) : SUBALIGN(4)
|
|
{
|
|
KEEP(*(.ctors))
|
|
KEEP(*(.ctors.*))
|
|
} > p1ram
|
|
|
|
.bss ALIGN(4) (NOLOAD) : SUBALIGN(4)
|
|
{
|
|
*(.bss)
|
|
*(.bss.*)
|
|
} > p1ram
|
|
|
|
.text.p2ram ALIGN(4) : SUBALIGN(4)
|
|
{
|
|
*(.p2ram)
|
|
*(.p2ram.*)
|
|
} > p1ram
|
|
|
|
__p1ram_end = .;
|
|
|
|
/DISCARD/ :
|
|
{
|
|
*(.debug*)
|
|
*(.comment*)
|
|
*(.rela*)
|
|
}
|
|
|
|
__bss_link_start = ADDR(.bss);
|
|
__bss_link_end = ADDR(.bss) + SIZEOF(.bss);
|
|
|
|
__ctors_link_start = ADDR(.ctors);
|
|
__ctors_link_end = ADDR(.ctors) + SIZEOF(.ctors);
|
|
}
|
|
|
|
__p1ram_start = ORIGIN(p1ram);
|
|
__p1ram_end = ORIGIN(p1ram) + LENGTH(p1ram);
|
|
|
|
INCLUDE "addresses.lds"
|