tests: subsys: shell: shell_flash: use DEVICE_DT_GET
Obtain flash device at compile time using DEVICE_DT_GET. Also drop useless static attribute from flash_dev. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
e6b0d2121c
commit
05b2221341
1 changed files with 3 additions and 4 deletions
|
@ -35,7 +35,7 @@ static void test_flash_read(void)
|
||||||
"00000020: 61 62 63 |abc |",
|
"00000020: 61 62 63 |abc |",
|
||||||
};
|
};
|
||||||
const struct shell *shell = shell_backend_dummy_get_ptr();
|
const struct shell *shell = shell_backend_dummy_get_ptr();
|
||||||
static const struct device *flash_dev;
|
const struct device *flash_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller));
|
||||||
const char *buf;
|
const char *buf;
|
||||||
const int test_base = FLASH_SIMULATOR_BASE_OFFSET;
|
const int test_base = FLASH_SIMULATOR_BASE_OFFSET;
|
||||||
const int test_size = 0x24; /* 32-alignment required */
|
const int test_size = 0x24; /* 32-alignment required */
|
||||||
|
@ -47,10 +47,9 @@ static void test_flash_read(void)
|
||||||
for (i = 0; i < test_size; i++) {
|
for (i = 0; i < test_size; i++) {
|
||||||
data[i] = 'A' + i;
|
data[i] = 'A' + i;
|
||||||
}
|
}
|
||||||
flash_dev = device_get_binding(DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL);
|
|
||||||
|
|
||||||
zassert_true(flash_dev != NULL,
|
zassert_true(device_is_ready(flash_dev),
|
||||||
"Simulated flash driver was not found!");
|
"Simulated flash driver not ready");
|
||||||
|
|
||||||
ret = flash_write(flash_dev, test_base, data, test_size);
|
ret = flash_write(flash_dev, test_base, data, test_size);
|
||||||
zassert_equal(0, ret, "flash_write() failed: %d", ret);
|
zassert_equal(0, ret, "flash_write() failed: %d", ret);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue