Przeglądaj źródła

application: switch to newlib_small for printf compatibility for demo_profiling

This change ensures that the profiling middleware works correctly since it
requires printf formatters (like %02) that are not supported in newlib_nano but
are available in newlib_small, mainly for terapines toolchain.

Additional comments were added to explain why this change is necessary and document
the optimization level setting for accurate profiling results.

Signed-off-by: Huaqi Fang <578567190@qq.com>
Huaqi Fang 5 dni temu
rodzic
commit
bcc00a2b98

+ 2 - 0
Components/profiling/README.md

@@ -1,5 +1,7 @@
 # Profiling and Coverage For Nuclei RISC-V CPU In Nuclei Studio IDE
 # Profiling and Coverage For Nuclei RISC-V CPU In Nuclei Studio IDE
 
 
+> **Note:** The profiling middleware uses `%02` format specifier in its printf statements. Ensure your C library supports this format.
+
 Profiling and coverage analysis tools like gprof and gcov play a vital role in identifying performance bottlenecks
 Profiling and coverage analysis tools like gprof and gcov play a vital role in identifying performance bottlenecks
 and untested regions within source code, ultimately leading to improved software efficiency and quality. 
 and untested regions within source code, ultimately leading to improved software efficiency and quality. 
 
 

+ 8 - 2
application/baremetal/demo_profiling/Makefile

@@ -1,7 +1,8 @@
-# Please use it in Nuclei Studio IDE not in command line
-# see https://doc.nucleisys.com/nuclei_sdk/design/app.html#demo-profiling
+# This demo is intended for use in Nuclei Studio IDE
+# For more information, visit: https://doc.nucleisys.com/nuclei_sdk/design/app.html#demo-profiling
 TARGET = demo_profiling
 TARGET = demo_profiling
 
 
+# Enable profiling middleware for this application
 MIDDLEWARE := profiling
 MIDDLEWARE := profiling
 
 
 NUCLEI_SDK_ROOT = ../../..
 NUCLEI_SDK_ROOT = ../../..
@@ -10,8 +11,13 @@ SRCDIRS = . src
 
 
 INCDIRS = . inc
 INCDIRS = . inc
 
 
+# Use newlib_small to ensure printf formatters (e.g., %02) work properly with profiling middleware
+# Note: newlib_nano does not support certain printf formatters used by the profiling middleware
+STDCLIB ?= newlib_small
+
 DOWNLOAD ?= sram
 DOWNLOAD ?= sram
 
 
+# Optimization level set to none for accurate profiling results
 COMMON_FLAGS := -O0
 COMMON_FLAGS := -O0
 
 
 include $(NUCLEI_SDK_ROOT)/Build/Makefile.base
 include $(NUCLEI_SDK_ROOT)/Build/Makefile.base

+ 2 - 0
application/baremetal/demo_profiling/npk.yml

@@ -32,6 +32,8 @@ configuration:
 setconfig:
 setconfig:
   - config: download_mode
   - config: download_mode
     value: sram
     value: sram
+  - config: stdclib
+    value: newlib_small
 
 
 ## Source Code Management
 ## Source Code Management
 codemanage:
 codemanage: