Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

1. Kernel Driver Compilation

The C3V Linux working environment compiles NN drivers by default, with the default driver version being V6.4.15.9. If you want to configure the driver version, please refer to 1.1, otherwise please skip it.

1.1. Driver Version Configuration

To choose the NN driver, you can use the command “make kconfig”. After entering the kernel configuration menu, select the corresponding driver version. The path for driver configuration is as follows:

Device Drivers -> 
	Multimedia support -> 
  	Media drivers ->
    	ML Inference Processor VIP9000_NPU

Select the required driver version and use the command “make” to complete the Linux compilation process.

image-20240126-073030.png

1.2. Driver Power Management

If you need to enable the power management function of the NN driver, you need to set the parameter “powerManagement=1” when probing the galcore.ko module.

modprobe galcore powerManagement=1

You will see the kernel message like this:

[   29.498289] galcore f8140000.galcore: NPU get power success
[   29.498971] galcore f8140000.galcore: galcore irq number is 44
[   29.499073] galcore f8140000.galcore: NPU clock: 900000000
[   29.503967] Galcore version 6.4.15.9.700103
[   29.509197] galcore f8140000.galcore: _SetPower 0 0 enable
[   29.518719] galcore f8140000.galcore: regulator enable success
[   29.519415] galcore f8140000.galcore: NPU ISO disable
[   29.524477] galcore f8140000.galcore: NPU HW reset SMS
[   29.529566] galcore f8140000.galcore: NPU HW reset deassert
[   29.535127] galcore f8140000.galcore: NPU HW clock enable
[   29.540803] galcore f8140000.galcore: _SetPower enable ret=0
[   29.546162] galcore f8140000.galcore: NPU clock enable success
[   29.559172] galcore f8140000.galcore: NPU clock disable success
[   29.559227] galcore f8140000.galcore: _SetPower 0 0 disable
[   29.563427] galcore f8140000.galcore: NPU HW clock disabled
[   29.568980] galcore f8140000.galcore: NPU HW reset assert
[   29.574355] galcore f8140000.galcore: NPU ISO enable
[   29.579308] galcore f8140000.galcore: regulator disable success
[   29.585206] galcore f8140000.galcore: _SetPower disable ret=0

after galcore model probe, we can file galcore device in /dev/galcore

~ # ls /dev/galcore
/dev/galcore

2. VIP9000 SDK Usage

2.1. App Compilation

The VIP9000 SDK has been placed in the C3V Linux system directory. The path of VIP9000 SDK is: workspace/linux/rootfs/initramfs/prebuilt/vip9000sdk.

VIP9000 NPU Linux OVXLib files are in the path: /usr/lib64:

~ # ls /usr/lib64/
audit                       
libArchModelSw.so           
libBrokenLocale.so          
libCLC.so                   
libGAL.so                   
libNNArchPerf.so            
libNNGPUBinary.so           
libNNVXCBinary.so           
libOpenCL.so                
libOpenCL.so.1              
libOpenCL.so.3              
libOpenCL.so.3.0.0          
libOpenVX.so                
libOpenVX.so.1              
libOpenVX.so.1.3.0          
libOpenVXU.so               
libOvx12VXCBinary.so        
libOvxGPUVXCBinary.so      

When compiling NN related applicaiton, it is necessary to include SDK headers and libraries.

  • Example of SDK Include Path:

INCLUDES+=-I$(VIVANTE_SDK_DIR)/include/ \
          -I$(VIVANTE_SDK_DIR)/include/CL \
          -I$(VIVANTE_SDK_DIR)/include/VX \
          -I$(VIVANTE_SDK_DIR)/include/ovxlib \
          -I$(VIVANTE_SDK_DIR)/include/jpeg
  • Example of SDK Link Libraries:

LIBS+=-lOpenVX -lOpenVXU -lCLC -lVSC -lGAL -ljpeg -lovxlib

2.2. App Running

The location of the library files for the VIP9000 SDK in the C3V Linux system is /lib64. When executing NN related applications, it is necessary to specify the address of the SDK libraries:

export LD_LIBRARY_PATH=/lib64:$LD_LIBRARY_PATH
  • No labels