Autodetect SDRAM size in uBoot Bootloader via ARMv7 processor exception handler

Hi There,

I am writing some bootload code for the TI Sitara AM5726 processor which has Dual Arm-v7 Cortex-A15  cores. The uBoot bootloader is the code that runs before starting the Linux Kernel and is responsible for configuring the extents of the SDRAM.

I would like to be able to auto-detect the size (address space) of the installed SDRAM, which may either be 2GB or 4GB in size. To do this my thought process was to write a function that sets the minimum RAM size to 2 GB, then attempt to write and read from the 4GB address.

What happens is as expected when only 2GB of RAM is installed, an exception or trap is thrown and the processor goes into a HALT or infinite loop by hitting the _halt exception/trap vector.

I am looking for some ARM assembly or "C" code to do the following, that is to recover from the exception and keep executing.

void auto-detect() {
gd->ram_size = 2GB;
   try {
      if (successful) {
        gd->ram_size = 4GB;
   } catch {

Some working C or assembly code would be much appreciated.




Parents Reply Children
No data
More questions in this forum