From 5ac1ae2e0620f5ce9c8bf5ba3d2b9939b49675ba Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 16 Oct 2024 09:36:37 +0200 Subject: [PATCH] when in bootrom mode, the arg0 variable needed to be zeroed out before usage. We assign arg0 from a message before but we can discard that information in this particular case. Its quite odd to see the assignment failing but empty it out seems to have fixed it. --- bootrom/bootrom.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bootrom/bootrom.c b/bootrom/bootrom.c index 74c0a9b9e..8695222be 100644 --- a/bootrom/bootrom.c +++ b/bootrom/bootrom.c @@ -59,9 +59,9 @@ static int reply_old(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, #if DEBUG static void DbpString(char *str) { uint8_t len = 0; - while (str[len] != 0x00) + while (str[len] != 0x00) { len++; - + } reply_old(CMD_DEBUG_PRINT_STRING, len, 0, 0, (uint8_t *)str, len); } #endif @@ -131,14 +131,17 @@ static void UsbPacketReceived(uint8_t *packet) { switch (c->cmd) { case CMD_DEVICE_INFO: { ack = false; + arg0 = 0; arg0 = DEVICE_INFO_FLAG_BOOTROM_PRESENT | DEVICE_INFO_FLAG_CURRENT_MODE_BOOTROM | DEVICE_INFO_FLAG_UNDERSTANDS_START_FLASH | DEVICE_INFO_FLAG_UNDERSTANDS_CHIP_INFO | DEVICE_INFO_FLAG_UNDERSTANDS_VERSION | DEVICE_INFO_FLAG_UNDERSTANDS_READ_MEM; - if (g_common_area.flags.osimage_present) + + if (g_common_area.flags.osimage_present) { arg0 |= DEVICE_INFO_FLAG_OSIMAGE_PRESENT; + } reply_old(CMD_DEVICE_INFO, arg0, 1, 2, 0, 0); } @@ -291,8 +294,9 @@ static void UsbPacketReceived(uint8_t *packet) { break; } - if (ack) + if (ack) { reply_old(CMD_ACK, arg0, 0, 0, 0, 0); + } } // delay_loop(1) = 3.07us