diff --git a/build-flags/build_flags_mega2560slim2 b/build-flags/build_flags_mega2560-optiboot similarity index 100% rename from build-flags/build_flags_mega2560slim2 rename to build-flags/build_flags_mega2560-optiboot diff --git a/compiled/mega2560slim2/config.json b/compiled/Mega2560-optiboot/mega2560-optiboot/config.json similarity index 100% rename from compiled/mega2560slim2/config.json rename to compiled/Mega2560-optiboot/mega2560-optiboot/config.json diff --git a/compiled/mega2560slim2/firmware.bin b/compiled/Mega2560-optiboot/mega2560-optiboot/firmware.bin similarity index 100% rename from compiled/mega2560slim2/firmware.bin rename to compiled/Mega2560-optiboot/mega2560-optiboot/firmware.bin diff --git a/compiled/mega2560slim2/firmware.hex b/compiled/Mega2560-optiboot/mega2560-optiboot/firmware.hex similarity index 100% rename from compiled/mega2560slim2/firmware.hex rename to compiled/Mega2560-optiboot/mega2560-optiboot/firmware.hex diff --git a/compiled/mega2560slim2/getCNF.sh b/compiled/Mega2560-optiboot/mega2560-optiboot/getCNF.sh similarity index 100% rename from compiled/mega2560slim2/getCNF.sh rename to compiled/Mega2560-optiboot/mega2560-optiboot/getCNF.sh diff --git a/compiled/mega2560slim2/uploadCNF.sh b/compiled/Mega2560-optiboot/mega2560-optiboot/uploadCNF.sh similarity index 93% rename from compiled/mega2560slim2/uploadCNF.sh rename to compiled/Mega2560-optiboot/mega2560-optiboot/uploadCNF.sh index 31f9c0e..e387dcb 100755 --- a/compiled/mega2560slim2/uploadCNF.sh +++ b/compiled/Mega2560-optiboot/mega2560-optiboot/uploadCNF.sh @@ -1 +1 @@ -../tools/mac/arduinoOTA -address elev.local -port 65280 -username arduino -password password -sketch config.json -b -upload /config +../tools/mac/arduinoOTA -address elev.local -port 65280 -username arduino -password password -sketch config.json -b -upload /config.json diff --git a/compiled/mega2560slim2/uploadOTA.bat b/compiled/Mega2560-optiboot/mega2560-optiboot/uploadOTA.bat similarity index 100% rename from compiled/mega2560slim2/uploadOTA.bat rename to compiled/Mega2560-optiboot/mega2560-optiboot/uploadOTA.bat diff --git a/compiled/mega2560slim2/uploadOTA.sh b/compiled/Mega2560-optiboot/mega2560-optiboot/uploadOTA.sh similarity index 100% rename from compiled/mega2560slim2/uploadOTA.sh rename to compiled/Mega2560-optiboot/mega2560-optiboot/uploadOTA.sh diff --git a/compiled/update_bin.sh b/compiled/update_bin.sh index 868334e..96288fe 100755 --- a/compiled/update_bin.sh +++ b/compiled/update_bin.sh @@ -3,8 +3,8 @@ cp ../.pio/build/controllino/firmware.hex controllino cp ../.pio/build/m5stack/firmware.bin m5stack cp ../.pio/build/mega2560slim-5100/firmware.hex mega2560slim-5100 cp ../.pio/build/mega2560slim-5100/firmware.bin mega2560slim-5100 -cp ../.pio/build/mega2560slim2/firmware.hex mega2560slim2 -cp ../.pio/build/mega2560slim2/firmware.bin mega2560slim2 +cp ../.pio/build/mega2560-optiboot/firmware.hex mega2560-optiboot +cp ../.pio/build/mega2560-optiboot/firmware.bin mega2560-optiboot cp ../.pio/build/mega2560-5100/firmware.hex mega2560-5100 cp ../.pio/build/nrf52840/firmware.hex nrf52840-5500 cp ../.pio/build/esp32-wifi/firmware.bin esp32-wifi diff --git a/extra_script.py b/extra_script.py new file mode 100644 index 0000000..6e7948e --- /dev/null +++ b/extra_script.py @@ -0,0 +1,12 @@ +Import("env") +script = env.GetProjectOption("_upload_command") + +#env.Replace( +# UPLOADER="executable or path to executable", +# UPLOADCMD=script +#) +env.AddCustomTarget( + "ota", + "$BUILD_DIR/${PROGNAME}.bin", + script +) \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 8f4ff09..62bb053 100644 --- a/platformio.ini +++ b/platformio.ini @@ -20,7 +20,7 @@ default_envs = ; Another Arduino Mega compact build without 1-wire, DMX, but with OTA ; OPTIBOOT bootloader required! https://github.com/MCUdude/MegaCore ; universal Wiznet network driver -; mega2560slim2 +; mega2560-optiboot ; Arduino Mega + Ethernet shield Wiznet 5100 ; mega2560-5100 @@ -123,7 +123,15 @@ monitor_speed = 115200 [env:m5stack] platform = espressif32 board = m5stack-core-esp32 -monitor_baud = 115200 +extra_scripts = extra_script.py + +;Comment next 2 lines to disable OTA and allow USB uploading, uncomment for OTA +;upload_protocol = custom +;upload_command = arduinoOTA -address 192.168.1.17 -port 80 -username arduino -password password -b -upload /sketch -sketch $SOURCE ;sleep 6 + +;Alternatively, use OTA script for target ota (pio -t ota). Place appropriate script to custom-build-flags/ to allow OTA by one click +_upload_command = custom-build-flags/upload_m5stack $SOURCE + framework = arduino upload_speed = 921600 build_flags = !python get_build_flags.py m5stack @@ -187,11 +195,15 @@ framework = arduino monitor_filters = esp32_exception_decoder build_type = debug board = esp32-evb -monitor_baud = 115200 -;upload_speed = 115200 -;upload_command = arduinoOTA -address 192.168.88.60 -port 80 -username arduino -password password -b -upload /sketch -sketch $SOURCE;sleep 5 -;upload_command = arduinoOTA -address 192.168.11.230 -port 80 -username arduino -password password -b -upload /sketch -sketch $SOURCE;sleep 5 +extra_scripts = extra_script.py + +;Comment next 2 lines to disable OTA and allow USB uploading, uncomment for OTA ;upload_protocol = custom +;upload_command = arduinoOTA -address 192.168.1.17 -port 80 -username arduino -password password -b -upload /sketch -sketch $SOURCE ;sleep 6 + +;Alternatively, use OTA script for target ota (pio -t ota). Place appropriate script to custom-build-flags/ to allow OTA by one click +_upload_command = custom-build-flags/upload_esp32-wifi $SOURCE + build_flags = !python get_build_flags.py esp32-wifi lib_ignore = @@ -255,13 +267,19 @@ monitor_speed = 115200 platform = atmelsam framework = arduino board = due -monitor_baud = 115200 +extra_scripts = extra_script.py build_flags = !python get_build_flags.py due ; Need to place arduinoOTA utility from Arduino IDE distribution to folder in your PATH ;fix address and password -;upload_flags = -upload_command = arduinoOTA -address 192.168.88.21 -port 80 -username arduino -password password -b -upload /sketch -sketch $SOURCE -upload_protocol = custom + + +;Comment next 2 lines to disable OTA and allow USB uploading, uncomment for OTA +;upload_protocol = custom +;upload_command = arduinoOTA -address 192.168.1.17 -port 80 -username arduino -password password -b -upload /sketch -sketch $SOURCE ;sleep 6 + +;Alternatively, use OTA script for target ota (pio -t ota). Place appropriate script to custom-build-flags/ to allow OTA by one click +_upload_command = custom-build-flags/upload_lighthub21 $SOURCE + lib_ignore = ;DS2482_OneWire //UNCOMMENT for software 1-wire driver DHT sensor library for ESPx @@ -373,10 +391,13 @@ lib_deps = monitor_speed = 115200 -[env:mega2560slim2] +[env:mega2560-optiboot] platform = atmelavr ;For OTA programming - generating bin image -extra_scripts = post:toBin.py +extra_scripts = + pre:extra_script.py + post:toBin.py + ;OptiBoot setting board = ATmega2560 ;was megaatmega2560 for conventional bootloader @@ -387,13 +408,17 @@ board_build.f_cpu = 16000000L ; Comment out to enable LTO (this line unflags it) ;build_unflags = -flto - not working without LTO! -;upload_protocol = arduino -upload_command = arduinoOTA -address 192.168.11.213 -port 80 -username arduino -password password -b -upload /sketch -sketch $BUILD_DIR/${PROGNAME}.bin;sleep 5 -upload_protocol = custom +;Comment next 2 lines to disable OTA and allow USB uploading, uncomment for OTA +;upload_protocol = custom +;upload_command = arduinoOTA -address 192.168.1.17 -port 80 -username arduino -password password -b -upload /sketch -sketch $SOURCE ;sleep 6 + +;Alternatively, use OTA script for target ota (pio -t ota). Place appropriate script to custom-build-flags/ to allow OTA by one click +_upload_command = custom-build-flags/upload_mega2560-optiboot $SOURCE + board_upload.speed = ${env:fuses_bootloader.board_bootloader.speed} framework = arduino -build_flags = !python get_build_flags.py mega2560slim2 +build_flags = !python get_build_flags.py mega2560-optiboot lib_ignore = ;DS2482_OneWire //UNCOMMENT for software 1-wire driver DHT sensor library for ESPx @@ -494,8 +519,8 @@ monitor_speed = 115200 platform = espressif8266 framework = arduino board = nodemcuv2 -monitor_baud = 115200 -upload_protocol = esptool +extra_scripts = extra_script.py +;upload_protocol = esptool build_type = debug monitor_filters = esp8266_exception_decoder @@ -505,7 +530,16 @@ monitor_filters = esp8266_exception_decoder ;upload_flags = ; --auth=password ; --port=65280 + +;Comment next 2 lines to disable OTA and allow USB uploading, uncomment for OTA +;upload_protocol = custom +;upload_command = arduinoOTA -address 192.168.1.17 -port 80 -username arduino -password password -b -upload /sketch -sketch $SOURCE ;sleep 6 + +;Alternatively, use OTA script for target ota (pio -t ota). Place appropriate script to custom-build-flags/ to allow OTA by one click +_upload_command = custom-build-flags/upload_esp8266-wifi $SOURCE + build_flags = !python get_build_flags.py esp8266-wifi + lib_ignore = ;COMMENT/UNCOMMENT next line for software 1-wire driver on/off DS2482_OneWire @@ -564,7 +598,7 @@ monitor_speed = 115200 [env:mega2560-5100] platform = atmelavr board = megaatmega2560 -monitor_baud = 115200 +extra_scripts = extra_script.py framework = arduino ;upload_port = net:192.168.88.2:23000 build_flags = !python get_build_flags.py mega2560-5100 @@ -618,11 +652,17 @@ monitor_speed = 115200 platform = atmelsam framework = arduino board = due -monitor_baud = 115200 +extra_scripts = extra_script.py build_flags = !python get_build_flags.py lighthub21 -upload_command = arduinoOTA -address 192.168.11.172 -port 80 -username arduino -password password -b -upload /sketch -sketch $SOURCE ;sleep 6 -upload_protocol = custom +;Comment next 2 lines to disable OTA and allow USB uploading, uncomment for OTA +;upload_protocol = custom +;upload_command = arduinoOTA -address 192.168.1.17 -port 80 -username arduino -password password -b -upload /sketch -sketch $SOURCE ;sleep 6 + +;Alternatively, use OTA script for target ota (pio -t ota). Place appropriate script to custom-build-flags/ to allow OTA by one click +_upload_command = custom-build-flags/upload_lighthub21 $SOURCE + + lib_ignore = ;DS2482_OneWire //UNCOMMENT for software 1-wire driver DHT sensor library for ESPx @@ -676,7 +716,7 @@ monitor_speed = 115200 [env:controllino] platform = atmelavr board = megaatmega2560 -monitor_baud = 115200 + framework = arduino build_flags = !python get_build_flags.py controllino lib_ignore = @@ -728,7 +768,7 @@ monitor_speed = 115200 platform = ststm32 framework = arduino board = nucleo_f103rb -monitor_baud = 115200 + upload_protocol = stlink debug_tool = stlink build_flags = !python get_build_flags.py stm32-enc2860 @@ -788,7 +828,7 @@ board = olimexino board_build.mcu = stm32f103rbt6 board_build.f_cpu = 72000000L framework = arduino -monitor_baud = 115200 + monitor_dtr = 1 upload_protocol = dfu ;debug_tool = cmsis-dap