The bare metal program got stuck at some point.

Hi team,

         Hi, In our project we are using Agilex 7 soc. We have an Apollo Agilex board. I am using the Uboot spl code.  I am just adding a small piece of code, to write and read the DDR memory. The code is given below. The issue is when I run the "for" loop code it runs for a few seconds after the code stops running.

for(i=0;i<0xFFE0000;i++){

*base = i;

__socfpga_udelay(1000000);

}

ptr = ((u64 *)0x0000000000000000);

j=0;

for(i=0;i<0xFFE0000;i++){

*ptr = i;

if(*ptr!=i){

printf("ddr failed at %p\n",ptr);

}

if(j==0x100000){

printf("ddr write and read success at %p\n",ptr);

j=0;

}

ptr++;

}

The above code runs correctly, the difference between the two codes is printf.

Thanks,

Regards,

Veerappan P.

  • Hi

    My name is Stephen and I work at Arm.

    You will need to use the debug features of Arm DS Debugger to help debug your program.
    Some things to investigate/check are:
    1) In what way does the code stop running?  Does it hang in a loop within your code, or has an exception occurred, e.g. a data abort or prefetch abort?  Check where the program counter (PC) is when you press Stop.  If you suspect an exception has occurred, try enabling exception traps - select Manage Signals from the Breakpoints toolbar or the view menu to display the Manage Signals dialog box:

    https://developer.arm.com/documentation/101470/2024-0/Controlling-Target-Execution/Handling-processor-exceptions

    2) Is there accessible memory present over the whole of the range of addresses being tested?  If not, then data abort exceptions may be occurring.
    3) Is the MMU enabled?  Again, data aborts may occur if setup incorrectly.  Try turning the MMU off.
    4) Are you sure that your code is not accidentally overwriting its own active data?  Try single-stepping through its point of failure.
    5) Try reducing the range of addresses in memory being tested.  Does a smaller for() loop succeed?

    Hope these ideas help you to identify the problem

    Stephen