From e08be6b237e92df1016c18e837619fd5f4379a09 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Sat, 9 Jun 2018 21:48:53 +0800 Subject: [PATCH 01/22] Add macros like PINOP to set pin configuration and read pin state --- inc/uf2.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/inc/uf2.h b/inc/uf2.h index ed668047..06b98d17 100644 --- a/inc/uf2.h +++ b/inc/uf2.h @@ -243,6 +243,8 @@ void system_init(void); #define LED_TICK led_tick #define PINOP(pin, OP) (PORT->Group[(pin) / 32].OP.reg = (1 << ((pin) % 32))) +#define PINIP(pin) (((PORT->Group[(pin) / 32].IN.reg) >> ((pin) % 32)) & 0x1) +#define PINCFG(pin, cfg) (PORT->Group[(pin) / 32].PINCFG[(pin) % 32].reg = cfg) void led_tick(void); void led_signal(void); From f2816425c8210986b64b4bc4e1a9fbcce6d5c5f8 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Sat, 9 Jun 2018 21:49:39 +0800 Subject: [PATCH 02/22] Add a way to allow a GPIO to hold the bootloader from running the app. --- src/main.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main.c b/src/main.c index cdcfcbd6..880f1236 100644 --- a/src/main.c +++ b/src/main.c @@ -95,6 +95,26 @@ extern int8_t led_tick_step; static void check_start_application(void) { uint32_t app_start_address; +// Check if there is an IO which will hold us inside the bootloader. +#if defined(HOLD_PIN) && defined(HOLD_STATE) + PINOP(HOLD_PIN, DIRCLR); // Pin is an input + + #if defined(HOLD_PIN_PULLUP) + PINCFG(HOLD_PIN, 0x06); + PINOP(HOLD_PIN, OUTSET); // Pin is pulled up. + #elif defined(HOLD_PIN_PULLDOWN) + PINCFG(HOLD_PIN, 0x06); + PINOP(HOLD_PIN, OUTCLR); // Pin is pulled up. + #else + PINCFG(HOLD_PIN, 0x02); + #endif + + if (PINIP(HOLD_PIN) == HOLD_STATE) { + /* Stay in bootloader */ + return; + } +#endif + /* Load the Reset Handler address of the application */ app_start_address = *(uint32_t *)(APP_START_ADDRESS + 4); From e06e6c7b795609eed4a17e70ba163f9340aa62a1 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 11 Jun 2018 12:35:56 +0800 Subject: [PATCH 03/22] Change pinconfig to not use magic numbers. Same code size, more readable. --- src/main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 880f1236..4d0953b4 100644 --- a/src/main.c +++ b/src/main.c @@ -97,17 +97,21 @@ static void check_start_application(void) { // Check if there is an IO which will hold us inside the bootloader. #if defined(HOLD_PIN) && defined(HOLD_STATE) + PORT_PINCFG_Type pincfg = {0}; + pincfg.bit.PMUXEN = false; + pincfg.bit.INEN = true; + pincfg.bit.DRVSTR = true; + PINOP(HOLD_PIN, DIRCLR); // Pin is an input #if defined(HOLD_PIN_PULLUP) - PINCFG(HOLD_PIN, 0x06); + pincfg.bit.PULLEN = true; PINOP(HOLD_PIN, OUTSET); // Pin is pulled up. #elif defined(HOLD_PIN_PULLDOWN) - PINCFG(HOLD_PIN, 0x06); + pincfg.bit.PULLEN = true; PINOP(HOLD_PIN, OUTCLR); // Pin is pulled up. - #else - PINCFG(HOLD_PIN, 0x02); #endif + PINCFG(HOLD_PIN) = pincfg.reg; if (PINIP(HOLD_PIN) == HOLD_STATE) { /* Stay in bootloader */ From d6071d997355a5d18cf5214e3bae25b1742256ab Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 11 Jun 2018 12:39:28 +0800 Subject: [PATCH 04/22] Make PINCFG macro more flexible (can read or write) Add macro for updating PINMUX. --- inc/uf2.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/uf2.h b/inc/uf2.h index 06b98d17..91c5c40b 100644 --- a/inc/uf2.h +++ b/inc/uf2.h @@ -244,7 +244,8 @@ void system_init(void); #define PINOP(pin, OP) (PORT->Group[(pin) / 32].OP.reg = (1 << ((pin) % 32))) #define PINIP(pin) (((PORT->Group[(pin) / 32].IN.reg) >> ((pin) % 32)) & 0x1) -#define PINCFG(pin, cfg) (PORT->Group[(pin) / 32].PINCFG[(pin) % 32].reg = cfg) +#define PINCFG(pin) (PORT->Group[(pin) / 32].PINCFG[(pin) % 32].reg) +#define PINMUX(pin) (PORT->Group[(pin) / 32].PMUX[((pin) % 32)/2].reg) void led_tick(void); void led_signal(void); From a714932ca51dbed8b543b2d23068a7417a1061ee Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Tue, 19 Jun 2018 11:23:10 +0800 Subject: [PATCH 05/22] Document the hold GPIO functionality --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 30a05a49..e59b0283 100644 --- a/README.md +++ b/README.md @@ -188,6 +188,30 @@ Thus, it's best to set the USB ID to one for which there are no drivers. The bootloader sits at 0x00000000, and the application starts at 0x00002000. +#### Bootloader Hold Switch + +A Board can be configured to sense the state of a GPIO and to hold the bootloader from running an application if it is in the appropriate state. To enable this, add the following to your board configuration header file. + +```C +// The Pin that will tell us to stay in the bootloader or not. +#define HOLD_PIN PIN_PA02 + +// Optional, define if a Pull up or pulldown is needed. +#define HOLD_PIN_PULLUP +//#define HOLD_PIN_PULLDOWN + +// What is the Hold state of the GPIO, 0 or 1. +#define HOLD_STATE 1 +``` + +Set `HOLD_PIN` to the appropriate GPIO and `HOLD_STATE` to the logic level which will hold the bootloader from running the application. + +The definition of _BOTH_ `HOLD_PIN` and `HOLD_STATE` triggers the inclusion of this feature. If either of these is undefined, this feature is not enabled. + +If an internal pullup/pulldown is required for the IO, it can be enabled with the _OPTIONAL_ `HOLD_PIN_PULLUP` or `HOLD_PIN_PULLDOWN` macros. If neither are defined, then no pullup/pulldown will be enabled for the io pin. + +This switch is NOT dynamic. Once the bootloader has sensed this pin and decided not to run the application, then a change in this IO will not, itself, then cause the Application to run, without also resetting the board. + ## Code of Conduct This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. From 771f43751626f8f22dcb95068afa532251a4fe2d Mon Sep 17 00:00:00 2001 From: Michal Moskal Date: Tue, 27 Aug 2019 10:35:30 -0700 Subject: [PATCH 06/22] Add config for ILI9341 screen --- boards/arcade_itsybitsy_m4/ili9341.cf2 | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 boards/arcade_itsybitsy_m4/ili9341.cf2 diff --git a/boards/arcade_itsybitsy_m4/ili9341.cf2 b/boards/arcade_itsybitsy_m4/ili9341.cf2 new file mode 100644 index 00000000..13c82a58 --- /dev/null +++ b/boards/arcade_itsybitsy_m4/ili9341.cf2 @@ -0,0 +1,6 @@ +DISPLAY_CFG0 = 0xc8 +DISPLAY_CFG1 = 0x0018ff +DISPLAY_CFG2 = 50 +DISPLAY_WIDTH = 320 +DISPLAY_HEIGHT = 240 +DISPLAY_TYPE = 9341 From 7b6f05e202968c056dae66af1a0c1e90de1d50d0 Mon Sep 17 00:00:00 2001 From: Michal Moskal Date: Tue, 27 Aug 2019 10:45:49 -0700 Subject: [PATCH 07/22] Allow for 320x240 screens --- src/screen.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/screen.c b/src/screen.c index 13806d2e..3e644bd4 100644 --- a/src/screen.c +++ b/src/screen.c @@ -206,8 +206,10 @@ static void sendCmdSeq(const uint8_t *buf) { static uint32_t palXOR; static void setAddrWindow(int x, int y, int w, int h) { - uint8_t cmd0[] = {ST7735_RASET, 0, (uint8_t)x, 0, (uint8_t)(x + w - 1)}; - uint8_t cmd1[] = {ST7735_CASET, 0, (uint8_t)y, 0, (uint8_t)(y + h - 1)}; + w += x - 1; + h += y - 1; + uint8_t cmd0[] = {ST7735_RASET, 0, (uint8_t)x, (uint8_t)(w >> 8), (uint8_t)w}; + uint8_t cmd1[] = {ST7735_CASET, 0, (uint8_t)y, (uint8_t)(h >> 8), (uint8_t)h}; sendCmd(cmd1, sizeof(cmd1)); sendCmd(cmd0, sizeof(cmd0)); } @@ -457,9 +459,12 @@ void screen_init() { uint32_t offY = (cfg0 >> 16) & 0xff; //uint32_t freq = (cfg2 & 0xff); + offX += (CFG(DISPLAY_WIDTH) - DISPLAY_WIDTH) / 2; + offY += (CFG(DISPLAY_HEIGHT) - DISPLAY_HEIGHT) / 2; + // DMESG("configure screen: FRMCTR1=%p MADCTL=%p SPI at %dMHz", frmctr1, madctl, freq); configure(madctl, frmctr1); - setAddrWindow(offX, offY, CFG(DISPLAY_WIDTH), CFG(DISPLAY_HEIGHT)); + setAddrWindow(offX, offY, DISPLAY_WIDTH, DISPLAY_HEIGHT); memset(fb, 0, sizeof(fb)); } From 903c406fe35932d9b854fa14a66488ff9d63f4b3 Mon Sep 17 00:00:00 2001 From: wallarug Date: Fri, 4 Oct 2019 22:44:38 +1000 Subject: [PATCH 08/22] added updated robohatmm1 by robotics masters bootloader files. NOTE: Using RPi Serial line as the UART port for bootloader --- boards/{robohatmm1 => robohatmm1_m0}/board.mk | 0 .../board_config.h | 6 ++-- boards/robohatmm1_m4/board.mk | 2 ++ boards/robohatmm1_m4/board_config.h | 28 +++++++++++++++++++ 4 files changed, 33 insertions(+), 3 deletions(-) rename boards/{robohatmm1 => robohatmm1_m0}/board.mk (100%) rename boards/{robohatmm1 => robohatmm1_m0}/board_config.h (70%) create mode 100644 boards/robohatmm1_m4/board.mk create mode 100644 boards/robohatmm1_m4/board_config.h diff --git a/boards/robohatmm1/board.mk b/boards/robohatmm1_m0/board.mk similarity index 100% rename from boards/robohatmm1/board.mk rename to boards/robohatmm1_m0/board.mk diff --git a/boards/robohatmm1/board_config.h b/boards/robohatmm1_m0/board_config.h similarity index 70% rename from boards/robohatmm1/board_config.h rename to boards/robohatmm1_m0/board_config.h index 95b47c09..8919b6a9 100644 --- a/boards/robohatmm1/board_config.h +++ b/boards/robohatmm1_m0/board_config.h @@ -5,13 +5,13 @@ #define VENDOR_NAME "Robotics Masters" #define PRODUCT_NAME "Robo HAT MM1" -#define VOLUME_LABEL "ROBOBOOT" +#define VOLUME_LABEL "ROBOM0BOOT" #define INDEX_URL "https://roboticsmasters.co" -#define BOARD_ID "SAMD21G18A-v4" +#define BOARD_ID "SAMD21G18A-RoboHATMM1-v24" #define USB_VID 0x1209 #define USB_PID 0x4D44 -#define LED_PIN PIN_PA21 +#define LED_PIN PIN_PB22 #endif diff --git a/boards/robohatmm1_m4/board.mk b/boards/robohatmm1_m4/board.mk new file mode 100644 index 00000000..0d8d74a9 --- /dev/null +++ b/boards/robohatmm1_m4/board.mk @@ -0,0 +1,2 @@ +CHIP_FAMILY = samd51 +CHIP_VARIANT = SAMD51G19A diff --git a/boards/robohatmm1_m4/board_config.h b/boards/robohatmm1_m4/board_config.h new file mode 100644 index 00000000..97fc292d --- /dev/null +++ b/boards/robohatmm1_m4/board_config.h @@ -0,0 +1,28 @@ +#ifndef BOARD_CONFIG_H +#define BOARD_CONFIG_H + +#define CRYSTALLESS 1 + +#define VENDOR_NAME "Robotics Masters" +#define PRODUCT_NAME "Robo HAT MM1 M4" +#define VOLUME_LABEL "ROBOM4BOOT" +#define INDEX_URL "https://roboticsmasters.co" +#define BOARD_ID "SAMD51G19A-RoboHATMM1-v24" + +#define USB_VID 0x1209 +#define USB_PID 0x4D44 + +#define LED_PIN PIN_PB22 + +#define BOOT_USART_MODULE SERCOM1 +#define BOOT_USART_MASK APBAMASK +#define BOOT_USART_BUS_CLOCK_INDEX MCLK_APBAMASK_SERCOM1 +#define BOOT_USART_PAD_SETTINGS UART_RX_PAD1_TX_PAD0 +#define BOOT_USART_PAD3 PINMUX_UNUSED +#define BOOT_USART_PAD2 PINMUX_UNUSED +#define BOOT_USART_PAD1 PINMUX_PA17C_SERCOM1_PAD1 +#define BOOT_USART_PAD0 PINMUX_PA16C_SERCOM1_PAD0 +#define BOOT_GCLK_ID_CORE SERCOM1_GCLK_ID_CORE +#define BOOT_GCLK_ID_SLOW SERCOM1_GCLK_ID_SLOW + +#endif From 84c32dc901aaa71ba3286b763c1620555247a1bb Mon Sep 17 00:00:00 2001 From: Joel Ray Holveck Date: Sun, 27 Oct 2019 22:57:59 -0700 Subject: [PATCH 09/22] Make the FAT media descriptor match everywhere. In a FAT12 or FAT16 filesystem, the first entry's first byte must match the media descriptor given in the BPB (BIOS Parameter Block, part of the boot sector). This gives a kind of check of the disk geometry: on an unpartitioned disk (like a floppy or ZIP disk), the BPB can be read with the wrong geometry, but to properly locate the FAT, the geometry must be correct. Many OSs don't check that these match, but a few do, such as FreeBSD (both in the kernel msdos filesystem driver, and in fsck_msdosfs). If they don't match, the mount will fail with an unhelpful error message. Previously, the media descriptor was 0xf8 in the BPB, but 0xf0 in the FAT. This patch changes them to 0xf0 everywhere. There were different values used for different disk geometries before disk addressing was reformed in the 90s, but since then only 0xf0 and 0xf8 are in common use. Typically, 0xf0 is used for a filesystem within an unpartitioned medium (such as a floppy disk), and 0xf8 is used for a filesystem within a partition (such as a hard disk). Since the UF2 bootloader emulates an unpartitioned removable medium, 0xf0 seemed appropriate. See also the description of the media descriptor, offset 0x15, at https://en.wikipedia.org/w/index.php?title=Design_of_the_FAT_file_system&oldid=920681387#BIOS_Parameter_Block particularly the last few paragraphs which note that it must match the FAT ID. --- src/fat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fat.c b/src/fat.c index 70da28fb..eb47666c 100644 --- a/src/fat.c +++ b/src/fat.c @@ -115,11 +115,11 @@ static const FAT_BootBlock BootBlock = { .FATCopies = 2, .RootDirectoryEntries = (ROOT_DIR_SECTORS * DIRENTRIES_PER_SECTOR), .TotalSectors16 = NUM_FAT_BLOCKS - 2, - .MediaDescriptor = 0xF8, + .MediaDescriptor = 0xf0, // typical for unpartitioned disks .SectorsPerFAT = SECTORS_PER_FAT, .SectorsPerTrack = 1, .Heads = 1, - .PhysicalDriveNum = 0x80, // to match MediaDescriptor of 0xF8 + .PhysicalDriveNum = 0x00, // to match MediaDescriptor of 0xf0 .ExtendedBootSig = 0x29, .VolumeSerialNumber = 0x00420042, .VolumeLabel = VOLUME_LABEL, @@ -152,7 +152,7 @@ void read_block(uint32_t block_no, uint8_t *data) { sectionIdx -= SECTORS_PER_FAT; // second FAT is same as the first... #if USE_FAT if (sectionIdx == 0) { - data[0] = 0xf0; + data[0] = 0xf0; // must match MediaDescriptor // WARNING -- code presumes only one NULL .content for .UF2 file // and all non-NULL .content fit in one sector // and requires it be the last element of the array From b68f3a1edc36f5a645add26b2fda6e75b87e1156 Mon Sep 17 00:00:00 2001 From: Joel Ray Holveck Date: Sun, 27 Oct 2019 23:14:33 -0700 Subject: [PATCH 10/22] Fix endianness issues on USB mass storage CBW and CSW signatures. USB mass storage works by wrapping other storage protocols in USB packets. There are several defined, but universally the most common one is SCSI. While SCSI is big-endian, USB is little-endian. The wrappers used in the USB mass storage protocol have some "signature" (magic number) fields that are part of the USB protocol, and hence little-endian. Most OSs apparently don't check these signatures, but some (such as FreeBSD) do. The previous code encodes these signatures as big-endian. This patch fixes them to be little-endian. (Technical background follows for the curious. This is oriented to SCSI under USB Bulk-Only mass storage protocol, which is by far the predominant protocol used by USB mass storage devices, including the UF2 bootloader here.) A CBW (Command Block Wrapper) is a SCSI command (or other protocol, but typically SCSI) embedded in a USB mass storage packet. A CSW (Command Status Wrapper) is a SCSI status (reply) embedded in a USB mass storage packet. The CBW/CSW mechanism embeds any SCSI protocol transaction. The first command is typically an INQUIRY command (which retrieves metadata about the drive), but for simplicity, we'll talk about a READ command. A typical "read" transaction is as folllows: 1. The host sends the device a SCSI read command (SCSI CDB block), encapsulated in a USB mass storage CBW packet (which is further encapsulated in USB bulk data packets, addressed to the device's read endpoint). 2. If the device is able to fulfill the request, it sends the host the requested data, with no encapsulation at the USB mass storage level. (These packets are still encapsulated at the protocol layer, addressed from the device's write endpoint). 3. If the device is unable to fulfill the request, it sends a USB STALL packet (which is at the protocol level, lower than the mass storage level). 4. Regardless of whether the device was able to fulfill the request or not, it sends a SCSI status packet, encapsulated in a USB mass storage CSW packet (which is further encapsulated in USB bulk data packets, addressed from the device's write endpoint). If everything works well, the host now can unambiguously tell whether the command succeeded or failed, based on the presence / absence of the STALL packet, and interprets the next packet as a SCSI status packet (embedded in a CSW wrapper). If everything isn't working well, the host and device can get out of sync in these state transitions. To ensure that everything is working properly, every SCSI command or status is wrapped in a packet specific to the USB mass storage protocol: a CBW for a command, or CSW for a status (reply). The CBW starts with the magic number 0x43425355 (little-endian, "USBC"), followed by a tag used to identify this command. The CSW starts with the magic number 0x53425355 (little-endian, "USBS"), followed by the tag of the command being responded to. (The endianness of the tag is irrelevant, since it's only a four-byte sequence that needs to be the same in the CSW as in the initiating CBW.) Since the CBW's and CSW's magic numbers are typically irrelevant, they can usually be ignored. Most OSs' implementations of the USB mass storage protocol ignore them. However, they serve as a good check to ensure that the host and device are in sync; hence, some OSs (such as FreeBSD) do validate them. Since the CBW and CSW are defined as part of the USB spec, their signatures are little-endian, even though the values in the wrapped packets are big-endian. As described above, these signatures are ignored by many OSs, but are validated by FreeBSD. I'm surprised that try_read_cbw ever worked if USE_MSC_CHECKS was enabled. I patched the code within USE_MSC_CHECKS, but haven't actually tested it: I only tested the default build. --- src/msc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/msc.c b/src/msc.c index fe1cb9cf..02d04148 100644 --- a/src/msc.c +++ b/src/msc.c @@ -84,7 +84,7 @@ void msc_reset(void) { //! Structure to receive a CBW packet static struct usb_msc_cbw udi_msc_cbw; //! Structure to send a CSW packet -static struct usb_msc_csw udi_msc_csw = {.dCSWSignature = CPU_TO_BE32(USB_CSW_SIGNATURE)}; +static struct usb_msc_csw udi_msc_csw = {.dCSWSignature = cpu_to_le32(USB_CSW_SIGNATURE)}; //! Structure with current SCSI sense data static struct scsi_request_sense_data udi_msc_sense; @@ -281,7 +281,7 @@ bool try_read_cbw(struct usb_msc_cbw *cbw, uint8_t ep, PacketBuffer *handoverCac #if USE_MSC_CHECKS // Check CBW integrity: // transfer status/CBW length/CBW signature - if ((sizeof(*cbw) != nb_received) || (cbw->dCBWSignature != CPU_TO_BE32(USB_CBW_SIGNATURE))) { + if ((sizeof(*cbw) != nb_received) || (cbw->dCBWSignature != cpu_to_le32(USB_CBW_SIGNATURE))) { if (handoverCache) resetIntoBootloader(); // (5.2.1) Devices receiving a CBW with an invalid signature should @@ -783,7 +783,7 @@ static void handover_flash(UF2_HandoverArgs *handover, PacketBuffer *handoverCac static void process_handover_initial(UF2_HandoverArgs *handover, PacketBuffer *handoverCache, WriteState *state) { struct usb_msc_csw csw = {.dCSWTag = handover->cbw_tag, - .dCSWSignature = CPU_TO_BE32(USB_CSW_SIGNATURE), + .dCSWSignature = cpu_to_le32(USB_CSW_SIGNATURE), .bCSWStatus = USB_CSW_STATUS_PASS, .dCSWDataResidue = 0}; // write out the block passed from user space @@ -807,7 +807,7 @@ static void process_handover(UF2_HandoverArgs *handover, PacketBuffer *handoverC } struct usb_msc_csw csw = {.dCSWTag = cbw.dCBWTag, - .dCSWSignature = CPU_TO_BE32(USB_CSW_SIGNATURE), + .dCSWSignature = cpu_to_le32(USB_CSW_SIGNATURE), .bCSWStatus = USB_CSW_STATUS_PASS, .dCSWDataResidue = le32_to_cpu(cbw.dCBWDataTransferLength)}; From c08c68a16af35ffc2fa22f2a0b68f16134ff751d Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Thu, 26 Dec 2019 20:50:08 +0100 Subject: [PATCH 11/22] Add configuration for PewPew M4 board Information about the board: https://hackaday.io/project/165032 --- boards/pewpew_m4/board.mk | 2 + boards/pewpew_m4/board_config.h | 74 +++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 boards/pewpew_m4/board.mk create mode 100644 boards/pewpew_m4/board_config.h diff --git a/boards/pewpew_m4/board.mk b/boards/pewpew_m4/board.mk new file mode 100644 index 00000000..c17f5fba --- /dev/null +++ b/boards/pewpew_m4/board.mk @@ -0,0 +1,2 @@ +CHIP_FAMILY = samd51 +CHIP_VARIANT = SAMD51J19A diff --git a/boards/pewpew_m4/board_config.h b/boards/pewpew_m4/board_config.h new file mode 100644 index 00000000..c83fff26 --- /dev/null +++ b/boards/pewpew_m4/board_config.h @@ -0,0 +1,74 @@ +#ifndef BOARD_CONFIG_H +#define BOARD_CONFIG_H + +#define VENDOR_NAME "Radomir Dopieralski" +#define PRODUCT_NAME "PewPew" +#define VOLUME_LABEL "PEWBOOT" +#define INDEX_URL "http://pewpew.rtfd.io" +#define BOARD_ID "SAMD51J19A-PewPew-M4" + +#define USB_VID 0x239A +#define USB_PID 0x0034 + +#define BOARD_NEOPIXEL_COUNT 0 + +#define BOARD_SCREEN 1 + +#define BOOT_USART_MODULE SERCOM3 +#define BOOT_USART_MASK APBAMASK +#define BOOT_USART_BUS_CLOCK_INDEX MCLK_APBBMASK_SERCOM3 +#define BOOT_USART_PAD_SETTINGS UART_RX_PAD1_TX_PAD0 +#define BOOT_USART_PAD3 PINMUX_UNUSED +#define BOOT_USART_PAD2 PINMUX_UNUSED +#define BOOT_USART_PAD1 PINMUX_PA22C_SERCOM3_PAD0 +#define BOOT_USART_PAD0 PINMUX_PA23C_SERCOM3_PAD1 +#define BOOT_GCLK_ID_CORE SERCOM3_GCLK_ID_CORE +#define BOOT_GCLK_ID_SLOW SERCOM3_GCLK_ID_SLOW + +#define HAS_CONFIG_DATA 1 + +// This configuration data should be edited at https://microsoft.github.io/uf2/patcher/ +// Just drop this file there. +// Alternatively, it can be also binary edited there after the bootloader is compiled. + +#ifdef DEFINE_CONFIG_DATA +const uint32_t config_data[] = { + /* CF2 START */ + 513675505, 539130489, // magic + 23, 100, // used entries, total entries + 4, 0xa, // PIN_BTN_A = PA10 + 5, 0x9, // PIN_BTN_B = PA09 + 26, 0x2, // PIN_SPEAKER_AMP = PA02 + 32, 0xd, // PIN_DISPLAY_SCK = PA13 + 34, 0xf, // PIN_DISPLAY_MOSI = PA15 + 35, 0xb, // PIN_DISPLAY_CS = PA11 + 36, 0x10, // PIN_DISPLAY_DC = PA16 + 37, 0xa0, // DISPLAY_WIDTH = 160 + 38, 0x80, // DISPLAY_HEIGHT = 128 + 39, 0x80, // DISPLAY_CFG0 = 0x80 + 40, 0x12c2d, // DISPLAY_CFG1 = 0x12c2d + 41, 0x18, // DISPLAY_CFG2 = 0x18 + 43, 0x11, // PIN_DISPLAY_RST = PA17 + 47, 0x37, // PIN_BTN_LEFT = PB23 + 48, 0x36, // PIN_BTN_RIGHT = PB22 + 49, 0x17, // PIN_BTN_UP = PA23 + 50, 0x1b, // PIN_BTN_DOWN = PA27 + 51, 0x16, // PIN_BTN_MENU = PA22 + 204, 0x80000, // FLASH_BYTES = 0x80000 + 205, 0x30000, // RAM_BYTES = 0x30000 + 208, 0x470c08e2, // BOOTLOADER_BOARD_ID = 0x470c08e2 + 209, 0x55114460, // UF2_FAMILY = ATSAMD51 + 210, 0x20, // PINS_PORT_SIZE = PA_32 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* CF2 END */ +}; +#endif + +#endif + + + From bf38448b2e087d201eb6ec154943d4f16b78358e Mon Sep 17 00:00:00 2001 From: Michael van Niekerk Date: Sun, 29 Dec 2019 15:05:49 +0200 Subject: [PATCH 12/22] Update SVD --- lib/same54/svd/ATSAME54P20A.svd | 250 +++++++++++++++++++++++++++++++- 1 file changed, 248 insertions(+), 2 deletions(-) diff --git a/lib/same54/svd/ATSAME54P20A.svd b/lib/same54/svd/ATSAME54P20A.svd index 353460e1..05ced12a 100644 --- a/lib/same54/svd/ATSAME54P20A.svd +++ b/lib/same54/svd/ATSAME54P20A.svd @@ -23319,12 +23319,159 @@ Peripheral Multiplexing for Even-Numbered Pin 0 4 + + PMUXESelect + + A + Peripheral function A selected + 0x0 + + + B + Peripheral function B selected + 0x1 + + + C + Peripheral function C selected + 0x2 + + + D + Peripheral function D selected + 0x3 + + + E + Peripheral function E selected + 0x4 + + + F + Peripheral function F selected + 0x5 + + + G + Peripheral function G selected + 0x6 + + + H + Peripheral function H selected + 0x7 + + + I + Peripheral function I selected + 0x8 + + + J + Peripheral function J selected + 0x9 + + + K + Peripheral function K selected + 0xA + + + L + Peripheral function L selected + 0xB + + + M + Peripheral function M selected + 0xC + + + N + Peripheral function N selected + 0xD + + PMUXO Peripheral Multiplexing for Odd-Numbered Pin 4 4 + + PMUXOSelect + + A + Peripheral function A selected + 0x0 + + + B + Peripheral function B selected + 0x1 + + + C + Peripheral function C selected + 0x2 + + + D + Peripheral function D selected + 0x3 + + + E + Peripheral function E selected + 0x4 + + + F + Peripheral function F selected + 0x5 + + + G + Peripheral function G selected + 0x6 + + + H + Peripheral function H selected + 0x7 + + + I + Peripheral function I selected + 0x8 + + + J + Peripheral function J selected + 0x9 + + + K + Peripheral function K selected + 0xA + + + L + Peripheral function L selected + 0xB + + + M + Peripheral function M selected + 0xC + + + N + Peripheral function N selected + 0xD + + + @@ -28457,7 +28604,7 @@ Host Control 1 0x028 8 - 0xE00 + 0x00 LEDCTRL @@ -28581,7 +28728,7 @@ HC1R 0x028 8 - 0xE00 + 0x00 DW @@ -33068,6 +33215,39 @@ Operating Mode 2 3 + + MODESelect + + USART_EXT_CLK + USART mode with external clock + 0x0 + + + USART_INT_CLK + USART mode with internal clock + 0x1 + + + SPI_SLAVE + SPI mode with external clock + 0x2 + + + SPI_MASTER + SPI mode with internal clock + 0x3 + + + I2C_SLAVE + I2C mode with external clock + 0x4 + + + I2C_MASTER + I2C mode with internal clock + 0x5 + + RUNSTDBY @@ -33883,6 +34063,39 @@ Operating Mode 2 3 + + MODESelect + + USART_EXT_CLK + USART mode with external clock + 0x0 + + + USART_INT_CLK + USART mode with internal clock + 0x1 + + + SPI_SLAVE + SPI mode with external clock + 0x2 + + + SPI_MASTER + SPI mode with internal clock + 0x3 + + + I2C_SLAVE + I2C mode with external clock + 0x4 + + + I2C_MASTER + I2C mode with internal clock + 0x5 + + RUNSTDBY @@ -34283,6 +34496,39 @@ Operating Mode 2 3 + + MODESelect + + USART_EXT_CLK + USART mode with external clock + 0x0 + + + USART_INT_CLK + USART mode with internal clock + 0x1 + + + SPI_SLAVE + SPI mode with external clock + 0x2 + + + SPI_MASTER + SPI mode with internal clock + 0x3 + + + I2C_SLAVE + I2C mode with external clock + 0x4 + + + I2C_MASTER + I2C mode with internal clock + 0x5 + + RUNSTDBY From 15fa44f1bb49c30b6090c411af64ea40b8695f15 Mon Sep 17 00:00:00 2001 From: Michael van Niekerk Date: Tue, 31 Dec 2019 09:49:04 +0200 Subject: [PATCH 13/22] Bitwidth fix --- .gitignore | 4 ++++ lib/same54/svd/ATSAME54P20A.svd | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index e0e9abe9..0f022cad 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,7 @@ node_modules scripts/clean-ifaces/*.plist .vscode/c_cpp_properties.json TAGS + +**/.DS_STORE +**/*.iml +**/.idea diff --git a/lib/same54/svd/ATSAME54P20A.svd b/lib/same54/svd/ATSAME54P20A.svd index 05ced12a..f76e985e 100644 --- a/lib/same54/svd/ATSAME54P20A.svd +++ b/lib/same54/svd/ATSAME54P20A.svd @@ -12723,7 +12723,7 @@ GENCTRL0 Generic Clock Generator Control 0 Synchronization Busy bits 2 - 1 + 12 read-only GENCTRL0Select @@ -12793,7 +12793,7 @@ GENCTRL1 Generic Clock Generator Control 1 Synchronization Busy bits 3 - 1 + 12 read-only GENCTRL1Select @@ -12863,7 +12863,7 @@ GENCTRL2 Generic Clock Generator Control 2 Synchronization Busy bits 4 - 1 + 12 read-only GENCTRL2Select @@ -12933,7 +12933,7 @@ GENCTRL3 Generic Clock Generator Control 3 Synchronization Busy bits 5 - 1 + 12 read-only GENCTRL3Select @@ -13003,7 +13003,7 @@ GENCTRL4 Generic Clock Generator Control 4 Synchronization Busy bits 6 - 1 + 12 read-only GENCTRL4Select @@ -13073,7 +13073,7 @@ GENCTRL5 Generic Clock Generator Control 5 Synchronization Busy bits 7 - 1 + 12 read-only GENCTRL5Select @@ -13143,7 +13143,7 @@ GENCTRL6 Generic Clock Generator Control 6 Synchronization Busy bits 8 - 1 + 12 read-only GENCTRL6Select @@ -13213,7 +13213,7 @@ GENCTRL7 Generic Clock Generator Control 7 Synchronization Busy bits 9 - 1 + 12 read-only GENCTRL7Select @@ -13283,7 +13283,7 @@ GENCTRL8 Generic Clock Generator Control 8 Synchronization Busy bits 10 - 1 + 12 read-only GENCTRL8Select @@ -13353,7 +13353,7 @@ GENCTRL9 Generic Clock Generator Control 9 Synchronization Busy bits 11 - 1 + 12 read-only GENCTRL9Select @@ -13423,7 +13423,7 @@ GENCTRL10 Generic Clock Generator Control 10 Synchronization Busy bits 12 - 1 + 12 read-only GENCTRL10Select @@ -13493,7 +13493,7 @@ GENCTRL11 Generic Clock Generator Control 11 Synchronization Busy bits 13 - 1 + 12 read-only GENCTRL11Select From 30d153ed67a3fc3c23b3f56f8ab2342a63121f68 Mon Sep 17 00:00:00 2001 From: wallarug Date: Fri, 23 Apr 2021 18:19:52 +1000 Subject: [PATCH 14/22] Delete boards/robohatmm1_m0 directory The MM1_m0 does not exist. --- boards/robohatmm1_m0/board.mk | 2 -- boards/robohatmm1_m0/board_config.h | 17 ----------------- 2 files changed, 19 deletions(-) delete mode 100644 boards/robohatmm1_m0/board.mk delete mode 100644 boards/robohatmm1_m0/board_config.h diff --git a/boards/robohatmm1_m0/board.mk b/boards/robohatmm1_m0/board.mk deleted file mode 100644 index 0a90fdf6..00000000 --- a/boards/robohatmm1_m0/board.mk +++ /dev/null @@ -1,2 +0,0 @@ -CHIP_FAMILY = samd21 -CHIP_VARIANT = SAMD21G18A diff --git a/boards/robohatmm1_m0/board_config.h b/boards/robohatmm1_m0/board_config.h deleted file mode 100644 index 8919b6a9..00000000 --- a/boards/robohatmm1_m0/board_config.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef BOARD_CONFIG_H -#define BOARD_CONFIG_H - -#define CRYSTALLESS 1 - -#define VENDOR_NAME "Robotics Masters" -#define PRODUCT_NAME "Robo HAT MM1" -#define VOLUME_LABEL "ROBOM0BOOT" -#define INDEX_URL "https://roboticsmasters.co" -#define BOARD_ID "SAMD21G18A-RoboHATMM1-v24" - -#define USB_VID 0x1209 -#define USB_PID 0x4D44 - -#define LED_PIN PIN_PB22 - -#endif From be9a2c4d6d1f3dedfb6b983fadeaacab2c61e9d1 Mon Sep 17 00:00:00 2001 From: Michal Moskal Date: Thu, 10 Jun 2021 14:01:05 -0700 Subject: [PATCH 15/22] Use Buffer.alloc() - fixes #100 --- scripts/bin2uf2.js | 4 ++-- scripts/dbgtool.js | 2 +- scripts/gendata.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/bin2uf2.js b/scripts/bin2uf2.js index 69acc840..c4e9b141 100644 --- a/scripts/bin2uf2.js +++ b/scripts/bin2uf2.js @@ -13,7 +13,7 @@ const UF2_MAGIC_END = 0x0AB16F30 // Ditto let numBlocks = (buf.length + 255) >> 8 let outp = [] for (let pos = 0; pos < buf.length; pos += 256) { - let bl = new Buffer(512) + let bl = Buffer.alloc(512) for (let i = 0; i < 512; ++i) bl[i] = 0 // just in case bl.writeUInt32LE(UF2_MAGIC_START0, 0) @@ -34,4 +34,4 @@ if (numBlocks != outp.length) throw "oops"; let outn = process.argv[3] || "flash.uf2" fs.writeFileSync(outn, Buffer.concat(outp)) -console.log(`Wrote ${numBlocks} blocks to ${outn}`) \ No newline at end of file +console.log(`Wrote ${numBlocks} blocks to ${outn}`) diff --git a/scripts/dbgtool.js b/scripts/dbgtool.js index f0c25130..416ec394 100755 --- a/scripts/dbgtool.js +++ b/scripts/dbgtool.js @@ -103,7 +103,7 @@ function main() { if (err) { fatal("error: " + err.message) } - let buf = new Buffer(logSize) + let buf = Buffer.alloc(logSize) for (let l of stdout.split(/\r?\n/)) { let m = /^M\((\d+)\)\s*=\s*(\d+)/.exec(l) if (m) { diff --git a/scripts/gendata.js b/scripts/gendata.js index b814b787..50ab18bd 100644 --- a/scripts/gendata.js +++ b/scripts/gendata.js @@ -3,7 +3,7 @@ let fs = require("fs") let buildPath = process.argv[2] let binName = buildPath + "/" + process.argv[3] let buf = fs.readFileSync(binName) -let tail = new Buffer(8192 - buf.length) +let tail = Buffer.alloc(8192 - buf.length) if (buf.length > 8192) { console.error("Bootloader too big!") process.exit(1) From dd415d582b3179a6d752d0ce50da3247411aa6e8 Mon Sep 17 00:00:00 2001 From: Michal Moskal Date: Thu, 10 Jun 2021 14:01:23 -0700 Subject: [PATCH 16/22] Auto-update tasks.json --- .vscode/tasks.json | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 295b1d81..79740235 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,9 +1,16 @@ { // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format - "version": "0.1.0", + "version": "2.0.0", "command": "make", - "isShellCommand": true, "args": [], - "showOutput": "always" + "tasks": [ + { + "label": "make", + "type": "shell", + "command": "make", + "problemMatcher": [], + "group": "build" + } + ] } \ No newline at end of file From b393cb19f179012d7f0095532a9ebbc95af196ba Mon Sep 17 00:00:00 2001 From: Michal Moskal Date: Thu, 20 Jan 2022 10:11:16 +0100 Subject: [PATCH 17/22] fix #103 - gcc warnings thanks @JackCasual --- lib/cmsis/CMSIS/Include/core_cmFunc.h | 4 ++-- src/cdc_enumerate.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cmsis/CMSIS/Include/core_cmFunc.h b/lib/cmsis/CMSIS/Include/core_cmFunc.h index 01089f13..d5e32c51 100644 --- a/lib/cmsis/CMSIS/Include/core_cmFunc.h +++ b/lib/cmsis/CMSIS/Include/core_cmFunc.h @@ -426,7 +426,7 @@ __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PSP(void) */ __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) { - __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp"); + __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : ); } @@ -453,7 +453,7 @@ __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void) */ __attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) { - __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp"); + __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : ); } diff --git a/src/cdc_enumerate.c b/src/cdc_enumerate.c index b05795fc..3f182550 100644 --- a/src/cdc_enumerate.c +++ b/src/cdc_enumerate.c @@ -721,7 +721,7 @@ uint32_t USB_WriteCore(const void *pData, uint32_t length, uint8_t ep_num, bool //* \brief Send zero length packet through the control endpoint //*---------------------------------------------------------------------------- void AT91F_USB_SendZlp(void) { - uint8_t c; + uint8_t c = 0; USB_Write(&c, 0, 0); } From e8e41dce559ebaa90d0465eecc37e55c2900489e Mon Sep 17 00:00:00 2001 From: Erik van Zijst Date: Thu, 18 Aug 2022 09:10:42 -0700 Subject: [PATCH 18/22] Fix Makefile.user reference in README.md The Makefile automatically includes `Makefile.user`, not `Makefile.local` as was mentioned in `README.md`. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 265e21ed..bdb44330 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ The default board is `zero`. You can build a different one using: make BOARD=metro_m0 ``` -If you're working on different board, it's best to create `Makefile.local` +If you're working on different board, it's best to create `Makefile.user` with say `BOARD=metro` to change the default. The names `zero` and `metro` refer to subdirectories of `boards/`. From a78c217f30cc463ade8457fd7eb2186362e7c608 Mon Sep 17 00:00:00 2001 From: "microsoft-github-policy-service[bot]" <77245923+microsoft-github-policy-service[bot]@users.noreply.github.com> Date: Fri, 19 Aug 2022 07:28:04 +0000 Subject: [PATCH 19/22] Microsoft mandatory file --- SECURITY.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..869fdfe2 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,41 @@ + + +## Security + +Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). + +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). + +If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). + +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). + +Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: + + * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) + * Full paths of source file(s) related to the manifestation of the issue + * The location of the affected source code (tag/branch/commit or direct URL) + * Any special configuration required to reproduce the issue + * Step-by-step instructions to reproduce the issue + * Proof-of-concept or exploit code (if possible) + * Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. + +## Preferred Languages + +We prefer all communications to be in English. + +## Policy + +Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). + + From 569c1d8681e736fd81b00af5e91a4d09f39d0058 Mon Sep 17 00:00:00 2001 From: xeno27 <20142175+xeno27@users.noreply.github.com> Date: Tue, 6 Jun 2023 12:29:40 +0200 Subject: [PATCH 20/22] fix WS (1->2 by 48Mhz) --- src/init_samd51.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init_samd51.c b/src/init_samd51.c index c1bd30ce..cec88fc9 100644 --- a/src/init_samd51.c +++ b/src/init_samd51.c @@ -1,8 +1,8 @@ #include "uf2.h" void system_init(void) { - /* Set 1 Flash Wait State for 48MHz */ - NVMCTRL->CTRLA.reg |= NVMCTRL_CTRLA_RWS(0); + /* Set 2 Flash Wait State for 48MHz , refer to TAB 56.6 in datasheet*/ + NVMCTRL->CTRLA.reg |= NVMCTRL_CTRLA_RWS(2); // Output GCLK0 to Metro M4 D5. This way we can see if/when we mess it up. //PORT->Group[1].PINCFG[14].bit.PMUXEN = true; From 555468b1e5f6ef02d94f9485c2aa0d0cf6a5d006 Mon Sep 17 00:00:00 2001 From: "Sven M. Hallberg" Date: Sun, 23 Jul 2023 20:34:19 +0200 Subject: [PATCH 21/22] specify that we need GNU make --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8db10655..f09a975a 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ to temporarily turn off the protection. In gdb the command is: ### Requirements -* `make` and an Unix environment +* GNU `make` and a Unix environment * `node`.js in path (optional) * `arm-none-eabi-gcc` in the path (the one coming with Yotta will do just fine). You can get the latest version from ARM: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads * `openocd` - you can use the one coming with Arduino (after your install the M0 board support) From 27d75270f9c9a488f5e244ae5d87c303ef699102 Mon Sep 17 00:00:00 2001 From: "Sven M. Hallberg" Date: Mon, 21 Aug 2023 17:36:04 +0200 Subject: [PATCH 22/22] fix DISPLAY_CFG0 for PewPew M4 This board was originally prototyped with a different display than what ended up being sold. Both values are correct, depending on which display is used - the difference is in the horizontal offset. The value 0x20180 is correct for the board as it was sold, so that is likely what users want. The value can be changed with the uf2patcher tool if needed. --- boards/pewpew_m4/board_config.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/boards/pewpew_m4/board_config.h b/boards/pewpew_m4/board_config.h index c83fff26..9a98bd55 100644 --- a/boards/pewpew_m4/board_config.h +++ b/boards/pewpew_m4/board_config.h @@ -45,7 +45,8 @@ const uint32_t config_data[] = { 36, 0x10, // PIN_DISPLAY_DC = PA16 37, 0xa0, // DISPLAY_WIDTH = 160 38, 0x80, // DISPLAY_HEIGHT = 128 - 39, 0x80, // DISPLAY_CFG0 = 0x80 + //39, 0x80, // DISPLAY_CFG0 = 0x80 (prototype) + 39, 0x20180, // DISPLAY_CFG0 = 0x20180 (sold version) 40, 0x12c2d, // DISPLAY_CFG1 = 0x12c2d 41, 0x18, // DISPLAY_CFG2 = 0x18 43, 0x11, // PIN_DISPLAY_RST = PA17