Skip to content

Commit 29fa81f

Browse files
author
Andrew Boie
committed
Merge remote-tracking branch 'origin/core'
Adds support for Xtensa architecture. Andrew Boie (24): xtensa: fixup license identifiers xtensa: fix find_msb_set() and find_lsb_set() xcc: add location of C++ compiler Makefile: test for -fno-asynchronous-unwind-tables xtensa: Makefile: cleanup xtensa_sim_console: remove deprecation warning xt-run: delete any stale fifos to avoid mkfifo error xt-sim: enable use of xtensa simulator with 'make run' sanitycheck: don't disable tryrun xt-run: fix sanitycheck communication REVERTME: disable xip test on xtensa xt-sim: add support for 'make debug' xt-run: don't leave dead emulator processes lying around xcc: add ccache support legacy: work around XCC issue in MDEF threads xtensa: cleanup fatal error handling xtensa: fix build warning if no coprocessors present xtensa: remove nonexistent offset REVERTME: cpp_synchronization: disable on Xtensa REVERTME: tests: stackprot: disable on xtensa sanitycheck: fix defconfig regex sanitycheck: only disable tryrun when using SDK xtensa: fix numerous checkpatch issues REVERTME: tests: crypto: disable on Xtensa Max Filippov (1): xtensa: support 'make qemu' target Mazen NEIFER (62): Xtensa port: Started port to for Xtensa cores family. Xtensa port: Added board config files for Xtensa simulator paltform Xtensa port: Added support for XCC, the Cadence Systems Inc compiler Xtensa port: Added kernel arch dependent structs and functions. Xtensa port: Added Xtensa header generic files. Xtensa port: Fixed typo in XCC toochain specific make file. Xtensa port: Added Xtensa specific include files. Xtensa port: Added support for Xtensa cores in toolchain/gcc.h. Xtensa port: Added support in arch/cpu.h for Xtensa cores. Xtensa port: Remove XCC warning about unrecognized CLI option. Xtensa port: Added fields offset support for kernel and thread structures. Xtensa port: Added Kbuild file for Xtensa arch. Xtensa port: Added support for Xtensa architecture in zephyr include files. Xtensa port: Added support for Xtensa architecture to linker-defs.h. Xtensa port: Removed the need to put an empy file soc.c in arch/xtensa/soc dir. Xtensa port: Added Xtensa internal timer configuration need by assembly files. Xtensa port: Added support for Xtensa simulator console driver. Xtensa port: Added Xtensa specific code (C + S) files. Xtensa port: Fixed tests/kernel/context to compile with Xtensa internal timer. Xtensa port: Enable long calls for Xtensa vector table. Xtensa port: Moved XCC specific libraries out of genric Xtensa make file. Xtensa port: Added linker script for several Xtensa cores. Xtensa port: Define __builtin_unreachable() as CLI macro when using XCC. Xtensa port: Changed simulation support with xt-run/xtsc-run to be qemu like. Xtensa port: Fixed assembly comments to be accurate with code. Changed Kbuild to pass also KBUILD_CPPFLAGS to CC on addition to KBUILD_CFLAGS. Xtensa port: Added support for Xtensa internal timer as system timer. Xtensa port: Replaced call to legacy sys_thread_self_get by one to k_current_get Xtensa port: _thread_entry shall use call4 to start the thread. Xtensa port: Let xcc specific make file override unsupported -Og with -O0. Xtensa port: Removed compiler warnings about printf formats/arguments mismatch. Xtensa port: Added missing initalization of thread base sturct in _new_thread. Xtensa port: Removed warnings related to function _NanoFatalErrorHandler. Xtensa port: Fixed Swap function not updating _kernel.current. Xtensa port: Fixed RAMABLE_REGION in linker scripts. sanitycheck: support other simulators (xt-run and/or xtsc) than QEMU. gitignore: Ignore Eclipse (Xtensa Xplorer) project files. Xtensa port: Fixed function setting Sawp return value. Xtensa port: Enable console when building for Xtensa simulator as board. Fixed compilation error caused by bad initialization of unamed union field. Xtensa port: Increased idle thread stack size to avoid stack overflow. Xtensa port: Removed duplicate file and renamed to sys_io.h as other platforms. Xtensa port: Fixed linker script for hifi_mini core. Xtensa port: Use directly assmebler and linker instead of via the compiler. sanitycheck: Fixed displayed log when current directory is a symbolic link. Xtensa port: Removed duplicate code and fixed update of current thread pointer. Xtensa port: Restore interrupted context the same way as premption resume. Xtensa port: Moved coprocessor stack area on bottom of stack, just after TCS. Xtensa port: xt*-run requires options to be passed before file to be ran. Xtensa port: Set Swap function result to -EAGAIN. Xtensa port: Removed unsupported c++ flags cuasing xt-c++ to throw an error. Xtensa port: Connect Xtensa timer to tick IRQ in legacy test_context. Xtensa port: Fixed memory corruption in interrupt handler exit function. Xtensa port: Fixed defintion of MAX_HEAP_SIZE, thus, compilation of new_lib. Xtensa port: Added support for sample_controller core and set is as default. Xtensa port: Fixed scheduling bug caused to missing Endianess related macros. Xtensa port: Prevent preemption of locked threads. Xtensa port: Fixed compilation errors caused by last rebase on master. Xtensa port: Fixed Xtensa timer in case of tickles idle. tests: Introduced new config option to add extra stack size for tests. xtensa port: Added arch .ini file to support xt-sim Xtensa port: Removed trailing spaces and unused macros. Reformatted comments. .gitignore | 3 + Kbuild | 2 +- Makefile | 16 +- arch/Kconfig | 4 + arch/xtensa/Kbuild | 12 + arch/xtensa/Kconfig | 81 + arch/xtensa/Makefile | 41 + arch/xtensa/core/Makefile | 18 + arch/xtensa/core/atomic.S | 405 ++++ arch/xtensa/core/cpu_idle.c | 39 + arch/xtensa/core/crt1-boards.S | 271 +++ arch/xtensa/core/crt1-sim.S | 246 ++ arch/xtensa/core/fatal.c | 242 ++ arch/xtensa/core/irq_manage.c | 38 + arch/xtensa/core/irq_offload.c | 39 + arch/xtensa/core/offsets/Makefile | 1 + arch/xtensa/core/offsets/offsets.c | 65 + arch/xtensa/core/startup/Makefile | 2 + arch/xtensa/core/startup/reset-vector.S | 695 ++++++ arch/xtensa/core/sw_isr_table.S | 59 + arch/xtensa/core/swap.S | 96 + arch/xtensa/core/thread.c | 179 ++ arch/xtensa/core/xt_zephyr.S | 388 ++++ arch/xtensa/core/xtensa_context.S | 609 +++++ arch/xtensa/core/xtensa_intr.c | 69 + arch/xtensa/core/xtensa_intr_asm.S | 140 ++ arch/xtensa/core/xtensa_vectors.S | 1887 ++++++++++++++++ arch/xtensa/include/kernel_arch_data.h | 195 ++ arch/xtensa/include/kernel_arch_func.h | 94 + .../include/kernel_event_logger_arch.h | 36 + arch/xtensa/include/offsets_short_arch.h | 40 + arch/xtensa/include/start_task_arch.h | 37 + arch/xtensa/include/xtensa_api.h | 73 + arch/xtensa/include/xtensa_config.h | 141 ++ arch/xtensa/include/xtensa_context.h | 314 +++ arch/xtensa/include/xtensa_rtos.h | 202 ++ arch/xtensa/include/xtensa_timer.h | 149 ++ arch/xtensa/soc/D_108mini/Kconfig | 12 + arch/xtensa/soc/D_108mini/Makefile | 1 + arch/xtensa/soc/D_108mini/linker.ld | 606 +++++ arch/xtensa/soc/D_212GP/Kconfig | 12 + arch/xtensa/soc/D_212GP/Makefile | 1 + arch/xtensa/soc/D_212GP/linker.ld | 612 +++++ arch/xtensa/soc/D_233L/Kconfig | 12 + arch/xtensa/soc/D_233L/Makefile | 3 + arch/xtensa/soc/D_233L/linker.ld | 513 +++++ arch/xtensa/soc/Kconfig.cores | 62 + arch/xtensa/soc/XRC_D2PM/Kconfig | 12 + arch/xtensa/soc/XRC_D2PM/Makefile | 1 + arch/xtensa/soc/XRC_D2PM/linker.ld | 616 +++++ arch/xtensa/soc/XRC_D2PM_5swIrq/Kconfig | 12 + arch/xtensa/soc/XRC_D2PM_5swIrq/Makefile | 1 + arch/xtensa/soc/XRC_D2PM_5swIrq/linker.ld | 616 +++++ .../xtensa/soc/XRC_FUSION_AON_ALL_LM/Kconfig | 12 + .../soc/XRC_FUSION_AON_ALL_LM/Makefile | 1 + .../soc/XRC_FUSION_AON_ALL_LM/linker.ld | 445 ++++ arch/xtensa/soc/hifi2_std/Kconfig | 12 + arch/xtensa/soc/hifi2_std/Makefile | 1 + arch/xtensa/soc/hifi2_std/linker.ld | 616 +++++ arch/xtensa/soc/hifi3_bd5/Kconfig | 12 + arch/xtensa/soc/hifi3_bd5/Makefile | 1 + arch/xtensa/soc/hifi3_bd5/linker.ld | 392 ++++ arch/xtensa/soc/hifi3_bd5_call0/Kconfig | 12 + arch/xtensa/soc/hifi3_bd5_call0/Makefile | 1 + arch/xtensa/soc/hifi3_bd5_call0/linker.ld | 392 ++++ arch/xtensa/soc/hifi4_bd7/Kconfig | 12 + arch/xtensa/soc/hifi4_bd7/Makefile | 1 + arch/xtensa/soc/hifi4_bd7/linker.ld | 439 ++++ arch/xtensa/soc/hifi_mini/Kconfig | 12 + arch/xtensa/soc/hifi_mini/Makefile | 1 + arch/xtensa/soc/hifi_mini/linker.ld | 364 +++ arch/xtensa/soc/hifi_mini_4swIrq/Kconfig | 12 + arch/xtensa/soc/hifi_mini_4swIrq/Makefile | 1 + arch/xtensa/soc/hifi_mini_4swIrq/linker.ld | 364 +++ arch/xtensa/soc/sample_controller/Kconfig | 12 + arch/xtensa/soc/sample_controller/Makefile | 1 + arch/xtensa/soc/sample_controller/linker.ld | 606 +++++ boards/xtensa/xt-sim/Kconfig | 12 + boards/xtensa/xt-sim/Kconfig.board | 8 + boards/xtensa/xt-sim/Kconfig.defconfig | 11 + boards/xtensa/xt-sim/Makefile | 5 + boards/xtensa/xt-sim/Makefile.board | 4 + boards/xtensa/xt-sim/board.c | 4 + boards/xtensa/xt-sim/board.h | 10 + boards/xtensa/xt-sim/xt-sim_defconfig | 4 + drivers/console/Kconfig | 19 +- drivers/console/Makefile | 1 + drivers/console/xtensa_sim_console.c | 86 + drivers/timer/Kconfig | 43 + drivers/timer/Makefile | 2 + drivers/timer/xtensa_sys_timer.c | 351 +++ include/arch/cpu.h | 2 + include/arch/xtensa/addr_types.h | 15 + include/arch/xtensa/arch.h | 144 ++ include/arch/xtensa/exc.h | 45 + include/arch/xtensa/offsets.h | 11 + include/arch/xtensa/sys_io.h | 113 + include/arch/xtensa/xtensa_irq.h | 54 + include/kernel.h | 4 +- include/legacy.h | 2 +- include/linker-defs.h | 2 + include/linker-tool-gcc.h | 2 + include/toolchain/common.h | 4 +- include/toolchain/gcc.h | 5 +- kernel/Kconfig | 1 + lib/libc/newlib/libc-hooks.c | 3 + .../microkernel/testcase.ini | 1 + .../nanokernel/testcase.ini | 1 + scripts/Makefile.toolchain.xcc | 104 + scripts/Makefile.xt-run | 32 + scripts/Makefile.xtsc-run | 51 + scripts/sanity_chk/arches/xtensa.ini | 7 + scripts/sanitycheck | 9 +- scripts/support/xt-gdb.sh | 23 + scripts/waitpid | 5 + tests/Kconfig | 5 + tests/crypto/test_aes/testcase.ini | 2 + tests/crypto/test_ctr_prng/testcase.ini | 2 + tests/crypto/test_ecc_dh/testcase.ini | 2 + tests/kernel/context/src/context.c | 5 +- .../test_fifo_api/src/test_fifo_contexts.c | 2 +- .../fifo/test_fifo_api/src/test_fifo_loop.c | 2 +- .../test_lifo_api/src/test_lifo_contexts.c | 2 +- .../lifo/test_lifo_api/src/test_lifo_loop.c | 2 +- .../kernel/mbox/mbox_api/src/test_mbox_api.c | 2 +- .../src/test_mpool_threadsafe.c | 2 +- tests/kernel/stackprot/testcase.ini | 2 +- .../cdata_api/src/test_customdata_api.c | 2 +- .../src/test_threads_cancel_abort.c | 2 +- .../lifecycle_api/src/test_threads_spawn.c | 2 +- .../src/test_threads_suspend_resume.c | 2 +- .../schedule_api/src/test_sched.h | 2 +- tests/kernel/xip/testcase.ini | 2 + .../legacy/kernel/test_context/src/context.c | 7 +- .../kernel/test_sema/nanokernel/src/sema.c | 4 +- tests/legacy/kernel/test_sleep/src/sleep.c | 4 +- .../test_stackprot/microkernel/testcase.ini | 2 +- 137 files changed, 14962 insertions(+), 39 deletions(-) create mode 100644 arch/xtensa/Kbuild create mode 100644 arch/xtensa/Kconfig create mode 100644 arch/xtensa/Makefile create mode 100644 arch/xtensa/core/Makefile create mode 100644 arch/xtensa/core/atomic.S create mode 100644 arch/xtensa/core/cpu_idle.c create mode 100644 arch/xtensa/core/crt1-boards.S create mode 100644 arch/xtensa/core/crt1-sim.S create mode 100644 arch/xtensa/core/fatal.c create mode 100644 arch/xtensa/core/irq_manage.c create mode 100644 arch/xtensa/core/irq_offload.c create mode 100644 arch/xtensa/core/offsets/Makefile create mode 100644 arch/xtensa/core/offsets/offsets.c create mode 100644 arch/xtensa/core/startup/Makefile create mode 100644 arch/xtensa/core/startup/reset-vector.S create mode 100644 arch/xtensa/core/sw_isr_table.S create mode 100644 arch/xtensa/core/swap.S create mode 100644 arch/xtensa/core/thread.c create mode 100644 arch/xtensa/core/xt_zephyr.S create mode 100644 arch/xtensa/core/xtensa_context.S create mode 100644 arch/xtensa/core/xtensa_intr.c create mode 100644 arch/xtensa/core/xtensa_intr_asm.S create mode 100644 arch/xtensa/core/xtensa_vectors.S create mode 100644 arch/xtensa/include/kernel_arch_data.h create mode 100644 arch/xtensa/include/kernel_arch_func.h create mode 100644 arch/xtensa/include/kernel_event_logger_arch.h create mode 100644 arch/xtensa/include/offsets_short_arch.h create mode 100644 arch/xtensa/include/start_task_arch.h create mode 100644 arch/xtensa/include/xtensa_api.h create mode 100644 arch/xtensa/include/xtensa_config.h create mode 100644 arch/xtensa/include/xtensa_context.h create mode 100644 arch/xtensa/include/xtensa_rtos.h create mode 100644 arch/xtensa/include/xtensa_timer.h create mode 100644 arch/xtensa/soc/D_108mini/Kconfig create mode 100644 arch/xtensa/soc/D_108mini/Makefile create mode 100644 arch/xtensa/soc/D_108mini/linker.ld create mode 100644 arch/xtensa/soc/D_212GP/Kconfig create mode 100644 arch/xtensa/soc/D_212GP/Makefile create mode 100644 arch/xtensa/soc/D_212GP/linker.ld create mode 100644 arch/xtensa/soc/D_233L/Kconfig create mode 100644 arch/xtensa/soc/D_233L/Makefile create mode 100644 arch/xtensa/soc/D_233L/linker.ld create mode 100644 arch/xtensa/soc/Kconfig.cores create mode 100644 arch/xtensa/soc/XRC_D2PM/Kconfig create mode 100644 arch/xtensa/soc/XRC_D2PM/Makefile create mode 100644 arch/xtensa/soc/XRC_D2PM/linker.ld create mode 100644 arch/xtensa/soc/XRC_D2PM_5swIrq/Kconfig create mode 100644 arch/xtensa/soc/XRC_D2PM_5swIrq/Makefile create mode 100644 arch/xtensa/soc/XRC_D2PM_5swIrq/linker.ld create mode 100644 arch/xtensa/soc/XRC_FUSION_AON_ALL_LM/Kconfig create mode 100644 arch/xtensa/soc/XRC_FUSION_AON_ALL_LM/Makefile create mode 100644 arch/xtensa/soc/XRC_FUSION_AON_ALL_LM/linker.ld create mode 100644 arch/xtensa/soc/hifi2_std/Kconfig create mode 100644 arch/xtensa/soc/hifi2_std/Makefile create mode 100644 arch/xtensa/soc/hifi2_std/linker.ld create mode 100644 arch/xtensa/soc/hifi3_bd5/Kconfig create mode 100644 arch/xtensa/soc/hifi3_bd5/Makefile create mode 100644 arch/xtensa/soc/hifi3_bd5/linker.ld create mode 100644 arch/xtensa/soc/hifi3_bd5_call0/Kconfig create mode 100644 arch/xtensa/soc/hifi3_bd5_call0/Makefile create mode 100644 arch/xtensa/soc/hifi3_bd5_call0/linker.ld create mode 100644 arch/xtensa/soc/hifi4_bd7/Kconfig create mode 100644 arch/xtensa/soc/hifi4_bd7/Makefile create mode 100644 arch/xtensa/soc/hifi4_bd7/linker.ld create mode 100644 arch/xtensa/soc/hifi_mini/Kconfig create mode 100644 arch/xtensa/soc/hifi_mini/Makefile create mode 100644 arch/xtensa/soc/hifi_mini/linker.ld create mode 100644 arch/xtensa/soc/hifi_mini_4swIrq/Kconfig create mode 100644 arch/xtensa/soc/hifi_mini_4swIrq/Makefile create mode 100644 arch/xtensa/soc/hifi_mini_4swIrq/linker.ld create mode 100644 arch/xtensa/soc/sample_controller/Kconfig create mode 100644 arch/xtensa/soc/sample_controller/Makefile create mode 100644 arch/xtensa/soc/sample_controller/linker.ld create mode 100644 boards/xtensa/xt-sim/Kconfig create mode 100644 boards/xtensa/xt-sim/Kconfig.board create mode 100644 boards/xtensa/xt-sim/Kconfig.defconfig create mode 100644 boards/xtensa/xt-sim/Makefile create mode 100644 boards/xtensa/xt-sim/Makefile.board create mode 100644 boards/xtensa/xt-sim/board.c create mode 100644 boards/xtensa/xt-sim/board.h create mode 100644 boards/xtensa/xt-sim/xt-sim_defconfig create mode 100644 drivers/console/xtensa_sim_console.c create mode 100644 drivers/timer/xtensa_sys_timer.c create mode 100644 include/arch/xtensa/addr_types.h create mode 100644 include/arch/xtensa/arch.h create mode 100644 include/arch/xtensa/exc.h create mode 100644 include/arch/xtensa/offsets.h create mode 100644 include/arch/xtensa/sys_io.h create mode 100644 include/arch/xtensa/xtensa_irq.h create mode 100644 scripts/Makefile.toolchain.xcc create mode 100644 scripts/Makefile.xt-run create mode 100644 scripts/Makefile.xtsc-run create mode 100644 scripts/sanity_chk/arches/xtensa.ini create mode 100644 scripts/support/xt-gdb.sh create mode 100755 scripts/waitpid Change-Id: I666a35e30526bcc6d57cc95ac5381abaec0ca0a5 Signed-off-by: Andrew Boie <[email protected]>
2 parents 0c87784 + da7864e commit 29fa81f

