Hi all,

The problem:

I'm running an embedded Linux kernel, and I want to obtain a real memory address from user space.
After goggeling a little, I found that the only way was to use mmap to access /dev/mem.
But I never used mmap, and everything I read about it didn't help me much more.

Si, I wondered if someone could explain me how I could do in my case?

What I want to do:

I want to load a program in memory, in order to make it available from another processor, that has access to the DDR, but not to the flash memory where program is stored.

Here is the code I use:

	// Open file and get its size
	FILE* program = fopen(argv[3],"rb");
	fseek(program, 0, SEEK_END);
	long program_size = ftell(program);
	fseek(program, 0, SEEK_SET);

	// Prepare memory to copy it in
	void* program_address = malloc(program_size+1);
	FILE* memory_stream = fmemopen(program_real_address, program_size + 1, "wb");
	printf("Program address: 0x%x\n", (int)program_address);
	// Do the copy
	int temp;
	while ((temp = getc(program)) != EOF) putc(temp, memory_stream);
As you can see, program_address is only a virtual address. But I need to know its real address, in order to transmit it to the other processor, that does not have a Linux, but a standalone application that I wrote by myself.

if anyone could help me, just telling how I could use mmap in my case?

Thank you.