But seriously, you can do this multiple ways nowadays. The most elegant way probably is to use a custom partition table and declare an 1MB partition there. Then use the partition API to map that partition into memory and do what you want with the data in it.
Hi @ ESP_Sprite,@ESP_Angus
I am trying to memory map a region of external flash into a data region . It finds my partition and maps the region succesfully. However program crashes if I write data to it. Can you check this code .. I couldnt find any examples so Im probably doing something wrong. How are you supposed to read/write data to the mapped partition?
Code: Select all
const esp_partition_t *p = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, 0x80, NULL);
if(p != NULL)
{
TRACE_D("MMap partition found\n");
}
else
{
TRACE_D("MMap partition NOT found\n");
}
uint32_t *mmap_data;
spi_flash_mmap_handle_t mmap_handle;
if( esp_partition_mmap(p, 0, 2048000, SPI_FLASH_MMAP_DATA,
(const void **)&mmap_data, &mmap_handle) == ESP_OK)
{
TRACE_D("Memory mappped\n");
}
else
{
TRACE_D("Memory map fail\n");
}
mmap_data[0] = 12345678; //This line causes crash
if(mmap_data[0] == 12345678)
{
TRACE_D("test Pass\n");
}