Sinapse-Energia / bootloader-stm32

Contains the code of the bootloader for Sinapse Devices based on stm32 chips
7 stars 5 forks source link

Fix mistake in reading from flash (inside Flash_NVM.c ) #6

Open francisjjp opened 7 years ago

francisjjp commented 7 years ago

It is needed to fix following function:

`HAL_StatusTypeDef FlashNVM_Read(uint32_t start_address, uint8_t* data_out, uint32_t size) { uint32_t sizeCounter = 0;

// Check input data
if (!IS_FLASH_ADDRESS(start_address)) {
    // It's not Flash's address
    return HAL_ERROR;
}

while (sizeCounter < size) {
    *data_out = (*(__IO uint32_t*)start_address);
    data_out++;
    start_address++;
    sizeCounter++;
}
return 1;

}`

Line:

*`data_out = ((__IO uint32_t)start_address);`** is wrong. It works in F4 family but not in F0 family.,

The right implementation is this:

*`data_out = ((__IO uint8_t)start_address);`* because data_out points to uint8_t variable.