README improvements.

Example improvement.
cmake improvement.
github workflow tuning.
pull/19/head
Christophe Favergeon 4 years ago
parent ca7fa852f5
commit 0db91786e9

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

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

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

@ -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); return (SNR);
@ -167,7 +167,7 @@ uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
{ {
uint32_t i; uint32_t i;
int32_t diff, diffCrnt = 0; int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0; int32_t maxDiff = 0;
for (i = 0; i < numSamples; i++) 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; uint32_t i;
int32_t diff, diffCrnt = 0; int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0; int32_t maxDiff = 0;
for (i = 0; i < numSamples; i++) for (i = 0; i < numSamples; i++)
{ {

@ -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); return (SNR);
@ -167,7 +167,7 @@ uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
{ {
uint32_t i; uint32_t i;
int32_t diff, diffCrnt = 0; int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0; int32_t maxDiff = 0;
for (i = 0; i < numSamples; i++) 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; uint32_t i;
int32_t diff, diffCrnt = 0; int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0; int32_t maxDiff = 0;
for (i = 0; i < numSamples; i++) for (i = 0; i < numSamples; i++)
{ {

@ -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); return (SNR);
@ -167,7 +167,7 @@ uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
{ {
uint32_t i; uint32_t i;
int32_t diff, diffCrnt = 0; int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0; int32_t maxDiff = 0;
for (i = 0; i < numSamples; i++) 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; uint32_t i;
int32_t diff, diffCrnt = 0; int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0; int32_t maxDiff = 0;
for (i = 0; i < numSamples; i++) for (i = 0; i < numSamples; i++)
{ {

@ -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); return (SNR);
@ -167,7 +167,7 @@ uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
{ {
uint32_t i; uint32_t i;
int32_t diff, diffCrnt = 0; int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0; int32_t maxDiff = 0;
for (i = 0; i < numSamples; i++) 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; uint32_t i;
int32_t diff, diffCrnt = 0; int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0; int32_t maxDiff = 0;
for (i = 0; i < numSamples; i++) for (i = 0; i < numSamples; i++)
{ {

@ -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); return (SNR);
@ -167,7 +167,7 @@ uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
{ {
uint32_t i; uint32_t i;
int32_t diff, diffCrnt = 0; int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0; int32_t maxDiff = 0;
for (i = 0; i < numSamples; i++) 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; uint32_t i;
int32_t diff, diffCrnt = 0; int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0; int32_t maxDiff = 0;
for (i = 0; i < numSamples; i++) for (i = 0; i < numSamples; i++)
{ {

@ -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); return (SNR);
@ -167,7 +167,7 @@ uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
{ {
uint32_t i; uint32_t i;
int32_t diff, diffCrnt = 0; int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0; int32_t maxDiff = 0;
for (i = 0; i < numSamples; i++) 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; uint32_t i;
int32_t diff, diffCrnt = 0; int32_t diff, diffCrnt = 0;
uint32_t maxDiff = 0; int32_t maxDiff = 0;
for (i = 0; i < numSamples; i++) for (i = 0; i < numSamples; i++)
{ {

@ -102,7 +102,7 @@ project (testcmsisdsp VERSION 0.1)
add_subdirectory(${CMSISDSP}/Source bin_dsp) 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. 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. 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. `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_PREFIX_PATH="path to compiler" \
-DCMAKE_TOOLCHAIN_FILE=../../Testing/armac6.cmake \ -DCMAKE_TOOLCHAIN_FILE=../../Testing/armac6.cmake \
-DCMSIS="path_to_cmsis" \ -DCMSIS="path_to_cmsis" \
-DCMSISDSPFOLDER="path_to_cmsisdsp" \ -DCMSISDSP="path_to_cmsisdsp" \
-DARM_CPU="cortex-m55" \ -DARM_CPU="cortex-m55" \
-DPLATFORM="FVP" \ -DPLATFORM="FVP" \
-DHELIUM=ON \ -DHELIUM=ON \
@ -191,10 +191,40 @@ cmake -DLOOPUNROLL=ON \
-DBAYES=ON \ -DBAYES=ON \
-DDISTANCE=ON \ -DDISTANCE=ON \
-DINTERPOLATION=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. Once cmake has generated the makefiles, you can use a GNU Make to build.

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

@ -4,7 +4,9 @@ include(CMakePrintHelpers)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") 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) function(writeConfig path)
set(output "") set(output "")

@ -55,7 +55,7 @@ endfunction()
function(configboot PROJECT_NAME) 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() set_platform_core()
################### ###################

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

Loading…
Cancel
Save