diff --git a/README.md b/README.md index da56326f..031dea52 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ bootloader and SoftDevice zip package"). - LilyGO T-Echo - Minewsemi MX25LE01 - MuziWorks Base Uno / Base Duo / Superbase +- Meshtastic Generic, S140 6.1.1 (`meshtastic_6.1.1`) and 7.3.0 (`meshtastic_7.3.0`), for DIY boards with no board-specific bootloader: no LED or button - Nologo ProMicro NRF52840 (aka SuperMini NRF52840) - RAK 3401 - RAK 4631 ([See note](#notes-on-rak4631-bootloader)) @@ -110,6 +111,7 @@ When in OTA DFU mode, devices advertise using a board-specific name rather than | LILYGO T-Echo | `LGTE_DFU` | | Minewsemi MX25LE01 | `MX25_DFU` | | MuziWorks Base / Superbase | `MUZI_DFU` | +| Meshtastic Generic | `MESH_DFU` | | ProMicro NRF52840 | `PROM_DFU` | | RAK 4631 | `4631_DFU` | | RAK 3401 | `3401_DFU` | diff --git a/changelog.md b/changelog.md index 83fa7075..d552a267 100644 --- a/changelog.md +++ b/changelog.md @@ -8,6 +8,7 @@ provenance. - The project is renamed the Meshtastic nRF52 Bootloader (repo `meshtastic/nRF52_Bootloader`), and releases are tagged plain `x.y.z` from 2.6.0, continuing the OTAFIX numbering. Board-IDs, BLE names and asset file names are unchanged. - New board: Seeed Studio Wio Tracker L1 Pro 1W (OTA DFU advertising name `WTLP_DFU`). +- New boards: `meshtastic_6.1.1` and `meshtastic_7.3.0`, generic nRF52840 bootloaders for DIY boards with no board-specific one, for S140 6.1.1 and 7.3.0 (Board-IDs `nRF52840-Meshtastic-Generic-S140v6` and `-S140v7`, OTA DFU name `MESH_DFU`). They drive no LED, and their required button is the reset pin P0.18 so it claims no free GPIO. They share USB `0x239A:0x0029` with the RAK4631, RAK3401, T-Echo, WisMesh Tag and MX25LE01, so their update UF2 installs over those boards' bootloaders and the reverse. - A board with a valid application that sits in DFU for 6 minutes with no activity boots its application. A BLE connection or DFU write, a UF2 drive read or write, USB enumeration, and serial DFU traffic each restart the 6 minutes; a board with no valid application keeps waiting. - A SoftDevice flash timeout during a BLE or serial transfer, or the activation settings save, is retried every 100 ms, up to 20 times, instead of resetting the bootloader. - `INFO_UF2.TXT` shows a `Last-Fault: id=0x.. pc=0x.. info=0x..` line for a SoftDevice or SDK fault the bootloader recorded since the last UF2 drive session. It appears only if the next boot reaches the drive before an application boots, since the application's RAM use wipes the record. The record lives in a 16-byte RAM region behind a magic word and is cleared once printed; for an SDK error `info` is the error code. diff --git a/src/boards/meshtastic_6.1.1/board.h b/src/boards/meshtastic_6.1.1/board.h new file mode 100644 index 00000000..eceafd95 --- /dev/null +++ b/src/boards/meshtastic_6.1.1/board.h @@ -0,0 +1,67 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2018 Ha Thach for Adafruit Industries + * + * 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. + */ + +#ifndef _MESHTASTIC_H +#define _MESHTASTIC_H + +#define _PINNUM(port, pin) ((port)*32 + (pin)) + +/*------------------------------------------------------------------*/ +/* LED + *------------------------------------------------------------------*/ +#define LEDS_NUMBER 0 +//#define LED_PRIMARY_PIN _PINNUM(0, 24) // Green +//#define LED_STATE_ON 0 + +/*------------------------------------------------------------------*/ +/* BUTTON + *------------------------------------------------------------------*/ +#define BUTTONS_NUMBER 2 +#define BUTTON_1 _PINNUM(0, 18) // unusable: RESET +#define BUTTON_2 _PINNUM(0, 18) // unusable: RESET +#define BUTTON_PULL NRF_GPIO_PIN_PULLUP + +//--------------------------------------------------------------------+ +// BLE OTA +//--------------------------------------------------------------------+ +#define BLEDIS_MANUFACTURER "Meshtastic" +#define BLEDIS_MODEL "Meshtastic" + +//--------------------------------------------------------------------+ +// USB +//--------------------------------------------------------------------+ +#define USB_DESC_VID 0x239A +#define USB_DESC_UF2_PID 0x0029 +#define USB_DESC_CDC_ONLY_PID 0x002A + +//--------------------------------------------------------------------+ +// UF2 +//--------------------------------------------------------------------+ +#define UF2_PRODUCT_NAME "Meshtastic Generic" +#define UF2_VOLUME_LABEL "MESHBOOT" +#define UF2_BOARD_ID "nRF52840-Meshtastic-Generic-S140v6" +#define UF2_INDEX_URL "https://github.com/meshtastic/firmware.git" + + +#endif /* _MESHTASTIC_H */ diff --git a/src/boards/meshtastic_6.1.1/board.mk b/src/boards/meshtastic_6.1.1/board.mk new file mode 100644 index 00000000..0bdf19fd --- /dev/null +++ b/src/boards/meshtastic_6.1.1/board.mk @@ -0,0 +1,3 @@ +MCU_SUB_VARIANT = nrf52840 +CFLAGS += -DDEVICE_NAME='"MESH_DFU"' + diff --git a/src/boards/meshtastic_6.1.1/pinconfig.c b/src/boards/meshtastic_6.1.1/pinconfig.c new file mode 100644 index 00000000..a983e4ab --- /dev/null +++ b/src/boards/meshtastic_6.1.1/pinconfig.c @@ -0,0 +1,19 @@ +#include "boards.h" +#include "uf2/configkeys.h" + +__attribute__((used, section(".bootloaderConfig"))) +const uint32_t bootloaderConfig[] = +{ + /* CF2 START */ + CFG_MAGIC0, CFG_MAGIC1, // magic + 5, 100, // used entries, total entries + + 204, 0x100000, // FLASH_BYTES = 0x100000 + 205, 0x40000, // RAM_BYTES = 0x40000 + 208, (USB_DESC_VID << 16) | USB_DESC_UF2_PID, // BOOTLOADER_BOARD_ID = USB VID+PID, used for verification when updating bootloader via uf2 + 209, 0xada52840, // UF2_FAMILY = 0xada52840 + 210, 0x20, // PINS_PORT_SIZE = PA_32 + + 0, 0, 0, 0, 0, 0, 0, 0 + /* CF2 END */ +}; diff --git a/src/boards/meshtastic_7.3.0/board.h b/src/boards/meshtastic_7.3.0/board.h new file mode 100644 index 00000000..9d4e5025 --- /dev/null +++ b/src/boards/meshtastic_7.3.0/board.h @@ -0,0 +1,67 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2018 Ha Thach for Adafruit Industries + * + * 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. + */ + +#ifndef _MESHTASTIC_H +#define _MESHTASTIC_H + +#define _PINNUM(port, pin) ((port)*32 + (pin)) + +/*------------------------------------------------------------------*/ +/* LED + *------------------------------------------------------------------*/ +#define LEDS_NUMBER 0 +//#define LED_PRIMARY_PIN _PINNUM(0, 24) // Green +//#define LED_STATE_ON 0 + +/*------------------------------------------------------------------*/ +/* BUTTON + *------------------------------------------------------------------*/ +#define BUTTONS_NUMBER 2 +#define BUTTON_1 _PINNUM(0, 18) // unusable: RESET +#define BUTTON_2 _PINNUM(0, 18) // unusable: RESET +#define BUTTON_PULL NRF_GPIO_PIN_PULLUP + +//--------------------------------------------------------------------+ +// BLE OTA +//--------------------------------------------------------------------+ +#define BLEDIS_MANUFACTURER "Meshtastic" +#define BLEDIS_MODEL "Meshtastic" + +//--------------------------------------------------------------------+ +// USB +//--------------------------------------------------------------------+ +#define USB_DESC_VID 0x239A +#define USB_DESC_UF2_PID 0x0029 +#define USB_DESC_CDC_ONLY_PID 0x002A + +//--------------------------------------------------------------------+ +// UF2 +//--------------------------------------------------------------------+ +#define UF2_PRODUCT_NAME "Meshtastic Generic" +#define UF2_VOLUME_LABEL "MESHBOOT" +#define UF2_BOARD_ID "nRF52840-Meshtastic-Generic-S140v7" +#define UF2_INDEX_URL "https://github.com/meshtastic/firmware.git" + + +#endif /* _MESHTASTIC_H */ diff --git a/src/boards/meshtastic_7.3.0/board.mk b/src/boards/meshtastic_7.3.0/board.mk new file mode 100644 index 00000000..16bd37bd --- /dev/null +++ b/src/boards/meshtastic_7.3.0/board.mk @@ -0,0 +1,4 @@ +MCU_SUB_VARIANT = nrf52840 +CFLAGS += -DDEVICE_NAME='"MESH_DFU"' +SD_VERSION = 7.3.0 + diff --git a/src/boards/meshtastic_7.3.0/pinconfig.c b/src/boards/meshtastic_7.3.0/pinconfig.c new file mode 100644 index 00000000..a983e4ab --- /dev/null +++ b/src/boards/meshtastic_7.3.0/pinconfig.c @@ -0,0 +1,19 @@ +#include "boards.h" +#include "uf2/configkeys.h" + +__attribute__((used, section(".bootloaderConfig"))) +const uint32_t bootloaderConfig[] = +{ + /* CF2 START */ + CFG_MAGIC0, CFG_MAGIC1, // magic + 5, 100, // used entries, total entries + + 204, 0x100000, // FLASH_BYTES = 0x100000 + 205, 0x40000, // RAM_BYTES = 0x40000 + 208, (USB_DESC_VID << 16) | USB_DESC_UF2_PID, // BOOTLOADER_BOARD_ID = USB VID+PID, used for verification when updating bootloader via uf2 + 209, 0xada52840, // UF2_FAMILY = 0xada52840 + 210, 0x20, // PINS_PORT_SIZE = PA_32 + + 0, 0, 0, 0, 0, 0, 0, 0 + /* CF2 END */ +};