Added routine to invalidate all cachces, and to clean dcache. Using said
routine, both right before disabling the MPU for setup, and while the
MPU is disabled for setup to ensure that the cache state is well known
(i.e. all data that may have only been written to the cache definitely
is in RAM, and all of cache is invalid).
-There seemed to have been a problem with caching and uncart, at least
under a9lh and with one system. Explicitly disabling the mpu before
setting it up and before calling subroutines related to setting it up
appears to have fixed the problem.
Since brahma has its stack (unless it is changed) in ARM9 memory, the
default logic for setting up the heap breaks, since it assumes the heap
is in lower memory than the stack. This commit uses a hook used by
newlib to setup the heap at any random location in memory. This commit
just allocates a 32MB heap, although it could certainly be larger.
-newlib handles allocations, in the default case, by starting to
allocate memory right after the end of the program in memory, and will
continue to allocate memory as requested until it hits the stack. As a
result, it is safe to use memory allocation function to get memory for
usage. Changed some of the memory management in the application to use
memalign (memory needs to be aligned to at least 16 bits if sdmmc.c is
to work, preferably 32 bits).
-Added an option for the user to either dump the full ROM, or just the
partitions.
Using some header information from rom_tool, it was possible to
implement something that will accurately determine the real ROM size.
With that information, uncart no longer dumps in 2GB chunks, but to the
actual size of ROM (all 8 partitions).
Warnings were cleaned up as much as possible for now (2 remain). i2c
support was added in order to be able to shut down uncart when it is
over (it isn't clear that the ASM in start.s is right for returning
control to brahma, if that's even possible). More warnings were enabled
in the Makefile, and lto was enabled.
Currently, the Makefile and the draw.h are configured for a9lh support.