I'm making a simple language for Arduino, and want to compile this with LLVM.
I tried to generate LLVM IR (to understand what LLVM IR is generated from the Arduino code). I used this command:
> clang -S -emit-llvm -Os -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -x c++ -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I "C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" -I "C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" Blink.cc -o ./Blink.cc.ll -I "C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include" --target=avr
It generates Blink.ll
. And likewise, I also can compile the source code to .o
(object) file.
But this file is not able to upload to the Arduino board.
To upload to the Arduino, I have to use avrdude
. But it requires.hex
file.
And LLVM outputs .o
file, only. I have no clue what have I do to upload this file to the Arduino board.