Good methods for understanding structure of bootloader

Discussion around AT91RM9200 and SAM9 Series Products.

Moderator: nferre

666666
Posts: 4
Joined: Tue Oct 18, 2016 8:13 am

Good methods for understanding structure of bootloader

Fri Nov 18, 2016 11:02 am

I recently figured out the cause of a nasty bug I've been working on with an Atmel AT91SAM9G20 SBC running U-boot, an open source bootloader. The core of the problem was that U-boot expected the hardware to be configured differently than I had built it, so some of the device registers were misconfigured.

Now that I've figured out the problem, I need to tweak U-boot to configure the registers correctly. I can do this blindly by adding a few lines of code at the end of the program, but that's messy.

This brings me to my question: how can I figure out how U-boot works more efficiently than starting at main() and reading all possible code paths across all files? I've tried grepping around in the files and looking at the code near relevant identifiers. This has proved ineffective; it seems that most of the code is drivers for subsystems I don't care about. I actually understand how the bootloader works pretty well by now, but I'm hoping there exists a better method than my naive approach.
blue_z
Location: USA
Posts: 1505
Joined: Thu Apr 19, 2007 10:15 pm

Re: Good methods for understanding structure of bootloader

Mon Nov 21, 2016 10:16 pm

666666 wrote:The core of the problem was that U-boot expected the hardware to be configured differently than I had built it, so some of the device registers were misconfigured.
That's a circular explanation.
666666 wrote:I can do this blindly by adding a few lines of code at the end of the program, but that's messy.
Apparently you need to learn to about functional layering and code modularity.
666666 wrote:This brings me to my question: how can I figure out how U-boot works more efficiently than starting at main() and reading all possible code paths across all files?
Discern the structure of the program.
Have you read the U-Boot README file, e.g. the section on "Board Initialisation Flow"?
There's also an explanation on how to spell U-Boot.

Regards

Return to “SAM9 ARM9 MPU”

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests