As for memory mapping there are two levels -mapping to physical addresses and remapping physical addresses to virtual addresses which in Linux can be different for each running process.
Also please note that there in no flash memory directly in the Pi. Only the SD card which is separately managed by microcontroller inside the card and cannot be mapped to memory of the main CPU directly. Instead data from card is transferred via SD/MMC commands in blocks (of typically 512 bytes) to main SDRAM memory.
Then there is the virtual memory and how operating system manages it and as for Linux there is a mmap system call where you can map any linux file or device to the virtual memory so it appears like it is in memory while it is not. When your program tries to read/write the memory, the operating system will work behind scenes and communicate with the device so the correct part is read/written for you. Virtual memory is managed in pages (of 4KB typically).
mmap allows you to choose offset into file and size so if the file is larger than memory you can do it in parts
complicated? see e.g.
lilzz wrote:Normally flash memory, rom memory can be memory mapped to DRAM main memory.
well not exactly, memory (sdram,sram,rom,flash) can be mapped to memory space (i.e. some address range), you don't map one to another (rom to sdram).
But since flash memory could be bigger than DRAM main memory, then how it could be mapped from something bigger to something smaller?
on lowest physical level this is also done by paging, ie the CPU sees only part of the memory at one time.
I read some where the main processor for Pi has internal sram, is that means the system doesn't DRAM main memory because sram can be used as main memory.
SRAM is typicaly very small (like 256KB) so it is used only when main DRAM is not yet enabled (i.e. at boot time in bootloader before operating system is loaded), then it is also used as CPU cache (L1,L2) because it is fast, and sometimes as frame buffer for display (not in the Pi, it would not fit)