On 03/08/2012 12:16 PM, Wookey wrote:
+++ Singh, Ravi Kumar (Ravi) [2012-03-08 22:28 +0530]:
Can someone point me to bare metal example using GNU toolchain.
Hector Oron has played with this:
here is a makefile for building some simple code either with
bare-metal compilerof linux/libc compiler
[snip, reorder]
>
http://git.emdebian.org/?p=upstream/cortex-examples.git;a=blob;f=05_blinky/makefile;h=b2b7f58168f47456923cf41c8a0d71af653c319e;hb=master
Yes, that looks like a good resource. Might be a bit HW specific for
some but still useful.
(in practice the latter
worked as well or better so the actual need for a bare-metal compiler
seems to me to be unclear in most cases):
I suspect you actually know the answer to that Wookey and your comment
is more of a value choice. However for any other readers out there ...
Yes, you can certainly target non Linux user space ABI environments with
a Linux user space ABI compiler. The kernel itself is a great example
of this. However, the kernel includes its own copies of the libgcc
equivalent functions, its own implementation of memcpy, and its own
printf equivalent in printk.
The value of a bare metal compiler is it makes all this easier. You can
divide a 64 bit integer, call memcpy, and get most of a printf
implementation. If some one supplies some board specific boot code, a
few low level i/o functions, and a link template, it lets multiple
people create simple main() applications like this one:
http://git.emdebian.org/?p=upstream/cortex-examples.git;a=blob;f=08_sym/main_file.c;h=da5b705eb036feb3e53f4a02d60d8ccae38ee215;hb=master
compared to the typical no library program which usually looks like:
http://git.emdebian.org/?p=upstream/cortex-examples.git;a=tree;f=05_blinky;h=26fd090d21cc039b2bf0e93771bbb5007e10c202;hb=master
[BTW: I don't think blinky's use of cs3.h is legally correct.]
Bill
_______________________________________________
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-toolchain