Organize and Share your Electronics the way you want. Sign-Up for a free account now. It takes only 30 seconds!

Homemade ARM Board Running Linux with LCD: Part 4 U-boot Bootloader Porting and Cross Compile

Homemade ARM Board Running Linux with LCD: Part 4 U-boot Bootloader Porting and Cross Compile
This post is going to be 4th part in series of making a Linux capable ARM Board at home. click First, Second and Third to go to previous Parts,so lets start.
what is a Bootloader, Why do we need it? 
a boot loader is a program which is the first one to be executed by the CPU. it severs some very specific purpose “configuring few very essential things before loading the main program (may be OS) into main memory” , that is why it is called boot loader. depending on needs boot loader may do some other task(we will cover them here).
there are various shape and sizes of the bootloaders , they all serve almost same purpose.
with microcontrollers , some times it does not actually load the main program into memory but pass on the executing pointer to main program so that main program can run directly form the memory where it is.

Need of a bootloader in mircocontroller is different than CPU , for MCU bootloaders are generally ment to have capablity of software update. MCU are capable of executing without bootloader at all. bootloader are not required but they add some luxury.

      Lets start with a simple mircontroller bootloader , there may be diffrent type here also, depending on from where they receive main program to where they write. like you may have a UART bootloader , which will come up every time CPU resets , in case of program update required.bootloader receive execulable  program over UART and program it into flash or just put into RAM(some small mircocontrollers have only RAM for execution like cypress  cy7c68013a they always need to receive program on startup either via USB or external EEPROM).a USB based bootloader will also do same , but it receive program over USB bus and program into flash or put it into RAM.
       For mircontroller almost all the absolutely crucial peripherals (like RAM , Clock ,Power) are initialized by the chip in the hardware itself. microcontroller hardware know where exactly to look for  program in the flash or in any other memory.with MCU everthing thing is onchip , hardware know where it what . he knows memory size and all the buses too. almost nothing can change or go wrong. all the peripherals on the MCU are hard-wired by the chip designer.
     Need of  Bootloader with CPU is different , they are responsible to configure some of hardware like external RAM parameters Size,  Bus width , timings etc. they are also responsible to load the kernel file from a sophisticated file system rather than a fixed memory location. bootloader is almost always required if you are trying to run some resource consuming main progam.
      With CPU , hardware generally have a very basic ability “same as mircocontrollers” to load some executable program from some fixed external memory (few processors have more than one option , almost no CPU has onchip flash for customer code) . like few CPU reads a particular sector in SD card or NAND flah. or even few processor are capable of loading the program from USB or UART. after loading the program from external ROM into internal memory CPU start executing bootloader . please note that all descent CPU has  large amount of RAM off Chip. but they still bootloader get  into onchip RAM instead off chip RAM. because at the time of reset CPU doen’t even know even the external RAM is connected , or even if it is connected then how it is connected. so the only way you can execute bootloader progam is onchip RAM , CPU start executing bootloader from onchip RAM and all the information about the hardware will be available with bootloader. Allwinner a13 has 48K SRAM onchip.  all CPU are capable of running only with onchip RAM you don’t need any external memory.
it is the same reason CPU can’t just go and load OS out of external memory and start executing. because at the start-up , there is only a tiny amount of onchip RAM is considered to be usable.and you can not load comparably  large size OS image into this small onchip RAM start executing.
you need some light weight program which can be loaded into limited amount of internal RAM , and configure all other stuff, load OS file from some sophisticated source like , FAT or ext file system or even network. and transfer the executing control to that. 
 

only after configuration of  RAM parameters ,external RAM is considered to be usabl. bootloader also configure clock , PMU power regulator setting etc.

U-boot

 u-boot is just one of many bootloader programs , the good things about this is , as then name says in it is universal bootloader , it support many different architecture. it is very famous hence has a large support community . it is open source.
u-boot already ported to the CPU which we are using here the Allwinner A13, u-boot already support the booting medium we need .
so it is always a wise choice to chose already ported U-boot rather than making your own or even try porting some very architecture specific bootloader to your platform.
but still as ever hardware is different in some why , some modification to u-boot required to support your new Hardware.  like we have some RAM configuration changes, LCD power and Backlit controls are   with the PMU and u-boot manage them. there can be many such things depending your hardware configuration.
sunxi is linux community that support allwinner procesosor
the sunxi uboot already ported to A13 CPU is availalb at this github repo
there are two ports there , one is sunxi brach  which is leagcy u-boot , it support linux kernel 3.4 , and very very stable.
and there is one another branch there in repo which is underdevelopment branch , new branch support new version of kernel , but new version of kernel does not support many features like 3D graphics GPU acceleration etc. we need to stick with old version till there is stable new version of stable sunxi kernel is available.
so checkout legacy sunxi branch ,
now we have code which already support our CPU , we just need to add some hardware configuration and u-boot configuration file ,  this process describe how to port or configure u-boot for the new custom linux broad you have.
u-boot has many different configuration file , board specific file and hardware configurations.
first of all you need to again look at the board from where you took reference hardware schematic. findout if u-boot already has configuration for that board . as we have  Allwinner A13 processor has we have been taking reference from Oilmex A13 board , we use Olimex board’s configuration file as reference.

we need  mark all the changes that we have made and need to make changes in each and every file associated with those changes.

now lets look at u-boot directory where exactly these file are located in the source.

Read more Here







 

More Articles to Read

Peeqo is a desktop bot that communicates through GIFs
Peeqo is a desktop bot that communicates through GIFs
Using a Programmable Input Multiplier to Minimize Integer Boundary Spurs
Using a Programmable Input Multiplier to Minimize Integer Boundary Spurs
Serial seven segment LED display shield
Serial seven segment LED display shield
G-code controlled drawing plotter
G-code controlled drawing plotter
An Arduino round word clock
An Arduino round word clock
The Sandwich-o-Matic will make your lunch automatically
The Sandwich-o-Matic will make your lunch automatically
Scalar Network Analyser Jr
Scalar Network Analyser Jr
An Arduino-controlled automated whiskey distillery
An Arduino-controlled automated whiskey distillery
The Rex800 looks like a dinosaur Terminator
The Rex800 looks like a dinosaur Terminator
Home Environment Monitor
Home Environment Monitor
Understanding the Operation of the Frequency Synthesizer in Maxim’s RF Transceivers
Understanding the Operation of the Frequency Synthesizer in Maxim’s RF Transceivers
App note: EPIC: Electro-Pyrotechnic Initiator Chip Resistor
App note: EPIC: Electro-Pyrotechnic Initiator Chip Resistor
Noisy ESP8266
Noisy ESP8266
App note: Noise analysis for high-speed op amps
App note: Noise analysis for high-speed op amps
Skill Sunday: Arrays
Skill Sunday: Arrays
App note: Infrared remote control implementation with MSP430FR4xx
App note: Infrared remote control implementation with MSP430FR4xx
Gesture Controlled Smart Home
Gesture Controlled Smart Home
Design for a Wideband, Differential Transimpedance DAC Output
Design for a Wideband, Differential Transimpedance DAC Output
Wrist thrusters let you fly through the water effortlessly
Wrist thrusters let you fly through the water effortlessly
Bertan/Spellman 225-20R HV power supply teardown
Bertan/Spellman 225-20R HV power supply teardown

Top


Shares