Jelajahi Sumber

doc: Add ECLICv2 support documentation

- Add ECLICv2 hardware feature support note in changelog.rst
- Document ECLICv2 support with hardware context auto-save in SoC section
- Add XLCFG_ECLIC=2 support documentation in evalsoc.rst
- Add new ECLICv2 Support section with configuration details and examples
- Include XLCFG_ECLIC and ECLIC_HWCTX make variable documentation

Signed-off-by: Huaqi Fang <578567190@qq.com>
Huaqi Fang 1 bulan lalu
induk
melakukan
de4510b1d7
2 mengubah file dengan 43 tambahan dan 0 penghapusan
  1. 5 0
      doc/source/changelog.rst
  2. 38 0
      doc/source/design/soc/evalsoc.rst

+ 5 - 0
doc/source/changelog.rst

@@ -10,6 +10,7 @@ V0.9.0-dev
 
     - Please use ``Nuclei Studio 2025.10`` with v0.9.0 and later version.
     - **Nuclei N100 series with ECLIC configured** are supported, see :ref:`N100 support limitation <n100_support_limitation>`
+    - ECLIC v2 hardware feature is supported, see :ref:`design_soc_evalsoc_eclicv2`
 
 This is release version of ``0.9.0`` of Nuclei SDK, which is still under development.
 
@@ -18,6 +19,7 @@ This is release version of ``0.9.0`` of Nuclei SDK, which is still under develop
   - Change ``core_feature_pmp.h`` to support more PMP entries, changed from 16 to 64 now
   - Enable __LD/__SD macro when Zilsd extension present for rv32 in ``core_feature_base.h``
   - Add comments for updating ECLIC threshold MTH setting recommendations in ``core_feature_eclic.h``
+  - Add ECLICv2 related CSR and bit macros in ``riscv_encoding.h`` to support ECLICv2 hardware context auto-save feature
   - Fix **HDBG** bit position in SysTimer **MTIMECTL** from 4 to 3 in ``core_feature_timer.h``
   - Add **MTIME_SRC** bit position and update SRW control handling in ``core_feature_timer.h``
   - Add new field mapping of ``CSR_MTLBCFGINFO_Type`` CSR structure in ``core_feature_base.h``
@@ -62,6 +64,7 @@ This is release version of ``0.9.0`` of Nuclei SDK, which is still under develop
   - Mention about other RTOSs Nuclei supported, but not in Nuclei SDK, see :ref:`design_rtos_others`
   - Add support for **ThreadX SMP** kernel support for both Nuclei RISC-V RV32 and RV64 CPU with ECLIC feature enabled.
   - Fix issue where ``tx_thread_run_count`` was not incremented during task switches and initial task creation in the ThreadX kernel.
+  - Add ECLICv2 hardware context auto-save support for all RTOS including FreeRTOS, RT-Thread, ThreadX and UCOSII when ``ECLIC_HWCTX=1`` and ``XLCFG_ECLIC=2``
 
 * Build System
 
@@ -83,6 +86,8 @@ This is release version of ``0.9.0`` of Nuclei SDK, which is still under develop
   - Enable ``IC_CANCEL_EN`` in mcache_ctl when I-Cache present by default to prevent I-cache pipeline stalls on branch misprediction
   - Optimize evalsoc startup code for n100 cpu since n100 dont have many cpu features, so many initialization can be simplified
   - Add ``__CPU_PA_SIZE`` macro to identify the Physical Address size (PASIZE).
+  - Add ECLICv2 support with hardware context auto-save feature in evalsoc, including conditional compilation guards and ECLIC version definitions
+  - Add ``XLCFG_ECLIC=2`` support in evalsoc to enable ECLICv2 configuration, see :ref:`design_soc_evalsoc_eclicv2`
 
 * Documentation
 

+ 38 - 0
doc/source/design/soc/evalsoc.rst

@@ -100,6 +100,8 @@ Extra make variables supported only in this SoC and used internally only by Nucl
   * **QEMU_CPU_EXTOPT** is used to pass extra options to Nuclei Qemu ``-cpu`` cpu options for evalsoc,
     please dont pass any extra ``,`` to this make variable, you can pass such as ``QEMU_CPU_EXTOPT=vlen=512`` but
     not pass ``QEMU_CPU_EXTOPT=,vlen=512``
+  * **XLCFG_ECLIC**: it is used to control ECLIC configuration, when ``XLCFG_ECLIC=0`` it will undefine ``CFG_HAS_CLIC``, when ``XLCFG_ECLIC=1`` it will define ``CFG_HAS_CLIC``, and when ``XLCFG_ECLIC=2`` it will define both ``CFG_HAS_ECLICV2`` and ``CFG_HAS_CLIC`` for ECLICv2 support, introduced in 0.9.0 release.
+  * **ECLIC_HWCTX**: it is used to enable ECLIC hardware context auto-save feature, when ``ECLIC_HWCTX=1`` it will define ``ECLIC_HW_CTX_AUTO`` macro, introduced in 0.9.0 release.
 
 .. code-block:: shell
 
@@ -111,5 +113,41 @@ Extra make variables supported only in this SoC and used internally only by Nucl
     make SOC=evalsoc clean
     make SOC=evalsoc all
 
+.. _design_soc_evalsoc_eclicv2:
+
+ECLICv2 Support
+---------------
+
+Starting from version 0.9.0, Nuclei EvalSoC provides support for ECLICv2 with hardware context auto-save feature.
+
+**Features:**
+
+* Hardware context auto-save/restore for non-vector interrupt and exception handlers
+* Automatic task stack pointer switching
+* Support for both M-mode and S-mode operation
+* Conditional compilation for backward compatibility
+
+**Configuration:**
+
+To enable ECLICv2 support with hardware context auto-save:
+
+* **MUST**: Nuclei RISC-V CPU must have ECLICv2 feature configured
+* Set ``XLCFG_ECLIC=2`` to enable ECLICv2 configuration or ``cpufeature.h`` contains ``CFG_HAS_ECLICV2`` macro
+* Set ``ECLIC_HWCTX=1`` to enable hardware context auto-save feature
+* When both options are enabled, the hardware will automatically save/restore context and handle stack pointer switching
+
+**Example:**
+
+.. code-block:: shell
+
+    # Enable ECLICv2 with hardware context auto-save
+    # eg. you are running on Nuclei N300 RISC-V CPU with ECLICv2 feature present
+    # Test baremetal eclic v2 auto-save/restore feature, trap sp auto switch not enabled
+    cd application/baremetal/demo_eclic
+    # Test freertos eclic v2 auto-save/restore feature, trap sp auto switch enabled, since interrupt/exception need seperated stack besides task stack
+    # cd application/freertos/demo
+    make SOC=evalsoc CORE=n300 XLCFG_ECLIC=2 ECLIC_HWCTX=1 clean
+    make SOC=evalsoc CORE=n300 XLCFG_ECLIC=2 ECLIC_HWCTX=1 all
+
 
 .. _Nuclei: https://nucleisys.com/