File tree

137 files changed

+14962
-39
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+14962
-39
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ scripts/grub
3131
doc/reference/kconfig/CONFIG_*
3232
doc/reference/kconfig/index.rst
3333
tags
34+
.project
35+
.cproject
36+
.xxproject

Kbuild

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ define rule_cc_o_c_1
9090
$(call echo-cmd,cc_o_c_1) $(cmd_cc_o_c_1);
9191
endef
9292

93-
cmd_cc_o_c_1 = $(CC) $(KBUILD_CFLAGS) $(ZEPHYRINCLUDE) -c -o $@ $<
93+
cmd_cc_o_c_1 = $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(ZEPHYRINCLUDE) -c -o $@ $<
9494

9595
arch/$(ARCH)/core/offsets/offsets.o: arch/$(ARCH)/core/offsets/offsets.c $(KCONFIG_CONFIG) \
9696
include/generated/generated_dts_board.h

Makefile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@ ZEPHYRINCLUDE = \
376376
KBUILD_CPPFLAGS := -DKERNEL -D__ZEPHYR__=1
377377

378378
KBUILD_CFLAGS := -c -g -std=c99 \
379-
-fno-asynchronous-unwind-tables \
380379
-Wall \
381380
-Wformat \
382381
-Wformat-security \
@@ -595,6 +594,12 @@ drivers-y := drivers/
595594
ARCH = $(subst $(DQUOTE),,$(CONFIG_ARCH))
596595
export ARCH
597596

