aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-04-25 20:55:35 +0200
committerlonkaars <loek@pipeframe.xyz>2023-04-25 20:55:35 +0200
commita5ae433b7f12246adb709a57223a853bd2a948c1 (patch)
tree9d82a347d34a4b1b8c71a54886999f6beb016953
parent3a5c0f9bc2f9049114228e472826e31423dc5263 (diff)
WIP arduino + pololu libraries build system
-rw-r--r--.gitmodules24
m---------zumo/lib/ArduinoCore-avr0
m---------zumo/lib/fastgpio-arduino0
m---------zumo/lib/pololu-buzzer-arduino0
m---------zumo/lib/pololu-hd44780-arduino0
m---------zumo/lib/pololu-menu-arduino0
m---------zumo/lib/pololu-oled-arduino0
m---------zumo/lib/pushbutton-arduino0
m---------zumo/lib/usb-pause-arduino0
m---------zumo/lib/zumo-32u4-arduino-library0
-rw-r--r--zumo/main.c15
-rw-r--r--zumo/main.cpp13
-rw-r--r--zumo/makefile15
-rw-r--r--zumo/zumo.mk61
14 files changed, 110 insertions, 18 deletions
diff --git a/.gitmodules b/.gitmodules
index e29501f..a60d698 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,27 @@
[submodule "zumo/lib/zumo-32u4-arduino-library"]
path = zumo/lib/zumo-32u4-arduino-library
url = https://github.com/pololu/zumo-32u4-arduino-library
+[submodule "zumo/lib/fastgpio-arduino"]
+ path = zumo/lib/fastgpio-arduino
+ url = https://github.com/pololu/fastgpio-arduino
+[submodule "zumo/lib/pushbutton-arduino"]
+ path = zumo/lib/pushbutton-arduino
+ url = https://github.com/pololu/pushbutton-arduino
+[submodule "zumo/lib/ArduinoCore-avr"]
+ path = zumo/lib/ArduinoCore-avr
+ url = https://github.com/arduino/ArduinoCore-avr
+[submodule "zumo/lib/usb-pause-arduino"]
+ path = zumo/lib/usb-pause-arduino
+ url = https://github.com/pololu/usb-pause-arduino
+[submodule "zumo/lib/pololu-buzzer-arduino"]
+ path = zumo/lib/pololu-buzzer-arduino
+ url = https://github.com/pololu/pololu-buzzer-arduino
+[submodule "zumo/lib/pololu-hd44780-arduino"]
+ path = zumo/lib/pololu-hd44780-arduino
+ url = https://github.com/pololu/pololu-hd44780-arduino
+[submodule "zumo/lib/pololu-menu-arduino"]
+ path = zumo/lib/pololu-menu-arduino
+ url = https://github.com/pololu/pololu-menu-arduino
+[submodule "zumo/lib/pololu-oled-arduino"]
+ path = zumo/lib/pololu-oled-arduino
+ url = https://github.com/pololu/pololu-oled-arduino
diff --git a/zumo/lib/ArduinoCore-avr b/zumo/lib/ArduinoCore-avr
new file mode 160000
+Subproject 42fa4a1ea1b1b11d1cc0a60298e529d37f9d14b
diff --git a/zumo/lib/fastgpio-arduino b/zumo/lib/fastgpio-arduino
new file mode 160000
+Subproject 5853c593b07730e632127570279e7dea06de1af
diff --git a/zumo/lib/pololu-buzzer-arduino b/zumo/lib/pololu-buzzer-arduino
new file mode 160000
+Subproject 20ef7b734814a7c5e9f02f54a2cdd41729759d5
diff --git a/zumo/lib/pololu-hd44780-arduino b/zumo/lib/pololu-hd44780-arduino
new file mode 160000
+Subproject 0a35789a58ca92ca6f69b63fbc269959b2d1858
diff --git a/zumo/lib/pololu-menu-arduino b/zumo/lib/pololu-menu-arduino
new file mode 160000
+Subproject 8970b8db6e4e80b1c0e95172a87a35410bf593b
diff --git a/zumo/lib/pololu-oled-arduino b/zumo/lib/pololu-oled-arduino
new file mode 160000
+Subproject e6b83b6c181962ffb98f99a4a4c3fd7cbf7e670
diff --git a/zumo/lib/pushbutton-arduino b/zumo/lib/pushbutton-arduino
new file mode 160000
+Subproject 442884e004859ff550d5c0cae70033d7d568fc2
diff --git a/zumo/lib/usb-pause-arduino b/zumo/lib/usb-pause-arduino
new file mode 160000
+Subproject 3f76e486460bb351f9738c86595f22db2da34c5
diff --git a/zumo/lib/zumo-32u4-arduino-library b/zumo/lib/zumo-32u4-arduino-library
new file mode 160000
+Subproject f4dfe054e23176ba445748b4b91f463701e7eb7
diff --git a/zumo/main.c b/zumo/main.c
deleted file mode 100644
index ab66db4..0000000
--- a/zumo/main.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#define F_CPU 16000000
-
-#include <avr/io.h>
-#include <util/delay.h>
-
-int main() {
- DDRC |= (1 << DDC7);
- while(1) {
- PORTC |= (1 << PORTC7);
- _delay_ms(500);
- PORTC &= ~(1 << PORTC7);
- _delay_ms(500);
- }
-}
-
diff --git a/zumo/main.cpp b/zumo/main.cpp
new file mode 100644
index 0000000..23d13db
--- /dev/null
+++ b/zumo/main.cpp
@@ -0,0 +1,13 @@
+#include <Zumo32U4.h>
+#include <Arduino.h>
+#include <Wire.h>
+
+void setup() {
+}
+
+void loop() {
+ ledRed(1);
+ delay(1000);
+ ledRed(0);
+ delay(1000);
+}
diff --git a/zumo/makefile b/zumo/makefile
index aac11f4..1a7ad36 100644
--- a/zumo/makefile
+++ b/zumo/makefile
@@ -1,10 +1,13 @@
PORT = /dev/ttyUSB0
+C++ = avr-g++
CC = avr-gcc
LD = avr-ld
RM = rm -f
-MCU=atmega32u4
+MCU = atmega32u4
+TARGET = main
+SRCS += main.cpp
CFLAGS += -mcall-prologues
CFLAGS += -mmcu=$(MCU)
@@ -13,14 +16,20 @@ CFLAGS += -g
CFLAGS += -Wl,-gc-sections
CFLAGS += -Wl,-relax
-TARGET = main
-SRCS += main.c
+include zumo.mk
+
OBJS := $(patsubst %.c,%.o, $(SRCS))
+OBJS := $(patsubst %.cpp,%.o, $(OBJS))
+
+MAKEFLAGS += -j4
.PHONY: all clean flash
all: $(TARGET).hex
+%.o: %.cpp
+ $(C++) -c $(CFLAGS) $< -o $@
+
%.o: %.c
$(CC) -c $(CFLAGS) $< -o $@
diff --git a/zumo/zumo.mk b/zumo/zumo.mk
new file mode 100644
index 0000000..9605cb7
--- /dev/null
+++ b/zumo/zumo.mk
@@ -0,0 +1,61 @@
+CFLAGS += -DF_CPU=16000000
+CFLAGS += -I./lib/zumo-32u4-arduino-library/src
+CFLAGS += -I./lib/fastgpio-arduino
+CFLAGS += -I./lib/pushbutton-arduino
+CFLAGS += -I./lib/usb-pause-arduino
+CFLAGS += -I./lib/pololu-buzzer-arduino/src
+CFLAGS += -I./lib/pololu-hd44780-arduino
+CFLAGS += -I./lib/pololu-menu-arduino/src
+CFLAGS += -I./lib/pololu-oled-arduino/src
+CFLAGS += -I./lib/ArduinoCore-avr/cores/arduino
+CFLAGS += -I./lib/ArduinoCore-avr/libraries/HID/src
+CFLAGS += -I./lib/ArduinoCore-avr/libraries/SoftwareSerial/src
+CFLAGS += -I./lib/ArduinoCore-avr/libraries/SPI/src
+CFLAGS += -I./lib/ArduinoCore-avr/libraries/EEPROM/src
+CFLAGS += -I./lib/ArduinoCore-avr/libraries/Wire/src
+CFLAGS += -I./lib/ArduinoCore-avr/variants/circuitplay32u4
+
+LIBS += lib/ArduinoCore-avr/libraries/HID/src/HID.cpp \
+ lib/ArduinoCore-avr/libraries/SoftwareSerial/src/SoftwareSerial.cpp \
+ lib/ArduinoCore-avr/libraries/SPI/src/SPI.cpp \
+ lib/ArduinoCore-avr/libraries/Wire/src/Wire.cpp \
+ lib/ArduinoCore-avr/cores/arduino/HardwareSerial1.cpp \
+ lib/ArduinoCore-avr/cores/arduino/HardwareSerial0.cpp \
+ lib/ArduinoCore-avr/cores/arduino/WString.cpp \
+ lib/ArduinoCore-avr/cores/arduino/PluggableUSB.cpp \
+ lib/ArduinoCore-avr/cores/arduino/WMath.cpp \
+ lib/ArduinoCore-avr/cores/arduino/IPAddress.cpp \
+ lib/ArduinoCore-avr/cores/arduino/abi.cpp \
+ lib/ArduinoCore-avr/cores/arduino/HardwareSerial.cpp \
+ lib/ArduinoCore-avr/cores/arduino/CDC.cpp \
+ lib/ArduinoCore-avr/cores/arduino/new.cpp \
+ lib/ArduinoCore-avr/cores/arduino/Stream.cpp \
+ lib/ArduinoCore-avr/cores/arduino/HardwareSerial2.cpp \
+ lib/ArduinoCore-avr/cores/arduino/Print.cpp \
+ lib/ArduinoCore-avr/cores/arduino/main.cpp \
+ lib/ArduinoCore-avr/cores/arduino/HardwareSerial3.cpp \
+ lib/pololu-buzzer-arduino/src/PololuBuzzer.cpp \
+ lib/pushbutton-arduino/Pushbutton.cpp \
+ lib/zumo-32u4-arduino-library/src/QTRSensors.cpp \
+ lib/zumo-32u4-arduino-library/src/Zumo32U4IRPulses.cpp \
+ lib/zumo-32u4-arduino-library/src/Zumo32U4Encoders.cpp \
+ lib/zumo-32u4-arduino-library/src/Zumo32U4IMU.cpp \
+ lib/zumo-32u4-arduino-library/src/Zumo32U4Motors.cpp \
+ lib/zumo-32u4-arduino-library/src/Zumo32U4ProximitySensors.cpp \
+ lib/usb-pause-arduino/USBPause.cpp \
+ lib/pololu-hd44780-arduino/PololuHD44780.cpp \
+ lib/fastgpio-arduino/FastGPIO.cpp \
+ lib/pololu-oled-arduino/src/font.cpp
+# lib/ArduinoCore-avr/cores/arduino/Tone.cpp
+# lib/ArduinoCore-avr/libraries/Wire/src/utility/twi.c
+
+LIBS += lib/ArduinoCore-avr/cores/arduino/WInterrupts.c \
+ lib/ArduinoCore-avr/cores/arduino/hooks.c \
+ lib/ArduinoCore-avr/cores/arduino/wiring_shift.c \
+ lib/ArduinoCore-avr/cores/arduino/wiring_digital.c \
+ lib/ArduinoCore-avr/cores/arduino/wiring_analog.c \
+ lib/ArduinoCore-avr/cores/arduino/wiring_pulse.c \
+ lib/ArduinoCore-avr/cores/arduino/wiring.c
+
+SRCS += $(LIBS)
+