Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

data adresses on physical mem

hello,

can someone help me, I want to know if there's a way to print the adresses of my data on the physical memory.

I want to know if there are some ALT functions allowing this kind of manipilation and which I can put in my C code. I'm using nios 2 fast proc.

thks for your attention;

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    If you mean to print the address of a variable you could do something like this:

    int i = 3;

    printf("The location of variable 'i' is %d.", &i);

    The '&' gives the address of an object instead of the data itself. Normally I print my addresses in hex so this might work better:

    printf("The location of variable 'i' is 0x%x.", (unsigned long)&i);
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    If you mean to print the address of a variable

    --- Quote End ---

    In systems with MMU the address in CPU memory and physical memory can be different. Variable may exist in CPU memory but do not exist in real memory.