-
Notifications
You must be signed in to change notification settings - Fork 15
hal_rpi_pico: flash: Move partial write support for RP2040 and add support for RP2350 #11
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
Conversation
ffdc8b9
to
f7cde54
Compare
410c418
to
5b76fb7
Compare
…pport for RP2350 Partial flash write support for RP2040 was previously implemented in Zephyr, but due to license incompatibility, it has now been moved to the hal_rpi_pico module. This commit removes the in-tree implementation from Zephyr and integrates partial write support from hal_rpi_pico for RP2040 devices. Additionally, partial write support has been added for the RP2350 (used in Raspberry Pi Pico W 2 and Pico 2) in hal_rpi_pico. Zephyr now correctly enables and utilizes this functionality for both RP2040 and RP2350. Signed-off-by: Hanan Arshad <hananarshad619@gmail.com>
/** | ||
* Low level flash functions are based on: | ||
* github.com/raspberrypi/pico-bootrom-rp2040/blob/master/bootrom/program_flash_generic.c, | ||
* github.com/raspberrypi/pico-bootrom-rp2350/blob/master/src/main/arm/varm_generic_flash.c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just want to confirm.
The code referenced here is the same BSD-3 as this code
and was created by Raspberry Pi (Trading) Ltd.
, the same author as the original of this code.
Since they're both BSD-3, I think this description is sufficient, but what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is OK. There's enough willing here to show attribution.
Any update on this? |
#include "hardware/structs/io_qspi.h" | ||
#if PICO_RP2040 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the perspective of source management, it is easy to maintain only add
than adding and deleting, so add
#include "hardware/structs/io_qspi.h"
under #else
on line 13 without changing the position of #if PICO_RP2040
.
@ajf58 |
@@ -24,6 +24,8 @@ | |||
#define FLASH_RUID_DATA_BYTES FLASH_UNIQUE_ID_SIZE_BYTES | |||
#define FLASH_RUID_TOTAL_BYTES (1 + FLASH_RUID_DUMMY_BYTES + FLASH_RUID_DATA_BYTES) | |||
|
|||
void __no_inline_not_in_flash_func(flash_write_partial_internal)(uint32_t addr, const uint8_t *data, size_t size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that this is a direct copy from the bootrom codebase, but if the declaration is here it should be declared as static.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will work OK. A couple of notes:
- When we bump the SDK (I've been waiting on a 2.1.2, but maybe just need to make the relevant fix directly), they'll be some changes e.g. raspberrypi@7b07b0b .
- I wonder whether this would be better achieved using the SDK's bootrom API: e.g. rom_flash_range_program .
I forgot to mention one thing. Please update ChangeLog.zephyr.md too. |
@soburi This PR is merged. Should I create another PR for ChangeLog.zephyr.md? |
Yes it is, this PR has been merged. This is can't edit any more. |
Partial flash write support for RP2040 was previously implemented in Zephyr, but due to license incompatibility, it has now been moved to the hal_rpi_pico module.
This commit removes the in-tree implementation from Zephyr and integrates partial write support from hal_rpi_pico for RP2040 devices.
Additionally, partial write support has been added for the RP2350 (used in Raspberry Pi Pico W 2 and Pico 2) in hal_rpi_pico. Zephyr now correctly enables and utilizes this functionality for both RP2040 and RP2350.