sc520: Move RAM sizing code from asm to C