597+
ifeq ($(CONFIG_DEBUG),y)
598+
KBUILD_CFLAGS += -Og
599+
else
600+
KBUILD_CFLAGS += -Os
601+
endif
602+
598603
ifdef ZEPHYR_GCC_VARIANT
599604
include $(srctree)/scripts/Makefile.toolchain.$(ZEPHYR_GCC_VARIANT)
600605
else
@@ -632,11 +637,8 @@ KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
632637
$(call cc-option,-fno-partial-inlining)
633638
endif
634639

635-
ifeq ($(CONFIG_DEBUG),y)
636-
KBUILD_CFLAGS += -Og
637-
else
638-
KBUILD_CFLAGS += -Os
639-
endif
640+
# Some GCC variants don't support these
641+
KBUILD_CFLAGS += $(call cc-option,-fno-asynchronous-unwind-tables,)
640642

641643
ifeq ($(CONFIG_STACK_CANARIES),y)
642644
KBUILD_CFLAGS += $(call cc-option,-fstack-protector-all,)
@@ -683,8 +685,10 @@ else
683685
# Use make W=1 to enable this warning (see scripts/Makefile.build)
684686
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
685687
KBUILD_CFLAGS += $(call cc-option,-fno-reorder-functions)
688+
ifneq (${ZEPHYR_GCC_VARIANT},xcc)
686689
KBUILD_CFLAGS += $(call cc-option,-fno-defer-pop)
687690
endif
691+
endif
688692

