Uzebox Bootloader V5

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
User avatar
Jubatian
Posts: 1563
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: New bootloader

Post by Jubatian »

nicksen782 wrote: Fri Nov 17, 2017 9:00 pmActually, can that be done with the existing bootloader?
Yes, the SoftReset() function does that. The function does not return (so calling it you should end up in the bootloader provided you hold a button down if it is in "Game" mode - normally you might add it to an "Exit" or similar menu entry in the game, it may feel a bit quirky at first, but it is likely an easy thing to realize that it just needs a little longer push for a proper return to the loader).
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: New bootloader

Post by nicksen782 »

So, SoftReset() will reboot the Uzebox? The user would need to hold the B button to have the bootloader trigger then?

In this case, what is still in RAM? When you reflash a game does that also wipe whatever is in RAM?
User avatar
Jubatian
Posts: 1563
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: New bootloader

Post by Jubatian »

nicksen782 wrote: Sat Nov 18, 2017 1:15 am So, SoftReset() will reboot the Uzebox? The user would need to hold the B button to have the bootloader trigger then?

In this case, what is still in RAM? When you reflash a game does that also wipe whatever is in RAM?
Yes, SoftReset() does a reboot using the watchdog (the START + SELECT + B + Y combo actually calls that). Any button can be held down to enter the bootloader (if you release all buttons fast, then if the bootloader was in "Game" mode, it will see that no button is held, so will restart the game). In the new bootloader I can add some small tweaks to shorten the required button press (currently you would have to hold it for nearly a second which is due to that I wait first for power & sync stabilization and only read the controllers then), theoretically it can be shortened down to as low as about 50ms.

When you soft-reset, the first thing happening is the bootloader starting. The old bootloader is a C program, it wipes the .bss area by the C init, and sets up the stack at 0x10FF, so those parts are overwritten. The new bootloader wipes nearly all the RAM. If you mean the new game load API, then you can most reasonably expect a complete wipe happening, so passing any information to a newly booted game is only possible by EEPROM or SD Card (for example like Emuze which can manage stuff in the EEPROM, thus affecting other games).
User avatar
Jubatian
Posts: 1563
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: New bootloader

Post by Jubatian »

I made another minor upgrade (V.5.0.08):

Now soft-reset is smoother as the bootloader now starts sampling the controller as soon as possible to see whether anything is held down. So an user-triggered soft-reset will extremely likely end up within the game selector menu (you would have to tap the button very slightly to achieve a reset returning to the game).

By the way the bootloader's controller handling is also based off of the experiment with Flight of a Dragon where I made it capable to support wireless SNES controllers. So it should also be capable to work with those, enabling a pathway to slowly transition towards supporting those proper.

Anything else? Alec: What do you think about the capability of requesting burning a new game? (Currently it is in) I really need some more feedback before propagating this to master (and maybe Alec towards the actual kits), this is a rather significant transition.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: New bootloader

Post by Artcfox »

My vote is to keep game loading support in there, and have a strong policy/warnings in place so people don't abuse it.
User avatar
nicksen782
Posts: 714
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: New bootloader

Post by nicksen782 »

uze6666 wrote: Wed Nov 01, 2017 3:45 am I don't want to tone down the overall excellent work, but I'm not fond about the part about allowing a game to flash sectors.
Alec did say this earlier. It would be nice but could be a concern. What if the game could request the game to flash but instead of flashing it could already be selected by the bootloader?

I could be open to the idea of "game" that could flash a new bootloader but there would need to be safeties in place.
User avatar
ry755
Posts: 226
Joined: Mon May 22, 2017 6:01 am

Re: New bootloader

Post by ry755 »

I think you should leave it in, and then have a dialog box asking "Are you sure you want to flash example.uze?" It would make sure it's not trying to flash something you don't want, but it would still look good at the same time.

EDIT: Is it possible to have the bootloader draw a dialog box right on top of the running game? Like have the bootloader be called without clearing the screen?
User avatar
Jubatian
Posts: 1563
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: New bootloader

Post by Jubatian »

ry755 wrote: Sat Nov 25, 2017 5:06 am I think you should leave it in, and then have a dialog box asking "Are you sure you want to flash example.uze?" (...)
"Are you su", and then I am out of free space :lol: Just to emphasise on the difficulty of adding anything of such magnitude!
User avatar
ry755
Posts: 226
Joined: Mon May 22, 2017 6:01 am

Re: New bootloader

Post by ry755 »

Jubatian wrote: Sat Nov 25, 2017 10:17 am
ry755 wrote: Sat Nov 25, 2017 5:06 am I think you should leave it in, and then have a dialog box asking "Are you sure you want to flash example.uze?" (...)
"Are you su", and then I am out of free space :lol: Just to emphasise on the difficulty of adding anything of such magnitude!
Oh, right :D How much free space is actually left?
User avatar
Jubatian
Posts: 1563
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: New bootloader

Post by Jubatian »

ry755 wrote: Sat Nov 25, 2017 10:20 am
Jubatian wrote: Sat Nov 25, 2017 10:17 am
ry755 wrote: Sat Nov 25, 2017 5:06 am I think you should leave it in, and then have a dialog box asking "Are you sure you want to flash example.uze?" (...)
"Are you su", and then I am out of free space :lol: Just to emphasise on the difficulty of adding anything of such magnitude!
Oh, right :D How much free space is actually left?
I have exactly that much space left!
Post Reply