Skip to content

Commit 30c088e

Browse files
author
rogerclarkmelbourne
committed
Bootloader. Fixed bug in upload to RAM and updated the maple mini binary. Note upload to RAM has not been tested as the Maple mini doesn't have enough RAM to test with
1 parent 4d5ccb3 commit 30c088e

3 files changed

Lines changed: 16 additions & 13 deletions

File tree

-12 Bytes
Binary file not shown.

usb_bootloader/STM32F1/dfu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void dfuInit(void) {
6161
thisBlockLen = 0;;
6262
userAppAddr = USER_CODE_RAM; /* default RAM user code location */
6363
userAppEnd = RAM_END;
64-
userUploadType=DFU_UPLOAD_RAM;
64+
userUploadType=DFU_UPLOAD_NONE;
6565
code_copy_lock = WAIT;
6666
dfuBusy = FALSE;
6767
}

usb_bootloader/STM32F1/main.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,28 +61,31 @@ int main()
6161
}
6262
}
6363

64-
if (checkUserCode(USER_CODE_FLASH0X8002000))
64+
if (userUploadType==DFU_UPLOAD_RAM)
6565
{
66-
jumpToUser(USER_CODE_FLASH0X8002000);
67-
}
68-
else
66+
// if we have just uploaded to RAM, then run whats in RAM
67+
jumpToUser(USER_CODE_RAM);
68+
}
69+
else
6970
{
70-
if (checkUserCode(USER_CODE_FLASH0X8005000))
71+
// This may be an upload to flash or a cold boot
72+
73+
if (checkUserCode(USER_CODE_FLASH0X8002000))
7174
{
72-
jumpToUser(USER_CODE_FLASH0X8005000);
75+
jumpToUser(USER_CODE_FLASH0X8002000);
7376
}
74-
else
77+
else
7578
{
76-
if (checkUserCode(USER_CODE_RAM) && userUploadType==DFU_UPLOAD_RAM)
79+
if (checkUserCode(USER_CODE_FLASH0X8005000))
7780
{
78-
jumpToUser(USER_CODE_RAM);
79-
}
81+
jumpToUser(USER_CODE_FLASH0X8005000);
82+
}
8083
else
8184
{
8285
// Nothing to execute in either Flash or RAM
83-
strobePin(LED_BANK, LED, 5, BLINK_FAST);
86+
strobePin(LED_BANK, LED, 5, BLINK_FAST);
8487
systemHardReset();
8588
}
8689
}
87-
}
90+
}
8891
}

0 commit comments

Comments
 (0)