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

This commit is contained in:
rogerclarkmelbourne 2015-04-26 17:13:37 +10:00
parent 4d5ccb3a15
commit 30c088e6a1
3 changed files with 16 additions and 13 deletions

View File

@ -61,7 +61,7 @@ void dfuInit(void) {
thisBlockLen = 0;;
userAppAddr = USER_CODE_RAM; /* default RAM user code location */
userAppEnd = RAM_END;
userUploadType=DFU_UPLOAD_RAM;
userUploadType=DFU_UPLOAD_NONE;
code_copy_lock = WAIT;
dfuBusy = FALSE;
}

View File

@ -61,28 +61,31 @@ int main()
}
}
if (checkUserCode(USER_CODE_FLASH0X8002000))
if (userUploadType==DFU_UPLOAD_RAM)
{
jumpToUser(USER_CODE_FLASH0X8002000);
}
else
// if we have just uploaded to RAM, then run whats in RAM
jumpToUser(USER_CODE_RAM);
}
else
{
if (checkUserCode(USER_CODE_FLASH0X8005000))
// This may be an upload to flash or a cold boot
if (checkUserCode(USER_CODE_FLASH0X8002000))
{
jumpToUser(USER_CODE_FLASH0X8005000);
jumpToUser(USER_CODE_FLASH0X8002000);
}
else
else
{
if (checkUserCode(USER_CODE_RAM) && userUploadType==DFU_UPLOAD_RAM)
if (checkUserCode(USER_CODE_FLASH0X8005000))
{
jumpToUser(USER_CODE_RAM);
}
jumpToUser(USER_CODE_FLASH0X8005000);
}
else
{
// Nothing to execute in either Flash or RAM
strobePin(LED_BANK, LED, 5, BLINK_FAST);
strobePin(LED_BANK, LED, 5, BLINK_FAST);
systemHardReset();
}
}
}
}
}