Skip to content

Commit f78317e

Browse files
soc: nxp: imxrt700: Add i.MXRT700 HiFi1 DSP support
The i.MX RT700 has an ultra-low power Sense Subsystem which includes an ARM Cortex-M33 and Cadence Tensilica HiFi 1 DSP. Here, we add support for the HiFi1 core. Signed-off-by: Iuliana Prodan <[email protected]>
1 parent a010677 commit f78317e

File tree

11 files changed

+687
-0
lines changed

11 files changed

+687
-0
lines changed

soc/nxp/imxrt/imxrt7xx/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ if(CONFIG_SOC_MIMXRT798S_CM33_CPU0 OR CONFIG_SOC_MIMXRT798S_CM33_CPU1)
88
add_subdirectory(cm33)
99
elseif(CONFIG_SOC_MIMXRT798S_HIFI4)
1010
add_subdirectory(hifi4)
11+
elseif(CONFIG_SOC_MIMXRT798S_HIFI1)
12+
add_subdirectory(hifi1)
1113
endif()

soc/nxp/imxrt/imxrt7xx/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ config SOC_MIMXRT798S_HIFI4
4848
select GEN_ISR_TABLES
4949
select HAS_MCUX
5050

51+
config SOC_MIMXRT798S_HIFI1
52+
select XTENSA
53+
select XTENSA_HAL if ("$(ZEPHYR_TOOLCHAIN_VARIANT)" != "xcc" && "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "xt-clang")
54+
select XTENSA_RESET_VECTOR
55+
select XTENSA_USE_CORE_CRT1
56+
select XTENSA_GEN_HANDLERS
57+
select XTENSA_SMALL_VECTOR_TABLE_ENTRY
58+
select GEN_ISR_TABLES
59+
select HAS_MCUX
60+
5161
if SOC_SERIES_IMXRT7XX
5262

5363
if NXP_IMXRT_BOOT_HEADER
@@ -65,5 +75,6 @@ config MCUX_CORE_SUFFIX
6575
default "_cm33_core0" if SOC_MIMXRT798S_CM33_CPU0
6676
default "_cm33_core1" if SOC_MIMXRT798S_CM33_CPU1
6777
default "_hifi4" if SOC_MIMXRT798S_HIFI4
78+
default "_hifi1" if SOC_MIMXRT798S_HIFI1
6879

6980
endif # SOC_SERIES_IMXRT7XX

soc/nxp/imxrt/imxrt7xx/Kconfig.defconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,25 @@ config NXP_IMXRT_BOOT_HEADER
5555
default n
5656

5757
endif # SOC_MIMXRT798S_HIFI4
58+
59+
if SOC_MIMXRT798S_HIFI1
60+
61+
config SYS_CLOCK_HW_CYCLES_PER_SEC
62+
default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency)
63+
64+
config XTENSA_TIMER
65+
default y
66+
67+
config GEN_IRQ_VECTOR_TABLE
68+
default n
69+
70+
config NXP_IMXRT_BOOT_HEADER
71+
default n
72+
73+
config XTENSA_CCOUNT_HZ
74+
default SYS_CLOCK_HW_CYCLES_PER_SEC
75+
76+
config SYS_CLOCK_TICKS_PER_SEC
77+
default 1000
78+
79+
endif # SOC_MIMXRT798S_HIFI1

soc/nxp/imxrt/imxrt7xx/Kconfig.soc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,16 @@ config SOC_MIMXRT798S_HIFI4
2929
help
3030
NXP i.MXRT7xx HiFi4 DSP Core
3131

32+
config SOC_MIMXRT798S_HIFI1
33+
bool
34+
select SOC_MIMXRT798S
35+
help
36+
NXP i.MXRT7xx HiFi1 DSP Core
37+
3238
config SOC_TOOLCHAIN_NAME
3339
string
3440
default "nxp_rt700_hifi4" if SOC_MIMXRT798S_HIFI4
41+
default "nxp_rt700_hifi1" if SOC_MIMXRT798S_HIFI1
3542

