MMU: Add configurable mmu page size support on ESP32C2
This commit is contained in:
@@ -21,20 +21,18 @@ extern "C" {
|
||||
#define FLASH_SECTOR_SIZE 0x1000
|
||||
#define FLASH_BLOCK_SIZE 0x10000
|
||||
#define MMAP_ALIGNED_MASK 0x0000FFFF
|
||||
#define MMU_FLASH_MASK (~(SPI_FLASH_MMU_PAGE_SIZE - 1))
|
||||
|
||||
//This will be replaced with a kconfig, TODO: IDF-3821
|
||||
#define MMU_PAGE_SIZE 0x10000
|
||||
#define MMU_FLASH_MASK (~(MMU_PAGE_SIZE - 1))
|
||||
/**
|
||||
* MMU mapping must always be in the unit of a MMU_PAGE_SIZE
|
||||
* MMU mapping must always be in the unit of a SPI_FLASH_MMU_PAGE_SIZE
|
||||
* This macro is a helper for you to get needed page nums to be mapped. e.g.:
|
||||
* Let's say MMU_PAGE_SIZE is 64KB.
|
||||
* Let's say SPI_FLASH_MMU_PAGE_SIZE is 64KB.
|
||||
* - v_start = 0x4200_0004
|
||||
* - size = 4 * 64KB
|
||||
*
|
||||
* You should map from 0x4200_0000, then map 5 pages.
|
||||
*/
|
||||
#define GET_REQUIRED_MMU_PAGES(size, v_start) ((size + (v_start - (v_start & MMU_FLASH_MASK)) + MMU_PAGE_SIZE - 1) / MMU_PAGE_SIZE)
|
||||
#define GET_REQUIRED_MMU_PAGES(size, v_start) ((size + (v_start - (v_start & MMU_FLASH_MASK)) + SPI_FLASH_MMU_PAGE_SIZE - 1) / SPI_FLASH_MMU_PAGE_SIZE)
|
||||
|
||||
/* SPI commands (actual on-wire commands not SPI controller bitmasks)
|
||||
Suitable for use with the bootloader_execute_flash_command static function.
|
||||
|
||||
Reference in New Issue
Block a user