Mapping flash to instruction address bus
Posted: Mon Feb 26, 2018 6:17 am
My goal is to map a region of flash memory to the virtual address range of an ESP32 (Instruction bus).
Let us assume I have 64K I wish to map. That is 1 page.
Let us assume that the data exists on flash at offset
0x30 0000 to 0x31 0000
My goal is to map this to address range 0x4080 0000 to 0x4081 0000.
My understanding is that this is all within the rules.
To achieve this task, I execute the following statements in my C program:
After performing this, I use the built-in GDB and perform a dump of the address range using:
The result is:
which is not what I loaded into flash at 0x30 0000 offset.
I validated what I have in flash by dumping that region of flash to a file and find my data "good" so confidence is "ok" that what is in flash is correct.
Studying the ESP32 Tech Ref, I find that 0x4080 0000 is MMU entry 192 and the 48th page of 64K is 0x30 0000.
Is there more that I need to do in order to cause flash to be mapped? I have been assuming that simply changing the entries in the tables DPORT_PRO_FLASH_MMU_TABLE and DPORT_APP_FLASH_MMU_TABLE would be sufficient ... but that may be too simplistic.
Let us assume I have 64K I wish to map. That is 1 page.
Let us assume that the data exists on flash at offset
0x30 0000 to 0x31 0000
My goal is to map this to address range 0x4080 0000 to 0x4081 0000.
My understanding is that this is all within the rules.
To achieve this task, I execute the following statements in my C program:
Code: Select all
DPORT_PRO_FLASH_MMU_TABLE[192] = 48;
DPORT_APP_FLASH_MMU_TABLE[192] = 48;
Code: Select all
(gdb) x /100x 0x40800000
Code: Select all
0x40800000: 0xbad00bad 0xbad00bad 0xbad00bad 0xbad00bad
0x40800010: 0xbad00bad 0xbad00bad 0xbad00bad 0xbad00bad
0x40800020: 0xbad00bad 0xbad00bad 0xbad00bad 0xbad00bad
0x40800030: 0xbad00bad 0xbad00bad 0xbad00bad 0xbad00bad
0x40800040: 0xbad00bad 0xbad00bad 0xbad00bad 0xbad00bad
0x40800050: 0xbad00bad 0xbad00bad 0xbad00bad 0xbad00bad
0x40800060: 0xbad00bad 0xbad00bad 0xbad00bad 0xbad00bad
I validated what I have in flash by dumping that region of flash to a file and find my data "good" so confidence is "ok" that what is in flash is correct.
Studying the ESP32 Tech Ref, I find that 0x4080 0000 is MMU entry 192 and the 48th page of 64K is 0x30 0000.
Is there more that I need to do in order to cause flash to be mapped? I have been assuming that simply changing the entries in the tables DPORT_PRO_FLASH_MMU_TABLE and DPORT_APP_FLASH_MMU_TABLE would be sufficient ... but that may be too simplistic.