current working changes

This commit is contained in:
sessionm21
2020-04-07 15:23:50 -07:00
parent 23d27d7e2d
commit 2c146ff224
5 changed files with 244 additions and 52 deletions

View File

@@ -17,6 +17,7 @@ CFLAGS?=-Datmega328p\
-DARDUINO=200\
-DARDUINO_AVR_NANO\
-DARDUINO_ARCH_AVR\
-std=c++11\
-Os\
-ffunction-sections\
-fdata-sections\
@@ -59,9 +60,9 @@ SRC_FILES?=./$(ARDUINO_DIR)/cores/arduino/main.cpp\
./$(NANOPB_DIR)/pb_common.c\
./gateway/message.pb.c
build: $(OUT)$(NAME).hex
build: $(OUT)$(NAME)
$(OUT)$(NAME).hex: $(OUT)$(NAME).elf
$(OUT)$(NAME): $(OUT)$(NAME).elf
$(OBJCOPY) -R .eeprom -O ihex $(OUT)$(NAME).elf $(OUT)$(NAME).hex
$(OUT)eep.hex: $(OUT)$(NAME).elf
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $(OUT)$(NAME).elf $(OUT)eep.hex
@@ -70,13 +71,17 @@ $(OUT)$(NAME).elf: protobuf bin
protobuf:
mkdir -p protobuf/gateway
python external/nanopb/generator/nanopb_generator.py gateway/message.proto -D protobuf
python3 external/nanopb/generator/nanopb_generator.py gateway/message.proto -D protobuf
bin:
mkdir bin
flash:
avrdude -v -patmega328p -carduino -P/dev/ttyUSB0 -b115200 -D -Uflash:w:$(OUT)$(NAME).hex:i
stop:
avrdude -v -patmega328p -carduino -P/dev/ttyUSB0 -b115200 -D -Uflash:w:nothing.hex:i
clean:
rm -r protobuf
rm -r bin