Difference between revisions of "Category:BareMetal"

From Gumstix User Wiki
Jump to: navigation, search
Line 46: Line 46:
 
==References==
 
==References==
  
Code used:<br />
+
'''Code used:'''<br />
 
The Hello World C code is from:<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 />
 
http://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-using-qemu/<br />
Line 54: Line 54:
 
The Definitive Guide to the ARM Cortex-M3 P172-174<br />
 
The Definitive Guide to the ARM Cortex-M3 P172-174<br />
  
Cross compiling tool used:<br />
+
'''Cross compiling tool used:'''<br />
 
http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/<br />
 
http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/<br />
  
Manuals:<br />
+
'''Manuals:'''<br />
 
Uboot:<br />
 
Uboot:<br />
 
http://www.denx.de/wiki/view/DULG/Manual<br />
 
http://www.denx.de/wiki/view/DULG/Manual<br />
Line 66: Line 66:
 
http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html<br />
 
http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html<br />
  
Futher readings:<br />
+
'''Futher readings:'''<br />
 
http://stackoverflow.com/questions/6870712/beagleboard-bare-metal-programming<br />
 
http://stackoverflow.com/questions/6870712/beagleboard-bare-metal-programming<br />
 
http://wiki.osdev.org/Beagleboard<br />
 
http://wiki.osdev.org/Beagleboard<br />

Revision as of 15:54, 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 play with them.
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

This category currently contains no pages or media.