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

FUTURE_SEQUANA: Fix flash_api bug introduced with e16d2d81d9 #10412

Merged
merged 1 commit into from Apr 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/flash_api.c
Expand Up @@ -48,7 +48,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
{
(void)(obj);
int32_t status = 0;
static uint8_t prog_buf[CY_FLASH_SIZEOF_ROW];
static uint32_t prog_buf[CY_FLASH_SIZEOF_ROW / sizeof(uint32_t)];
while (size) {
uint32_t offset = address % CY_FLASH_SIZEOF_ROW;
uint32_t chunk_size;
Expand All @@ -59,7 +59,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
}
uint32_t row_address = address / CY_FLASH_SIZEOF_ROW * CY_FLASH_SIZEOF_ROW;
memcpy(prog_buf, (const void *)row_address, CY_FLASH_SIZEOF_ROW);
memcpy(prog_buf + offset, data, chunk_size);
memcpy((uint8_t *)prog_buf + offset, data, chunk_size);

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