@
KocsisV You owe me a truck full of beer for
this! (A little ranting)
This is why I'm reluctant to accept huge commits from 3rd parties...
The theory says it should be error-free, but there'll always be some bugs, people will fly away leaving your project broken, and you'll be the only one fixing it, which will be 5x harder because you didn't made the changes.
Spot the error:
// Ensure flash was erased
for (uint32_t i = 0u; i < (numPages * FLASH_PAGE_SIZE / sizeof(int32_t)); i++) {
if( *((uint32_t*)(pageAddress + i)) != 0xFFFFFFFF){
Flash_error();
}
}
// Ensure flash was erased
for (uint32_t i = 0u; i < (numPages * FLASH_PAGE_SIZE / sizeof(int32_t)); i++) {
if( *((uint32_t*)pageAddress + i) != 0xFFFFFFFF){
Flash_error();
}
}
The difference is subtle, almost evil!
((uint32_t*)(pageAddress + i))
Casts a uint32_t pointer to (pageAddress+i). When i=1...3, it will cause misaligned access.
((uint32_t*)pageAddress + i)
Casts a uint32_t pointer to pageAddress, then increase increase the pointer by "i" times 32-bit, so each "i" increases the pointer by 4bytes.
The reason it didn't crash in Cortex-M3 (STM32F10x) is because it seems to support unaligned access, but Cortex-M0 clearly doesn't!
Neither was the code checking what it was suppossed to, it worked by pure luck
.
New builds available, Quicko F072 is working again.
Re-checked the projects, some were wrong (CubeIDE mixed some flags) or lacked binary outputs, fixed everything.