mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-02 16:11:41 +01:00
feat(mmu): support mmu and flash mmap driver on p4
This commit is contained in:
@@ -55,7 +55,6 @@ typedef struct test_block_info_ {
|
||||
} test_block_info_t;
|
||||
|
||||
static LIST_HEAD(test_block_list_head_, test_block_info_) test_block_head;
|
||||
static DRAM_ATTR uint8_t sector_buf[TEST_BLOCK_SIZE];
|
||||
|
||||
|
||||
static void s_fill_random_data(uint8_t *buffer, size_t size, int random_seed)
|
||||
@@ -66,7 +65,7 @@ static void s_fill_random_data(uint8_t *buffer, size_t size, int random_seed)
|
||||
}
|
||||
}
|
||||
|
||||
static bool s_test_mmap_data_by_random(uint8_t *mblock_ptr, size_t size, int random_seed)
|
||||
static bool s_test_mmap_data_by_random(uint8_t *mblock_ptr, size_t size, int random_seed, uint8_t *flash_ref_buf)
|
||||
{
|
||||
srand(random_seed);
|
||||
uint8_t *test_ptr = mblock_ptr;
|
||||
@@ -77,7 +76,7 @@ static bool s_test_mmap_data_by_random(uint8_t *mblock_ptr, size_t size, int ran
|
||||
printf("i: %d\n", i);
|
||||
printf("test_data: %d\n", test_data);
|
||||
printf("test_ptr[%d]: %d\n", i, test_ptr[i]);
|
||||
printf("sector_buf[%d]: %d\n", i, sector_buf[i]);
|
||||
printf("flash_ref_buf[%d]: %d\n", i, flash_ref_buf[i]);
|
||||
ESP_EARLY_LOGE(TAG, "FAIL!!!!!!");
|
||||
return false;
|
||||
}
|
||||
@@ -87,6 +86,9 @@ static bool s_test_mmap_data_by_random(uint8_t *mblock_ptr, size_t size, int ran
|
||||
|
||||
TEST_CASE("test all readable vaddr can map to flash", "[mmu]")
|
||||
{
|
||||
uint8_t *sector_buf = heap_caps_calloc(1, TEST_BLOCK_SIZE, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||
TEST_ASSERT(sector_buf);
|
||||
|
||||
//Get the partition used for SPI1 erase operation
|
||||
const esp_partition_t *part = s_get_partition();
|
||||
ESP_LOGI(TAG, "found partition '%s' at offset 0x%"PRIx32" with size 0x%"PRIx32, part->label, part->address, part->size);
|
||||
@@ -113,7 +115,7 @@ TEST_CASE("test all readable vaddr can map to flash", "[mmu]")
|
||||
ret = esp_mmu_map(part->address, TEST_BLOCK_SIZE, MMU_TARGET_FLASH0, MMU_MEM_CAP_READ, 0, &ptr);
|
||||
if (ret == ESP_OK) {
|
||||
ESP_LOGI(TAG, "ptr is %p", ptr);
|
||||
bool success = s_test_mmap_data_by_random((uint8_t *)ptr, sizeof(sector_buf), test_seed);
|
||||
bool success = s_test_mmap_data_by_random((uint8_t *)ptr, sizeof(sector_buf), test_seed, sector_buf);
|
||||
TEST_ASSERT(success);
|
||||
} else if (ret == ESP_ERR_NOT_FOUND) {
|
||||
free(block_info);
|
||||
@@ -138,6 +140,8 @@ TEST_CASE("test all readable vaddr can map to flash", "[mmu]")
|
||||
block_to_free = LIST_NEXT(block_to_free, entries);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
free(sector_buf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,3 +5,4 @@ CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||
|
||||
CONFIG_COMPILER_DUMP_RTL_FILES=y
|
||||
CONFIG_HAL_ASSERTION_SILENT=y
|
||||
|
||||
Reference in New Issue
Block a user