3643
config SOC_PART_NUMBER_MIMXRT798SGAWAR
3744
bool
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright 2024 NXP
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
8+
9+
set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld CACHE INTERNAL "")
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright 2024 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef __COMMON_DSP_CACHE_H__
8+
#define __COMMON_DSP_CACHE_H__
9+
10+
#include <xtensa/hal.h>
11+
12+
#endif
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright 2024 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef __INCLUDE_IO__
8+
#define __INCLUDE_IO__
9+
10+
#include <stdint.h>
11+
#include <soc/memory.h>
12+
#include <zephyr/sys/sys_io.h>
13+
#include <zephyr/arch/common/sys_io.h>
14+
15+
static inline uint32_t io_reg_read(uint32_t reg)
16+
{
17+
return sys_read32(reg);
18+
}
19+
20+
static inline void io_reg_write(uint32_t reg, uint32_t val)
21+
{
22+
sys_write32(val, reg);
23+
}
24+
25+
static inline void io_reg_update_bits(uint32_t reg, uint32_t mask, uint32_t value)
26+
{
27+
io_reg_write(reg, (io_reg_read(reg) & (~mask)) | (value & mask));
28+
}
29+
30+
static inline uint16_t io_reg_read16(uint32_t reg)
31+
{
32+
return sys_read16(reg);
33+
}
34+
35+
static inline void io_reg_write16(uint32_t reg, uint16_t val)
36+
{
37+
sys_write16(val, reg);
38+
}
39+
40+
#endif
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2024 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <string.h>
8+
#include <errno.h>
9+
10+
#include <zephyr/sys/sys_io.h>
11+
#include <dsp/cache.h>
12+
13+
#ifndef __INC_IMXRT_SOC_H
14+
#define __INC_IMXRT_SOC_H
15+
16+
/* Macros related to interrupt handling */
17+
#define XTENSA_IRQ_NUM_SHIFT 0
18+
#define XTENSA_IRQ_NUM_MASK 0xff
19+
20+
/*
21+
* IRQs are mapped on levels. 2nd, 3rd and 4th level are left as 0x00.
22+
*
23+
* 1. Peripheral Register bit offset.
24+
*/
25+
#define XTENSA_IRQ_NUMBER(_irq) ((_irq >> XTENSA_IRQ_NUM_SHIFT) & XTENSA_IRQ_NUM_MASK)
26+
27+
extern void z_soc_irq_enable(uint32_t irq);
28+
extern void z_soc_irq_disable(uint32_t irq);
29+
extern int z_soc_irq_is_enabled(unsigned int irq);
30+
31+
#endif /* __INC_IMXRT_SOC_H */
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright 2024 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef __XTENSA_MEMORY_H__
8+
#define __XTENSA_MEMORY_H__
9+
10+
#include <zephyr/autoconf.h>
11+
12+
#define IRAM_RESERVE_HEADER_SPACE 0x400
13+
14+
#define IRAM0_BASE 0x00580000
15+
#define IRAM0_SIZE 0x8000
16+
17+
#define IRAM1_BASE 0x00680000
18+
#define IRAM1_SIZE 0x80000
19+
20+
#define DRAM_BASE 0x20700000
21+
#define DRAM_SIZE 0x80000
22+
23+
/* The reset vector address in IRAM and its size. */
24+
#define XCHAL_RESET_VECTOR0_PADDR_IRAM IRAM0_BASE
25+
#define MEM_RESET_TEXT_SIZE (0x2E0)
26+
#define MEM_RESET_LIT_SIZE (0x120)
27+
28+
/* Base address of all interrupt vectors in IRAM. */
29+
#define XCHAL_VECBASE_RESET_PADDR_IRAM (IRAM0_BASE + IRAM_RESERVE_HEADER_SPACE)
30+
#define MEM_VECBASE_LIT_SIZE (0x178)
31+
/* Vector and literal sizes. */
32+
#define MEM_VECT_LIT_SIZE (0x4)
33+
#define MEM_VECT_TEXT_SIZE (0x1C)
34+
35+
/* Addresses of the interrupt vectors. */
36+
#define XCHAL_INT_VECTOR_ADDR(x) (XCHAL_VECBASE_RESET_PADDR_IRAM + (x))
37+
#define XCHAL_INTLEVEL2_VECTOR_PADDR_IRAM (XCHAL_INT_VECTOR_ADDR(0x17C))
38+
#define XCHAL_INTLEVEL3_VECTOR_PADDR_IRAM (XCHAL_INT_VECTOR_ADDR(0x19C))
39+
#define XCHAL_INTLEVEL4_VECTOR_PADDR_IRAM (XCHAL_INT_VECTOR_ADDR(0x1BC))
40+
#define XCHAL_INTLEVEL5_VECTOR_PADDR_IRAM (XCHAL_INT_VECTOR_ADDR(0x1DC))
41+
#define XCHAL_KERNEL_VECTOR_PADDR_IRAM (XCHAL_INT_VECTOR_ADDR(0x1FC))
42+
#define XCHAL_USER_VECTOR_PADDR_IRAM (XCHAL_INT_VECTOR_ADDR(0x21C))
43+
#define XCHAL_DOUBLEEXC_VECTOR_PADDR_IRAM (XCHAL_INT_VECTOR_ADDR(0x23C))
44+
45+
/* Location for the intList section which is later used to construct the
46+
* Interrupt Descriptor Table (IDT). This is a bogus address as this
47+
* section will be stripped off in the final image.
48+
*/
49+
#define IDT_BASE (IRAM0_BASE + IRAM0_SIZE)
50+
51+
/* Size of the Interrupt Descriptor Table (IDT). */
52+
#define IDT_SIZE (0x2000)
53+
54+
#endif

0 commit comments

Comments
 (0)