atsamd: Add Kconfig definitions for same51j19 and same54p20 chips
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
69bd26b757
commit
bdf79caac4
|
@ -64,8 +64,8 @@ class PrinterTemperatureMCU:
|
|||
cfg_funcs = [
|
||||
('rp2040', self.config_rp2040),
|
||||
('sam3', self.config_sam3), ('sam4', self.config_sam4),
|
||||
('same70', self.config_same70),
|
||||
('samd21', self.config_samd21), ('samd51', self.config_samd51),
|
||||
('same70', self.config_same70), ('samd21', self.config_samd21),
|
||||
('samd51', self.config_samd51), ('same5', self.config_samd51),
|
||||
('stm32f1', self.config_stm32f1), ('stm32f2', self.config_stm32f2),
|
||||
('stm32f4', self.config_stm32f4),
|
||||
('stm32f042', self.config_stm32f0x2),
|
||||
|
|
|
@ -336,12 +336,13 @@ def flash_rp2040(options, binfile):
|
|||
sys.exit(-1)
|
||||
|
||||
MCUTYPES = {
|
||||
'sam3': flash_atsam3, 'sam4': flash_atsam4, 'samd': flash_atsamd,
|
||||
'same70': flash_atsam4, 'lpc176': flash_lpc176x, 'stm32f103': flash_stm32f1,
|
||||
'sam3': flash_atsam3, 'sam4': flash_atsam4, 'same70': flash_atsam4,
|
||||
'samd': flash_atsamd, 'same5': flash_atsamd,
|
||||
'lpc176': flash_lpc176x, 'stm32f103': flash_stm32f1,
|
||||
'stm32f4': flash_stm32f4, 'stm32f042': flash_stm32f4,
|
||||
'stm32f072': flash_stm32f4, 'stm32g0b1': flash_stm32f4,
|
||||
'stm32h7': flash_stm32f4, 'rp2040': flash_rp2040,
|
||||
'stm32l4': flash_stm32f4
|
||||
'stm32h7': flash_stm32f4, 'stm32l4': flash_stm32f4,
|
||||
'rp2040': flash_rp2040,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ choice
|
|||
config MACH_ATSAM
|
||||
bool "SAM3/SAM4/SAM E70 (Due and Duet)"
|
||||
config MACH_ATSAMD
|
||||
bool "SAMD21/SAMD51"
|
||||
bool "SAMD21/SAMD51/SAME5x"
|
||||
config MACH_LPC176X
|
||||
bool "LPC176x (Smoothieboard)"
|
||||
config MACH_STM32
|
||||
|
|
|
@ -47,12 +47,27 @@ choice
|
|||
config MACH_SAMD51P20
|
||||
bool "SAMD51P20 (Adafruit Grand Central)"
|
||||
select MACH_SAMD51
|
||||
config MACH_SAME51J19
|
||||
bool "SAME51J19"
|
||||
select MACH_SAME51
|
||||
config MACH_SAME54P20
|
||||
bool "SAME54P20"
|
||||
select MACH_SAME54
|
||||
endchoice
|
||||
|
||||
config MACH_SAMD21
|
||||
bool
|
||||
config MACH_SAMX5
|
||||
bool
|
||||
config MACH_SAMD51
|
||||
bool
|
||||
select MACH_SAMX5
|
||||
config MACH_SAME51
|
||||
bool
|
||||
select MACH_SAMX5
|
||||
config MACH_SAME54
|
||||
bool
|
||||
select MACH_SAMX5
|
||||
|
||||
config MCU
|
||||
string
|
||||
|
@ -63,13 +78,15 @@ config MCU
|
|||
default "samd51j19a" if MACH_SAMD51J19
|
||||
default "samd51n19a" if MACH_SAMD51N19
|
||||
default "samd51p20a" if MACH_SAMD51P20
|
||||
default "same51j19a" if MACH_SAME51J19
|
||||
default "same54p20a" if MACH_SAME54P20
|
||||
|
||||
config FLASH_SIZE
|
||||
hex
|
||||
default 0x8000 if MACH_SAMD21E15
|
||||
default 0x40000 if MACH_SAMD21G18 || MACH_SAMD21E18
|
||||
default 0x80000 if MACH_SAMD51G19 || MACH_SAMD51J19 || MACH_SAMD51N19
|
||||
default 0x100000 if MACH_SAMD51P20
|
||||
default 0x80000 if MACH_SAMD51G19 || MACH_SAMD51J19 || MACH_SAMD51N19 || MACH_SAME51J19
|
||||
default 0x100000 if MACH_SAMD51P20 || MACH_SAME54P20
|
||||
|
||||
config RAM_START
|
||||
hex
|
||||
|
@ -79,8 +96,8 @@ config RAM_SIZE
|
|||
hex
|
||||
default 0x1000 if MACH_SAMD21E15
|
||||
default 0x8000 if MACH_SAMD21G18 || MACH_SAMD21E18
|
||||
default 0x30000 if MACH_SAMD51G19 || MACH_SAMD51J19 || MACH_SAMD51N19
|
||||
default 0x40000 if MACH_SAMD51P20
|
||||
default 0x30000 if MACH_SAMD51G19 || MACH_SAMD51J19 || MACH_SAMD51N19 || MACH_SAME51J19
|
||||
default 0x40000 if MACH_SAMD51P20 || MACH_SAME54P20
|
||||
|
||||
config STACK_SIZE
|
||||
int
|
||||
|
@ -91,13 +108,13 @@ choice
|
|||
config CLOCK_REF_X32K
|
||||
bool "32.768Khz crystal"
|
||||
config CLOCK_REF_X25M
|
||||
bool "25Mhz crystal" if MACH_SAMD51
|
||||
bool "25Mhz crystal" if MACH_SAMX5
|
||||
config CLOCK_REF_INTERNAL
|
||||
bool "Internal clock"
|
||||
endchoice
|
||||
|
||||
choice
|
||||
depends on MACH_SAMD51 && LOW_LEVEL_OPTIONS
|
||||
depends on MACH_SAMX5 && LOW_LEVEL_OPTIONS
|
||||
prompt "Processor speed"
|
||||
config SAMD51_FREQ_120
|
||||
bool "120 MHz (standard)"
|
||||
|
@ -115,7 +132,7 @@ config CLOCK_FREQ
|
|||
default 150000000 if SAMD51_FREQ_150
|
||||
default 180000000 if SAMD51_FREQ_180
|
||||
default 200000000 if SAMD51_FREQ_200
|
||||
default 120000000 if MACH_SAMD51
|
||||
default 120000000 if MACH_SAMX5
|
||||
|
||||
choice
|
||||
prompt "Bootloader offset"
|
||||
|
|
|
@ -8,8 +8,9 @@ dirs-y += src/atsamd src/generic
|
|||
MCU := $(shell echo $(CONFIG_MCU) | tr a-z A-Z)
|
||||
|
||||
CFLAGS-$(CONFIG_MACH_SAMD21) += -mcpu=cortex-m0plus -Ilib/samd21/samd21a/include
|
||||
CFLAGS-$(CONFIG_MACH_SAMD51) += -mcpu=cortex-m4 -Ilib/samd51/samd51a/include
|
||||
CFLAGS-$(CONFIG_MACH_SAMD51) += -Ilib/same54/include
|
||||
CFLAGS-$(CONFIG_MACH_SAMD51) += -Ilib/samd51/samd51a/include
|
||||
CFLAGS-$(CONFIG_MACH_SAME51) += -Ilib/same51/include
|
||||
CFLAGS-$(CONFIG_MACH_SAMX5) += -mcpu=cortex-m4 -Ilib/same54/include
|
||||
CFLAGS += $(CFLAGS-y) -D__$(MCU)__ -mthumb -Ilib/cmsis-core
|
||||
|
||||
CFLAGS_klipper.elf += --specs=nano.specs --specs=nosys.specs
|
||||
|
@ -28,8 +29,8 @@ src-$(CONFIG_HAVE_SERCOM) += atsamd/sercom.c
|
|||
src-$(CONFIG_HAVE_GPIO_HARD_PWM) += atsamd/hard_pwm.c
|
||||
src-$(CONFIG_MACH_SAMD21) += atsamd/watchdog.c
|
||||
src-$(CONFIG_MACH_SAMD21) += atsamd/clock.c atsamd/timer.c generic/timer_irq.c
|
||||
src-$(CONFIG_MACH_SAMD51) += atsamd/samd51_watchdog.c
|
||||
src-$(CONFIG_MACH_SAMD51) += atsamd/samd51_clock.c generic/armcm_timer.c
|
||||
src-$(CONFIG_MACH_SAMX5) += atsamd/samd51_watchdog.c
|
||||
src-$(CONFIG_MACH_SAMX5) += atsamd/samd51_clock.c generic/armcm_timer.c
|
||||
|
||||
# Build the additional hex and bin output files
|
||||
target-y += $(OUT)klipper.bin $(OUT)klipper.elf.hex
|
||||
|
@ -48,7 +49,7 @@ lib/bossac/bin/bossac:
|
|||
$(Q)make -C lib/bossac bin/bossac
|
||||
|
||||
BOSSAC_OFFSET-$(CONFIG_MACH_SAMD21) := 0x2000
|
||||
BOSSAC_OFFSET-$(CONFIG_MACH_SAMD51) := 0x4000
|
||||
BOSSAC_OFFSET-$(CONFIG_MACH_SAMX5) := 0x4000
|
||||
|
||||
flash: $(OUT)klipper.bin lib/bossac/bin/bossac
|
||||
@echo " Flashing $< to $(FLASH_DEVICE)"
|
||||
|
|
|
@ -21,7 +21,7 @@ static const uint8_t adc_pins[] = {
|
|||
GPIO('B', 2), GPIO('B', 3), GPIO('B', 4), GPIO('B', 5), GPIO('B', 6),
|
||||
GPIO('B', 7), GPIO('A', 8), GPIO('A', 9), GPIO('A', 10), GPIO('A', 11)
|
||||
};
|
||||
#elif CONFIG_MACH_SAMD51
|
||||
#elif CONFIG_MACH_SAMX5
|
||||
|
||||
#define SAMD51_ADC_SYNC(ADC, BIT) \
|
||||
while(ADC->SYNCBUSY.reg & ADC_SYNCBUSY_ ## BIT)
|
||||
|
@ -53,7 +53,7 @@ static struct gpio_adc gpio_adc_pin_to_struct(uint8_t pin)
|
|||
}
|
||||
#if CONFIG_MACH_SAMD21
|
||||
Adc* reg = ADC;
|
||||
#elif CONFIG_MACH_SAMD51
|
||||
#elif CONFIG_MACH_SAMX5
|
||||
Adc* reg = (chan < 16 ? ADC0 : ADC1);
|
||||
chan %= 16;
|
||||
#endif
|
||||
|
@ -85,7 +85,7 @@ adc_init(void)
|
|||
ADC->SAMPCTRL.reg = 63;
|
||||
ADC->CTRLA.reg = ADC_CTRLA_ENABLE;
|
||||
|
||||
#elif CONFIG_MACH_SAMD51
|
||||
#elif CONFIG_MACH_SAMX5
|
||||
// Enable adc clock
|
||||
enable_pclock(ADC0_GCLK_ID, ID_ADC0);
|
||||
enable_pclock(ADC1_GCLK_ID, ID_ADC1);
|
||||
|
|
|
@ -46,7 +46,7 @@ gpio_peripheral(uint32_t gpio, char ptype, int32_t pull_up)
|
|||
#define NUM_PORT 2
|
||||
DECL_ENUMERATION_RANGE("pin", "PA0", GPIO('A', 0), 32);
|
||||
DECL_ENUMERATION_RANGE("pin", "PB0", GPIO('B', 0), 32);
|
||||
#elif CONFIG_MACH_SAMD51
|
||||
#elif CONFIG_MACH_SAMX5
|
||||
#define NUM_PORT 4
|
||||
DECL_ENUMERATION_RANGE("pin", "PA0", GPIO('A', 0), 32);
|
||||
DECL_ENUMERATION_RANGE("pin", "PB0", GPIO('B', 0), 32);
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
#include "samd21.h"
|
||||
#elif CONFIG_MACH_SAMD51
|
||||
#include "samd51.h"
|
||||
#elif CONFIG_MACH_SAME51
|
||||
#include "same51.h"
|
||||
#elif CONFIG_MACH_SAME54
|
||||
#include "same54.h"
|
||||
#endif
|
||||
|
||||
#define GPIO(PORT, NUM) (((PORT)-'A') * 32 + (NUM))
|
||||
|
|
|
@ -127,7 +127,7 @@ static const struct sercom_pad sercom_pads[] = {
|
|||
{ 5, GPIO('B', 3), 1, 'D'},
|
||||
{ 5, GPIO('B', 0), 2, 'D'},
|
||||
{ 5, GPIO('B', 1), 3, 'D'},
|
||||
#elif CONFIG_MACH_SAMD51
|
||||
#elif CONFIG_MACH_SAMX5
|
||||
{ 0, GPIO('A', 8), 0, 'C'},
|
||||
{ 0, GPIO('A', 9), 1, 'C'},
|
||||
{ 0, GPIO('A', 10), 2, 'C'},
|
||||
|
|
|
@ -61,7 +61,7 @@ serial_init(void)
|
|||
su->CTRLA.reg = areg | SERCOM_USART_CTRLA_ENABLE;
|
||||
#if CONFIG_MACH_SAMD21
|
||||
armcm_enable_irq(SERCOM0_Handler, SERCOM0_IRQn, 0);
|
||||
#elif CONFIG_MACH_SAMD51
|
||||
#elif CONFIG_MACH_SAMX5
|
||||
armcm_enable_irq(SERCOM0_Handler, SERCOM0_0_IRQn, 0);
|
||||
armcm_enable_irq(SERCOM0_Handler, SERCOM0_1_IRQn, 0);
|
||||
armcm_enable_irq(SERCOM0_Handler, SERCOM0_2_IRQn, 0);
|
||||
|
|
|
@ -181,7 +181,7 @@ bootloader_request(void)
|
|||
irq_disable();
|
||||
#if CONFIG_MACH_SAMD21
|
||||
writel((void*)0x20007FFC, 0x07738135);
|
||||
#elif CONFIG_MACH_SAMD51
|
||||
#elif CONFIG_MACH_SAMX5
|
||||
writel((void*)(HSRAM_ADDR + HSRAM_SIZE - 4), 0xf01669ef);
|
||||
#endif
|
||||
NVIC_SystemReset();
|
||||
|
@ -253,7 +253,7 @@ usbserial_init(void)
|
|||
USB->DEVICE.INTENSET.reg = USB_DEVICE_INTENSET_EORST;
|
||||
#if CONFIG_MACH_SAMD21
|
||||
armcm_enable_irq(USB_Handler, USB_IRQn, 1);
|
||||
#elif CONFIG_MACH_SAMD51
|
||||
#elif CONFIG_MACH_SAMX5
|
||||
armcm_enable_irq(USB_Handler, USB_0_IRQn, 1);
|
||||
armcm_enable_irq(USB_Handler, USB_1_IRQn, 1);
|
||||
armcm_enable_irq(USB_Handler, USB_2_IRQn, 1);
|
||||
|
|
Loading…
Reference in New Issue