Jump to content


What is the folder "bootloader" used for?


  • Please log in to reply
6 replies to this topic

#1 John Liu

John Liu

    Member

  • Members
  • PipPip
  • 20 posts
  • Country: flag of Singapore Singapore

Posted 29 December 2011 - 09:11 AM

Hi! guys!
   I have compiled the codes relative to my board using Keil, which is a more familiar tool for me. But until now I am not sure whether I should use this folder or not.
  Can you someone tell me whether the BOOTLOADER is ONLY used for eclipse&makefile or some other tool, BUT NOT for Keil?
  Thanks!

#2 D-Lite

D-Lite

    Core Team

  • Members
  • PipPipPip
  • 968 posts
  • Country: flag of Germany Germany


Posted 29 December 2011 - 11:15 AM

The bootloader is the first thing that is run during powerup or reset. It then starts the main firmware. It's also the piece of code that is run to update or rescue the main firmware. There's normaly no need to update the bootloader itself but if you want to, you have to compile the bootloader, no matter what compiler or IDE you use.

#3 John Liu

John Liu

    Member

  • Members
  • PipPip
  • 20 posts
  • Country: flag of Singapore Singapore

Posted 31 December 2011 - 03:59 AM

View PostD-Lite, on 29 December 2011 - 11:15 AM, said:

The bootloader is the first thing that is run during powerup or reset. It then starts the main firmware. It's also the piece of code that is run to update or rescue the main firmware. There's normaly no need to update the bootloader itself but if you want to, you have to compile the bootloader, no matter what compiler or IDE you use.
Thank you for your kindly reply, D-Lite. :)  Now I know I must compile bootloader folder. But would you answer me another question?
    There are two "main" functions in the whole project(one belongs to bootloader, the other belongs to px2fmu),  since the start address in the memory of bootloader and px2fmu are "0x08000000" and "0x08008000", I can hardly imagine one main can call another even we can modify px22fmu's main to "px2fmu_main". How can I compile bootloader and px2fmu together in one project?
    Thank you for your patient to me, a newer.

#4 naiiawah

naiiawah

    Core Developer

  • Members
  • PipPipPip
  • 309 posts
  • LocationNorthwest USA
  • Country: flag of United States United States


Posted 31 December 2011 - 05:02 AM

View PostJohn Liu, on 31 December 2011 - 03:59 AM, said:

Thank you for your kindly reply, D-Lite. :)  Now I know I must compile bootloader folder. But would you answer me another question?
There are two "main" functions in the whole project(one belongs to bootloader, the other belongs to px2fmu),  since the start address in the memory of bootloader and px2fmu are "0x08000000" and "0x08008000", I can hardly imagine one main can call another even we can modify px22fmu's main to "px2fmu_main". How can I compile bootloader and px2fmu together in one project?
Thank you for your patient to me, a newer.

They are not intended to be compiled into a single project (when I say project, I mean .elf file).  They are two completely separate, but symbiotic programs (projects), just like the GCS is a different project(program) from the flight FW.

The Bootloader is there to have a small isolated piece of code that can handle downloads of new FW from the host via USB, to take care of bringing up the HW into a sane state, and finally launching the main system FW (the "flight" code).  When you use the "Rescue" function of the GCS, it is talking to the bootloader via USB to download new FW.  The bootloader (now that it is stable) is put on the boards at the factory, and usually will never need to be touched again.  When the CPU comes out of reset, it is the bootloader that is being run.  It will later jump to a known location entry point if it finds FW on the board.

The main flight FW is built into a separate .elf file, which subsequently gets transformed into the .opfw file.  Your goal should be to build this .elf file for the flight "project"

#5 John Liu

John Liu

    Member

  • Members
  • PipPip
  • 20 posts
  • Country: flag of Singapore Singapore

Posted 31 December 2011 - 05:50 AM

View Postnaiiawah, on 31 December 2011 - 05:02 AM, said:

They are not intended to be compiled into a single project (when I say project, I mean .elf file).  They are two completely separate, but symbiotic programs (projects), just like the GCS is a different project(program) from the flight FW.

The Bootloader is there to have a small isolated piece of code that can handle downloads of new FW from the host via USB, to take care of bringing up the HW into a sane state, and finally launching the main system FW (the "flight" code).  When you use the "Rescue" function of the GCS, it is talking to the bootloader via USB to download new FW.  The bootloader (now that it is stable) is put on the boards at the factory, and usually will never need to be touched again.  When the CPU comes out of reset, it is the bootloader that is being run.  It will later jump to a known location entry point if it finds FW on the board.

The main flight FW is built into a separate .elf file, which subsequently gets transformed into the .opfw file.  Your goal should be to build this .elf file for the flight "project"

    Thank you for your help. I like your explanation. Happy new year!

#6 naiiawah

naiiawah

    Core Developer

  • Members
  • PipPipPip
  • 309 posts
  • LocationNorthwest USA
  • Country: flag of United States United States


Posted 31 December 2011 - 05:55 AM

View PostJohn Liu, on 31 December 2011 - 05:50 AM, said:

Thank you for your help. I like your explanation. Happy new year!

Glad I could help.  And Happy and Prosperous New Years wishes to you too!

#7 A*Morale

A*Morale

    Core Developer

  • Members
  • PipPipPip
  • 190 posts
  • LocationRome/Italy
  • Country: flag of Italy Italy


Posted 03 January 2012 - 03:41 PM

Excuse me, but won't be better to use the makefiles that ships with op?
Isn't very time consuming aligning with every firmware version? Not counting the possibility that some bug can be introduced due, for exams to different optimization of the gcc va keil compiler. Just my two cents :)
Alessio my Blog
Posted Image