sketch: ensure sparse fusemap is enabled only for ATF750C

This commit is contained in:
ole00 2024-02-04 23:36:45 +00:00
parent 5f2105680f
commit 7ef0038209
1 changed files with 12 additions and 8 deletions

View File

@ -661,16 +661,20 @@ void setup() {
Serial.println(">"); Serial.println(">");
} }
static void sparseSetup(char clearArray){
// Note: Sparse fuse map is ignored on MCUs with big SRAM
if (gal == ATF750C) {
sparseInit(clearArray);
} else {
sparseDisable();
}
}
//copy galinfo item from the flash array into RAM backed struct //copy galinfo item from the flash array into RAM backed struct
static void copyGalInfo(void) { static void copyGalInfo(void) {
memcpy_P(&galinfo, &galInfoList[gal], sizeof(galinfo_t)); memcpy_P(&galinfo, &galInfoList[gal], sizeof(galinfo_t));
// Note: Sparse fuse map is ignored on MCUs with big SRAM sparseSetup(0);
if (gal == ATF750C || gal == ATF22V10C) {
sparseInit(0);
} else {
sparseDisable();
}
} }
// read from serial line and discard the data // read from serial line and discard the data
@ -1997,7 +2001,7 @@ static void readOrVerifyGal(char verify)
for (i = 0; i < MAXFUSES; i++) { for (i = 0; i < MAXFUSES; i++) {
fusemap[i] = 0; fusemap[i] = 0;
} }
sparseInit(1); sparseSetup(1);
} }
turnOn(READGAL); turnOn(READGAL);
@ -2872,7 +2876,7 @@ void loop() {
for (i = 0; i < MAXFUSES; i++) { for (i = 0; i < MAXFUSES; i++) {
fusemap[i] = 0; fusemap[i] = 0;
} }
sparseInit(1); sparseSetup(1);
isUploading = 1; isUploading = 1;
uploadError = 0; uploadError = 0;
} break; } break;