Difference between revisions of "Category:BareMetal"

From Gumstix User Wiki
Jump to: navigation, search
(Created page with "==Setup the cross compiling environment== The one I used is Sourcery CodeBench Lite Edition, you can get it from its website.(http://www.mentor.com/embedded-software/sourcery-too...")
 
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Setup the cross compiling environment==
 
==Setup the cross compiling environment==
The one I used is Sourcery CodeBench Lite Edition, you can get it from its website.(http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/)
+
The one I used is Sourcery CodeBench Lite Edition, you can get it from [http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/ its website].<br />
Please choose the eabi verison and format tar.bz2(This is what I used arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2)
+
Please choose the eabi verison and the tar.bz2 one. I used arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 <br />
Untar the file
+
Untar the file:<br />
  mkdir ~/overo-standalone
+
  $ mkdir ~/overo-standalone
  cd ~/overo-standalone
+
  $ cd ~/overo-standalone
  tar xvjf arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
+
  $ tar xvjf arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
Add the bin to your PATH
+
Add the bin to your PATH:<br />
  export PATH=$PATH:~/overo-standalone/arm-2008q3/bin
+
  $ export PATH=$PATH:~/overo-standalone/arm-2008q3/bin
  
 
==Write the program==
 
==Write the program==
The following two Hello World program has been tested on an overo
+
The following two Hello World programs have been tested on an overo.<br />
You have test with them
+
You can get source files from [https://github.com/zhaoruibing/overo-bare-metal-hello-world here].
  
 
==Compile the program==
 
==Compile the program==
Get into the desired folder
+
Assembly verison:
  cd c/ or cd asm/
+
  $ cd asm/
Run the compile files in c program folder
+
Use make to compile the asm program<br />
  sh compile
+
$ make
Use make to compile the asm program
+
C version:
make
+
  $ cd c/
 
+
Run the compile file in c program folder<br />
 +
  $ sh compile
 
==Run the program==
 
==Run the program==
You needed a flashed, bootable MicroSD. You can make one by using Sakoman's scripts (mkcard.sh and mksdcard.sh from http://www.sakoman.com/downloads.html)
+
You needed a flashed, bootable MicroSD. You can make one by using Sakoman's scripts ([http://www.sakoman.com/downloads.html mkcard.sh and mksdcard.sh]).<br />
Copy the .bin file generated by the compiler to the boot drive on the SD card
+
Copy the .bin file generated by the compiler to the boot drive on the SD card:<br />
  cp *.bin /media/boot/
+
  $ cp *.bin /media/boot/
Umount the SD card
+
Umount the SD card<br />
  umount /media/boot
+
  $ umount /media/boot
  umount /media/rootfs
+
  $ umount /media/rootfs
Plug the SD card in overo and connect the overo on a Tobi expansion board
+
 
Power it up and go into serial console
+
Plug the SD card in overo and connect the overo on a Tobi expansion board.<br />
When the console prompt "Hit any key to stop autoboot", please hit any key
+
Power it up and go into serial console.<br />
  mmc list
+
 
  mmc part
+
When the console prompt "Hit any key to stop autoboot", please hit any key to interrupt.<br />
  fatls mmc 0:1
+
And run:
  fatload mmc 0:1 0x80200000 uimage
+
  # mmc list
  go 0x80200000
+
  # mmc part
 +
  # fatls mmc 0:1
 +
  # fatload mmc 0:1 0x80200000 boot.bin
 +
  # go 0x80200000
 +
 
 +
By now you should see "Hello world!" poping in the console.
 +
 
 +
==References==
 +
 
 +
'''Code used:'''<br />
 +
:The Hello World C code is from:<br />
 +
:http://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-using-qemu/<br />
 +
:The commands used in serial console are from:<br />
 +
:http://gumstix.8.n6.nabble.com/Running-program-on-bare-metal-Overo-td4965440.html<br />
 +
:The code used in Hello World is modified from:<br />
 +
:The Definitive Guide to the ARM Cortex-M3 P172-174<br />
 +
 
 +
'''Cross compiling tool used:'''<br />
 +
:http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/<br />
 +
 
 +
'''Manuals:'''<br />
 +
:Uboot:<br />
 +
:http://www.denx.de/wiki/view/DULG/Manual<br />
 +
:Linker script:<br />
 +
:http://sourceware.org/binutils/docs/ld/Scripts.html#Scripts<br />
 +
:ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_mono/ld.html<br />
 +
:Compiler:<br />
 +
:http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html<br />
  
By now you should see "Hello world!" poping in the console
+
'''Futher readings:'''<br />
 +
:http://stackoverflow.com/questions/6870712/beagleboard-bare-metal-programming<br />
 +
:http://wiki.osdev.org/Beagleboard<br />
 +
:Building Bare-Metal ARM Systems with GNU
 +
'''TRM(Technical Reference Manuals):'''<br />
 +
:TI OMAP35x Applications Processor Technical Reference Manual<br />
 +
:ARM Architecture Reference Manual<br />
 +
:ARM Assembly Language Tools User's Guide<br />
 +
:RealView Platform Baseboard for Cortex-A8 User Guide<br />

Latest revision as of 15:05, 21 September 2012

Setup the cross compiling environment

The one I used is Sourcery CodeBench Lite Edition, you can get it from its website.
Please choose the eabi verison and the tar.bz2 one. I used arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
Untar the file:

$ mkdir ~/overo-standalone
$ cd ~/overo-standalone
$ tar xvjf arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

Add the bin to your PATH:

$ export PATH=$PATH:~/overo-standalone/arm-2008q3/bin

Write the program

The following two Hello World programs have been tested on an overo.
You can get source files from here.

Compile the program

Assembly verison:

$ cd asm/

Use make to compile the asm program

$ make

C version:

$ cd c/

Run the compile file in c program folder

$ sh compile

Run the program

You needed a flashed, bootable MicroSD. You can make one by using Sakoman's scripts (mkcard.sh and mksdcard.sh).
Copy the .bin file generated by the compiler to the boot drive on the SD card:

$ cp *.bin /media/boot/

Umount the SD card

$ umount /media/boot
$ umount /media/rootfs

Plug the SD card in overo and connect the overo on a Tobi expansion board.
Power it up and go into serial console.

When the console prompt "Hit any key to stop autoboot", please hit any key to interrupt.
And run:

# mmc list
# mmc part
# fatls mmc 0:1
# fatload mmc 0:1 0x80200000 boot.bin
# go 0x80200000

By now you should see "Hello world!" poping in the console.

References

Code used:

The Hello World C code is from:
http://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-using-qemu/
The commands used in serial console are from:
http://gumstix.8.n6.nabble.com/Running-program-on-bare-metal-Overo-td4965440.html
The code used in Hello World is modified from:
The Definitive Guide to the ARM Cortex-M3 P172-174

Cross compiling tool used:

http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/

Manuals:

Uboot:
http://www.denx.de/wiki/view/DULG/Manual
Linker script:
http://sourceware.org/binutils/docs/ld/Scripts.html#Scripts
ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_mono/ld.html
Compiler:
http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html

Futher readings:

http://stackoverflow.com/questions/6870712/beagleboard-bare-metal-programming
http://wiki.osdev.org/Beagleboard
Building Bare-Metal ARM Systems with GNU

TRM(Technical Reference Manuals):

TI OMAP35x Applications Processor Technical Reference Manual
ARM Architecture Reference Manual
ARM Assembly Language Tools User's Guide
RealView Platform Baseboard for Cortex-A8 User Guide

This category currently contains no pages or media.