diff --git a/pkg/cmsis-dsp/Makefile b/pkg/cmsis-dsp/Makefile index 6584d149d4..b5ace34db1 100644 --- a/pkg/cmsis-dsp/Makefile +++ b/pkg/cmsis-dsp/Makefile @@ -1,13 +1,12 @@ PKG_NAME=cmsis-dsp -PKG_URL=https://github.com/gebart/CMSIS-DSP.git -PKG_VERSION=v1.4.5a-riot2 -PKG_LICENSE=BSD-3-Clause - -CFLAGS += -Wno-strict-aliasing +PKG_URL=https://github.com/ARM-software/CMSIS_5 +PKG_VERSION=5.4.0 +PKG_LICENSE=Apache-2.0 +CFLAGS += -Wno-strict-aliasing -Wno-unused-parameter .PHONY: all all: git-download - "$(MAKE)" -C $(PKG_BUILDDIR) + "$(MAKE)" -C $(PKG_BUILDDIR) -f $(CURDIR)/Makefile.$(PKG_NAME) include $(RIOTBASE)/pkg/pkg.mk diff --git a/pkg/cmsis-dsp/Makefile.cmsis-dsp b/pkg/cmsis-dsp/Makefile.cmsis-dsp new file mode 100644 index 0000000000..7bd5831e6b --- /dev/null +++ b/pkg/cmsis-dsp/Makefile.cmsis-dsp @@ -0,0 +1,43 @@ +PKG_NAME=cmsis-dsp + +# A list of all the directories to build for CMSIS-DSP +CMSIS_DIRS += \ + CMSIS/DSP/Source/BasicMathFunctions \ + CMSIS/DSP/Source/CommonTables \ + CMSIS/DSP/Source/ComplexMathFunctions \ + CMSIS/DSP/Source/ControllerFunctions \ + CMSIS/DSP/Source/FastMathFunctions \ + CMSIS/DSP/Source/FilteringFunctions \ + CMSIS/DSP/Source/MatrixFunctions \ + CMSIS/DSP/Source/StatisticsFunctions \ + CMSIS/DSP/Source/SupportFunctions \ + CMSIS/DSP/Source/TransformFunctions \ +# + +INCLUDES += -I$(CURDIR)/CMSIS/DSP/Include +CMSIS_BINDIRS = $(addprefix $(BINDIR)/$(PKG_NAME)/,$(CMSIS_DIRS)) + +# Override default RIOT search path for sources to include all of the CMSIS-DSP +# sources in one library instead of one library per subdirectory. +SRC := $(foreach DIR,$(CMSIS_DIRS),$(wildcard $(DIR)/*.c)) +SRCXX := $(foreach DIR,$(CMSIS_DIRS),$(wildcard $(DIR)/*.cpp)) +ASMSRC := $(foreach DIR,$(CMSIS_DIRS),$(wildcard $(DIR)/*.s)) +ASSMSRC := $(foreach DIR,$(CMSIS_DIRS),$(wildcard $(DIR)/*.S)) + +OBJC := $(SRC:%.c=$(BINDIR)/$(PKG_NAME)/%.o) +OBJCXX := $(SRCXX:%.cpp=$(BINDIR)/$(PKG_NAME)/%.o) +ASMOBJ := $(ASMSRC:%.s=$(BINDIR)/$(PKG_NAME)/%.o) +ASSMOBJ := $(ASSMSRC:%.S=$(BINDIR)/$(PKG_NAME)/%.o) +OBJ = $(OBJC) $(OBJCXX) $(ASMOBJ) $(ASSMOBJ) + +# Create subdirectories if they do not already exist +$(OBJ): | $(CMSIS_BINDIRS) + +$(CMSIS_BINDIRS): + @mkdir -p $@ + +# Reset the default goal. +.DEFAULT_GOAL := + +# Include RIOT settings and recipes +include $(RIOTBASE)/Makefile.base diff --git a/pkg/cmsis-dsp/Makefile.include b/pkg/cmsis-dsp/Makefile.include index d76141ecfc..c60a187ebc 100644 --- a/pkg/cmsis-dsp/Makefile.include +++ b/pkg/cmsis-dsp/Makefile.include @@ -1 +1 @@ -INCLUDES += -I$(PKGDIRBASE)/cmsis-dsp/include +INCLUDES += -I$(PKGDIRBASE)/cmsis-dsp/CMSIS/DSP/Include diff --git a/pkg/cmsis-dsp/README.md b/pkg/cmsis-dsp/README.md index ad0392fa97..8d81a73e80 100644 --- a/pkg/cmsis-dsp/README.md +++ b/pkg/cmsis-dsp/README.md @@ -1 +1,2 @@ -Since there is no official public repository for the CMSIS-DSP library, we are using our own repo. +This package uses DSP ARM CMSIS header from the official +[ARM github repo](https://github.com/ARM-software/CMSIS_5) diff --git a/pkg/cmsis-dsp/patches/0001-PATCH-arm_math-add-clang-branch-for-optimization-mac.patch b/pkg/cmsis-dsp/patches/0001-PATCH-arm_math-add-clang-branch-for-optimization-mac.patch new file mode 100644 index 0000000000..ed67f6a980 --- /dev/null +++ b/pkg/cmsis-dsp/patches/0001-PATCH-arm_math-add-clang-branch-for-optimization-mac.patch @@ -0,0 +1,30 @@ +From da78a3a713c2431f32685da0c28b574bfb93bd4b Mon Sep 17 00:00:00 2001 +From: Martine Lenders +Date: Thu, 6 Dec 2018 14:09:00 +0100 +Subject: [PATCH 1/2] [PATCH] arm_math: add clang branch for optimization + macros + +--- + CMSIS/DSP/Include/arm_math.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/CMSIS/DSP/Include/arm_math.h b/CMSIS/DSP/Include/arm_math.h +index ea9dd26a..6e4d9116 100644 +--- a/CMSIS/DSP/Include/arm_math.h ++++ b/CMSIS/DSP/Include/arm_math.h +@@ -7074,6 +7074,12 @@ void arm_rfft_fast_f32( + #define IAR_ONLY_LOW_OPTIMIZATION_ENTER + #define IAR_ONLY_LOW_OPTIMIZATION_EXIT + ++#elif defined(__clang__) ++ #define LOW_OPTIMIZATION_ENTER __attribute__(( optnone )) ++ #define LOW_OPTIMIZATION_EXIT ++ #define IAR_ONLY_LOW_OPTIMIZATION_ENTER ++ #define IAR_ONLY_LOW_OPTIMIZATION_EXIT ++ + #elif defined ( __GNUC__ ) + #define LOW_OPTIMIZATION_ENTER \ + __attribute__(( optimize("-O1") )) +-- +2.17.1 + diff --git a/pkg/cmsis-dsp/patches/0001-arm_math-add-clang-branch-for-optimization-macros.patch b/pkg/cmsis-dsp/patches/0001-arm_math-add-clang-branch-for-optimization-macros.patch deleted file mode 100644 index fe46236553..0000000000 --- a/pkg/cmsis-dsp/patches/0001-arm_math-add-clang-branch-for-optimization-macros.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 1d862f709c9da0d59e54ea5ff9eb7417b1db92a4 Mon Sep 17 00:00:00 2001 -From: Martine Lenders -Date: Tue, 7 Aug 2018 12:34:16 +0200 -Subject: [PATCH] arm_math: add clang branch for optimization macros - ---- - include/arm_math.h | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/include/arm_math.h b/include/arm_math.h -index e4b2f62..65973f6 100644 ---- a/include/arm_math.h -+++ b/include/arm_math.h -@@ -7516,6 +7516,16 @@ void arm_rfft_fast_f32( - //Exit low optimization region - place directly after end of function definition - #define IAR_ONLY_LOW_OPTIMIZATION_EXIT - -+#elif defined(__clang__) -+ -+ #define LOW_OPTIMIZATION_ENTER __attribute__(( optnone )) -+ -+ #define LOW_OPTIMIZATION_EXIT -+ -+ #define IAR_ONLY_LOW_OPTIMIZATION_ENTER -+ -+ #define IAR_ONLY_LOW_OPTIMIZATION_EXIT -+ - #elif defined(__GNUC__) - - #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") )) --- -2.7.4 - diff --git a/pkg/cmsis-dsp/patches/0001-include-cpu_conf.h.patch b/pkg/cmsis-dsp/patches/0001-include-cpu_conf.h.patch deleted file mode 100644 index 7064e4624d..0000000000 --- a/pkg/cmsis-dsp/patches/0001-include-cpu_conf.h.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 53e086efc203ad8e1646524c732588d27aabfc53 Mon Sep 17 00:00:00 2001 -From: Vincent Dupont -Date: Mon, 20 Feb 2017 19:00:08 +0100 -Subject: [PATCH] include cpu_conf.h - ---- - include/arm_math.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/include/arm_math.h b/include/arm_math.h -index e4b2f62..cde16bf 100644 ---- a/include/arm_math.h -+++ b/include/arm_math.h -@@ -288,6 +288,8 @@ - #ifndef _ARM_MATH_H - #define _ARM_MATH_H - -+#include "cpu_conf.h" -+ - #define __CMSIS_GENERIC /* disable NVIC and Systick functions */ - - #if defined(ARM_MATH_CM7) --- -2.9.3 - diff --git a/pkg/cmsis-dsp/patches/0002-PATCH-include-cpu_conf.h.patch b/pkg/cmsis-dsp/patches/0002-PATCH-include-cpu_conf.h.patch new file mode 100644 index 0000000000..0e7ec01ed7 --- /dev/null +++ b/pkg/cmsis-dsp/patches/0002-PATCH-include-cpu_conf.h.patch @@ -0,0 +1,25 @@ +From fdd48d357dcf09933b3bee28b510386b7cb98b34 Mon Sep 17 00:00:00 2001 +From: Vincent Dupont +Date: Tue, 15 Jan 2019 17:32:56 +0100 +Subject: [PATCH 2/2] [PATCH] include cpu_conf.h + +--- + CMSIS/DSP/Include/arm_math.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/CMSIS/DSP/Include/arm_math.h b/CMSIS/DSP/Include/arm_math.h +index 6e4d9116..6af24bab 100644 +--- a/CMSIS/DSP/Include/arm_math.h ++++ b/CMSIS/DSP/Include/arm_math.h +@@ -289,6 +289,8 @@ + #ifndef _ARM_MATH_H + #define _ARM_MATH_H + ++#include "cpu_conf.h" ++ + /* Compiler specific diagnostic adjustment */ + #if defined ( __CC_ARM ) + +-- +2.17.1 +