diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-04-25 19:48:52 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-04-25 19:48:52 +0200 |
commit | 3a5c0f9bc2f9049114228e472826e31423dc5263 (patch) | |
tree | fe659f30cb5da82497e46184b837abafdb72cad4 |
pololu blink build system working
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | license | 21 | ||||
-rw-r--r-- | zumo/.gitignore | 5 | ||||
-rw-r--r-- | zumo/main.c | 15 | ||||
-rw-r--r-- | zumo/makefile | 40 |
5 files changed, 84 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e29501f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "zumo/lib/zumo-32u4-arduino-library"] + path = zumo/lib/zumo-32u4-arduino-library + url = https://github.com/pololu/zumo-32u4-arduino-library @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 lonkaars + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/zumo/.gitignore b/zumo/.gitignore new file mode 100644 index 0000000..d3e1535 --- /dev/null +++ b/zumo/.gitignore @@ -0,0 +1,5 @@ +main +*.o +*.hex +compile_commands.json +.cache diff --git a/zumo/main.c b/zumo/main.c new file mode 100644 index 0000000..ab66db4 --- /dev/null +++ b/zumo/main.c @@ -0,0 +1,15 @@ +#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/makefile b/zumo/makefile new file mode 100644 index 0000000..aac11f4 --- /dev/null +++ b/zumo/makefile @@ -0,0 +1,40 @@ +PORT = /dev/ttyUSB0 + +CC = avr-gcc +LD = avr-ld +RM = rm -f + +MCU=atmega32u4 + +CFLAGS += -mcall-prologues +CFLAGS += -mmcu=$(MCU) +CFLAGS += -Os +CFLAGS += -g +CFLAGS += -Wl,-gc-sections +CFLAGS += -Wl,-relax + +TARGET = main +SRCS += main.c +OBJS := $(patsubst %.c,%.o, $(SRCS)) + +.PHONY: all clean flash + +all: $(TARGET).hex + +%.o: %.c + $(CC) -c $(CFLAGS) $< -o $@ + +$(TARGET): $(OBJS) + $(LD) $^ $(LFLAGS) -o $@ + +$(TARGET).hex: $(TARGET) + avr-objcopy -R .eeprom -O ihex $< $@ + +flash: $(TARGET).hex + avrdude -p $(MCU) -c avr109 -P $(PORT) -U flash:w:$(TARGET).hex + +clean: + $(RM) $(TARGET) $(TARGET).hex $(OBJS) + +compile_commands.json: makefile + compiledb make -Bn |