Commit b475e1fc authored by Siyuan Cheng's avatar Siyuan Cheng Committed by Carles Cufi
Browse files

zdsp: add ARC DSPLIB backend for zdsp



Introduce ARC DSPLIB backend zdsp library for ARC target.
Add agu and restrict attributes to map with ARC DSPLIB

Signed-off-by: default avatarSiyuan Cheng <siyuanc@synopsys.com>
parent a0db0699
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ optimized. The status of the various architectures can be found below:
============ =============
Architecture Status
============ =============
ARC          Unoptimized
ARC          Optimized
ARM          Optimized
ARM64        Optimized
MIPS         Unoptimized
@@ -46,11 +46,13 @@ Optimizing for your architecture

If your architecture is showing as ``Unoptimized``, it's possible to add a new
zDSP backend to better support it. To do that, a new Kconfig option should be
added to `subsys/dsp/Kconfig`_ along with the required dependencies and the
added to :file:`subsys/dsp/Kconfig` along with the required dependencies and the
``default`` set for ``DSP_BACKEND`` Kconfig choice.

Next, the implementation should be added at ``subsys/dsp/<backend>/`` and
linked in at `subsys/dsp/CMakeLists.txt`_.
linked in at :file:`subsys/dsp/CMakeLists.txt`. To add architecture-specific attributes,
its corresponding Kconfig option should be added to :file:`subsys/dsp/Kconfig` and use
them to update ``DSP_DATA`` and ``DSP_STATIC_DATA`` in :file:`include/zephyr/dsp/dsp.h`.

API Reference
*************
@@ -59,3 +61,4 @@ API Reference

.. _subsys/dsp/Kconfig: https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/dsp/Kconfig
.. _subsys/dsp/CMakeLists.txt: https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/dsp/CMakeLists.txt
.. _include/zephyr/dsp/dsp.h: https://github.com/zephyrproject-rtos/zephyr/blob/main/include/zephyr/dsp/dsp.h
+8 −0
Original line number Diff line number Diff line
@@ -17,9 +17,17 @@
#define DSP_FUNC_SCOPE
#endif

#ifdef CONFIG_DSP_BACKEND_HAS_AGU
#define DSP_DATA __agu
#else
#define DSP_DATA
#endif

#ifdef CONFIG_DSP_BACKEND_HAS_XDATA_SECTION
#define DSP_STATIC_DATA DSP_DATA __attribute__((section(".Xdata")))
#else
#define DSP_STATIC_DATA DSP_DATA
#endif

/**
 * @brief DSP Interface
+2 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ else()
			       -Xshift_assist -Xfpus_div -Xfpu_mac -Xfpuda -Xfpus_mpy_slow
			       -Xfpus_div_slow -Xbitstream -Xtimer0 -Xtimer1)

  zephyr_ld_option_ifdef(CONFIG_SOC_NSIM_EM11D -Hlib=em9d_nrg_fpusp -Hdsplib)

  if(CONFIG_SOC_NSIM_EM11D)
    set_property(GLOBAL PROPERTY z_arc_dsp_options -Xxy -Xagu_large -Hfxapi -Xdsp2
              -Xdsp_accshift=full -Xdsp_divsqrt=radix2 -Xdsp_complex -Xdsp_itu
+1 −0
Original line number Diff line number Diff line
@@ -2,3 +2,4 @@
# SPDX-License-Identifier: Apache-2.0

add_subdirectory_ifdef(CONFIG_DSP_BACKEND_CMSIS cmsis)
add_subdirectory_ifdef(CONFIG_DSP_BACKEND_ARCMWDT arcmwdt)
+18 −0
Original line number Diff line number Diff line
@@ -13,9 +13,16 @@ if DSP
config DSP_BACKEND_HAS_STATIC
	bool

config DSP_BACKEND_HAS_AGU
	bool

config DSP_BACKEND_HAS_XDATA_SECTION
	bool

choice DSP_BACKEND
	prompt "DSP library backend selection"
	default DSP_BACKEND_CMSIS if CMSIS_DSP
	default DSP_BACKEND_ARCMWDT if ARC && "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "arcmwdt"
	default DSP_BACKEND_CUSTOM

config DSP_BACKEND_CMSIS
@@ -32,6 +39,17 @@ config DSP_BACKEND_CUSTOM
	  Rely on the application to provide a custom DSP backend. The implementation should be
	  added to the 'zdsp' build target by the application or one of its modules.

config DSP_BACKEND_ARCMWDT
	bool "Use the mwdt library as the math backend"
	depends on ARCMWDT_LIBC
	depends on CMSIS_DSP
	select DSP_BACKEND_HAS_STATIC
	select DSP_BACKEND_HAS_AGU
	select DSP_BACKEND_HAS_XDATA_SECTION
	help
	  Implement the various zephyr DSP functions using the MWDT-DSP library. This feature
	  requires the MetaWare toolchain and CMSIS module to be selected.

endchoice

endif # DSP
Loading