{"id":217,"date":"2013-08-11T10:16:40","date_gmt":"2013-08-11T09:16:40","guid":{"rendered":"http:\/\/zsteva.info\/?p=217"},"modified":"2013-08-11T10:16:40","modified_gmt":"2013-08-11T09:16:40","slug":"arduino-bez-arduino-idea","status":"publish","type":"post","link":"http:\/\/zsteva.info\/blog\/2013\/08\/arduino-bez-arduino-idea\/","title":{"rendered":"Arduino bez Arduino IDEa"},"content":{"rendered":"<p>Nije bas bez IDEa, ali kori\u0161\u0107enjem regularnog editora (u mom slu\u010daju <strong>vim<\/strong>a) i <strong>make<\/strong>-a, a IDE morate da instalirate zbog svih ostalih fajlova i dependinga.<\/p>\n<p>Makefile:<\/p>\n<pre>\r\nAVR_GPP = avr-g++\r\nAVR_GCC = avr-gcc\r\nAVR_OBJCOPY = avr-objcopy\r\nARDUINODIR = \/usr\/share\/arduino\r\nLIBRARY = $(ARDUINODIR)\/libraries\r\nCOREDIR = $(ARDUINODIR)\/hardware\/arduino\/cores\/arduino\r\n\r\nSERIALPORT=\/dev\/ttyUSB0\r\n\r\nARDUINODIR = \/usr\/share\/arduino\r\n\r\nCFLAGS = -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100\r\n\r\nLIBS =\r\n#LIBS += $(LIBRARY)\/EEPROM\/EEPROM.cpp\r\n#LIBS += $(LIBRARY)\/Ethernet\/Dhcp.cpp\r\n#LIBS += $(LIBRARY)\/Ethernet\/Dns.cpp\r\n#LIBS += $(LIBRARY)\/Ethernet\/EthernetClient.cpp\r\n#LIBS += $(LIBRARY)\/Ethernet\/Ethernet.cpp\r\n#LIBS += $(LIBRARY)\/Ethernet\/EthernetServer.cpp\r\n#LIBS += $(LIBRARY)\/Ethernet\/EthernetUdp.cpp\r\n#LIBS += $(LIBRARY)\/Firmata\/Firmata.cpp\r\nLIBS += $(LIBRARY)\/LiquidCrystal\/LiquidCrystal.cpp\r\n#LIBS += $(LIBRARY)\/SD\/File.cpp\r\n#LIBS += $(LIBRARY)\/SD\/SD.cpp\r\n#LIBS += $(LIBRARY)\/Servo\/Servo.cpp\r\n#LIBS += $(LIBRARY)\/SoftwareSerial\/SoftwareSerial.cpp\r\n#LIBS += $(LIBRARY)\/SPI\/SPI.cpp\r\n#LIBS += $(LIBRARY)\/Stepper\/Stepper.cpp\r\nLIBS += $(LIBRARY)\/Wire\/Wire.cpp\r\nLIBS += $(LIBRARY)\/Wire\/utility\/twi.c\r\nLIBS += Timer\/Timer.cpp\r\nLIBS += Timer\/Event.cpp\r\nLIBS += OneWire\/OneWire.cpp\r\n\r\n#LIBS += LiquidCrystal\/LiquidCrystal.cpp\r\n\r\nOUTFILE = lcd1\r\nSRCFILES = lcd1.cpp\r\n\r\nCFLAGS += -I$(COREDIR)\r\nCFLAGS += -I$(ARDUINODIR)\/hardware\/arduino\/variants\/standard\r\nCFLAGS += $(foreach l,$(LIBS), -I$(shell dirname $(l)))\r\n\r\nLDFLAGS = -lm\r\n\r\nCOREFILES = wiring_pulse.c wiring.c wiring_shift.c WInterrupts.c wiring_digital.c wiring_analog.c USBCore.cpp IPAddress.cpp Stream.cpp main.cpp HardwareSerial.cpp Print.cpp WMath.cpp Tone.cpp CDC.cpp new.cpp HID.cpp WString.cpp\r\n\r\nOBJS = \r\n\r\ndefine BUILD\r\n$(1): $(2)\r\nifeq ($(suffix $(2)),.c)\r\n\t$$(AVR_GCC) -c $$(CFLAGS) -o $$@ $$^\r\nelse\r\n\t$$(AVR_GPP) -c $$(CFLAGS) -o $$@ $$^\r\nendif\r\n\r\nOBJS += $(1)\r\nendef\r\n\r\n$(foreach l,$(LIBS),$(eval $(call BUILD,core\/$(shell basename $(l)).o,$(l))))\r\n\r\n$(foreach l,$(COREFILES),$(eval $(call BUILD,core\/$(shell basename $(l)).o,$(COREDIR)\/$(l))))\r\n\r\n$(foreach l,$(SRCFILES),$(eval $(call BUILD,$(l).o,$(l))))\r\n\r\n.PHONY: all\r\n.DEFAULT:\r\n\r\nall: $(OUTFILE).elf $(OUTFILE).eep $(OUTFILE).hex\r\n\r\n$(OUTFILE).elf: $(OBJS)\r\n\t$(AVR_GCC) -Os -Wl,--gc-sections -mmcu=atmega328p -o $@ $^ $(LDFLAGS)\r\n\r\n$(OUTFILE).eep: $(OUTFILE).elf\r\n\t$(AVR_OBJCOPY) -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $^ $@\r\n\r\n$(OUTFILE).hex: $(OUTFILE).elf\r\n\t$(AVR_OBJCOPY) -O ihex -R .eeprom $^ $@\r\n\r\n.PHONY: clean\r\n\r\nclean:\r\n\trm -f *.o  *.epp *.elf *.hex\r\n\r\ndistclean:\r\n\trm -f core\/*.o\r\n\r\nflash: $(OUTFILE).hex\r\n\t$(ARDUINODIR)\/hardware\/tools\/avrdude -C$(ARDUINODIR)\/hardware\/tools\/avrdude.conf -v -patmega328p -carduino -P$(SERIALPORT) -b57600 -D -Uflash:w:$(OUTFILE).hex:i\r\n<\/pre>\n<p>Treba promeniti OUTFILE i SRCFILES (na\u0161i sourcevi), kao i u linijama sa LIBS enablovati sistemske i lokalne biblioteke.<\/p>\n<p>I u source (osim \u0161to nije .pde ekstenzija) treba dodati <\/p>\n<pre>\r\n#include &lt;Arduino.h&gt;\r\n<\/pre>\n<p>Kompajliranje:<\/p>\n<pre>\r\nmake all\r\n<\/pre>\n<p>flashovanje<\/p>\n<pre>\r\nmake flash\r\n<\/pre>\n<p>Napomena: parametri u fajlu su za atmega328p 16Mhz baziranim arduinom.<\/p>\n<p>dl: <a href='http:\/\/zsteva.info\/blog\/wp-content\/uploads\/2013\/08\/Makefile.txt'>Makefile<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nije bas bez IDEa, ali kori\u0161\u0107enjem regularnog editora (u mom slu\u010daju vima) i make-a, a IDE morate da instalirate zbog svih ostalih fajlova i dependinga. Makefile: AVR_GPP = avr-g++ AVR_GCC = avr-gcc AVR_OBJCOPY = avr-objcopy ARDUINODIR = \/usr\/share\/arduino LIBRARY = &hellip; <a href=\"http:\/\/zsteva.info\/blog\/2013\/08\/arduino-bez-arduino-idea\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[50,6],"tags":[93,97,94,96,95],"_links":{"self":[{"href":"http:\/\/zsteva.info\/blog\/wp-json\/wp\/v2\/posts\/217"}],"collection":[{"href":"http:\/\/zsteva.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zsteva.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zsteva.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/zsteva.info\/blog\/wp-json\/wp\/v2\/comments?post=217"}],"version-history":[{"count":5,"href":"http:\/\/zsteva.info\/blog\/wp-json\/wp\/v2\/posts\/217\/revisions"}],"predecessor-version":[{"id":223,"href":"http:\/\/zsteva.info\/blog\/wp-json\/wp\/v2\/posts\/217\/revisions\/223"}],"wp:attachment":[{"href":"http:\/\/zsteva.info\/blog\/wp-json\/wp\/v2\/media?parent=217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zsteva.info\/blog\/wp-json\/wp\/v2\/categories?post=217"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zsteva.info\/blog\/wp-json\/wp\/v2\/tags?post=217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}