Porting the bootloader to ARM

Libraries, utilities, bootloaders...

Porting the bootloader to ARM

Postby AloyseTech » Fri Jul 03, 2015 7:23 pm

Hi,

I'm looking for a way to implement the bootloader on the Arduino Zero (SAMD21 CPU) to load code from SD card. I'm very new to bootloader things, so, I guess I'll need your help folks! :)

Any idea how to do this?

Thanks,
AloyseTech
AloyseTech
 
Posts: 3
Joined: Fri Jul 03, 2015 6:58 pm

Re: Porting the bootloader to ARM

Postby Myndale » Tue Jul 14, 2015 1:36 am

First step would be to make sure Gamebuino's LOADER.HEX compiles and runs properly on the Zero. Actual game loading won't work at this stage but it will allow you to test that the SD functions work as expected.

Next step would be to download the zero bootloader source code and get it to compile.

The next step would be to modify the bootloader to load LOADER.HEX on launch when the C button is held down. The zero has 256kb of flash which is 8 times larger than the Atmel328p so I'd probably just use the regular File/SD libs. Keep in mind that none of the compiled games will work on the zero, you'll have to recompile them all specifically for ARM just as you did for the loader.

Finally add two functions to the loader which applications can call directly: load_game and write_flash_page (see the wiki for more info on how these work). You'll need to set these at a fixed address in the bootloader, which will require messing around with the bootloader make file settings, and you'll also need to make the relevant changes to the address in Gamebuino.h:

Code: Select all
    #define load_game (*((void(*)(const char* filename))(0x7ffc/2)))
    #define write_flash_page (*((void(*)(const char * page, unsigned char * buffer))(0x7ffa/2)))


With this done do a recompile of loader, it should pick up the new address and now load games correctly.
Myndale
 
Posts: 507
Joined: Sat Mar 01, 2014 1:25 am

Re: Porting the bootloader to ARM

Postby AloyseTech » Fri Jul 17, 2015 11:52 pm

Hi Myndale! Thanks for your answer :)

Actually I'm not looking for a way to implement the whole Gamebuino on the zero, only the LOADER sketch + bootloader. The Write_page function is not yet needed and would only be some extra/special feature.
I'm really new to the bootloader part of the Arduino world and I don't really understand the process of programming/compiling a bootloader... Could you please explain me a little bit how does it works?
Do I need something else than the Arduino IDE to compile/program the bootloader?

Thanks for your help, I really appreciate that.
AloyseTech
 
Posts: 3
Joined: Fri Jul 03, 2015 6:58 pm

Re: Porting the bootloader to ARM

Postby jonnection » Sat Jul 18, 2015 6:28 am

Bootloaders are not compiled with the arduino ide. This is because bootloaders are very specific to the hardware they are run on. The Zero bootloader seems extremely well commented and clear. One directory below the link that Myndale gave you is an .atsln file. It means that the bootloader is probably compiled in Atmel Studio (free). Go download it, open the Zero bootloader project file in Atmel Studio and compile. If you can do that, then you can start to try to put your own code in the bootloader. If you can't then I think you need to start on some basics first. I don't want to discourage you and Myndale will perhaps disagree, but in my opinion coding an SD bootloader is pretty advanced.
User avatar
jonnection
 
Posts: 317
Joined: Sun May 04, 2014 8:21 pm

Re: Porting the bootloader to ARM

Postby AloyseTech » Sun Jul 19, 2015 12:08 am

Hi Jonnection,thanks for your answer!
I know that writing a bootloader is not an easy task, and that why I'm looking for help rigth there. I will try to compile the Zero bootloader as soon as I have my PC working (Atmel Studio seems to not be available on mac..). I any of you are interested to help me code this, let me know. I can pay you for working code if I'm really unable to figure it out by myself! :)
AloyseTech
 
Posts: 3
Joined: Fri Jul 03, 2015 6:58 pm


Return to Software Development

Who is online

Users browsing this forum: No registered users and 2 guests

cron