Skip to content

Commit fc12229

Browse files
authored
Merge pull request ARMmbed#10412 from lrusinowicz/flash_api_fix
FUTURE_SEQUANA: Fix flash_api bug introduced with e16d2d8
2 parents ca887a9 + f81fbab commit fc12229

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/flash_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
4848
{
4949
(void)(obj);
5050
int32_t status = 0;
51-
static uint8_t prog_buf[CY_FLASH_SIZEOF_ROW];
51+
static uint32_t prog_buf[CY_FLASH_SIZEOF_ROW / sizeof(uint32_t)];
5252
while (size) {
5353
uint32_t offset = address % CY_FLASH_SIZEOF_ROW;
5454
uint32_t chunk_size;
@@ -59,7 +59,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
5959
}
6060
uint32_t row_address = address / CY_FLASH_SIZEOF_ROW * CY_FLASH_SIZEOF_ROW;
6161
memcpy(prog_buf, (const void *)row_address, CY_FLASH_SIZEOF_ROW);
62-
memcpy(prog_buf + offset, data, chunk_size);
62+
memcpy((uint8_t *)prog_buf + offset, data, chunk_size);
6363

6464
if (Cy_Flash_ProgramRow(row_address, (const uint32_t *)prog_buf) != CY_FLASH_DRV_SUCCESS) {
6565
status = -1;

0 commit comments

Comments
 (0)