Home > Net >  What type of memory is Uboot able to see using "md"?
What type of memory is Uboot able to see using "md"?

Time:02-16

I am a complete newbie at this and I have stumbled upon something I cannot find the answer to. I am currently playing around with a Linux based system called Toradex Verdin iMX8MM. When I boot it into U-boot I can see some sort of memory. This is done by the standard "md" command. For fun I tried to print a bunch of different addresses and then display those address in u-boot. This seems to crash the system and I am not able to view those particular addresses. Does that mean its some sort of different memory, some sort of access denied or what is happening? I pasted the code I used below to print som adresses.

#include <lib.h>
#include <stdio.h>
#include <unistd.h>

static char mystr[256] = "Hello There\n";

int main(int argc, char const *argv[])
{
    while(1){
        static char str[14] = "Hello World\n";
        printf("%s", mystr);
        printf("%s", str);
        printf("point %p\n", str);
        printf("main %p ",(char*)main);
        sleep(3);
    }
    
}

My command for example: md 0xaaaadb65040

Error it throws

aaaadb65040:"Synchronous Abort" handler, esr 0x96000004
elr: 00000000402758cc lr : 0000000040275830 (reloc)
elr: 00000000bff858cc lr : 00000000bff85830
x0 : 000000000000000c x1 : 00000000308600b4
x2 : 00000000bff36890 x3 : 0000000000000000
x4 : 00000aaaadb65040 x5 : 00000000bd70efe8
x6 : 00000000bff9fbf4 x7 : 0000000000000004
x8 : 00000000bd70f9e8 x9 : 0000000000000008
x10: 00000000ffffffd0 x11: 0000000000000010
x12: 0000000000000006 x13: 000000000001869f
x14: 00000000bffa9c50 x15: 0000000000000021
x16: 00000000bff5581c x17: 00000000000041a0
x18: 00000000bd70fdb8 x19: 0000000000000040
x20: 00000aaaadb65040 x21: 00000aaaadb65040
x22: 00000000bff9f11c x23: 0000000000000008
x24: 0000000000000009 x25: 0000000000000004
x26: 0000000000000004 x27: 00000000bd70faa8
x28: 0000000000000004 x29: 00000000bd70fa20

Code: 12800000 17ffffcf 7100135f 54000201 (b9400085)
Resetting CPU ...

resetting ...

CodePudding user response:

What you're able to see depends on the memory map of the specific processor you're using. Generally speaking, if something is mapped to address X of physical memory, you can use md to read it and mw to write to it.

Now the code you're showing looks like a simple C program that would be run normally in user space. That's not going to work here as there's none of that support infrastructure in place really. And for just exploration of the system, that's not going to be the most useful path.

If you want to look around in memory, find the manual for the specific processor in question (it will say earlier in the startup log what it is) and then look at the different peripherals and where they're mapped to in memory by default. And possibly a little confusingly, keep in mind that DRAM is just another peripheral and that will show up in one range in memory while say a GPIO controller will show up in another spot in memory.

  • Related