diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 28e61cad..07382034 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -54,6 +54,7 @@ jobs: - ~/Arduino/libraries/Arduino_LPS22HB/examples - ~/Arduino/libraries/ArduinoDMX/examples - ~/Arduino/libraries/ArduinoRS485/examples + SKETCHES_REPORTS_PATH: sketches-reports strategy: fail-fast: false @@ -108,7 +109,7 @@ jobs: # CapacitiveSensor library does not support megaAVR core yet rm -r "$GITHUB_WORKSPACE/extras/examples/10.StarterKit_BasicKit/p13_TouchSensorLamp" - name: Compile examples - uses: arduino/actions/libraries/compile-examples@master + uses: arduino/compile-sketches@v1 with: github-token: ${{ secrets.GITHUB_TOKEN }} fqbn: ${{ matrix.board.fqbn }} @@ -144,10 +145,10 @@ jobs: ${{ env.UNIVERSAL_SKETCH_PATHS }} ${{ matrix.additional-sketch-paths }} enable-deltas-report: 'true' - verbose: 'true' + sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} - name: Save memory usage change report as artifact - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v2 with: - name: size-deltas-reports - path: size-deltas-reports + path: ${{ env.SKETCHES_REPORTS_PATH }} + name: ${{ env.SKETCHES_REPORTS_PATH }} diff --git a/.github/workflows/compile-muxto.yml b/.github/workflows/compile-muxto.yml new file mode 100644 index 00000000..881699af --- /dev/null +++ b/.github/workflows/compile-muxto.yml @@ -0,0 +1,105 @@ +name: Compile MuxTO + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + paths: + - ".github/workflows/compile-muxto.yml" + - "firmwares/MuxTO/**" + pull_request: + paths: + - ".github/workflows/compile-muxto.yml" + - "firmwares/MuxTO/**" + schedule: + # Run every Tuesday at 8 AM UTC to catch breakage caused by changes to external resources (libraries, platforms). + - cron: "0 8 * * TUE" + workflow_dispatch: + repository_dispatch: + +env: + BINARY_FILENAME: MuxTO.ino.bin + BINARY_ARTIFACT_NAME: MuxTO + +jobs: + build: + name: Build firmware + runs-on: ubuntu-latest + + strategy: + fail-fast: false + + matrix: + board: + - fqbn: arduino:samd:muxto:float=default,config=enabled,clock=internal_usb,timer=timer_732Hz,bootloader=4kb,serial=two_uart,usb=cdc + platforms: | + # Install MattairTech_Arduino:samd via Boards Manager for the toolchain + - name: MattairTech_Arduino:samd + source-url: https://www.mattairtech.com/software/arduino/package_MattairTech_index.json + # This needs to match with the version of MattairTech_Arduino:samd the Arduino fork is based on in order to get the right tool versions + version: 1.6.17 + # Install officila samd version for compiler support + - name: arduino:samd + # Install the platform with MuxTO support + - name: arduino:samd + source-url: https://github.com/arduino/ArduinoCore-samd.git + version: muxto + + steps: + - name: Set environment variables + run: | + # See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable + echo "BINARY_OUTPUT_PATH=${{ runner.temp }}/output" >> "$GITHUB_ENV" + echo "SKETCHES_REPORTS_PATH=${{ runner.temp }}/sketches-reports" >> "$GITHUB_ENV" + + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Compile firmware + uses: arduino/compile-sketches@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + fqbn: ${{ matrix.board.fqbn }} + platforms: ${{ matrix.board.platforms }} + libraries: | + - + sketch-paths: | + - firmwares/MuxTO + cli-compile-flags: | + - --output-dir=${{ env.BINARY_OUTPUT_PATH }} + enable-deltas-report: true + sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} + + - name: Save firmware binary as workflow artifact + uses: actions/upload-artifact@v2 + with: + if-no-files-found: error + path: ${{ env.BINARY_OUTPUT_PATH }}/${{ env.BINARY_FILENAME }} + name: ${{ env.BINARY_ARTIFACT_NAME }} + + - name: Save sketches report as workflow artifact + uses: actions/upload-artifact@v2 + with: + if-no-files-found: error + path: ${{ env.SKETCHES_REPORTS_PATH }} + name: sketches-reports + + size: + name: Check firmware size + needs: build + runs-on: ubuntu-latest + steps: + - name: Download binary artifact + uses: actions/download-artifact@v2 + with: + name: ${{ env.BINARY_ARTIFACT_NAME }} + + # The normal size check done by Arduino CLI is not working correctly, so it's necessary to check the size directly + - name: Check firmware binary size + run: | + BINARY_SIZE="$(stat --printf="%s" "${{ github.workspace }}/${{ env.BINARY_FILENAME }}")" + MAX_BINARY_SIZE=$((12 * 1024)) + echo "File size: ${BINARY_SIZE}/${MAX_BINARY_SIZE} B" + if [[ $BINARY_SIZE -gt $MAX_BINARY_SIZE ]]; then + echo "::error::Binary size of $BINARY_SIZE B exceeds the available memory ($MAX_BINARY_SIZE B)" + exit 1 + fi diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml index a359b257..1e37a511 100644 --- a/.github/workflows/report-size-deltas.yml +++ b/.github/workflows/report-size-deltas.yml @@ -10,4 +10,7 @@ jobs: steps: - name: Comment size deltas reports to PRs - uses: arduino/actions/libraries/report-size-deltas@master \ No newline at end of file + uses: arduino/report-size-deltas@v1 + with: + # The name of the workflow artifact created by the sketch compilation workflow + sketches-reports-source: sketches-reports diff --git a/README.md b/README.md index f5ace4fd..4090cd7e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Arduino Core for ATMEGA4809 CPU +[![Compile MuxTO status](https://github.com/arduino/ArduinoCore-megaavr/actions/workflows/compile-muxto.yml/badge.svg)](https://github.com/arduino/ArduinoCore-megaavr/actions/workflows/compile-muxto.yml) + This repository contains the source code and configuration files of the Arduino Core for Microchip's ATMEGA4809 processor (used on the Arduino Uno WiFi Rev2 boards). diff --git a/boards.txt b/boards.txt index 4652ff1a..504c40af 100644 --- a/boards.txt +++ b/boards.txt @@ -2,12 +2,17 @@ ############################################################## -uno2018.name=Arduino Uno WiFi Rev2 +uno2018.name=Arduino UNO WiFi Rev2 uno2018.vid.0=0x03eb uno2018.pid.0=0x2145 +uno2018.upload_port.0.vid=0x03eb +uno2018.upload_port.0.pid=0x2145 +uno2018.upload_port.1.board=uno2018 uno2018.upload.tool=avrdude +uno2018.upload.tool.default=avrdude +uno2018.upload.tool.network=arduino_ota uno2018.upload.protocol=xplainedmini_updi uno2018.upload.maximum_size=48640 uno2018.upload.maximum_data_size=6144 @@ -25,6 +30,7 @@ uno2018.build.extra_flags={build.328emulation} -DMILLIS_USE_TIMERB3 #uno2018.build.extra_flags=-B{runtime.tools.atpack.path}/gcc/dev/{build.mcu} uno2018.bootloader.tool=avrdude +uno2018.bootloader.tool.default=avrdude uno2018.bootloader.file=atmega4809_uart_bl.hex uno2018.bootloader.SYSCFG0=0xC9 uno2018.bootloader.BOOTEND=0x02 @@ -43,8 +49,13 @@ nona4809.name=Arduino Nano Every nona4809.vid.0=0x2341 nona4809.pid.0=0x0058 +nona4809.upload_port.0.vid=0x2341 +nona4809.upload_port.0.pid=0x0058 +nona4809.upload_port.1.board=nona4809 nona4809.upload.tool=avrdude +nona4809.upload.tool.default=avrdude +nona4809.upload.tool.network=arduino_ota nona4809.upload.protocol=jtag2updi nona4809.upload.maximum_size=49152 nona4809.upload.maximum_data_size=6144 @@ -62,6 +73,7 @@ nona4809.build.extra_flags={build.328emulation} -DMILLIS_USE_TIMERB3 -DNO_EXTERN #nona4809.build.extra_flags=-B{runtime.tools.atpack.path}/gcc/dev/{build.mcu} nona4809.bootloader.tool=avrdude +nona4809.bootloader.tool.default=avrdude nona4809.bootloader.file=atmega4809_uart_bl.hex nona4809.bootloader.SYSCFG0=0xC9 nona4809.bootloader.BOOTEND=0x00 diff --git a/cores/arduino/wiring_analog.c b/cores/arduino/wiring_analog.c index cda2b4da..36ddc680 100644 --- a/cores/arduino/wiring_analog.c +++ b/cores/arduino/wiring_analog.c @@ -145,6 +145,8 @@ void analogWrite(uint8_t pin, int val) uint16_t* timer_cmp_out; TCB_t *timer_B; + uint8_t savedSREG; + /* Find out Port and Pin to correctly handle port mux, and timer. */ switch (digital_pin_timer) { @@ -153,7 +155,10 @@ void analogWrite(uint8_t pin, int val) timer_cmp_out = ((uint16_t*) (&TCA0.SINGLE.CMP0BUF)) + bit_pos; /* Configure duty cycle for correct compare channel */ - (*timer_cmp_out) = (val); + savedSREG = SREG; + cli(); + (*timer_cmp_out) = (val); // non-atomic 16-bit write operation + SREG = savedSREG; /* Enable output on pin */ TCA0.SINGLE.CTRLB |= (1 << (TCA_SINGLE_CMP0EN_bp + bit_pos)); @@ -170,7 +175,12 @@ void analogWrite(uint8_t pin, int val) timer_B = ((TCB_t *)&TCB0 + (digital_pin_timer - TIMERB0)); /* set duty cycle */ - timer_B->CCMPH = val; + // (16-bit read/write operation are non-atomic and use a temporary register) + savedSREG = SREG; + cli(); + timer_B->CCMPL = timer_B->CCMPL; // copy CCMPL into temporary register + timer_B->CCMPH = val; // set CCMPH value + copy temporary register content into CCMPL + SREG = savedSREG; /* Enable Timer Output */ timer_B->CTRLB |= (TCB_CCMPEN_bm); diff --git a/extras/package_index.json.NewTag.template b/extras/package_index.json.NewTag.template index 1da2a8f8..fcc12676 100644 --- a/extras/package_index.json.NewTag.template +++ b/extras/package_index.json.NewTag.template @@ -23,7 +23,7 @@ }, "boards": [ { - "name": "Arduino Uno WiFi Rev2" + "name": "Arduino UNO WiFi Rev2" }, { "name": "Arduino Nano Every" @@ -51,4 +51,4 @@ "tools": [] } ] -} \ No newline at end of file +} diff --git a/libraries/HID/keywords.txt b/libraries/HID/keywords.txt deleted file mode 100644 index 32a9ba5f..00000000 --- a/libraries/HID/keywords.txt +++ /dev/null @@ -1,21 +0,0 @@ -####################################### -# Syntax Coloring Map HID -####################################### - -####################################### -# Datatypes (KEYWORD1) -####################################### - -HID KEYWORD1 - -####################################### -# Methods and Functions (KEYWORD2) -####################################### -begin KEYWORD2 -SendReport KEYWORD2 -AppendDescriptor KEYWORD2 - -####################################### -# Constants (LITERAL1) -####################################### -HID_TX LITERAL1 \ No newline at end of file diff --git a/libraries/HID/library.properties b/libraries/HID/library.properties deleted file mode 100644 index 499286d4..00000000 --- a/libraries/HID/library.properties +++ /dev/null @@ -1,9 +0,0 @@ -name=HID -version=1.0 -author=Arduino -maintainer=Arduino -sentence=Module for PluggableUSB infrastructure. Exposes an API for devices like Keyboards, Mice and Gamepads. -paragraph= -category=Communication -url=http://www.arduino.cc/en/Reference/HID -architectures=megaavr diff --git a/libraries/HID/src/HID.cpp b/libraries/HID/src/HID.cpp deleted file mode 100644 index 21ede269..00000000 --- a/libraries/HID/src/HID.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/* - Copyright (c) 2015, Arduino LLC - Original code (pre-library): Copyright (c) 2011, Peter Barrett - - Permission to use, copy, modify, and/or distribute this software for - any purpose with or without fee is hereby granted, provided that the - above copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL - WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR - BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES - OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - SOFTWARE. - */ - -#include "HID.h" - -#if defined(USBCON) - -HID_& HID() -{ - static HID_ obj; - return obj; -} - -int HID_::getInterface(uint8_t* interfaceCount) -{ - *interfaceCount += 1; // uses 1 - HIDDescriptor hidInterface = { - D_INTERFACE(pluggedInterface, 1, USB_DEVICE_CLASS_HUMAN_INTERFACE, HID_SUBCLASS_NONE, HID_PROTOCOL_NONE), - D_HIDREPORT(descriptorSize), - D_ENDPOINT(USB_ENDPOINT_IN(pluggedEndpoint), USB_ENDPOINT_TYPE_INTERRUPT, USB_EP_SIZE, 0x01) - }; - return USB_SendControl(0, &hidInterface, sizeof(hidInterface)); -} - -int HID_::getDescriptor(USBSetup& setup) -{ - // Check if this is a HID Class Descriptor request - if (setup.bmRequestType != REQUEST_DEVICETOHOST_STANDARD_INTERFACE) { return 0; } - if (setup.wValueH != HID_REPORT_DESCRIPTOR_TYPE) { return 0; } - - // In a HID Class Descriptor wIndex cointains the interface number - if (setup.wIndex != pluggedInterface) { return 0; } - - int total = 0; - HIDSubDescriptor* node; - for (node = rootNode; node; node = node->next) { - int res = USB_SendControl(TRANSFER_PGM, node->data, node->length); - if (res == -1) - return -1; - total += res; - } - - // Reset the protocol on reenumeration. Normally the host should not assume the state of the protocol - // due to the USB specs, but Windows and Linux just assumes its in report mode. - protocol = HID_REPORT_PROTOCOL; - - return total; -} - -uint8_t HID_::getShortName(char *name) -{ - name[0] = 'H'; - name[1] = 'I'; - name[2] = 'D'; - name[3] = 'A' + (descriptorSize & 0x0F); - name[4] = 'A' + ((descriptorSize >> 4) & 0x0F); - return 5; -} - -void HID_::AppendDescriptor(HIDSubDescriptor *node) -{ - if (!rootNode) { - rootNode = node; - } else { - HIDSubDescriptor *current = rootNode; - while (current->next) { - current = current->next; - } - current->next = node; - } - descriptorSize += node->length; -} - -int HID_::SendReport(uint8_t id, const void* data, int len) -{ - auto ret = USB_Send(pluggedEndpoint, &id, 1); - if (ret < 0) return ret; - auto ret2 = USB_Send(pluggedEndpoint | TRANSFER_RELEASE, data, len); - if (ret2 < 0) return ret2; - return ret + ret2; -} - -bool HID_::setup(USBSetup& setup) -{ - if (pluggedInterface != setup.wIndex) { - return false; - } - - uint8_t request = setup.bRequest; - uint8_t requestType = setup.bmRequestType; - - if (requestType == REQUEST_DEVICETOHOST_CLASS_INTERFACE) - { - if (request == HID_GET_REPORT) { - // TODO: HID_GetReport(); - return true; - } - if (request == HID_GET_PROTOCOL) { - // TODO: Send8(protocol); - return true; - } - if (request == HID_GET_IDLE) { - // TODO: Send8(idle); - } - } - - if (requestType == REQUEST_HOSTTODEVICE_CLASS_INTERFACE) - { - if (request == HID_SET_PROTOCOL) { - // The USB Host tells us if we are in boot or report mode. - // This only works with a real boot compatible device. - protocol = setup.wValueL; - return true; - } - if (request == HID_SET_IDLE) { - idle = setup.wValueL; - return true; - } - if (request == HID_SET_REPORT) - { - //uint8_t reportID = setup.wValueL; - //uint16_t length = setup.wLength; - //uint8_t data[length]; - // Make sure to not read more data than USB_EP_SIZE. - // You can read multiple times through a loop. - // The first byte (may!) contain the reportID on a multreport. - //USB_RecvControl(data, length); - } - } - - return false; -} - -HID_::HID_(void) : PluggableUSBModule(1, 1, epType), - rootNode(NULL), descriptorSize(0), - protocol(HID_REPORT_PROTOCOL), idle(1) -{ - epType[0] = EP_TYPE_INTERRUPT_IN; - PluggableUSB().plug(this); -} - -int HID_::begin(void) -{ - return 0; -} - -#endif /* if defined(USBCON) */ diff --git a/libraries/HID/src/HID.h b/libraries/HID/src/HID.h deleted file mode 100644 index ad2b06b1..00000000 --- a/libraries/HID/src/HID.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - Copyright (c) 2015, Arduino LLC - Original code (pre-library): Copyright (c) 2011, Peter Barrett - - Permission to use, copy, modify, and/or distribute this software for - any purpose with or without fee is hereby granted, provided that the - above copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL - WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR - BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES - OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - SOFTWARE. - */ - -#ifndef HID_h -#define HID_h - -#include -#include -#include "api/PluggableUSB.h" - -#if defined(USBCON) - -#define _USING_HID - -// HID 'Driver' -// ------------ -#define HID_GET_REPORT 0x01 -#define HID_GET_IDLE 0x02 -#define HID_GET_PROTOCOL 0x03 -#define HID_SET_REPORT 0x09 -#define HID_SET_IDLE 0x0A -#define HID_SET_PROTOCOL 0x0B - -#define HID_HID_DESCRIPTOR_TYPE 0x21 -#define HID_REPORT_DESCRIPTOR_TYPE 0x22 -#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23 - -// HID subclass HID1.11 Page 8 4.2 Subclass -#define HID_SUBCLASS_NONE 0 -#define HID_SUBCLASS_BOOT_INTERFACE 1 - -// HID Keyboard/Mouse bios compatible protocols HID1.11 Page 9 4.3 Protocols -#define HID_PROTOCOL_NONE 0 -#define HID_PROTOCOL_KEYBOARD 1 -#define HID_PROTOCOL_MOUSE 2 - -// Normal or bios protocol (Keyboard/Mouse) HID1.11 Page 54 7.2.5 Get_Protocol Request -// "protocol" variable is used for this purpose. -#define HID_BOOT_PROTOCOL 0 -#define HID_REPORT_PROTOCOL 1 - -// HID Request Type HID1.11 Page 51 7.2.1 Get_Report Request -#define HID_REPORT_TYPE_INPUT 1 -#define HID_REPORT_TYPE_OUTPUT 2 -#define HID_REPORT_TYPE_FEATURE 3 - -typedef struct -{ - uint8_t len; // 9 - uint8_t dtype; // 0x21 - uint8_t addr; - uint8_t versionL; // 0x101 - uint8_t versionH; // 0x101 - uint8_t country; - uint8_t desctype; // 0x22 report - uint8_t descLenL; - uint8_t descLenH; -} HIDDescDescriptor; - -typedef struct -{ - InterfaceDescriptor hid; - HIDDescDescriptor desc; - EndpointDescriptor in; -} HIDDescriptor; - -class HIDSubDescriptor { -public: - HIDSubDescriptor *next = NULL; - HIDSubDescriptor(const void *d, const uint16_t l) : data(d), length(l) { } - - const void* data; - const uint16_t length; -}; - -class HID_ : public PluggableUSBModule -{ -public: - HID_(void); - int begin(void); - int SendReport(uint8_t id, const void* data, int len); - void AppendDescriptor(HIDSubDescriptor* node); - -protected: - // Implementation of the PluggableUSBModule - int getInterface(uint8_t* interfaceCount); - int getDescriptor(USBSetup& setup); - bool setup(USBSetup& setup); - uint8_t getShortName(char* name); - -private: - unsigned int epType[1]; - - HIDSubDescriptor* rootNode; - uint16_t descriptorSize; - - uint8_t protocol; - uint8_t idle; -}; - -// Replacement for global singleton. -// This function prevents static-initialization-order-fiasco -// https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use -HID_& HID(); - -#define D_HIDREPORT(length) { 9, 0x21, 0x01, 0x01, 0, 1, 0x22, lowByte(length), highByte(length) } - -#else - -#error "No Native USB support available on this board" - -#endif // USBCON - -#endif // HID_h diff --git a/libraries/Wire/keywords.txt b/libraries/Wire/keywords.txt index 5e3d2b1c..04b8301a 100644 --- a/libraries/Wire/keywords.txt +++ b/libraries/Wire/keywords.txt @@ -6,6 +6,8 @@ # Datatypes (KEYWORD1) ####################################### +Wire KEYWORD2 + ####################################### # Methods and Functions (KEYWORD2) ####################################### @@ -18,12 +20,6 @@ requestFrom KEYWORD2 onReceive KEYWORD2 onRequest KEYWORD2 -####################################### -# Instances (KEYWORD2) -####################################### - -Wire KEYWORD2 - ####################################### # Constants (LITERAL1) ####################################### diff --git a/platform.txt b/platform.txt index e288636b..50992217 100644 --- a/platform.txt +++ b/platform.txt @@ -6,7 +6,7 @@ # https://arduino.github.io/arduino-cli/latest/platform-specification/ name=Arduino megaAVR Boards -version=1.8.7 +version=1.8.8 # AVR compile variables # --------------------- @@ -34,6 +34,7 @@ compiler.elf2hex.flags=-O ihex -R .eeprom compiler.elf2hex.bin.flags=-O binary -R .eeprom compiler.elf2hex.cmd=avr-objcopy compiler.ldflags= +compiler.libraries.ldflags= compiler.size.cmd=avr-size # This can be overridden in boards.txt @@ -66,7 +67,7 @@ archive_file_path={build.path}/{archive_file} recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" ## Combine gc-sections, archives, and objects -recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm "-Wl,-Map,{build.path}/{build.project_name}.map" +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} {compiler.libraries.ldflags} "{build.path}/{archive_file}" "-L{build.path}" -lm "-Wl,-Map,{build.path}/{build.project_name}.map" ## Create output files (.eep and .hex) recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep" @@ -90,6 +91,12 @@ recipe.preproc.includes="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} preproc.macros.flags=-w -x c++ -E -CC recipe.preproc.macros="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {preproc.macros.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} "-I{build.core.path}/api/deprecated" {includes} "{source_file}" -o "{preprocessed_file_path}" +# Required discoveries and monitors +# --------------------------------- +pluggable_discovery.required.0=builtin:serial-discovery +pluggable_discovery.required.1=builtin:mdns-discovery +pluggable_monitor.required.serial=builtin:serial-monitor + # AVR Uploader/Programmers tools # ------------------------------ @@ -97,8 +104,6 @@ tools.avrdude.path={runtime.tools.avrdude-6.3.0-arduino17.path} tools.avrdude.cmd.path={path}/bin/avrdude tools.avrdude.config.path={path}/etc/avrdude.conf -tools.avrdude.network_cmd={runtime.tools.arduinoOTA-1.3.0.path}/bin/arduinoOTA - tools.avrdude.upload.params.verbose=-v tools.avrdude.upload.params.quiet=-q -q # tools.avrdude.upload.verify is needed for backwards compatibility with IDE 1.6.8 or older, IDE 1.6.9 or newer overrides this value @@ -123,8 +128,17 @@ tools.avrdude.bootloader.pattern="{cmd.path}" "-C{config.path}" {bootloader.verb tools.avrdude_remote.upload.pattern=/usr/bin/run-avrdude /tmp/sketch.hex {upload.verbose} -p{build.mcu} +# The following rule is deprecated by pluggable discovery. +# We keep it to avoid breaking compatibility with the Arduino Java IDE. +tools.avrdude.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA tools.avrdude.upload.network_pattern="{network_cmd}" -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -d -v +# ArduinoOTA +tools.arduino_ota.cmd={runtime.tools.arduinoOTA-1.3.0.path}/bin/arduinoOTA +tools.arduino_ota.upload.field.password=Password +tools.arduino_ota.upload.field.password.secret=true +tools.arduino_ota.upload.pattern="{tools.arduino_ota.cmd}" -address {upload.port.address} -port 65280 -username arduino -password "{upload.field.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -d -v + # USB Default Flags # Default blank usb manufacturer will be filled in at compile time # - from numeric vendor ID, set to Unknown otherwise diff --git a/post_install.sh b/post_install.sh new file mode 100644 index 00000000..9a944e8a --- /dev/null +++ b/post_install.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +megaAVR_rules () { + echo "" + echo "# Arduino Mega AVR boards bootloader mode udev rules" + echo "" +cat < /etc/udev/rules.d/60-arduino-megaAVR.rules + +# reload udev rules +echo "Reload rules..." +udevadm control --reload-rules +udevadm trigger + diff --git a/programmers.txt b/programmers.txt index d9e83344..70af3a0a 100644 --- a/programmers.txt +++ b/programmers.txt @@ -3,4 +3,5 @@ medbg.communication=usb medbg.protocol=xplainedmini_updi medbg.program.protocol=xplainedmini_updi medbg.program.tool=avrdude -medbg.program.extra_params=-Pusb \ No newline at end of file +medbg.program.tool.default=avrdude +medbg.program.extra_params=-Pusb diff --git a/scripts/create_dfu_udev_rule b/scripts/create_dfu_udev_rule deleted file mode 100755 index 89d2a8a3..00000000 --- a/scripts/create_dfu_udev_rule +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# - -if [ "$(id -u)" != "0" ]; then - echo "This script must be run as root" - exit -fi - -NAME=99-arduino-uno-wifi-rev2.rules - -echo >/etc/udev/rules.d/$NAME -echo \# Arduino UNO WiFi Rev2 mEDBG CMSIS-DAP >>/etc/udev/rules.d/$NAME -echo SUBSYSTEM==\"tty\", ENV{ID_REVISION}==\"03eb\", ENV{ID_MODEL_ID}==\"2145\", MODE=\"0666\", ENV{ID_MM_DEVICE_IGNORE}=\"1\", ENV{ID_MM_CANDIDATE}=\"0\" >>/etc/udev/rules.d/$NAME -echo SUBSYSTEM==\"usb\", ATTR{idVendor}==\"03eb\", ATTR{idProduct}==\"2145\", MODE=\"0666\", ENV{ID_MM_DEVICE_IGNORE}=\"1\" >>/etc/udev/rules.d/$NAME - -udevadm control --reload-rules -udevadm trigger