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%3Ba=blob%3Bf=05_blin...
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%3Ba=blob%3Bf=08_sym/...
compared to the typical no library program which usually looks like: http://git.emdebian.org/?p=upstream/cortex-examples.git%3Ba=tree%3Bf=05_blin...
[BTW: I don't think blinky's use of cs3.h is legally correct.]
Bill