CLFS - Cross Compiled Linux From Scratch - The ARM Book

I'm sure most of you thought any time to compile Linux core in order to learn a little more of this Operative System, how to compile a great project as the Linux one is or simply to enjoy the path to success on doing it.
 
In my case I always wanted to compile it for an ARM processor (like Raspberry Pi, probably your smartphone or maybe your home router).
 
First I did is to search for it on Google:
 
http://www.google.es/search?q=compile+linux+for+ARM
 
You will find lot of differente processes to get it, but people who previously compiled a Linux distribution will find all shown links not enough to learn all process to compile it.
Searching a little more, I happily founded this great project called Cross Linux From Scratch, or CLFS:
 
http://trac.cross-lfs.org/
 
It explains all process going from the build of the cross compiling tools, configuration of your system, to the bootloader to allow your new system run.

The project allow you to follow it online or to build your own book. I'm uploading the books to compile linux from scratch for ARM, MIPS or x86 processors, a great resource for lovers of embedded systems
 

 

Bootloader for 18LF25K50

As I promised some weeks ago, I'm sharing with you the bootloader for this pic, adapted to development board I'm working with. There are some highlights on this bootloader:

  • It is based on Microchip Application Libraries, which provides a generic bootloader for 18F devices.
  • In this case I adapted it to avoid using blinking LEDs and be able to distinguish between bootloader mode or normal execution. As you can see in the schematic, I use the RC2 pin to check it.
  • I used free version of C18 compiler and it has no optimization when compiling so the bootloader uses more than 0x1000 memory addresses so I changed all pointers for reset and interruptions. Final flash memory usage uses 0x1102, I'm trying to delete unused code in order to reduce it below 0x1000 to match with the general version.

This is the code I want to remark:

Vectors remapping:

#define REMAPPED_APPLICATION_RESET_VECTOR 0x121E
#define REMAPPED_APPLICATION_HIGH_ISR_VECTOR 0x1208
#define REMAPPED_APPLICATION_LOW_ISR_VECTOR 0x1218
#define BOOTLOADER_ABSOLUTE_ENTRY_ADDRESS 0x001C

Bootloader main code:

//Assuming the I/O pin check entry method is enabled, check the I/O pin value
//to see if we should stay in bootloader mode, or jump to normal applicaiton
//execution mode.

#ifdef ENABLE_IO_PIN_CHECK_BOOTLOADER_ENTRY

//Need to make sure the I/O pin is configured for digital mode so we
//can sense the digital level on the input pin.

mInitSwitch2();
mInitAllSwitches();

//Check Bootload Mode Entry Condition from the I/O pin (ex: place a
//pushbutton and pull up resistor on the pin)

if(sw2 == 1) {
  _asm
    goto REMAPPED_APPLICATION_RESET_VECTOR //If the user is not trying to enter the bootloader, go straight to the main application remapped "reset" vector.
  _endasm

  //If we get to here, the user is not pressing the pushbutton. We
  //should default to jumping into application run mode in this case.
  //Restore default "reset" value of registers we may have modified temporarily.
  //mDeInitSwitch2();

  //Before going to application image however, make sure the image
  //is properly signed and is intact.
  //goto DoFlashSignatureCheck;

} else {
  //User is pressing the pushbutton. We should stay in bootloader mode
  _asm goto BootMain _endasm
}
#endif //#ifdef ENABLE_IO_PIN_CHECK_BOOTLOADER_ENTRY

 

 You have Mplabx project at the bottom of this entry. Feel free to get in contact with me if you have any doubts.

Download Bootloader 28LF25K50

 

MPLAB C18 v3.46 for MAC OS X << |

Syndicate content