Remove arm_atsam
platform (#24337)
This commit is contained in:
parent
096aca63c5
commit
3bd303f204
215 changed files with 3 additions and 73516 deletions
|
@ -1,84 +0,0 @@
|
|||
/* Copyright 2021 QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "samd51j18a.h"
|
||||
|
||||
#define A00 PIN_PA00
|
||||
#define A01 PIN_PA01
|
||||
#define A02 PIN_PA02
|
||||
#define A03 PIN_PA03
|
||||
#define A04 PIN_PA04
|
||||
#define A05 PIN_PA05
|
||||
#define A06 PIN_PA06
|
||||
#define A07 PIN_PA07
|
||||
#define A08 PIN_PA08
|
||||
#define A09 PIN_PA09
|
||||
#define A10 PIN_PA10
|
||||
#define A11 PIN_PA11
|
||||
#define A12 PIN_PA12
|
||||
#define A13 PIN_PA13
|
||||
#define A14 PIN_PA14
|
||||
#define A15 PIN_PA15
|
||||
#define A16 PIN_PA16
|
||||
#define A17 PIN_PA17
|
||||
#define A18 PIN_PA18
|
||||
#define A19 PIN_PA19
|
||||
#define A20 PIN_PA20
|
||||
#define A21 PIN_PA21
|
||||
#define A22 PIN_PA22
|
||||
#define A23 PIN_PA23
|
||||
#define A24 PIN_PA24
|
||||
#define A25 PIN_PA25
|
||||
#define A26 PIN_PA26
|
||||
#define A27 PIN_PA27
|
||||
#define A28 PIN_PA28
|
||||
#define A29 PIN_PA29
|
||||
#define A30 PIN_PA30
|
||||
#define A31 PIN_PA31
|
||||
|
||||
#define B00 PIN_PB00
|
||||
#define B01 PIN_PB01
|
||||
#define B02 PIN_PB02
|
||||
#define B03 PIN_PB03
|
||||
#define B04 PIN_PB04
|
||||
#define B05 PIN_PB05
|
||||
#define B06 PIN_PB06
|
||||
#define B07 PIN_PB07
|
||||
#define B08 PIN_PB08
|
||||
#define B09 PIN_PB09
|
||||
#define B10 PIN_PB10
|
||||
#define B11 PIN_PB11
|
||||
#define B12 PIN_PB12
|
||||
#define B13 PIN_PB13
|
||||
#define B14 PIN_PB14
|
||||
#define B15 PIN_PB15
|
||||
#define B16 PIN_PB16
|
||||
#define B17 PIN_PB17
|
||||
#define B18 PIN_PB18
|
||||
#define B19 PIN_PB19
|
||||
#define B20 PIN_PB20
|
||||
#define B21 PIN_PB21
|
||||
#define B22 PIN_PB22
|
||||
#define B23 PIN_PB23
|
||||
#define B24 PIN_PB24
|
||||
#define B25 PIN_PB25
|
||||
#define B26 PIN_PB26
|
||||
#define B27 PIN_PB27
|
||||
#define B28 PIN_PB28
|
||||
#define B29 PIN_PB29
|
||||
#define B30 PIN_PB30
|
||||
#define B31 PIN_PB31
|
|
@ -1,19 +0,0 @@
|
|||
/* Copyright 2021 Simon Arlott
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
// The platform is 32-bit, so prefer 32-bit timers to avoid overflow
|
||||
#define FAST_TIMER_T_SIZE 32
|
|
@ -1,9 +0,0 @@
|
|||
// Copyright 2023 Nick Brassel (@tzarc)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#pragma once
|
||||
|
||||
#define RESIDENT_IN_RAM(funcname) __attribute__((section(".ramfunc." #funcname), noinline)) funcname
|
||||
|
||||
#if __has_include_next("_util.h")
|
||||
# include_next "_util.h"
|
||||
#endif
|
|
@ -1,22 +0,0 @@
|
|||
/* Copyright 2021 QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "clks.h"
|
||||
|
||||
#define wait_ms(ms) CLK_delay_ms(ms)
|
||||
#define wait_us(us) CLK_delay_us(us)
|
||||
#define waitInputPinDelay()
|
|
@ -1,37 +0,0 @@
|
|||
/* Copyright 2021 QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "samd51j18a.h"
|
||||
|
||||
static __inline__ uint8_t __interrupt_disable__(void) {
|
||||
__disable_irq();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static __inline__ void __interrupt_enable__(const uint8_t *__s) {
|
||||
__enable_irq();
|
||||
|
||||
__asm__ volatile("" ::: "memory");
|
||||
(void)__s;
|
||||
}
|
||||
|
||||
#define ATOMIC_BLOCK(type) for (type, __ToDo = __interrupt_disable__(); __ToDo; __ToDo = 0)
|
||||
#define ATOMIC_FORCEON uint8_t sreg_save __attribute__((__cleanup__(__interrupt_enable__))) = 0
|
||||
|
||||
#define ATOMIC_BLOCK_RESTORESTATE _Static_assert(0, "ATOMIC_BLOCK_RESTORESTATE not implemented")
|
||||
#define ATOMIC_BLOCK_FORCEON ATOMIC_BLOCK(ATOMIC_FORCEON)
|
|
@ -1,48 +0,0 @@
|
|||
# Copyright 2017 Jack Humbert
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# If it's possible that multiple bootloaders can be used for one project,
|
||||
# you can leave this unset, and the correct size will be selected
|
||||
# automatically.
|
||||
#
|
||||
# Sets the bootloader defined in the keyboard's/keymap's rules.mk
|
||||
#
|
||||
# Current options for ARM (ATSAM):
|
||||
# md-boot Atmel SAM-BA (only used by Drop boards)
|
||||
#
|
||||
# If you need to provide your own implementation, you can set inside `rules.mk`
|
||||
# `BOOTLOADER = custom` -- you'll need to provide your own implementations. See
|
||||
# the respective file under `platforms/<PLATFORM>/bootloaders/custom.c` to see
|
||||
# which functions may be overridden.
|
||||
|
||||
FIRMWARE_FORMAT?=bin
|
||||
|
||||
ifeq ($(strip $(BOOTLOADER)), custom)
|
||||
OPT_DEFS += -DBOOTLOADER_CUSTOM
|
||||
BOOTLOADER_TYPE = custom
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(BOOTLOADER)), md-boot)
|
||||
OPT_DEFS += -DBOOTLOADER_MD_BOOT
|
||||
BOOTLOADER_TYPE = md_boot
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(BOOTLOADER_TYPE)),)
|
||||
ifneq ($(strip $(BOOTLOADER)),)
|
||||
$(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,Invalid bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.)
|
||||
else
|
||||
$(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,No bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.)
|
||||
endif
|
||||
endif
|
|
@ -1,69 +0,0 @@
|
|||
/* Copyright 2017 Fred Sundvik
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "bootloader.h"
|
||||
|
||||
#include "samd51j18a.h"
|
||||
|
||||
// WARNING: These are only for CTRL bootloader release "v2.18Jun 22 2018 17:28:08" for bootloader_jump support
|
||||
extern uint32_t _eram;
|
||||
#define BOOTLOADER_MAGIC 0x3B9ACA00
|
||||
#define MAGIC_ADDR (uint32_t *)((intptr_t)(&_eram) - 4)
|
||||
|
||||
// CTRL keyboards released with bootloader version below must use RAM method. Otherwise use WDT method.
|
||||
void bootloader_jump(void) {
|
||||
#ifdef KEYBOARD_massdrop_ctrl
|
||||
uint8_t ver_ram_method[] = "v2.18Jun 22 2018 17:28:08"; // The version to match (NULL terminated by compiler)
|
||||
uint8_t *ver_check = ver_ram_method; // Pointer to version match string for traversal
|
||||
uint8_t *ver_rom = (uint8_t *)0x21A0; // Pointer to address in ROM where this specific bootloader version would exist
|
||||
|
||||
while (*ver_check && *ver_rom == *ver_check) { // While there are check version characters to match and bootloader's version matches check's version
|
||||
ver_check++; // Move check version pointer to next character
|
||||
ver_rom++; // Move ROM version pointer to next character
|
||||
}
|
||||
|
||||
if (!*ver_check) { // If check version pointer is NULL, all characters have matched
|
||||
*MAGIC_ADDR = BOOTLOADER_MAGIC; // Set magic number into RAM
|
||||
NVIC_SystemReset(); // Perform system reset
|
||||
while (1)
|
||||
; // Won't get here
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set watchdog timer to reset. Directs the bootloader to stay in programming mode.
|
||||
WDT->CTRLA.bit.ENABLE = 0;
|
||||
|
||||
while (WDT->SYNCBUSY.bit.ENABLE)
|
||||
;
|
||||
while (WDT->CTRLA.bit.ENABLE)
|
||||
;
|
||||
|
||||
WDT->CONFIG.bit.WINDOW = 0;
|
||||
WDT->CONFIG.bit.PER = 0;
|
||||
WDT->EWCTRL.bit.EWOFFSET = 0;
|
||||
WDT->CTRLA.bit.ENABLE = 1;
|
||||
|
||||
while (WDT->SYNCBUSY.bit.ENABLE)
|
||||
;
|
||||
while (!WDT->CTRLA.bit.ENABLE)
|
||||
;
|
||||
while (1)
|
||||
; // Wait on timeout
|
||||
}
|
||||
|
||||
__attribute__((weak)) void mcu_reset(void) {
|
||||
NVIC_SystemReset();
|
||||
}
|
|
@ -1,179 +0,0 @@
|
|||
/* Copyright 2017 Fred Sundvik
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "eeprom.h"
|
||||
#include "debug.h"
|
||||
#include "util.h"
|
||||
#include "samd51j18a.h"
|
||||
#include "core_cm4.h"
|
||||
#include "component/nvmctrl.h"
|
||||
#include "eeprom_samd.h"
|
||||
|
||||
#ifndef BUSY_RETRIES
|
||||
# define BUSY_RETRIES 10000
|
||||
#endif
|
||||
|
||||
// #define DEBUG_EEPROM_OUTPUT
|
||||
|
||||
/*
|
||||
* Debug print utils
|
||||
*/
|
||||
#if defined(DEBUG_EEPROM_OUTPUT)
|
||||
# define eeprom_printf(fmt, ...) xprintf(fmt, ##__VA_ARGS__);
|
||||
#else /* NO_DEBUG */
|
||||
# define eeprom_printf(fmt, ...)
|
||||
#endif /* NO_DEBUG */
|
||||
|
||||
__attribute__((aligned(4))) static uint8_t buffer[EEPROM_SIZE] = {0};
|
||||
volatile uint8_t * SmartEEPROM8 = (uint8_t *)SEEPROM_ADDR;
|
||||
|
||||
static inline bool eeprom_is_busy(void) {
|
||||
int timeout = BUSY_RETRIES;
|
||||
while (NVMCTRL->SEESTAT.bit.BUSY && timeout-- > 0)
|
||||
;
|
||||
|
||||
return NVMCTRL->SEESTAT.bit.BUSY;
|
||||
}
|
||||
|
||||
static uint32_t get_virtual_eeprom_size(void) {
|
||||
// clang-format off
|
||||
static const uint32_t VIRTUAL_EEPROM_MAP[11][8] = {
|
||||
/* 4 8 16 32 64 128 256 512 */
|
||||
/* 0*/ { 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
/* 1*/ { 512, 1024, 2048, 4096, 4096, 4096, 4096, 4096 },
|
||||
/* 2*/ { 512, 1024, 2048, 4096, 8192, 8192, 8192, 8192 },
|
||||
/* 3*/ { 512, 1024, 2048, 4096, 8192, 16384, 16384, 16384 },
|
||||
/* 4*/ { 512, 1024, 2048, 4096, 8192, 16384, 16384, 16384 },
|
||||
/* 5*/ { 512, 1024, 2048, 4096, 8192, 16384, 32768, 32768 },
|
||||
/* 6*/ { 512, 1024, 2048, 4096, 8192, 16384, 32768, 32768 },
|
||||
/* 7*/ { 512, 1024, 2048, 4096, 8192, 16384, 32768, 32768 },
|
||||
/* 8*/ { 512, 1024, 2048, 4096, 8192, 16384, 32768, 32768 },
|
||||
/* 9*/ { 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536 },
|
||||
/*10*/ { 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536 },
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static uint32_t virtual_eeprom_size = UINT32_MAX;
|
||||
if (virtual_eeprom_size == UINT32_MAX) {
|
||||
virtual_eeprom_size = VIRTUAL_EEPROM_MAP[NVMCTRL->SEESTAT.bit.PSZ][NVMCTRL->SEESTAT.bit.SBLK];
|
||||
}
|
||||
// eeprom_printf("get_virtual_eeprom_size:: %d:%d:%d\n", NVMCTRL->SEESTAT.bit.PSZ, NVMCTRL->SEESTAT.bit.SBLK, virtual_eeprom_size);
|
||||
return virtual_eeprom_size;
|
||||
}
|
||||
|
||||
uint8_t eeprom_read_byte(const uint8_t *addr) {
|
||||
uintptr_t offset = (uintptr_t)addr;
|
||||
if (offset >= MAX(EEPROM_SIZE, get_virtual_eeprom_size())) {
|
||||
eeprom_printf("eeprom_read_byte:: out of bounds\n");
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
if (get_virtual_eeprom_size() == 0) {
|
||||
return buffer[offset];
|
||||
}
|
||||
|
||||
if (eeprom_is_busy()) {
|
||||
eeprom_printf("eeprom_write_byte:: timeout\n");
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
return SmartEEPROM8[offset];
|
||||
}
|
||||
|
||||
void eeprom_write_byte(uint8_t *addr, uint8_t value) {
|
||||
uintptr_t offset = (uintptr_t)addr;
|
||||
if (offset >= MAX(EEPROM_SIZE, get_virtual_eeprom_size())) {
|
||||
eeprom_printf("eeprom_write_byte:: out of bounds\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_virtual_eeprom_size() == 0) {
|
||||
buffer[offset] = value;
|
||||
return;
|
||||
}
|
||||
|
||||
if (eeprom_is_busy()) {
|
||||
eeprom_printf("eeprom_write_byte:: timeout\n");
|
||||
return;
|
||||
}
|
||||
|
||||
SmartEEPROM8[offset] = value;
|
||||
}
|
||||
|
||||
uint16_t eeprom_read_word(const uint16_t *addr) {
|
||||
const uint8_t *p = (const uint8_t *)addr;
|
||||
return eeprom_read_byte(p) | (eeprom_read_byte(p + 1) << 8);
|
||||
}
|
||||
|
||||
uint32_t eeprom_read_dword(const uint32_t *addr) {
|
||||
const uint8_t *p = (const uint8_t *)addr;
|
||||
return eeprom_read_byte(p) | (eeprom_read_byte(p + 1) << 8) | (eeprom_read_byte(p + 2) << 16) | (eeprom_read_byte(p + 3) << 24);
|
||||
}
|
||||
|
||||
void eeprom_read_block(void *buf, const void *addr, size_t len) {
|
||||
const uint8_t *p = (const uint8_t *)addr;
|
||||
uint8_t * dest = (uint8_t *)buf;
|
||||
while (len--) {
|
||||
*dest++ = eeprom_read_byte(p++);
|
||||
}
|
||||
}
|
||||
|
||||
void eeprom_write_word(uint16_t *addr, uint16_t value) {
|
||||
uint8_t *p = (uint8_t *)addr;
|
||||
eeprom_write_byte(p++, value);
|
||||
eeprom_write_byte(p, value >> 8);
|
||||
}
|
||||
|
||||
void eeprom_write_dword(uint32_t *addr, uint32_t value) {
|
||||
uint8_t *p = (uint8_t *)addr;
|
||||
eeprom_write_byte(p++, value);
|
||||
eeprom_write_byte(p++, value >> 8);
|
||||
eeprom_write_byte(p++, value >> 16);
|
||||
eeprom_write_byte(p, value >> 24);
|
||||
}
|
||||
|
||||
void eeprom_write_block(const void *buf, void *addr, size_t len) {
|
||||
uint8_t * p = (uint8_t *)addr;
|
||||
const uint8_t *src = (const uint8_t *)buf;
|
||||
while (len--) {
|
||||
eeprom_write_byte(p++, *src++);
|
||||
}
|
||||
}
|
||||
|
||||
void eeprom_update_byte(uint8_t *addr, uint8_t value) {
|
||||
eeprom_write_byte(addr, value);
|
||||
}
|
||||
|
||||
void eeprom_update_word(uint16_t *addr, uint16_t value) {
|
||||
uint8_t *p = (uint8_t *)addr;
|
||||
eeprom_write_byte(p++, value);
|
||||
eeprom_write_byte(p, value >> 8);
|
||||
}
|
||||
|
||||
void eeprom_update_dword(uint32_t *addr, uint32_t value) {
|
||||
uint8_t *p = (uint8_t *)addr;
|
||||
eeprom_write_byte(p++, value);
|
||||
eeprom_write_byte(p++, value >> 8);
|
||||
eeprom_write_byte(p++, value >> 16);
|
||||
eeprom_write_byte(p, value >> 24);
|
||||
}
|
||||
|
||||
void eeprom_update_block(const void *buf, void *addr, size_t len) {
|
||||
uint8_t * p = (uint8_t *)addr;
|
||||
const uint8_t *src = (const uint8_t *)buf;
|
||||
while (len--) {
|
||||
eeprom_write_byte(p++, *src++);
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
// Copyright 2022 Nick Brassel (@tzarc)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#pragma once
|
||||
|
||||
#ifndef EEPROM_SIZE
|
||||
# include "eeconfig.h"
|
||||
# define EEPROM_SIZE (((EECONFIG_SIZE + 3) / 4) * 4) // based off eeconfig's current usage, aligned to 4-byte sizes, to deal with LTO
|
||||
#endif
|
|
@ -1,23 +0,0 @@
|
|||
# Hey Emacs, this is a -*- makefile -*-
|
||||
##############################################################################
|
||||
# Architecture or project specific options
|
||||
#
|
||||
|
||||
MDLOADER_CLI ?= mdloader
|
||||
|
||||
define EXEC_MDLOADER
|
||||
$(MDLOADER_CLI) --first --download $(BUILD_DIR)/$(TARGET).bin --restart
|
||||
endef
|
||||
|
||||
mdloader: bin
|
||||
$(call EXEC_MDLOADER)
|
||||
|
||||
flash: bin
|
||||
$(SILENT) || printf "Flashing for bootloader: $(BLUE)$(BOOTLOADER)$(NO_COLOR)\n"
|
||||
ifneq ($(strip $(PROGRAM_CMD)),)
|
||||
$(UNSYNC_OUTPUT_CMD) && $(PROGRAM_CMD)
|
||||
else ifeq ($(strip $(ARM_ATSAM)),SAMD51J18A)
|
||||
$(UNSYNC_OUTPUT_CMD) && $(call EXEC_MDLOADER)
|
||||
else
|
||||
$(PRINT_OK); $(SILENT) || printf "$(MSG_FLASH_ARCH)"
|
||||
endif
|
|
@ -1,81 +0,0 @@
|
|||
/* Copyright 2021 QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "samd51j18a.h"
|
||||
|
||||
#include "pin_defs.h"
|
||||
|
||||
typedef uint8_t pin_t;
|
||||
|
||||
#define SAMD_PORT(pin) (((pin)&0x20) >> 5)
|
||||
#define SAMD_PIN(pin) ((pin)&0x1f)
|
||||
#define SAMD_PIN_MASK(pin) (1 << ((pin)&0x1f))
|
||||
|
||||
#define gpio_set_pin_input(pin) \
|
||||
do { \
|
||||
PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.INEN = 1; \
|
||||
PORT->Group[SAMD_PORT(pin)].DIRCLR.reg = SAMD_PIN_MASK(pin); \
|
||||
} while (0)
|
||||
|
||||
#define gpio_set_pin_input_high(pin) \
|
||||
do { \
|
||||
PORT->Group[SAMD_PORT(pin)].DIRCLR.reg = SAMD_PIN_MASK(pin); \
|
||||
PORT->Group[SAMD_PORT(pin)].OUTSET.reg = SAMD_PIN_MASK(pin); \
|
||||
PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.INEN = 1; \
|
||||
PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.PULLEN = 1; \
|
||||
} while (0)
|
||||
|
||||
#define gpio_set_pin_input_low(pin) \
|
||||
do { \
|
||||
PORT->Group[SAMD_PORT(pin)].DIRCLR.reg = SAMD_PIN_MASK(pin); \
|
||||
PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \
|
||||
PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.INEN = 1; \
|
||||
PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.PULLEN = 1; \
|
||||
} while (0)
|
||||
|
||||
#define gpio_set_pin_output_push_pull(pin) \
|
||||
do { \
|
||||
PORT->Group[SAMD_PORT(pin)].DIRSET.reg = SAMD_PIN_MASK(pin); \
|
||||
PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \
|
||||
} while (0)
|
||||
|
||||
#define gpio_set_pin_output_open_drain(pin) _Static_assert(0, "Open-drain outputs are not available on ATSAM")
|
||||
|
||||
#define gpio_set_pin_output(pin) gpio_set_pin_output_push_pull(pin)
|
||||
|
||||
#define gpio_write_pin_high(pin) \
|
||||
do { \
|
||||
PORT->Group[SAMD_PORT(pin)].OUTSET.reg = SAMD_PIN_MASK(pin); \
|
||||
} while (0)
|
||||
|
||||
#define gpio_write_pin_low(pin) \
|
||||
do { \
|
||||
PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \
|
||||
} while (0)
|
||||
|
||||
#define gpio_write_pin(pin, level) \
|
||||
do { \
|
||||
if (level) \
|
||||
PORT->Group[SAMD_PORT(pin)].OUTSET.reg = SAMD_PIN_MASK(pin); \
|
||||
else \
|
||||
PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \
|
||||
} while (0)
|
||||
|
||||
#define gpio_read_pin(pin) ((PORT->Group[SAMD_PORT(pin)].IN.reg & SAMD_PIN_MASK(pin)) != 0)
|
||||
|
||||
#define gpio_toggle_pin(pin) (PORT->Group[SAMD_PORT(pin)].OUTTGL.reg = SAMD_PIN_MASK(pin))
|
|
@ -1,9 +0,0 @@
|
|||
// Copyright 2022 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "hardware_id.h"
|
||||
|
||||
__attribute__((weak)) hardware_id_t get_hardware_id(void) {
|
||||
hardware_id_t id = {0};
|
||||
return id;
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/* Copyright 2021 QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "platform_deps.h"
|
||||
|
||||
void platform_setup(void) {
|
||||
// do nothing
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
# Hey Emacs, this is a -*- makefile -*-
|
||||
##############################################################################
|
||||
# Compiler settings
|
||||
#
|
||||
CC = $(CC_PREFIX) arm-none-eabi-gcc
|
||||
OBJCOPY = arm-none-eabi-objcopy
|
||||
OBJDUMP = arm-none-eabi-objdump
|
||||
SIZE = arm-none-eabi-size
|
||||
AR = arm-none-eabi-ar
|
||||
NM = arm-none-eabi-nm
|
||||
HEX = $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature
|
||||
EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT)
|
||||
BIN =
|
||||
|
||||
COMMON_VPATH += $(LIB_PATH)/arm_atsam/packs/atmel/SAMD51_DFP/1.0.70/include
|
||||
COMMON_VPATH += $(LIB_PATH)/arm_atsam/packs/arm/cmsis/5.0.1/CMSIS/Include
|
||||
|
||||
COMPILEFLAGS += -funsigned-char
|
||||
COMPILEFLAGS += -funsigned-bitfields
|
||||
COMPILEFLAGS += -ffunction-sections
|
||||
COMPILEFLAGS += -fshort-enums
|
||||
COMPILEFLAGS += -fno-inline-small-functions
|
||||
COMPILEFLAGS += -fno-strict-aliasing
|
||||
COMPILEFLAGS += -mfloat-abi=hard
|
||||
COMPILEFLAGS += -mfpu=fpv4-sp-d16
|
||||
COMPILEFLAGS += -mthumb
|
||||
COMPILEFLAGS += -fno-builtin-printf
|
||||
|
||||
#ALLOW_WARNINGS = yes
|
||||
|
||||
CFLAGS += $(COMPILEFLAGS)
|
||||
|
||||
CXXFLAGS += $(COMPILEFLAGS)
|
||||
CXXFLAGS += -fno-exceptions $(CXXSTANDARD)
|
||||
|
||||
LDFLAGS +=-Wl,--gc-sections
|
||||
LDFLAGS += -Wl,-Map="%OUT%%PROJ_NAME%.map"
|
||||
LDFLAGS += -Wl,--start-group
|
||||
LDFLAGS += -Wl,--end-group
|
||||
LDFLAGS += --specs=rdimon.specs
|
||||
LDFLAGS += -T$(LIB_PATH)/arm_atsam/packs/atmel/SAMD51_DFP/1.0.70/gcc/gcc/samd51j18a_flash.ld
|
||||
|
||||
OPT_DEFS += -DPROTOCOL_ARM_ATSAM
|
||||
|
||||
MCUFLAGS = -mcpu=$(MCU)
|
||||
MCUFLAGS += -D__$(ARM_ATSAM)__
|
||||
|
||||
# List any extra directories to look for libraries here.
|
||||
# Each directory must be seperated by a space.
|
||||
# Use forward slashes for directory separators.
|
||||
# For a directory that has spaces, enclose it in quotes.
|
||||
EXTRALIBDIRS =
|
||||
|
||||
cpfirmware: warn-arm_atsam
|
||||
.INTERMEDIATE: warn-arm_atsam
|
||||
warn-arm_atsam: $(FIRMWARE_FORMAT)
|
||||
$(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@)
|
||||
$(info This MCU support package has a lack of support from the upstream provider (Massdrop).)
|
||||
$(info There are currently questions about valid licensing, and at this stage it's likely)
|
||||
$(info their boards and supporting code will be removed from QMK in the near future. Please)
|
||||
$(info contact Massdrop for support, and encourage them to align their future board design)
|
||||
$(info choices to gain proper license compatibility with QMK.)
|
||||
$(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@)
|
||||
|
||||
# Convert hex to bin.
|
||||
bin: $(BUILD_DIR)/$(TARGET).hex
|
||||
$(OBJCOPY) -Iihex -Obinary $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
|
||||
$(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin;
|
|
@ -1,18 +0,0 @@
|
|||
/* Copyright 2021 QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
// here just to please the build
|
|
@ -1,34 +0,0 @@
|
|||
#include "matrix.h"
|
||||
#include "i2c_master.h"
|
||||
#include "md_rgb_matrix.h"
|
||||
#include "suspend.h"
|
||||
|
||||
/** \brief Suspend power down
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void suspend_power_down(void) {
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
I2C3733_Control_Set(0); // Disable LED driver
|
||||
#endif
|
||||
|
||||
suspend_power_down_kb();
|
||||
}
|
||||
|
||||
/** \brief run immediately after wakeup
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void suspend_wakeup_init(void) {
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
# ifdef USE_MASSDROP_CONFIGURATOR
|
||||
if (led_enabled) {
|
||||
I2C3733_Control_Set(1);
|
||||
}
|
||||
# else
|
||||
I2C3733_Control_Set(1);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
suspend_wakeup_init_kb();
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
#include "samd51j18a.h"
|
||||
#include "timer.h"
|
||||
#include "tmk_core/protocol/arm_atsam/clks.h"
|
||||
|
||||
void set_time(uint64_t tset) {
|
||||
ms_clk = tset;
|
||||
}
|
||||
|
||||
void timer_init(void) {
|
||||
timer_clear();
|
||||
}
|
||||
|
||||
uint16_t timer_read(void) {
|
||||
return (uint16_t)ms_clk;
|
||||
}
|
||||
|
||||
uint32_t timer_read32(void) {
|
||||
return (uint32_t)ms_clk;
|
||||
}
|
||||
|
||||
uint64_t timer_read64(void) {
|
||||
return ms_clk;
|
||||
}
|
||||
|
||||
uint16_t timer_elapsed(uint16_t tlast) {
|
||||
return TIMER_DIFF_16(timer_read(), tlast);
|
||||
}
|
||||
|
||||
uint32_t timer_elapsed32(uint32_t tlast) {
|
||||
return TIMER_DIFF_32(timer_read32(), tlast);
|
||||
}
|
||||
|
||||
void timer_clear(void) {
|
||||
set_time(0);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue