rgbds
rgbds copied to clipboard
Add a way to force two sections to be in the same bank
As discussed here: https://github.com/rednex/rgbds/issues/133
This could either be done in source code or by using the linkerscript.
SECTION "Code", ROMX
...
SECTION "Data", ROMX, BANK["Code"]
This would allow to have sections with different alignments if needed.
Seems useful overall. I wonder how this could be done linkerscript-side, though.
Linkerscripts can already do this, since they specify sections bank per bank.
If we wanted to remove the restriction of having to specify the bank, then your suggestion of writing only ROMX instead of ROMX $2A seems like a good idea, imo.
The problem is that linkerscripts force an order to the sections, but the source code solution doesn't.
Nice, I can certainly think of times in the past when I could’ve used this!
Does it matter that this solution doesn’t specify the order? After all, this isn’t something we usually enforce, unless if you use a linkerscript or manually specify a memory address.
I was thinking mostly about the gap that the alignment may leave between the sections. I'd like to give flexibility to the linker to place them however they fit.
It would be particularly useful for sections with large alignment requirements (I've used as high as $200!). The linker might even be able to fit another section in the gap.
On 23 Feb 2018 20:58, "AntonioND" [email protected] wrote:
I was thinking mostly about the gap that the alignment may leave between the sections. I'd like to give flexibility to the linker to place them however they fit.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rednex/rgbds/issues/244#issuecomment-368173635, or mute the thread https://github.com/notifications/unsubscribe-auth/AF2FfDvC5j5QNEgoc1Ua00OVkPaig5faks5tX1CVgaJpZM4SQP0k .
Sorry for necrobumping this, but if it isn't doesn't make the feature too complex, it'd be nice to have a BANK["Code" + 1] syntax.
Can we consider this fixed by #517? Make two SECTION FRAGMENTs with the same name, and they'll be allocated together. It's not perfect, because the constraints are solved globally on the section instead of at each fragment boundary (should that be considered a bug?), but it fulfills the use case.
Can we consider this fixed by #517? Make two
SECTION FRAGMENTs with the same name, and they'll be allocated together. It's not perfect, because the constraints are solved globally on the section instead of at each fragment boundary (should that be considered a bug?), but it fulfills the use case.
From #655, it seems like the answer is "no".
it'd be nice to have a BANK["Code" + 1] syntax
Another use case brought up for this is INCBINning a large binary file into multiple sequential banks.