If you only want to read the suffix, you won’t need to unlock the flash, you can just read that address direct.
This is a simple sketch that demonstrates that
uint8_t *s1 = (uint8_t*)0x80064B8;
uint8_t *s2 = (uint8_t*)0x800A4B8;
char suffix1[8];
char suffix2[8];
void setup() {
Particle.function("setSuffix", setSuffix);
}
int setSuffix(String arg) {
String suffix = arg.substring(0,6);
memset(suffix1, 0, sizeof(suffix1));
memcpy(suffix1, s1, sizeof(suffix1)-1);
memset(suffix2, 0, sizeof(suffix2));
memcpy(suffix2, s2, sizeof(suffix2)-1);
Serial.printlnf("Before: 0x%08X: %6s\r\n 0x%08X: %6s", (uint32_t)s1, suffix1, (uint32_t)s2, suffix2);
System.set(SYSTEM_CONFIG_SOFTAP_SUFFIX, arg.substring(0,6));
memset(suffix1, 0, sizeof(suffix1));
memcpy(suffix1, s1, suffix.length());
memset(suffix2, 0, sizeof(suffix2));
memcpy(suffix2, s2, suffix.length());
Serial.printlnf("After : 0x%08X: %6s\r\n 0x%08X: %6s", (uint32_t)s1, suffix1, (uint32_t)s2, suffix2);
return suffix.length();
}
You can set a new suffix and will get the suffix stored in the two locations before and after the change as serial output.