Fixed configuration: ONETIME vs PRIMARY. Configuration was no longer working.

The firmware was always reading the ONETIME config section, while the
config utility was always writing the PRIMARY section. And there was no way
to wipe/invalidate the ONETIME section - so the configuration utility had no effect.
Also, the "reboot" command was reading and writing the ONETIME config section,
so nothing changed there either.
There are several way to fix the configuration - depending on what was
originally intended with the ONETIME vs PRIMARY sections.
This is one way to fix the issue: a reboot now reads the PRIMARY section
and writes it to ONETIME.
This commit is contained in:
ThorstenB 2023-12-17 20:55:58 +01:00
parent a144d5850b
commit f239b02d0a
3 changed files with 5 additions and 5 deletions

View File

@ -375,8 +375,8 @@ bool DELAYED_COPY_CODE(is_primary_config_newer)() {
}
#endif
bool DELAYED_COPY_CODE(read_config)() {
if(is_config_valid(FLASH_CONFIG_ONETIME)) {
bool DELAYED_COPY_CODE(read_config)(bool onetime) {
if(onetime && is_config_valid(FLASH_CONFIG_ONETIME)) {
internal_flags &= ~IFLAGS_TEST;
soft_switches |= SOFTSW_TEXT_MODE;
if(parse_config(FLASH_CONFIG_ONETIME))
@ -772,7 +772,7 @@ void DELAYED_COPY_CODE(config_handler)() {
case 'b':
// Reboot and bypass auto-detection of machine type.
cfg_machine = current_machine;
read_config();
read_config(false);
write_config(true);
flash_reboot();
break;

View File

@ -102,7 +102,7 @@ extern volatile compat_t current_machine;
void default_config();
int make_config(uint32_t rev);
bool read_config();
bool read_config(bool onetime);
bool write_config(bool onetime);
void config_handler();

View File

@ -218,7 +218,7 @@ int main() {
dmacpy32(__ram_delayed_copy_start__, __ram_delayed_copy_end__, __ram_delayed_copy_source__);
// Load the config from flash, or defaults
read_config();
read_config(true);
#if defined(FUNCTION_Z80) && defined(ANALOG_GS)
uart_init(uart0, sio[0].baudrate);