We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Problem Code:
/* main.c */ uint8_t testBuf[] = {1, 2, 3, 4, 5}, FILE * fwr = fopen("tst1.txt", "w"); fwrite(testBuf, sizeof(uint8_t), sizeof(testBuf), fwr); fflush(fwr); fclose(fwr); /* flash_cmsis_driver.c */ int32_t ARM_Flash_ProgramData(uint32_t addr, const void *data, uint32_t cnt) { /* Problem: cnt is 8 while it should be 5 */ /* cnt is next nearest multiple of 4 */ }
/* Driver Capabilities */ static const ARM_FLASH_CAPABILITIES DriverCapabilities = { 1, /* Supports event ready status */ 0, /* data_width = 0:8-bit, 1:16-bit, 2:32-bit */ 0, /* Don't support chip erase */ 0U /* Reserved */ }; /* Flash Information */ static ARM_FLASH_INFO FlashInfo = { FLASH_SECTOR_INFO, FLASH_SECTOR_COUNT, FLASH_SECTOR_SIZE, 8, /* FLASH_PAGE_SIZE */ 1, /*FLASH_PROGRAM_UNIT */ 0xFF, /* FLASH_ERASED_VALUE */ { 0U, 0U, 0U } /* Reserved */ };