Skip to content

Commit

Permalink
Improved cmake to build tests on Neon with gcc and clang.
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe0606 committed Jan 22, 2025
1 parent 68d8271 commit f9773e3
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 46 deletions.
104 changes: 66 additions & 38 deletions Testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,54 +157,82 @@ target_include_directories(test PUBLIC FrameworkInclude

target_compile_definitions(test PUBLIC EMBEDDED NOTIMING)

target_compile_options(test PUBLIC -Wsign-compare
-Wdouble-promotion
-DNDEBUG
-Wall
-Wextra
-O3
-Wno-packed
-Wno-missing-variable-declarations
-Wno-missing-noreturn
-Wno-sign-conversion
-Wno-nonportable-include-path
-Wno-reserved-id-macro
-Wno-unused-macros
-Wno-documentation-unknown-command
-Wno-documentation
-Wno-parentheses-equality
-Wno-reserved-identifier
target_compile_options(test PUBLIC -Wsign-compare
-Wdouble-promotion
-DNDEBUG
-Wall
-Wextra
-O3
-Wno-packed
-Wno-missing-noreturn
-Wno-sign-conversion
-Wno-unused-macros
-ffunction-sections
-fdata-sections
-march=armv8.2-a+fp16fml
)


if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

target_compile_options(CMSISDSP PRIVATE -Wsign-compare
-Wdouble-promotion
-DNDEBUG
-Wall
-Wextra
-O3
-ffast-math
-Wno-packed
-Wno-missing-variable-declarations
-Wno-missing-noreturn
-Wno-sign-conversion
-Wno-nonportable-include-path
-Wno-reserved-id-macro
-Wno-unused-macros
-Wno-documentation-unknown-command
-Wno-documentation
-Wno-parentheses-equality
-Wno-reserved-identifier
-ffunction-sections
-fdata-sections
-march=armv8.2-a+fp16fml)
-Wdouble-promotion
-Wfloat-conversion
-DNDEBUG
-Wall
-Wextra
-std=c11
-O3
-ffast-math
-Wno-packed
-Wno-missing-prototypes
-Wno-missing-noreturn
-Wno-sign-conversion
-Wno-unused-macros
-flax-vector-conversions
-Wno-maybe-uninitialized
-ffunction-sections
-fdata-sections
-march=armv8.2-a+fp16fml
-Wmissing-prototypes
)

else()

target_compile_option(CMSISDSP PRIVATE -Wsign-compare
-Wdouble-promotion
-Wfloat-conversion
-DNDEBUG
-Wall
-Wextra
-Werror
-std=c11
-O3
-ffast-math
-Wno-packed
-Wno-missing-variable-declarations
-Wno-missing-prototypes
-Wno-missing-noreturn
-Wno-sign-conversion
-Wno-nonportable-include-path
-Wno-reserved-id-macro
-Wno-unused-macros
-Wno-documentation-unknown-command
-Wno-documentation
-Wno-parentheses-equality
-Wno-reserved-identifier
-ffunction-sections
-fdata-sections
-march=armv8.2-a+fp16fml
-Wmissing-prototypes
)

endif()

target_link_libraries(test PUBLIC CMSISDSP)


if(NOAUTOVEC)
target_compile_options(CMSISDSP PRIVATE -fno-slp-vectorize -fno-vectorize)
target_compile_options(test PRIVATE -fno-slp-vectorize -fno-vectorize )
endif()
endif()
12 changes: 8 additions & 4 deletions Testing/FrameworkInclude/Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@

// Pattern files are containing hexadecimal values.
// So we need to be able to convert some int into float without convertion
#define TOINT16(v) *((uint16_t*)&v)
#define TOINT32(v) *((uint32_t*)&v)
#define TOINT64(v) *((uint64_t*)&v)
//#define TOINT16(v) *((uint16_t*)&v)
//#define TOINT32(v) *((uint32_t*)&v)
//#define TOINT64(v) *((uint64_t*)&v)

#define TOINT16(d,v) memcpy(&d,&v,2)
#define TOINT32(d,v) memcpy(&d,&v,4)
#define TOINT64(d,v) memcpy(&d,&v,8)
// Or convert some float into a uint32 or uint64 without convertion
#define TOTYP(TYP,v) *((TYP*)&v)
//#define TOTYP(TYP,v) *((TYP*)&v)
// So it is a cast and not a data conversion.
// (uint32_t)1.0 would give 1. We want the hexadecimal representation of the float.
// TOINT32(1.0) can be used
Expand Down
6 changes: 3 additions & 3 deletions Testing/FrameworkSource/FPGA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ namespace Client
for(i=0; i < nb; i++)
{
v = data[i];
t = TOINT64(v);
TOINT64(t,v);
#if __SIZEOF_LONG__ == 8
printf("D: 0x%016lx\n",t);
#else
Expand All @@ -759,7 +759,7 @@ namespace Client
for(i=0; i < nb; i++)
{
v = data[i];
t = TOINT32(v);
TOINT32(t,v);
printf("D: 0x%08x\n",t);
}
printf("D: END\n");
Expand All @@ -779,7 +779,7 @@ namespace Client
for(i=0; i < nb; i++)
{
v = data[i];
t = TOINT16(v);
TOINT16(t,v);
printf("D: 0x0000%04x\n",t);
}
printf("D: END\n");
Expand Down
2 changes: 1 addition & 1 deletion Testing/testmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int testmain(const char *patterns)

// There is also possibility of using "FPGA" io
#if defined(EMBEDDED)
Client::FPGA io((const char*)testDesc,(const char*)patterns);
Client::FPGA io((const unsigned char*)testDesc,(const char*)patterns);
#else
Client::Semihosting io("../TestDesc.txt","../Patterns","../Output","../Parameters");
#endif
Expand Down

0 comments on commit f9773e3

Please sign in to comment.