soc: Add the MAX32690 SoC

Added ADI MAX series soc, first partnumber is MAX32690
The family structure will be
ADI_MAX
  MAX32xxx
    MAX32655
      MAX32655EVKIT
      MAX32655FTHR
    MAX32666
      MAX32666FTHR
      MAX32666FTHR2
    MAX32690
      MAX32690EVKIT
  MAX78xxx
    MAX78000
    MAX78002
        ...

When MAX32 MCUs goes to sleep mode debugger could not access it
and flashing fails, ARM_ON_ENTER_CPU_IDLE_HOOK prevent
the CPU from actually entering sleep
by skipping the WFE/WFI instruction.
Due to ARM_ON_ENTER_CPU_IDLE_HOOK is not configurable at the user
space, added a config wrapper as MAX32_ON_ENTER_CPU_IDLE_HOOK.

If MAX32_ON_ENTER_CPU_IDLE_HOOK config being defined (default y)
devicei will not goes to sleep mode in idle state.

To disable it add below line in your configuration file
CONFIG_MAX32_ON_ENTER_CPU_IDLE_HOOK=n

MAX32690 has two core Cortex-M4 and Risc-V this commit adds M4 core
support.

Co-authored-by: Jason Murphy <jason.murphy@analog.com>
Signed-off-by: Sadik Ozer <sadik.ozer@analog.com>
This commit is contained in:
Sadik Ozer 2023-10-13 16:23:57 +03:00 committed by Henrik Brix Andersen
commit d33d5b3a79
11 changed files with 1208 additions and 0 deletions

View file

@ -0,0 +1,8 @@
# Copyright (c) 2023-2024 Analog Devices, Inc.
# SPDX-License-Identifier: Apache-2.0
zephyr_include_directories(${ZEPHYR_BASE}/drivers)
zephyr_include_directories(common)
zephyr_sources(soc.c)
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "")

29
soc/adi/max32/Kconfig Normal file
View file

@ -0,0 +1,29 @@
# Analog Devices MAX32xxx MCU family
# Copyright (c) 2023-2024 Analog Devices, Inc.
# SPDX-License-Identifier: Apache-2.0
config SOC_FAMILY_MAX32
select ARM
select CPU_HAS_ARM_MPU
select CPU_HAS_FPU
select CPU_CORTEX_M_HAS_SYSTICK
select CLOCK_CONTROL
select BUILD_OUTPUT_HEX
config SOC_MAX32690
select CPU_CORTEX_M4
if SOC_FAMILY_MAX32
config MAX32_ON_ENTER_CPU_IDLE_HOOK
bool "CPU idle hook enable"
default y
imply ARM_ON_ENTER_CPU_IDLE_HOOK
help
Enables a hook (z_arm_on_enter_cpu_idle()) that is called when
the CPU is made idle (by k_cpu_idle() or k_cpu_atomic_idle()).
If needed, this hook can be used to prevent the CPU from actually
entering sleep by skipping the WFE/WFI instruction.
endif # SOC_FAMILY_MAX32

View file

@ -0,0 +1,13 @@
# Analog Devices MAX32xxx MCU family
# Copyright (c) 2023-2024 Analog Devices, Inc.
# SPDX-License-Identifier: Apache-2.0
if SOC_FAMILY_MAX32
rsource "Kconfig.defconfig.max32*"
config SRAM_VECTOR_TABLE
default y
endif # SOC_FAMILY_MAX32

View file

@ -0,0 +1,14 @@
# Analog Devices MAX32690 MCU
# Copyright (c) 2023-2024 Analog Devices, Inc.
# SPDX-License-Identifier: Apache-2.0
if SOC_MAX32690
config SYS_CLOCK_HW_CYCLES_PER_SEC
default $(dt_node_int_prop_int,/clocks/clk_ipo,clock-frequency)
config NUM_IRQS
default 112
endif # SOC_MAX32690

21
soc/adi/max32/Kconfig.soc Normal file
View file

@ -0,0 +1,21 @@
# Analog Devices MAX32xxx MCU family
# Copyright (c) 2023-2024 Analog Devices, Inc.
# SPDX-License-Identifier: Apache-2.0
config SOC_FAMILY_MAX32
bool
config SOC_FAMILY
default "max32" if SOC_FAMILY_MAX32
config SOC_MAX32690
bool
select SOC_FAMILY_MAX32
config SOC_MAX32690_M4
bool
select SOC_MAX32690
config SOC
default "max32690" if SOC_MAX32690

41
soc/adi/max32/soc.c Normal file
View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 2023-2024 Analog Devices, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief System/hardware module for MAX32xxx MCUs
*/
#include <zephyr/device.h>
#include <zephyr/init.h>
#include <wrap_max32_sys.h>
#if defined(CONFIG_MAX32_ON_ENTER_CPU_IDLE_HOOK)
bool z_arm_on_enter_cpu_idle(void)
{
/* Returning false prevent device goes to sleep mode */
return false;
}
#endif
/**
* @brief Perform basic hardware initialization at boot.
*
* This needs to be run from the very beginning.
* So the init priority has to be 0 (zero).
*
* @return 0
*/
static int max32xxx_init(void)
{
/* Apply device related preinit configuration */
max32xx_system_init();
return 0;
}
SYS_INIT(max32xxx_init, PRE_KERNEL_1, 0);

17
soc/adi/max32/soc.h Normal file
View file

@ -0,0 +1,17 @@
/*
* Copyright (c) 2023-2024 Analog Devices, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file SoC configuration macros for the MAX32xxx family processors.
*
*/
#ifndef _MAX32_SOC_H_
#define _MAX32_SOC_H_
#include <wrap_max32xxx.h>
#endif /* _MAX32_SOC_H_ */

9
soc/adi/max32/soc.yml Normal file
View file

@ -0,0 +1,9 @@
# Copyright (c) 2023-2024 Analog Devices, Inc.
# SPDX-License-Identifier: Apache-2.0
family:
- name: max32
socs:
- name: max32690
cpuclusters:
- name: m4