Skip to content

Commit f8b8545

Browse files
benpiccogalak
authored andcommitted
soc: atmel_sam0: Add SAMD51
This adds supoprt for the Atmel SAMD51 SoC. The SAME5x/SAMD5x is a line of Cortex-M4F MCUs that share peripherals with the sam0 Cortex-M0+ and saml1x Cortex-M23 parts. Signed-off-by: Benjamin Valentin <[email protected]>
1 parent 4cfd0fd commit f8b8545

File tree

7 files changed

+159
-0
lines changed

7 files changed

+159
-0
lines changed

soc/arm/atmel_sam0/common/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ zephyr_sources_ifdef(CONFIG_SOC_SERIES_SAMD20 soc_samd2x.c)
77
zephyr_sources_ifdef(CONFIG_SOC_SERIES_SAMD21 soc_samd2x.c)
88
zephyr_sources_ifdef(CONFIG_SOC_SERIES_SAMR21 soc_samd2x.c)
99

10+
zephyr_sources_ifdef(CONFIG_SOC_SERIES_SAMD51 soc_samd5x.c)
1011
zephyr_sources_ifdef(CONFIG_SOC_SERIES_SAME54 soc_samd5x.c)
1112

1213
zephyr_include_directories(.)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Kconfig - Atmel SAMD51 MCU series configuration options
2+
#
3+
# Copyright (c) 2019 ML!PA Consulting GmbH
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
if SOC_SERIES_SAMD51
7+
8+
config SOC_SERIES
9+
string
10+
default "samd51"
11+
12+
config SOC_PART_NUMBER
13+
string
14+
default "samd51g18a" if SOC_PART_NUMBER_SAMD51G18A
15+
default "samd51g19a" if SOC_PART_NUMBER_SAMD51G19A
16+
default "samd51j18a" if SOC_PART_NUMBER_SAMD51J18A
17+
default "samd51j19a" if SOC_PART_NUMBER_SAMD51J19A
18+
default "samd51j20a" if SOC_PART_NUMBER_SAMD51J20A
19+
default "samd51n19a" if SOC_PART_NUMBER_SAMD51N19A
20+
default "samd51n20a" if SOC_PART_NUMBER_SAMD51N20A
21+
default "samd51p19a" if SOC_PART_NUMBER_SAMD51P19A
22+
default "samd51p20a" if SOC_PART_NUMBER_SAMD51P20A
23+
24+
config NUM_IRQS
25+
int
26+
default 137
27+
28+
config SYS_CLOCK_HW_CYCLES_PER_SEC
29+
int
30+
default 120000000
31+
32+
endif # SOC_SERIES_SAMD51
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Kconfig - Atmel SAMD51 MCU series
2+
#
3+
# Copyright (c) 2019 ML!PA Consulting GmbH
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config SOC_SERIES_SAMD51
7+
bool "Atmel SAMD51 MCU"
8+
select CPU_CORTEX_M4
9+
select SOC_FAMILY_SAM0
10+
select CPU_CORTEX_M_HAS_SYSTICK
11+
select CPU_CORTEX_M_HAS_VTOR
12+
select ASF
13+
help
14+
Enable support for Atmel SAMD51 Cortex-M4F microcontrollers.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Kconfig - Atmel SAMD51 MCU series
2+
#
3+
# Copyright (c) 2019 ML!PA Consulting GmbH
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
choice
7+
prompt "Atmel SAMD51 MCU Selection"
8+
depends on SOC_SERIES_SAMD51
9+
10+
config SOC_PART_NUMBER_SAMD51G18A
11+
bool "SAMD51G18A"
12+
13+
config SOC_PART_NUMBER_SAMD51G19A
14+
bool "SAMD51G19A"
15+
16+
config SOC_PART_NUMBER_SAMD51J18A
17+
bool "SAMD51J18A"
18+
19+
config SOC_PART_NUMBER_SAMD51J19A
20+
bool "SAMD51J19A"
21+
22+
config SOC_PART_NUMBER_SAMD51J20A
23+
bool "SAMD51J20A"
24+
25+
config SOC_PART_NUMBER_SAMD51N19A
26+
bool "SAMD51N19A"
27+
28+
config SOC_PART_NUMBER_SAMD51N20A
29+
bool "SAMD51N20A"
30+
31+
config SOC_PART_NUMBER_SAMD51P19A
32+
bool "SAMD51P19A"
33+
34+
config SOC_PART_NUMBER_SAMD51P20A
35+
bool "SAMD51P20A"
36+
37+
endchoice
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright (c) 2019 ML!PA Consulting GmbH
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* SoC level DTS fixup file */
8+
9+
#define DT_FLASH_DEV_NAME DT_ATMEL_SAM0_NVMCTRL_0_LABEL
10+
11+
#define CONFIG_ENTROPY_NAME DT_ATMEL_SAM0_TRNG_0_LABEL
12+
13+
#define DT_NUM_IRQ_PRIO_BITS DT_ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
14+
15+
/* End of SoC Level DTS fixup file */
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* linker.ld - Linker command/script file */
2+
3+
/*
4+
* Copyright (c) 2017 Google LLC.
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
#include <arch/arm/cortex_m/scripts/linker.ld>

soc/arm/atmel_sam0/samd51/soc.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2019 ML!PA Consulting GmbH
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef _ATMEL_SAMD51_SOC_H_
8+
#define _ATMEL_SAMD51_SOC_H_
9+
10+
#ifndef _ASMLANGUAGE
11+
12+
#define DONT_USE_CMSIS_INIT
13+
14+
#include <zephyr/types.h>
15+
16+
#if defined(CONFIG_SOC_PART_NUMBER_SAMD51G18A)
17+
#include <samd51g18a.h>
18+
#elif defined(CONFIG_SOC_PART_NUMBER_SAMD51G19A)
19+
#include <samd51g19a.h>
20+
#elif defined(CONFIG_SOC_PART_NUMBER_SAMD51J18A)
21+
#include <samd51j18a.h>
22+
#elif defined(CONFIG_SOC_PART_NUMBER_SAMD51J19A)
23+
#include <samd51j19a.h>
24+
#elif defined(CONFIG_SOC_PART_NUMBER_SAMD51J20A)
25+
#include <samd51j20a.h>
26+
#elif defined(CONFIG_SOC_PART_NUMBER_SAMD51N19A)
27+
#include <samd51n19a.h>
28+
#elif defined(CONFIG_SOC_PART_NUMBER_SAMD51N20A)
29+
#include <samd51n20a.h>
30+
#elif defined(CONFIG_SOC_PART_NUMBER_SAMD51P19A)
31+
#include <samd51p19a.h>
32+
#elif defined(CONFIG_SOC_PART_NUMBER_SAMD51P20A)
33+
#include <samd51p20a.h>
34+
#else
35+
#error Library does not support the specified device.
36+
#endif
37+
38+
#endif /* _ASMLANGUAGE */
39+
40+
#include "sercom_fixup_samd5x.h"
41+
#include "tc_fixup_samd5x.h"
42+
43+
#define SOC_ATMEL_SAM0_OSC32K_FREQ_HZ 32768
44+
45+
/** Processor Clock (HCLK) Frequency */
46+
#define SOC_ATMEL_SAM0_HCLK_FREQ_HZ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
47+
/** Master Clock (MCK) Frequency */
48+
#define SOC_ATMEL_SAM0_MCK_FREQ_HZ SOC_ATMEL_SAM0_HCLK_FREQ_HZ
49+
#define SOC_ATMEL_SAM0_GCLK0_FREQ_HZ SOC_ATMEL_SAM0_MCK_FREQ_HZ
50+
#define SOC_ATMEL_SAM0_GCLK2_FREQ_HZ 48000000
51+
52+
#endif /* _ATMEL_SAMD51_SOC_H_ */

0 commit comments

Comments
 (0)