wiring-sucks

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit afdb2490a143273162b5e89879a0a8685a1f57f5
parent b511b96985bf350818af9c9d35c0fe0938c6fecf
Author: Elecon-rou <elecon@xecut.net>
Date:   Mon, 29 Jun 2020 00:27:21 +0000

switch back to make; add board config; add Core and SoftwareSerial makefiles

Diffstat:
AMakefile | 30++++++++++++++++++++++++++++++
Aboard.mk | 3+++
Aboard/mega2560.mk | 0
Aboard/pro1685v.mk | 0
Aboard/uno.mk | 3+++
Mconfig.mk | 18+++++-------------
Alib/Core/Makefile | 26++++++++++++++++++++++++++
Dlib/Core/mklib | 22----------------------
Alib/SoftwareSerial/Makefile | 22++++++++++++++++++++++
Dmkfile | 33---------------------------------
10 files changed, 89 insertions(+), 68 deletions(-)

diff --git a/Makefile b/Makefile @@ -0,0 +1,30 @@ +include config.mk +include board.mk + +.PHONY: all clean flash + +all: hex.bin + +%.o: %.S + $(CC) -x assembler-with-cpp -c $< + +%.o: %.cpp + $(CXX) -c $< + +%.o: %.c + $(CC) -c $< + +%.a: lib/% + $(MAKE) -C $< + +hex.o: main.o program.o $(LIBS) + $(CXX) $(CXXFLAGS) -o $@ $^ + +hex.bin: hex.o + $(OBJCOPY) $^ hex.bin + +flash: hex.bin + $(PROG) -U flash:w:$< + +clean: + rm *.a *.o hex.bin diff --git a/board.mk b/board.mk @@ -0,0 +1,3 @@ +CFLAGS=-Os -mmcu=atmega328p -DF_CPU=16000000L -Iinclude/Core +CXXFLAGS=$(CFLAGS) +PROGFLAGS=-p m328p -c arduino diff --git a/board/mega2560.mk b/board/mega2560.mk diff --git a/board/pro1685v.mk b/board/pro1685v.mk diff --git a/board/uno.mk b/board/uno.mk @@ -0,0 +1,3 @@ +CFLAGS=-Os -mmcu=atmega328p -DF_CPU=16000000L -Iinclude/Core +CXXFLAGS=$(CFLAGS) +PROGFLAGS=-p m328p -c arduino diff --git a/config.mk b/config.mk @@ -1,16 +1,9 @@ -MCU=atmega328p - SERIAL=/dev/ttyACM0 -LIBS=Core.a -#Core.a Bridge.a EEPROM.a Esplora.a Ethernet.a Firmata.a GSM.a HID.a Keyboard.a -#LiquidCrystal.a Mouse.a RobotIRremote.a Robot_Control.a Robot_Motor.a -#SD.a SPI.a Servo.a SofwareSerial.a SpacebrewYun.a Stepper.a TFT.a -#Temboo.a WiFi.a Wire.a - -CFLAGS=-Os -mmcu=$MCU -DF_CPU=16000000L +LIBS=Core.a SoftwareSerial.a -CC=avr-gcc $CFLAGS -CXX=avr-g++ $CFLAGS +CC=avr-gcc $(CFLAGS) +CXX=avr-g++ $(CXXFLAGS) AR=avr-ar rcs -OBJCOPY=avr-objcopy -j .text -j .data -O ihex- \ No newline at end of file +OBJCOPY=avr-objcopy -j .text -j .data -O ihex +PROG=avrdude $(PROGFLAGS) -P $SERIAL diff --git a/lib/Core/Makefile b/lib/Core/Makefile @@ -0,0 +1,26 @@ +include ../../config.mk +include ../../board.mk + +CFLAGS+=-I../../include/Core +CXXFLAGS=$(CFLAGS) + +OBJS=abi.o CDC.o HardwareSerial.o HardwareSerial0.o \ +HardwareSerial1.o HardwareSerial2.o HardwareSerial3.o hooks.o \ +IPAddress.o new.o PluggableUSB.o Print.o Stream.o Tone.o USBCore.o \ +WInterrupts.o wiring_analog.o wiring.o wiring_digital.o wiring_pulse.o \ +wiring_pulse_asm.o wiring_shift.o WMath.o WString.o + +%.o : %.S + $(CC) $(CFLAGS) -x assembler-with-cpp -c $< +%.o : %.cpp + $(CXX) $(CXXFLAGS) -c $< +%.o : %.c + $(CC) $(CFLAGS) -c $< + +Core.a: $(OBJS) + $(AR) ../../$@ $^ + +all: Core.a + +clean: + rm -f *.o diff --git a/lib/Core/mklib b/lib/Core/mklib @@ -1,22 +0,0 @@ -<../../config.mk - -INC=-I../../include/Core - -OBJS=abi.o CDC.o HardwareSerial.o HardwareSerial0.o \ -HardwareSerial1.o HardwareSerial2.o HardwareSerial3.o hooks.o \ -IPAddress.o new.o PluggableUSB.o Print.o Stream.o Tone.o USBCore.o \ -WInterrupts.o wiring_analog.o wiring.o wiring_digital.o wiring_pulse.o \ -wiring_pulse_asm.o wiring_shift.o WMath.o WString.o - -%.o : %.S - $CC $INC -x assembler-with-cpp -c $stem.S -%.o : %.cpp - $CXX $INC -c $stem.cpp -%.o : %.c - $CC $INC -c $stem.c - -Core.a : $OBJS - $AR ../../$target $prereq - -nuke:V: - rm -f *.o *.a diff --git a/lib/SoftwareSerial/Makefile b/lib/SoftwareSerial/Makefile @@ -0,0 +1,22 @@ +include ../../config.mk +include ../../board.mk + +CFLAGS+=-I../../include/Core -I../../include/SoftwareSerial +CXXFLAGS=$(CFLAGS) + +OBJS=SoftwareSerial.o + +%.o : %.S + $(CC) $(CFLAGS) -x assembler-with-cpp -c $< +%.o : %.cpp + $(CXX) $(CXXFLAGS) -c $< +%.o : %.c + $(CC) $(CFLAGS) -c $< + +SoftwareSerial.a: $(OBJS) + $(AR) ../../$@ $^ + +all: SoftwareSerial.a + +clean: + rm -f *.o diff --git a/mkfile b/mkfile @@ -1,32 +0,0 @@ -<config.mk - -INC=-Iinclude/Core - -all:V: applet.bin - -%.o : %.S - $CC $INC -x assembler-with-cpp -c $stem.S -%.o : %.cpp - $CXX $INC -c $stem.cpp -%.o : %.c - $CC $INC -c $stem.c -%.a : - cd lib/$stem - mk -f mklib - cd ../.. - -applet.o : main.o program.o $LIBS - $CXX $INC $prereq -o $target - -applet.bin : applet.o - $OBJCOPY $prereq $target - -flash:V: applet.bin - avrdude -p m328p -c arduino -P $SERIAL -U flash:w:$target - -clean:V: - rm -f *.o - -nuke:V: clean - rm -f applet.bin *.a lib/*/*.o - - \ No newline at end of file