Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose an additional 16 KB of RAM in TWL mode by moving DTCM around a bit #207

Open
asiekierka opened this issue Sep 27, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@asiekierka
Copy link
Contributor

asiekierka commented Sep 27, 2024

If we observe the memory map:

0x2FF0000: libnds shadows this area with DTCM, making it inaccessible through this address.
0x2FF4000: devkitARM bootstub structure

The entire area of memory from 0x2FF4000 to 0x2FFFFFF is effectively reserved, either for the devkitARM bootstub header or by data pre-loaded by the NTR/TWL loader. However, the area of main RAM from 0x2FF0000 - 0x2FF3FFF is shadowed and effectively unused; this doesn't matter on NTR consoles, as it's just a mirror of the 4/8 MB of RAM, but on TWL this constitutes an additional 16KB of RAM that could still be used for heap/stack data.

There's three identified changes that have to be done to allow for this:

  • move __dtcm_start to 0x2FF4000 in the link script (mpu_setup.s uses the symbol anyway);
  • make sure _exit() disables DTCM whenever it accesses bootstub data - this would probably require porting the necessary code to ASM routines to guarantee it doesn't use the stack, which is in DTCM;
  • (optional) patch the FAT driver's IS_MAIN_RAM macro to use the same.

Note that this is a low priority change; 16KB relative to (almost) 16MB is almost unnoticeable.

@asiekierka asiekierka changed the title Expose an additional 16 KB of RAM in TWL mode Expose an additional 16 KB of RAM in TWL mode by moving DTCM around a bit Sep 27, 2024
@AntonioND AntonioND added the enhancement New feature or request label Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants