Skip to content

Commit d120000

Browse files
committed
rp2350: Added flash driver
1 parent 8b9fc5a commit d120000

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

hal/rp2350.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
#include <target.h>
2727
#include "image.h"
2828
#include "printf.h"
29+
30+
#include "hardware/flash.h"
31+
2932
#ifdef TZEN
3033
#include "armv8m_tz.h"
3134
#include "pico/bootrom.h"
@@ -221,7 +224,8 @@ void hal_prepare_boot(void)
221224

222225
int RAMFUNCTION hal_flash_write(uint32_t address, const uint8_t *data, int len)
223226
{
224-
return 0; /* on success. */
227+
flash_range_program(address - XIP_BASE, data, len);
228+
return 0;
225229
}
226230

227231
void RAMFUNCTION hal_flash_unlock(void)
@@ -234,6 +238,7 @@ void RAMFUNCTION hal_flash_lock(void)
234238

235239
int RAMFUNCTION hal_flash_erase(uint32_t address, int len)
236240
{
237-
return 0; /* on success. */
241+
flash_range_erase(address - XIP_BASE, len);
242+
return 0;
238243
}
239244

0 commit comments

Comments
 (0)