From a720f8c627d0f10f658a07f761cb6e1644ee739e Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Sat, 9 Oct 2021 16:12:40 +0800 Subject: [PATCH] tests/subsys/storage/flash_map: get flash device from flash area Get flash device from flash area instead of the hardcoded DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL. This makes the test possible to be ran on device that has image_1 defined in external flash. Signed-off-by: Yong Cong Sin --- tests/subsys/storage/flash_map/src/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/subsys/storage/flash_map/src/main.c b/tests/subsys/storage/flash_map/src/main.c index 71c1fcaacae..72590caad60 100644 --- a/tests/subsys/storage/flash_map/src/main.c +++ b/tests/subsys/storage/flash_map/src/main.c @@ -31,8 +31,7 @@ void test_flash_area_get_sectors(void) zassert_true(rc == 0, "flash_area_open() fail"); /* First erase the area so it's ready for use. */ - flash_dev = - device_get_binding(DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL); + flash_dev = flash_area_get_device(fa); rc = flash_erase(flash_dev, fa->fa_off, fa->fa_size); zassert_true(rc == 0, "flash area erase fail");