[LLVMdev] Targeting low level embedded
Tom Hawkins
tomahawkins at gmail.com
Fri Mar 12 21:10:02 PST 2010
I'm new to LLVM and I'm trying to set it up to target a low level
embedded device with no OS. Therefore the final program needs to
perform variable initialization and be located at a certain address
location. Here is my basic flow:
Compile C to bytecode:
$ llvm-gcc -emit-llvm -c src1.c src2.c src3.c
Consolidate to one bytecode file:
$ llvm-link -o all.o src1.c src2.o src3.o
Emit assembly code:
$ llc -march=ppc32 -o all.s all.o
Assemble to machine code:
$ powerpc-eabi-as -o all.elf all.s
Relocate sections to target specific addresses:
$ powerpc-eabi-ld -T sections.ld -o relocated.elf all.elf
... then convert to an s-record and flash the device.
A few questions...
1. Is this the right approach?
2. Does llvm-gcc insert initialization code? It doesn't look like it,
but I may be missing something.
3. What is the difference between llvm-link and llvm-ld? Does
llvm-link do inter module optimization?
4. Can llvm-link or llvm-ld perform any memory placement, or does this
fall on binutils ld?
Thanks for any help!
-Tom
More information about the llvm-dev
mailing list