diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 18adaad1..4088654f 100644 --- a/.github/workflows/build.yaml +++ b/.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 diff --git a/Examples/ARM/arm_bayes_example/arm_bayes_example_f32.c b/Examples/ARM/arm_bayes_example/arm_bayes_example_f32.c index 1be97d60..07678b28 100755 --- a/Examples/ARM/arm_bayes_example/arm_bayes_example_f32.c +++ b/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) diff --git a/Examples/ARM/arm_class_marks_example/arm_class_marks_example_f32.c b/Examples/ARM/arm_class_marks_example/arm_class_marks_example_f32.c index 1bc2ad18..fe35350f 100644 --- a/Examples/ARM/arm_class_marks_example/arm_class_marks_example_f32.c +++ b/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) diff --git a/Examples/ARM/arm_convolution_example/math_helper.c b/Examples/ARM/arm_convolution_example/math_helper.c index 950bf42b..426d566f 100644 --- a/Examples/ARM/arm_convolution_example/math_helper.c +++ b/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++) { diff --git a/Examples/ARM/arm_fir_example/math_helper.c b/Examples/ARM/arm_fir_example/math_helper.c index 950bf42b..426d566f 100644 --- a/Examples/ARM/arm_fir_example/math_helper.c +++ b/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++) { diff --git a/Examples/ARM/arm_graphic_equalizer_example/math_helper.c b/Examples/ARM/arm_graphic_equalizer_example/math_helper.c index 3d3cbe57..53a46aca 100644 --- a/Examples/ARM/arm_graphic_equalizer_example/math_helper.c +++ b/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++) { diff --git a/Examples/ARM/arm_linear_interp_example/math_helper.c b/Examples/ARM/arm_linear_interp_example/math_helper.c index fce27d25..9511a01e 100644 --- a/Examples/ARM/arm_linear_interp_example/math_helper.c +++ b/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++) { diff --git a/Examples/ARM/arm_matrix_example/math_helper.c b/Examples/ARM/arm_matrix_example/math_helper.c index f62043d6..42e34d96 100644 --- a/Examples/ARM/arm_matrix_example/math_helper.c +++ b/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++) { diff --git a/Examples/ARM/arm_signal_converge_example/math_helper.c b/Examples/ARM/arm_signal_converge_example/math_helper.c index c87c97d9..4426513d 100644 --- a/Examples/ARM/arm_signal_converge_example/math_helper.c +++ b/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++) { diff --git a/README.md b/README.md index 636ec8b0..29a52b71 100755 --- a/README.md +++ b/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 +#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. diff --git a/Scripts/git/gen_pack.sh b/Scripts/git/gen_pack.sh index 4979ff39..ea724982 100644 --- a/Scripts/git/gen_pack.sh +++ b/Scripts/git/gen_pack.sh @@ -184,7 +184,7 @@ last=$(grep -n "" ${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" diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt index 74f2c45d..a2919d6c 100644 --- a/Testing/CMakeLists.txt +++ b/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 "") diff --git a/Testing/configBoot.cmake b/Testing/configBoot.cmake index 8a6f8c53..8b227cfd 100644 --- a/Testing/configBoot.cmake +++ b/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() ################### diff --git a/Testing/configPlatform.cmake b/Testing/configPlatform.cmake index 76ae6217..ec2f561a 100644 --- a/Testing/configPlatform.cmake +++ b/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)