diff --git a/.gitignore b/.gitignore index 3f2452e..83b0baf 100644 --- a/.gitignore +++ b/.gitignore @@ -35,5 +35,11 @@ # Setting files Debug.h /__vm +.vscode + +# Build artifacts _build bin +src.ino.cpp +src.ino.mega.hex +src.ino.with_bootloader.mega.hex diff --git a/Makefile b/Makefile index 2aa90f3..fe3ba21 100644 --- a/Makefile +++ b/Makefile @@ -6,9 +6,10 @@ FBARDUINO_FIRMWARE_SRC_DIR ?= src FBARDUINO_FIRMWARE_BUILD_DIR ?= $(BUILD_DIR)/sketch FBARDUINO_FIRMWARE_LIB_BUILD_DIR ?= $(BUILD_DIR)/libraries -ARDUINO_INSTALL_DIR ?= $(HOME)/arduino-1.8.5 +ARDUINO_INSTALL_DIR ?= $(HOME)/arduino-1.8.11 # Files to be tracked for make to know to rebuild. +COPY_INO := $(shell cp $(FBARDUINO_FIRMWARE_SRC_DIR)/src.ino $(FBARDUINO_FIRMWARE_SRC_DIR)/src.ino.cpp) CXX_SRC := $(wildcard $(FBARDUINO_FIRMWARE_SRC_DIR)/*.cpp) SRC := $(CXX_SRC) SRC_DEPS := $(SRC) $(wildcard $(FBARDUINO_FIRMWARE_SRC_DIR)/*.h) @@ -38,9 +39,10 @@ include lib/EEPROM.Makefile include lib/targets/ramps_v14.Makefile include lib/targets/farmduino_v10.Makefile include lib/targets/farmduino_k14.Makefile +include lib/targets/farmduino_k15.Makefile include lib/targets/express_k10.Makefile -.PHONY: all clean \ +.PHONY: all clean force_clean remove_ino_copy \ dep_core dep_core_clean \ dep_Servo dep_Servo_clean \ dep_SPI dep_SPI_clean \ @@ -48,28 +50,34 @@ include lib/targets/express_k10.Makefile target_ramps_v14 target_ramps_v14_clean \ target_farmduino_v10 target_farmduino_v10_clean \ target_farmduino_k14 target_farmduino_k14_clean \ + target_farmduino_k15 target_farmduino_k15_clean \ target_express_k10 target_express_k10_clean DEPS := $(DEP_CORE) $(DEP_SPI) $(DEP_Servo) $(DEP_EEPROM) DEPS_OBJ := $(DEP_SPI_OBJ) $(DEP_Servo_OBJ) $(DEP_EEPROM_OBJ) DEPS_CFLAGS := $(DEP_CORE_CFLAGS) $(DEP_SPI_CFLAGS) $(DEP_Servo_CFLAGS) $(DEP_EEPROM_CFLAGS) -all: $(BIN_DIR) $(DEPS) target_ramps_v14 target_farmduino_v10 target_farmduino_k14 target_express_k10 +all: $(BIN_DIR) $(DEPS) target_ramps_v14 target_farmduino_v10 target_farmduino_k14 target_farmduino_k15 target_express_k10 remove_ino_copy -clean: target_ramps_v14_clean target_farmduino_v10_clean target_farmduino_k14_clean target_express_k10_clean +clean: remove_ino_copy target_ramps_v14_clean target_farmduino_v10_clean target_farmduino_k14_clean target_farmduino_k15_clean target_express_k10_clean strings_test: all $(OBJ_COPY) -I ihex $(TARGET_ramps_v14_HEX) -O binary $(TARGET_ramps_v14_HEX).bin $(OBJ_COPY) -I ihex $(TARGET_farmduino_v10_HEX) -O binary $(TARGET_farmduino_v10_HEX).bin $(OBJ_COPY) -I ihex $(TARGET_farmduino_k14_HEX) -O binary $(TARGET_farmduino_k14_HEX).bin + $(OBJ_COPY) -I ihex $(TARGET_farmduino_k15_HEX) -O binary $(TARGET_farmduino_k15_HEX).bin $(OBJ_COPY) -I ihex $(TARGET_express_k10_HEX) -O binary $(TARGET_express_k10_HEX).bin - @strings $(TARGET_ramps_v14_HEX).bin | grep -q "6.4.0.R" - @strings $(TARGET_farmduino_v10_HEX).bin | grep -q "6.4.0.F" - @strings $(TARGET_farmduino_k14_HEX).bin | grep -q "6.4.0.G" - @strings $(TARGET_express_k10_HEX).bin | grep -q "6.4.0.E" + @strings $(TARGET_ramps_v14_HEX).bin | grep -q "6.5.0.R" + @strings $(TARGET_farmduino_v10_HEX).bin | grep -q "6.5.0.F" + @strings $(TARGET_farmduino_k14_HEX).bin | grep -q "6.5.0.G" + @strings $(TARGET_farmduino_k15_HEX).bin | grep -q "6.5.0.H" + @strings $(TARGET_express_k10_HEX).bin | grep -q "6.5.0.E" -force_clean: +force_clean: remove_ino_copy $(RM) -r $(BUILD_DIR) $(BIN_DIR) $(BIN_DIR): $(MKDIR_P) $(BIN_DIR) + +remove_ino_copy: + $(RM) $(FBARDUINO_FIRMWARE_SRC_DIR)/src.ino.cpp diff --git a/README.md b/README.md index 316bd18..7336774 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Options for compiling and uploading: * Select _Sketch_ > _Export compiled binary_. * The `.hex` file will save to the `src` directory. * Make (Linux) - * [Download the Arduino 1.8.5 IDE](https://www.arduino.cc/download_handler.php?f=/arduino-1.8.5-linux64.tar.xz) and unpack to the `/home` directory. + * [Download the Arduino 1.8.11 IDE](https://www.arduino.cc/download_handler.php?f=/arduino-1.8.11-linux64.tar.xz) and unpack to the `/home` directory. * `cd farmbot-arduino-firmware` * To compile: * `make` @@ -222,7 +222,7 @@ Value |Description 2 |Timeout 3 |Stall detected 14 |Invalid command -15 |No config +15 |No config Axis states (R05) ----------------- diff --git a/lib/targets/farmduino_k15.Makefile b/lib/targets/farmduino_k15.Makefile new file mode 100644 index 0000000..dd0df8f --- /dev/null +++ b/lib/targets/farmduino_k15.Makefile @@ -0,0 +1,25 @@ +TARGET_farmduino_k15_BUILD_DIR := $(BUILD_DIR)/farmduino_k15 +TARGET_farmduino_k15_HEX := $(BIN_DIR)/farmduino_k15.hex + +TARGET_farmduino_k15_OBJ := $(patsubst $(FBARDUINO_FIRMWARE_SRC_DIR)/%,$(TARGET_farmduino_k15_BUILD_DIR)/%,$(CXX_OBJ)) + +$(TARGET_farmduino_k15_HEX): $(TARGET_farmduino_k15_BUILD_DIR) $(TARGET_farmduino_k15_BUILD_DIR)/farmduino_k15.eep $(TARGET_farmduino_k15_BUILD_DIR)/farmduino_k15.elf + $(OBJ_COPY) -O ihex -R .eeprom $(TARGET_farmduino_k15_BUILD_DIR)/farmduino_k15.elf $@ + +$(TARGET_farmduino_k15_BUILD_DIR)/farmduino_k15.eep: $(TARGET_farmduino_k15_BUILD_DIR)/farmduino_k15.elf + $(OBJ_COPY) -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $< $@ + +$(TARGET_farmduino_k15_BUILD_DIR)/farmduino_k15.elf: $(TARGET_farmduino_k15_OBJ) + $(CC) -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections,--relax -mmcu=atmega2560 -o $@ $(TARGET_farmduino_k15_OBJ) $(DEPS_OBJ) $(DEP_CORE_LDFLAGS) + +$(TARGET_farmduino_k15_BUILD_DIR)/%.o: $(FBARDUINO_FIRMWARE_SRC_DIR)/%.cpp + $(CXX) $(CXX_FLAGS) -DFARMBOT_BOARD_ID=4 $(DEPS_CFLAGS) $< -o $@ + +$(TARGET_farmduino_k15_BUILD_DIR): + $(MKDIR_P) $(TARGET_farmduino_k15_BUILD_DIR) + +target_farmduino_k15: $(TARGET_farmduino_k15_HEX) + +target_farmduino_k15_clean: + $(RM) -r $(TARGET_farmduino_k15_BUILD_DIR) + $(RM) $(TARGET_farmduino_k15_HEX) diff --git a/src/Board.h b/src/Board.h index 4c1de87..c1dd951 100644 --- a/src/Board.h +++ b/src/Board.h @@ -3,6 +3,7 @@ //#define RAMPS_V14 //#define FARMDUINO_V10 //#define FARMDUINO_V14 + //#define FARMDUINO_V30 #define FARMDUINO_EXP_V20 #else @@ -10,6 +11,7 @@ #undef RAMPS_V14 #undef FARMDUINO_V10 #undef FARMDUINO_V14 + #undef FARMDUINO_V30 #undef FARMDUINO_EXP_V20 #if FARMBOT_BOARD_ID == 0 @@ -20,6 +22,9 @@ #define FARMDUINO_V14 #elif FARMBOT_BOARD_ID == 3 #define FARMDUINO_EXP_V20 + #elif FARMBOT_BOARD_ID == 4 + #define FARMDUINO_EXP_V20 + #define FARMDUINO_V30 #endif #endif diff --git a/src/Config.h b/src/Config.h index b872a40..4587107 100644 --- a/src/Config.h +++ b/src/Config.h @@ -252,6 +252,10 @@ enum MdlSpiEncoders #define SOFTWARE_VERSION "6.5.0.G\0" #endif +#if defined(FARMDUINO_V30) && !defined(SOFTWARE_VERSION) +#define SOFTWARE_VERSION "6.5.0.H\0" +#endif + #if defined(FARMDUINO_EXP_V20) && !defined(SOFTWARE_VERSION) #define SOFTWARE_VERSION "6.5.0.E\0" #endif