Index

auto-plow / 190f583

A wheelchair motor-propelled battery-powered ESP32-driven remote control snow plow.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
1030 Nov 2018 20:012b15547Update MakefileJoshua11649N

Blob @ auto-plow / Makefile

text/plain1879 bytesdownload raw
1# Raspberry Pi settings
2CC = gcc --std=c11
3CCFLAGS = -Wall -Wextra -pedantic -O3 -g
4SOURCES = $(shell find src/rpi -name '*.c')
5OBJECTS = $(SOURCES:%.c=%.o)
6OUT = autoplow
7
8
9# Arduino Settings
10F_CPU = 16000000L
11MCU = atmega328p
12
13ARDUINO_CC = avr-gcc
14ARDUINO_CXX = avr-g++
15ARDUINO_AR = avr-ar
16ARDUINO_OBJCOPY = avr-objcopy
17
18ARDUINO_FLAGS = -c -g -Os -Wall -Wextra -pedantic -MMD -ffunction-sections -fdata-sections -mmcu=$(MCU) -DF_CPU=$(F_CPU) -DUSB_VID=null -DUSB_PID=null -DARDUINO=106
19ARDUINO_CC_FLAGS = $(ARDUINO_FLAGS)
20ARDUINO_CXX_FLAGS = $(ARDUINO_FLAGS) -fno-exceptions
21
22ARDUINO_INCLUDE = "include/arduino/"
23
24ARD1_SOURCES = $(shell find src/ard1 -name '*.cpp')
25ARD1_CORE_CXX = $(shell find include/arduino -name '*.cpp')
26ARD1_CORE_CC = $(shell find include/arduino -name '*.c')
27ARD1_OUT = bin/ard1.hex
28# ARD2_SOURCES = $(shell find src/ard2 -name '*.cpp')
29
30
31.PHONY: all ard1-build ard1-upload
32
33all: $(OUT) $(OBJECTS)
34
35$(OUT): $(OBJECTS)
36 $(CC) $(CCFLAGS) $(OBJECTS) -o $(OUT)
37
38ard1-build: $(ARD1_OUT) $(ARD1_SOURCES) $(ARD1_CORE_CXX) $(ARD1_CORE_CC)
39 $(ARDUINO_CXX) $(ARDUINO_CXX_FLAGS) -I$(ARDUINO_INCLUDE) $(ARD1_CORE_CC) -o $(ARD1_CORE_CC:%.c=%.o)
40 $(ARDUINO_CXX) $(ARDUINO_CXX_FLAGS) -I$(ARDUINO_INCLUDE) $(ARD1_CORE_CXX) -o $(ARD1_CORE_CXX:%.cpp=%.o)
41 $(ARDUINO_CXX) $(ARDUINO_CXX_FLAGS) -I$(ARDUINO_INCLUDE) $(ARD1_SOURCES) -o $(ARD1_SOURCES:%.cpp=%.o)
42 $(ARDUINO_AR) rcs core.a $(shell find include/arduino -name '*.o')
43 $(ARDUINO_AR) rcs core.a $(ARD1_SOURCES:%.cpp:%.o)
44 $(ARDUINO_CC) -Os -Wl,--gc-sections -mmcu=$(MCU) -o $(ARD1_SOURCES:%.cpp:%.elf) $(ARD1_SOURCES:%.cpp:%.o) core.a -lm
45 $(ARDUINO_OBJCOPY) -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $(ARD1_SOURCES:%.cpp:%.elf) $(ARD1_SOURCES:%.cpp:%.eep)
46 $(ARDUINO_OBJCOPY) -O ihex -R .eeprom $(ARD1_SOURCES:%.cpp:%.elf) $(ARD1_OUT)
47 rm core.a
48