689693
# We trigger additional mismatches with less inlining
690694
ifdef CONFIG_DEBUG_SECTION_MISMATCH

arch/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#
44
# Copyright (c) 2014-2015 Wind River Systems, Inc.
55
# Copyright (c) 2015 Intel Corporation
6+
# Copyright (c) 2016 Cadence Design Systems, Inc.
67
#
78
# SPDX-License-Identifier: Apache-2.0
89
#
@@ -29,6 +30,9 @@ config NIOS2
2930
config RISCV32
3031
bool "RISCV32 architecture"
3132

33+
config XTENSA
34+
bool "Xtensa architecture"
35+
3236
endchoice
3337

3438
#

arch/xtensa/Kbuild

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
subdir-ccflags-y +=-I$(srctree)/include/drivers
2+
subdir-ccflags-y +=-I$(srctree)/drivers
3+
subdir-asflags-y := ${subdir-ccflags-y}
4+
5+
ifneq ($(SOC_FAMILY),)
6+
obj-y += soc/$(SOC_FAMILY)/
7+
else
8+
obj-y += soc/$(SOC_PATH)/
9+
endif
10+
11+
obj-y += core/
12+
obj-y += core/startup/

arch/xtensa/Kconfig

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Kconfig - XTENSA architecture configuration options
2+
#
3+
# Copyright (c) 2016 Cadence Design Systems, Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
choice
7+
prompt "XTENSA core Selection"
8+
default sample_controller
9+
depends on XTENSA
10+
11+
source "arch/xtensa/soc/Kconfig.cores"
12+
endchoice
13+
14+
menu "XTENSA Options"
15+
depends on XTENSA
16+
17+
config ARCH
18+
default "xtensa"
19+
20+
config SYS_CLOCK_HW_CYCLES_PER_SEC
21+
int
22+
prompt "Hardware clock cycles per second, 2000000 for ISS"
23+
default 2000000
24+
range 1000000 1000000000
25+
help
26+
This option specifies hardware clock.
27+
28+
config XTENSA_NO_IPC
29+
bool "Core has no IPC support"
30+
select ATOMIC_OPERATIONS_C
31+
default n
32+
help
33+
Uncheck this if you core does not implment "SCOMPARE1" register and "s32c1i"
34+
isntruction.
35+
36+
config SW_ISR_TABLE
37+
bool
38+
prompt "Enable software interrupt handler table"
39+
default y
40+
help
41+
Enable an interrupt handler table implemented in software. This
42+
table, unlike ISRs connected directly in the vector table, allow
43+
a parameter to be passed to the interrupt handlers. Also, invoking
44+
the exeception/interrupt exit stub is automatically done.
45+
This has to be enabled for dynamically connecting interrupt handlers
46+
at runtime (SW_ISR_TABLE_DYNAMIC).
47+
48+
config IRQ_OFFLOAD
49+
bool "Enable IRQ offload"
50+
default n
51+
help
52+
Enable irq_offload() API which allows functions to be synchronously
53+
run in interrupt context. Uses one entry in the IDT. Mainly useful
54+
for test cases.
55+
56+
config SW_ISR_TABLE_DYNAMIC
57+
bool
58+
prompt "Allow installing interrupt handlers at runtime"
59+
depends on SW_ISR_TABLE
60+
default n
61+
help
62+
This option enables irq_connect_dynamic(). It moves the ISR table to
63+
SRAM so that it is writable. This has the side-effect of removing
64+
write-protection on the ISR table.
65+
66+
menu "Specific core configuration"
67+
68+
config IRQ_OFFLOAD_INTNUM
69+
int
70+
prompt "IRQ offload SW interrupt index"
71+
help
72+
The index of the software interrupt to be used for IRQ offload.
73+
74+
Please note that in order for IRQ offload to work correctly the selected
75+
interrupt shall have its priority shall not exceed XCHAL_EXCM_LEVEL.
76+
77+
source "arch/xtensa/soc/*/Kconfig"
78+
79+
endmenu
80+
81+
endmenu

