c/cpp 지원함
Can I program the Arduino board in C?
In fact, you already are; the Arduino language is merely a set of C/C++ functions that can be called from your code. Your sketch undergoes minor changes (e.g. automatic generation of function prototypes) and then is passed directly to a C/C++ compiler (avr-g++). All standard C and C++ constructs supported by avr-g++ should work in Arduino. For more details, see the page on the Arduino build process.
[링크 : https://www.arduino.cc/en/Main/FAQ]
아두이노 켜면 뜨는 sketch 파일은 바로 빌드 되는게 아니라 여러 단계를 거쳐서 빌드 됨
일단 소스를 보면.. 기본골격이 setup() / loop() 인데
아마도... 이런 구조로 변환하려나?
#include "board.h" #include "wiring.h" #define F_CPU 16000000 extern void setup(); extern void loop(); int main() { setup(); while(1) { // main loop loop(); // event handler - not interrupt serial_event(); } } |
[링크 : https://www.arduino.cc/en/Hacking/BuildProcess]
[링크 : https://www.arduino.cc/en/Hacking/Preferences]
+
2016.03.28
빌드 메시지
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/eightanaloginputs /tmp/build3729038704914021233.tmp/SerialEvent.cpp -o /tmp/build3729038704914021233.tmp/SerialEvent.cpp.o Using previously compiled: /tmp/build3729038704914021233.tmp/WInterrupts.c.o Using previously compiled: /tmp/build3729038704914021233.tmp/wiring_pulse.c.o Using previously compiled: /tmp/build3729038704914021233.tmp/wiring_digital.c.o Using previously compiled: /tmp/build3729038704914021233.tmp/wiring_analog.c.o Using previously compiled: /tmp/build3729038704914021233.tmp/malloc.c.o Using previously compiled: /tmp/build3729038704914021233.tmp/realloc.c.o Using previously compiled: /tmp/build3729038704914021233.tmp/wiring.c.o Using previously compiled: /tmp/build3729038704914021233.tmp/wiring_shift.c.o Using previously compiled: /tmp/build3729038704914021233.tmp/CDC.cpp.o Using previously compiled: /tmp/build3729038704914021233.tmp/Stream.cpp.o Using previously compiled: /tmp/build3729038704914021233.tmp/main.cpp.o Using previously compiled: /tmp/build3729038704914021233.tmp/WMath.cpp.o Using previously compiled: /tmp/build3729038704914021233.tmp/HID.cpp.o Using previously compiled: /tmp/build3729038704914021233.tmp/WString.cpp.o Using previously compiled: /tmp/build3729038704914021233.tmp/HardwareSerial.cpp.o Using previously compiled: /tmp/build3729038704914021233.tmp/IPAddress.cpp.o Using previously compiled: /tmp/build3729038704914021233.tmp/USBCore.cpp.o Using previously compiled: /tmp/build3729038704914021233.tmp/new.cpp.o Using previously compiled: /tmp/build3729038704914021233.tmp/Tone.cpp.o Using previously compiled: /tmp/build3729038704914021233.tmp/Print.cpp.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/WInterrupts.c.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/wiring_pulse.c.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/wiring_digital.c.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/wiring_analog.c.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/malloc.c.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/realloc.c.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/wiring.c.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/wiring_shift.c.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/CDC.cpp.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/Stream.cpp.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/main.cpp.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/WMath.cpp.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/HID.cpp.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/WString.cpp.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/HardwareSerial.cpp.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/IPAddress.cpp.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/USBCore.cpp.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/new.cpp.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/Tone.cpp.o /usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/Print.cpp.o /usr/share/arduino/hardware/tools/avr/bin/avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p -o /tmp/build3729038704914021233.tmp/SerialEvent.cpp.elf /tmp/build3729038704914021233.tmp/SerialEvent.cpp.o /tmp/build3729038704914021233.tmp/core.a -L/tmp/build3729038704914021233.tmp -lm /usr/share/arduino/hardware/tools/avr/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/build3729038704914021233.tmp/SerialEvent.cpp.elf /tmp/build3729038704914021233.tmp/SerialEvent.cpp.eep /usr/share/arduino/hardware/tools/avr/bin/avr-objcopy -O ihex -R .eeprom /tmp/build3729038704914021233.tmp/SerialEvent.cpp.elf /tmp/build3729038704914021233.tmp/SerialEvent.cpp.hex 바이너리 스케치 사이즈: 3,566 바이트 (최대 30,720 바이트) |
$ cat main.cpp.d
/tmp/build3729038704914021233.tmp/main.cpp.o: \ /usr/share/arduino/hardware/arduino/cores/arduino/main.cpp \ /usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h \ /usr/share/arduino/hardware/arduino/cores/arduino/binary.h \ /usr/share/arduino/hardware/arduino/cores/arduino/WCharacter.h \ /usr/share/arduino/hardware/arduino/cores/arduino/WString.h \ /usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.h \ /usr/share/arduino/hardware/arduino/cores/arduino/Stream.h \ /usr/share/arduino/hardware/arduino/cores/arduino/Print.h \ /usr/share/arduino/hardware/arduino/cores/arduino/Printable.h \ /usr/share/arduino/hardware/arduino/cores/arduino/new.h \ /usr/share/arduino/hardware/arduino/variants/eightanaloginputs/pins_arduino.h \ /usr/share/arduino/hardware/arduino/variants/eightanaloginputs/../standard/pins_arduino.h |
$ cat /usr/share/arduino/hardware/arduino/cores/arduino/main.cpp
#include <Arduino.h> int main(void) { init(); #if defined(USBCON) USBDevice.attach(); #endif setup(); for (;;) { loop(); if (serialEventRun) serialEventRun(); } return 0; } |
'embeded > arduino(genuino)' 카테고리의 다른 글
arduino i2c 예제 (0) | 2016.03.30 |
---|---|
아두이노 on ubuntu 15.10 (0) | 2016.03.28 |
아두이노 나노 - LED 블링크 예제 (0) | 2016.03.27 |
아두이노 나노 - 시리얼 테스트 (3) | 2016.03.27 |
아두이노 나노 v3.0 / v3.1 (0) | 2016.03.27 |