Răsfoiți Sursa

README improvements.

Example improvement.
cmake improvement.
github workflow tuning.
Christophe Favergeon 3 ani în urmă
părinte
comite
0db91786e9

+ 1 - 1
.github/workflows/build.yaml

@@ -111,7 +111,7 @@ jobs:
       - name: Publish documentation
         if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
         run: |
-          rm -r main
+          rm -rf main
           mkdir main
           cd main
           tar -xvjf /tmp/doc.tbz2

+ 3 - 0
Examples/ARM/arm_bayes_example/arm_bayes_example_f32.c

@@ -112,6 +112,7 @@ int32_t main(void)
 
 #if defined(SEMIHOSTING)
   printf("Class = %d\n", index);
+  printf("Max proba = %f\n", (double)maxProba);
 #endif
 
   in[0] = -1.5f;
@@ -123,6 +124,7 @@ int32_t main(void)
 
 #if defined(SEMIHOSTING)
   printf("Class = %d\n", index);
+  printf("Max proba = %f\n", (double)maxProba);
 #endif
 
   in[0] = 0.0f;
@@ -134,6 +136,7 @@ int32_t main(void)
 
 #if defined(SEMIHOSTING)
   printf("Class = %d\n", index);
+  printf("Max proba = %f\n", (double)maxProba);
 #endif
 
 #if !defined(SEMIHOSTING)

+ 1 - 1
Examples/ARM/arm_class_marks_example/arm_class_marks_example_f32.c

@@ -212,7 +212,7 @@ int32_t main()
   arm_var_f32(testOutput, numStudents, &var);
 
 #if defined(SEMIHOSTING)
-  printf("mean = %f, std = %f\n",mean,std);
+  printf("mean = %f, std = %f\n",(double)mean,(double)std);
 #endif
 
 #if !defined(SEMIHOSTING)

+ 3 - 3
Examples/ARM/arm_convolution_example/math_helper.c

@@ -100,7 +100,7 @@ float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
     }
 
 
-  SNR = 10 * log10 (EnergySignal / EnergyError);
+  SNR = 10 * (float32_t)log10 ((double)EnergySignal / (double)EnergyError);
 
   return (SNR);
 