arch/xtensa/Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
SOC_PATH=${XTENSA_CORE}
2+
export SOC_PATH
3+
4+
flagBoardType=
5+
ifeq ($(CONFIG_BOARD_XTENSA),y)
6+
flagBoardType= -DXT_BOARD
7+
endif
8+
ifeq ($(CONFIG_SIMULATOR_XTENSA),y)
9+
flagBoardType= -DXT_SIMULATOR
10+
endif
11+
12+
# XCC emits an annoying warning if this is used even though the
13+
# $(call cc-option,) test in toplevel Makefile passes.
14+
KBUILD_CFLAGS := $(filter-out -fno-omit-frame-pointer, \
15+
${KBUILD_CFLAGS})
16+
17+
# Put functions and data in their own binary sections so that ld can
18+
# garbage collect them
19+
KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) \
20+
$(call cc-option,-fdata-sections,)
21+
22+
KBUILD_AFLAGS += $(flagBoardType)
23+
KBUILD_CFLAGS += -DPROC_$(XTENSA_CORE) \
24+
-DCONFIG_$(XTENSA_CORE) \
25+
$(flagBoardType) \
26+
$(call cc-option,-fms-extensions,)
27+
28+
include $(srctree)/arch/$(ARCH)/core/Makefile
29+
include $(srctree)/arch/$(ARCH)/soc/$(SOC_PATH)/Makefile
30+
31+
cflags-$(CONFIG_LTO) += $(call cc-option,-flto,)
32+
33+
KBUILD_CFLAGS += $(cflags-y)
34+
KBUILD_CXXFLAGS += $(cflags-y)
35+
36+
QEMU_CPU_TYPE_xtensa ?= unsupported
37+
QEMU_FLAGS_xtensa = -cpu $(QEMU_CPU_TYPE_xtensa) \
38+
-machine sim -semihosting -nographic
39+
QEMU_xtensa = qemu-system-xtensa
40+
41+
export QEMU_FLAGS_xtensa QEMU_xtensa

arch/xtensa/core/Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
ccflags-y += -I$(srctree)/kernel/unified/include
2+
asflags-y += -I$(srctree)/kernel/unified/include --longcalls
3+
4+
ifdef CONFIG_ATOMIC_OPERATIONS_C
5+
# Use C routines from kernel/nanokernel/atomic.c
6+
obj-atomic=
7+
else
8+
# Use our own routines implmented in assembly
9+
obj-atomic=atomic.o
10+
endif
11+
obj-y = ${obj-atomic} cpu_idle.o fatal.o \
12+
swap.o thread.o xt_zephyr.o xtensa_context.o xtensa_intr_asm.o \
13+
xtensa_intr.o xtensa_vectors.o irq_manage.o
14+
obj-$(CONFIG_IRQ_OFFLOAD) += irq_offload.o
15+
obj-$(CONFIG_SIMULATOR_XTENSA) += crt1-sim.o
16+
obj-$(CONFIG_BOARD_XTENSA) += crt1-boards.o
17+
# Keep this last so that vague linking works
18+
obj-y += sw_isr_table.o

0 commit comments

Comments
 (0)