Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nrf_qspi_nor.c Incorrect value used for checking start of RAM address space #29467

Closed
hakonfam opened this issue Oct 23, 2020 · 0 comments · Fixed by #30008
Closed

nrf_qspi_nor.c Incorrect value used for checking start of RAM address space #29467

hakonfam opened this issue Oct 23, 2020 · 0 comments · Fixed by #30008
Assignees
Labels
area: Drivers area: Flash bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@hakonfam
Copy link
Collaborator

nrf_qspi_nor.c checks incorrect value when deciding if data is stored in FLASH or RAM.

	if (size < 4U) {
		res = write_sub_word(dev, addr, src, size);
	} else if (((uintptr_t)src < CONFIG_SRAM_BASE_ADDRESS)) {
		res = write_from_nvmc(dev, addr, src, size);
	} else {
		res = nrfx_qspi_write(src, size, addr);
		qspi_wait_for_completion(dev, res);
	}

CONFIG_SRAM_BASE_ADDRESS is the base address of the image SRAM, and not the base of actual HW SRAM.

The devicetree node sram0 should be used instead.

This impacts trustzone-enabled devices where CONFIG_SRAM_BASE_ADDRESS does not point to the same address as the sram0 devicetree node (ie actual bottom of HW SRAM).

@hakonfam hakonfam added bug The issue is a bug, or the PR is fixing a bug area: Drivers area: Flash labels Oct 23, 2020
@nashif nashif added the priority: low Low impact/importance bug label Oct 27, 2020
@nvlsianpu nvlsianpu assigned nvlsianpu and unassigned kamlaz Nov 13, 2020
nvlsianpu added a commit to nvlsianpu/zephyr that referenced this issue Nov 17, 2020
The driver was using CONFIG_SRAM_BASE_ADDRESS as the value used to
recognize whether source buffer is in RAM. This label provide the
base address of the image SRAM, and not the base of actual HW SRAM.

This patch uses nrfx_is_in_ram() instead.

fixes zephyrproject-rtos#29467

Signed-off-by: Andrzej Puzdrowski <[email protected]>
nashif pushed a commit that referenced this issue Nov 17, 2020
The driver was using CONFIG_SRAM_BASE_ADDRESS as the value used to
recognize whether source buffer is in RAM. This label provide the
base address of the image SRAM, and not the base of actual HW SRAM.

This patch uses nrfx_is_in_ram() instead.

fixes #29467

Signed-off-by: Andrzej Puzdrowski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Drivers area: Flash bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
4 participants