@@ -167,7 +167,7 @@ uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
 {
   uint32_t i;
   int32_t diff, diffCrnt = 0;
-  uint32_t maxDiff = 0;
+  int32_t maxDiff = 0;
 
   for (i = 0; i < numSamples; i++)
   {
@@ -195,7 +195,7 @@ uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t * pOut, uint32_t numSamples)
 {
   uint32_t i;
   int32_t diff, diffCrnt = 0;
-  uint32_t maxDiff = 0;
+  int32_t maxDiff = 0;
 
   for (i = 0; i < numSamples; i++)
   {

+ 3 - 3
Examples/ARM/arm_fir_example/math_helper.c

@@ -100,7 +100,7 @@ float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
     }
 
 
-  SNR = 10 * log10 (EnergySignal / EnergyError);
+  SNR = 10 * (float32_t)log10 ((double)EnergySignal / (double)EnergyError);
 
   return (SNR);
 
@@ -167,7 +167,7 @@ uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
 {
   uint32_t i;
   int32_t diff, diffCrnt = 0;
-  uint32_t maxDiff = 0;
+  int32_t maxDiff = 0;
 
   for (i = 0; i < numSamples; i++)
   {
@@ -195,7 +195,7 @@ uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t * pOut, uint32_t numSamples)
 {
   uint32_t i;
   int32_t diff, diffCrnt = 0;
-  uint32_t maxDiff = 0;
+  int32_t maxDiff = 0;
 
   for (i = 0; i < numSamples; i++)
   {

+ 3 - 3
Examples/ARM/arm_graphic_equalizer_example/math_helper.c

@@ -100,7 +100,7 @@ float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
     }
 
 
-  SNR = 10 * log10 (EnergySignal / EnergyError);
+  SNR = 10 * (float32_t)log10 ((double)EnergySignal / (double)EnergyError);
 
   return (SNR);
 
@@ -167,7 +167,7 @@ uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
 {
   uint32_t i;
   int32_t diff, diffCrnt = 0;
-  uint32_t maxDiff = 0;
+  int32_t maxDiff = 0;
 
   for (i = 0; i < numSamples; i++)
   {
@@ -195,7 +195,7 @@ uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t * pOut, uint32_t numSamples)
 {
   uint32_t i;
   int32_t diff, diffCrnt = 0;
-  uint32_t maxDiff = 0;
+  int32_t maxDiff = 0;
 
   for (i = 0; i < numSamples; i++)
   {

+ 3 - 3
Examples/ARM/arm_linear_interp_example/math_helper.c

@@ -100,7 +100,7 @@ float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
     }
 
 
-  SNR = 10 * log10 (EnergySignal / EnergyError);
+  SNR = 10 * (float32_t)log10 ((double)EnergySignal / (double)EnergyError);
 
   return (SNR);
 
@@ -167,7 +167,7 @@ uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
 {
   uint32_t i;
   int32_t diff, diffCrnt = 0;
-  uint32_t maxDiff = 0;
+  int32_t maxDiff = 0;
 
   for (i = 0; i < numSamples; i++)
   {
@@ -195,7 +195,7 @@ uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t * pOut, uint32_t numSamples)
 {
   uint32_t i;
   int32_t diff, diffCrnt = 0;
-  uint32_t maxDiff = 0;
+  int32_t maxDiff = 0;
 
   for (i = 0; i < numSamples; i++)
   {

+ 3 - 3
Examples/ARM/arm_matrix_example/math_helper.c

@@ -100,7 +100,7 @@ float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
     }
 
 
-  SNR = 10 * log10 (EnergySignal / EnergyError);
+  SNR = 10 * (float32_t)log10 ((double)EnergySignal / (double)EnergyError);
 
   return (SNR);
 
@@ -167,7 +167,7 @@ uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
 {
   uint32_t i;
   int32_t diff, diffCrnt = 0;
-  uint32_t maxDiff = 0;
+  int32_t maxDiff = 0;
 
   for (i = 0; i < numSamples; i++)
   {
@@ -195,7 +195,7 @@ uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t * pOut, uint32_t numSamples)
 {
   uint32_t i;
   int32_t diff, diffCrnt = 0;
-  uint32_t maxDiff = 0;
+  int32_t maxDiff = 0;
 
   for (i = 0; i < numSamples; i++)
   {

+ 3 - 3
Examples/ARM/arm_signal_converge_example/math_helper.c

@@ -100,7 +100,7 @@ float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
     }
 
 
-  SNR = 10 * log10 (EnergySignal / EnergyError);
+  SNR = 10 * (float32_t)log10 ((double)EnergySignal / (double)EnergyError);
 
   return (SNR);
 
@@ -167,7 +167,7 @@ uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
 {
   uint32_t i;
   int32_t diff, diffCrnt = 0;
-  uint32_t maxDiff = 0;
+  int32_t maxDiff = 0;
 
   for (i = 0; i < numSamples; i++)
   {
@@ -195,7 +195,7 @@ uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t * pOut, uint32_t numSamples)
 {
   uint32_t i;
   int32_t diff, diffCrnt = 0;
-  uint32_t maxDiff = 0;
+  int32_t maxDiff = 0;
 
   for (i = 0; i < numSamples; i++)
   {

+ 35 - 5
README.md

@@ -102,7 +102,7 @@ project (testcmsisdsp VERSION 0.1)
 add_subdirectory(${CMSISDSP}/Source bin_dsp)
 ```
 
-CMSIS-DSP is dependent on the CMSIS Core includes. So, you should use a `target_include_directories` to define where the `CMSIS_5\CMSIS\Core\Include` is located. Or you can also define `CMSISCORE` on the cmake command line.
+CMSIS-DSP is dependent on the CMSIS Core includes. So, you should use a `target_include_directories` to define where the `CMSIS_5\CMSIS\Core\Include` is located. Or you can also define `CMSISCORE` on the cmake command line. The path used will be `${CMSISCORE}\Include`.
 
 You should also set the compilation options to use to build the library.
 
@@ -157,7 +157,7 @@ cmake -DHOST=YES \
 
 Building examples with cmake is similar to building only the CMSIS-DSP library but in addition to that we also rely on the CMSIS-DSP test framework for the boot code.
 
-In addition to the `CMSIS` variable, the variable `CMSISDSPFOLDER` must also be defined.
+In addition to the `CMSIS` variable, the variable `CMSISDSP` must also be defined.
 
 `Examples/CMakeLists.txt` can be used to build all the examples.
 
@@ -172,7 +172,7 @@ cmake -DLOOPUNROLL=ON \
       -DCMAKE_PREFIX_PATH="path to compiler" \
       -DCMAKE_TOOLCHAIN_FILE=../../Testing/armac6.cmake \
       -DCMSIS="path_to_cmsis" \
-      -DCMSISDSPFOLDER="path_to_cmsisdsp" \
+      -DCMSISDSP="path_to_cmsisdsp" \
       -DARM_CPU="cortex-m55" \
       -DPLATFORM="FVP" \
       -DHELIUM=ON \
@@ -191,10 +191,40 @@ cmake -DLOOPUNROLL=ON \
       -DBAYES=ON \
       -DDISTANCE=ON \
       -DINTERPOLATION=ON \
-      -G "Unix Makefiles" "../ARM"
+      -G "Unix Makefiles" ".."
 ```
 
-### Building 
+If you want `printf` to be enabled in the examples, you should also define `-DSEMIHOSTING`
+
+### How to build for aarch64
+
+The intrinsics defined in `Core_A/Include` are not available on recent Cortex-A processors.
+
+But you can still build for those Cortex-A cores and benefit from the Neon intrinsics.
+
+You need to build with `-D__GNUC_PYTHON__` on the compiler command line. This flag was introduced for building the Python wrapper and is disabling the use of CMSIS Core includes.
+
+When this flag is enabled, CMSIS-DSP is defining a few macros used in the library for compiler portability:
+
+```C
+#include <stdint.h>
+#define  __ALIGNED(x) __attribute__((aligned(x)))
+#define __STATIC_FORCEINLINE static inline __attribute__((always_inline)) 
+#define __STATIC_INLINE static inline
+```
+
+If the compiler you are using is requiring different definitions, you can add them to `arm_math_types.h` in the `Include` folder of the library. MSVC and XCode are already supported and in those case, you don't need to define `-D__GNUC_PYTHON`__
+
+Then, you need to define `-DARM_MATH_NEON`
+
+For cmake the equivalent options are:
+
+* -DHOST=ON
+* -DNEON=ON
+
+cmake is automatically including the ComputeLibrary folder. If you are using a different build, you need to include this folder too.
+
+### Launching the build
 
 Once cmake has generated the makefiles, you can use a GNU Make to build.
 

+ 1 - 1
Scripts/git/gen_pack.sh

@@ -184,7 +184,7 @@ last=$(grep -n "</releases>" ${PACK_VENDOR}.${PACK_NAME}.pdsc | cut -d: -f1)
 let first-=1
 let last+=1
 head -n ${first} "./${PACK_VENDOR}.${PACK_NAME}.pdsc" > "${PACK_BUILD}/${PACK_VENDOR}.${PACK_NAME}.pdsc"
-/bin/bash "${CHANGELOG}" -p -f pdsc 2>/dev/null | sed "s/^/  /" >> "${PACK_BUILD}/${PACK_VENDOR}.${PACK_NAME}.pdsc"
+/bin/bash "${CHANGELOG}" -f pdsc 2>/dev/null | sed "s/^/  /" >> "${PACK_BUILD}/${PACK_VENDOR}.${PACK_NAME}.pdsc"
 tail -n +${last} "./${PACK_VENDOR}.${PACK_NAME}.pdsc" | \
   sed -e "s/Cversion=\"[^\"]*\"/Cversion=\"${VERSION}\"/" >> "${PACK_BUILD}/${PACK_VENDOR}.${PACK_NAME}.pdsc"
 

+ 3 - 1
Testing/CMakeLists.txt

@@ -4,7 +4,9 @@ include(CMakePrintHelpers)
 
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
-set(CMSISDSPFOLDER "${CMAKE_CURRENT_SOURCE_DIR}/..")
+if (NOT (DEFINED CMSISDSP))
+set(CMSISDSP "${CMAKE_CURRENT_SOURCE_DIR}/..")
+endif()
 
 function(writeConfig path)
   set(output "")

+ 1 - 1
Testing/configBoot.cmake

@@ -55,7 +55,7 @@ endfunction()
 
 function(configboot PROJECT_NAME)
 
-  target_include_directories(${PROJECT_NAME} PRIVATE ${CMSIS}/CMSIS/DSP/Include)
+  target_include_directories(${PROJECT_NAME} PRIVATE ${CMSISDSP}/Include)
   set_platform_core()
 
   ###################

+ 1 - 1
Testing/configPlatform.cmake

@@ -1,6 +1,6 @@
 option(SEMIHOSTING "Test trace using printf" OFF)
 
-set(PLATFORMS "${CMSISDSPFOLDER}/Testing/Platforms")
+set(PLATFORMS "${CMSISDSP}/Testing/Platforms")
 
 if (PLATFORM STREQUAL "FVP")
 SET(PLATFORMFOLDER ${PLATFORMS}/FVP)