Hexagon architecture support#107122
Hexagon architecture support#107122androm3da wants to merge 9 commits intozephyrproject-rtos:mainfrom
Conversation
|
Sorry -- I realize it might be a bit premature to lump this into a single PR. I'll break it down into PRs for some of these commits that should land independently. I'll cut the hexagon-specific bits down into whatever size is suitable/reasonable for the community to accept at-a-time. |
|
The following west manifest projects have changed revision in this Pull Request:
✅ All manifest checks OK Note: This message is automatically posted and updated by the Manifest GitHub Action. |
Adding a description to the PR would be a good place to start. |
You're right -- thanks. Done. |
| #include <zephyr/arch/hexagon/arch.h> | ||
|
|
||
| /* Board-specific initialization */ | ||
| static int qemu_hexagon_init(void) |
| set(QEMU_FLAGS_${ARCH} | ||
| -machine virt | ||
| -m 4G | ||
| ) |
There was a problem hiding this comment.
misaliged bracket line 11, fix in whole PR
| CONFIG_LLVM_USE_ELD=y | ||
|
|
||
| # System configuration | ||
| CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000 |
There was a problem hiding this comment.
line 23 -> set in soc Kconfig.defconfig file and get from dt using dts functions
| CONFIG_SRAM_BASE_ADDRESS=0xa0000000 | ||
| CONFIG_PICOLIBC=y |
There was a problem hiding this comment.
these seem superfluous/wrong place
| # Memory configuration | ||
| CONFIG_MAIN_STACK_SIZE=2048 | ||
| CONFIG_IDLE_STACK_SIZE=2048 | ||
| CONFIG_ISR_STACK_SIZE=2048 | ||
| CONFIG_HEAP_MEM_POOL_SIZE=16384 |
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| check_set_linker_property(TARGET linker PROPERTY base | ||
| ${LINKERFLAGPREFIX},--gc-sections |
There was a problem hiding this comment.
misindentation, it is 2 spaces
|
|
||
| config SOC_SERIES | ||
| default "" if SOC_QEMU_HEXAGON_VIRT | ||
|
|
||
| config SOC_FAMILY | ||
| default "" if SOC_QEMU_HEXAGON_VIRT |
| # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
|
|
||
| config SOC_QEMU_HEXAGON_VIRT | ||
| bool "QEMU Hexagon Virtual Machine" |
There was a problem hiding this comment.
this is not valid for hwmv2
| void soc_early_init_hook(void) | ||
| { | ||
| /* SoC-specific early initialization */ | ||
| } |
| # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
|
|
||
| set(SUPPORTED_EMU_PLATFORMS qemu) | ||
|
|
There was a problem hiding this comment.
file to go unless line 4 is seen to be actually doing anything?
Add build system infrastructure for the Hexagon architecture port:
- arch/Kconfig, archs.yml: register hexagon in the arch list
- arch/hexagon/{CMakeLists.txt,Kconfig,defconfig}: top-level arch build
- arch/hexagon/core/{CMakeLists.txt,Kconfig}: core build and config
- arch/hexagon/core/offsets/offsets.c: kernel offset definitions
- soc/qemu/hexagon/{CMakeLists.txt,linker.ld}: SoC build and linker script
- include/zephyr/{linker,toolchain}: hexagon hooks for linker output
format and toolchain macros
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
Add public and private header files for the Hexagon architecture: Public API: - arch.h: architecture interface (IRQ locking, syscall, nop, etc.) - arch_inlines.h, error.h, exception.h, thread.h Private headers: - hexagon_vm.h: Hexagon VM operations and trap interfaces - irq.h, irq_connect.h: interrupt management - kernel_arch_data.h, kernel_arch_func.h: kernel integration - offsets_short_arch.h, thread_stack.h: thread/stack layout Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
Add the core runtime implementation for the Hexagon architecture: - hvm_event_vectors.S: HVM guest event vector base (GEVB) with reset, exception, trap0, and interrupt entry points - event_handlers.S: EVENT_ENTRY/EXIT macros for saving and restoring context on interrupt and exception entry - switch.S: arch_switch() context switch and thread start trampoline - irq_manage.c: interrupt dispatcher - intc.c: VM-based interrupt controller - cpu_idle.c: idle implementation using vmsetie with self-posted timer - vmsetie_cached.c: cached IE state tracking for nested irq_lock/unlock - thread.c: thread initialization with fake switch frames - tls.c: thread-local storage using UGP register - fatal.c: fatal error handling and exception dump - prep_c.c: early C entry point Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
Pass --no-default-config to both compile and link phases. The Hexagon cross-toolchain ships a hexagon-unknown-none-elf.cfg that clang auto-discovers. It injects -nostdlibinc and -isystem <picolibc> before command-line flags, causing picolibc headers to shadow Zephyr's minimal libc headers and breaking all CONFIG_MINIMAL_LIBC builds (ZRESTRICT undefined, conflicting types). With the default config suppressed, supply -nostdlibinc and the picolibc include path explicitly so include search order is correct regardless of libc selection. Note: clang >= 23 no longer leaks host /usr/include into the Hexagon target search path (see llvm/llvm-project#188824). Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
a819989 to
681e9f6
Compare
|



This patch series introduces architecture support for Qualcomm's Hexagon DSP processor to Zephyr.
The Hexagon architecture is a VLIW DSP architecture used in Qualcomm SoCs like SnapDragon and DragonWing. They're currently used for functions such as: Compute DSP / NPU, Audio DSP, Cellular modem, and more.
https://en.wikipedia.org/wiki/Qualcomm_Hexagon
For the sake of portability among DSP generations, we're creating a zephyr port that depends on the Hexagon Virtual Machine Specification. This is unfortunately unlike other architectures but perhaps strikes the best compromise for consistency's sake when new DSP generations make changes to the system architecture. This is the same approach we took for the linux kernel port to Hexagon.
The initial target is a QEMU-based virtual platform.
The Clang/LLVM and Rust/LLVM toolchains can target Hexagon. No modern gcc toolchain exists with support for Hexagon.