F7 has different memory bank sizes

This commit is contained in:
rusefi 2019-02-07 01:06:39 -05:00
parent 4bb905a990
commit e92b36820e
3 changed files with 24 additions and 11 deletions

View File

@ -14,17 +14,6 @@
#include "flash.h"
#include <string.h>
size_t flashSectorSize(flashsector_t sector) {
// sectors 0..11 are the 1st memory bank (1Mb), and 12..23 are the 2nd (the same structure).
if (sector <= 3 || (sector >= 12 && sector <= 15))
return 16 * 1024;
else if (sector == 4 || sector == 16)
return 64 * 1024;
else if ((sector >= 5 && sector <= 11) || (sector >= 17 && sector <= 23))
return 128 * 1024;
return 0;
}
flashaddr_t flashSectorBegin(flashsector_t sector) {
flashaddr_t address = FLASH_BASE;
while (sector > 0) {

View File

@ -10,6 +10,7 @@
#if EFI_PROD_CODE
#include "mpu_util.h"
#include "flash.h"
#include "error_handling.h"
#include "engine.h"
#include "pin_repository.h"
@ -420,5 +421,16 @@ CANDriver * detectCanDevice(brain_pin_e pinRx, brain_pin_e pinTx) {
#endif /* EFI_CAN_SUPPORT */
size_t flashSectorSize(flashsector_t sector) {
// sectors 0..11 are the 1st memory bank (1Mb), and 12..23 are the 2nd (the same structure).
if (sector <= 3 || (sector >= 12 && sector <= 15))
return 16 * 1024;
else if (sector == 4 || sector == 16)
return 64 * 1024;
else if ((sector >= 5 && sector <= 11) || (sector >= 17 && sector <= 23))
return 128 * 1024;
return 0;
}
#endif /* EFI_PROD_CODE */

View File

@ -7,6 +7,7 @@
#include "global.h"
#include "mpu_util.h"
#include "flash.h"
#include "error_handling.h"
#include "engine.h"
#include "pin_repository.h"
@ -411,3 +412,14 @@ CANDriver * detectCanDevice(brain_pin_e pinRx, brain_pin_e pinTx) {
#endif /* EFI_CAN_SUPPORT */
size_t flashSectorSize(flashsector_t sector) {
// sectors 0..11 are the 1st memory bank (1Mb), and 12..23 are the 2nd (the same structure).
if (sector <= 3 || (sector >= 12 && sector <= 15))
return 32 * 1024;
else if (sector == 4 || sector == 16)
return 128 * 1024;
else if ((sector >= 5 && sector <= 11) || (sector >= 17 && sector <= 23))
return 256 * 1024;
return 0;
}