Skip to content

Commit e69956a

Browse files
author
Bogdan Marinescu
committed
Updated DSP library + build system changes
Updated CMSIS DSP to latest version (CMSIS-SP-00300-r3p2-00rel1.zip) Build system changes to be able to preprocess assembler sources before compiling them: - GCC: use gcc '-x assembler-with-cpp' - ARM: preprocess first, then assemble (two separate commands) - IAR: added macro definitions and include directories to the assembler command line Removed CORTEX_ARM_SUPPORT restriction for the DSP libraries. Tested: LPC1768 with ARM, GCC_ARM and IAR, LPC11U24 with ARM.
1 parent d7d5954 commit e69956a

File tree

272 files changed

+26482
-12095
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

272 files changed

+26482
-12095
lines changed

libraries/dsp/cmsis_dsp/BasicMathFunctions/arm_abs_f32.c

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* ----------------------------------------------------------------------
2-
* Copyright (C) 2010 ARM Limited. All rights reserved.
2+
* Copyright (C) 2010-2013 ARM Limited. All rights reserved.
33
*
4-
* $Date: 15. February 2012
5-
* $Revision: V1.1.0
4+
* $Date: 17. January 2013
5+
* $Revision: V1.4.1
66
*
77
* Project: CMSIS DSP Library
88
* Title: arm_abs_f32.c
@@ -11,26 +11,31 @@
1111
*
1212
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
1313
*
14-
* Version 1.1.0 2012/02/15
15-
* Updated with more optimizations, bug fixes and minor API changes.
16-
*
17-
* Version 1.0.10 2011/7/15
18-
* Big Endian support added and Merged M0 and M3/M4 Source code.
19-
*
20-
* Version 1.0.3 2010/11/29
21-
* Re-organized the CMSIS folders and updated documentation.
22-
*
23-
* Version 1.0.2 2010/11/11
24-
* Documentation updated.
25-
*
26-
* Version 1.0.1 2010/10/05
27-
* Production release and review comments incorporated.
28-
*
29-
* Version 1.0.0 2010/09/20
30-
* Production release and review comments incorporated.
31-
*
32-
* Version 0.0.7 2010/06/10
33-
* Misra-C changes done
14+
* Redistribution and use in source and binary forms, with or without
15+
* modification, are permitted provided that the following conditions
16+
* are met:
17+
* - Redistributions of source code must retain the above copyright
18+
* notice, this list of conditions and the following disclaimer.
19+
* - Redistributions in binary form must reproduce the above copyright
20+
* notice, this list of conditions and the following disclaimer in
21+
* the documentation and/or other materials provided with the
22+
* distribution.
23+
* - Neither the name of ARM LIMITED nor the names of its contributors
24+
* may be used to endorse or promote products derived from this
25+
* software without specific prior written permission.
26+
*
27+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38+
* POSSIBILITY OF SUCH DAMAGE.
3439
* ---------------------------------------------------------------------------- */
3540

3641
#include "arm_math.h"
@@ -46,11 +51,12 @@
4651
* Computes the absolute value of a vector on an element-by-element basis.
4752
*
4853
* <pre>
49-
* pDst[n] = abs(pSrcA[n]), 0 <= n < blockSize.
54+
* pDst[n] = abs(pSrc[n]), 0 <= n < blockSize.
5055
* </pre>
5156
*
52-
* The operation can be done in-place by setting the input and output pointers to the same buffer.
53-
* There are separate functions for floating-point, Q7, Q15, and Q31 data types.
57+
* The functions support in-place computation allowing the source and
58+
* destination pointers to reference the same memory buffer.
59+
* There are separate functions for floating-point, Q7, Q15, and Q31 data types.
5460
*/
5561

5662
/**
@@ -73,7 +79,7 @@ void arm_abs_f32(
7379
{
7480
uint32_t blkCnt; /* loop counter */
7581

76-
#ifndef ARM_MATH_CM0
82+
#ifndef ARM_MATH_CM0_FAMILY
7783

7884
/* Run the below code for Cortex-M4 and Cortex-M3 */
7985
float32_t in1, in2, in3, in4; /* temporary variables */
@@ -141,7 +147,7 @@ void arm_abs_f32(
141147
/* Initialize blkCnt with number of samples */
142148
blkCnt = blockSize;
143149

144-
#endif /* #ifndef ARM_MATH_CM0 */
150+
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
145151

146152
while(blkCnt > 0u)
147153
{

libraries/dsp/cmsis_dsp/BasicMathFunctions/arm_abs_q15.c

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* ----------------------------------------------------------------------
2-
* Copyright (C) 2010 ARM Limited. All rights reserved.
2+
* Copyright (C) 2010-2013 ARM Limited. All rights reserved.
33
*
4-
* $Date: 15. February 2012
5-
* $Revision: V1.1.0
4+
* $Date: 17. January 2013
5+
* $Revision: V1.4.1
66
*
77
* Project: CMSIS DSP Library
88
* Title: arm_abs_q15.c
@@ -11,26 +11,31 @@
1111
*
1212
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
1313
*
14-
* Version 1.1.0 2012/02/15
15-
* Updated with more optimizations, bug fixes and minor API changes.
16-
*
17-
* Version 1.0.10 2011/7/15
18-
* Big Endian support added and Merged M0 and M3/M4 Source code.
19-
*
20-
* Version 1.0.3 2010/11/29
21-
* Re-organized the CMSIS folders and updated documentation.
22-
*
23-
* Version 1.0.2 2010/11/11
24-
* Documentation updated.
25-
*
26-
* Version 1.0.1 2010/10/05
27-
* Production release and review comments incorporated.
28-
*
29-
* Version 1.0.0 2010/09/20
30-
* Production release and review comments incorporated.
31-
*
32-
* Version 0.0.7 2010/06/10
33-
* Misra-C changes done
14+
* Redistribution and use in source and binary forms, with or without
15+
* modification, are permitted provided that the following conditions
16+
* are met:
17+
* - Redistributions of source code must retain the above copyright
18+
* notice, this list of conditions and the following disclaimer.
19+
* - Redistributions in binary form must reproduce the above copyright
20+
* notice, this list of conditions and the following disclaimer in
21+
* the documentation and/or other materials provided with the
22+
* distribution.
23+
* - Neither the name of ARM LIMITED nor the names of its contributors
24+
* may be used to endorse or promote products derived from this
25+
* software without specific prior written permission.
26+
*
27+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38+
* POSSIBILITY OF SUCH DAMAGE.
3439
* -------------------------------------------------------------------- */
3540

3641
#include "arm_math.h"
@@ -64,7 +69,8 @@ void arm_abs_q15(
6469
{
6570
uint32_t blkCnt; /* loop counter */
6671

67-
#ifndef ARM_MATH_CM0
72+
#ifndef ARM_MATH_CM0_FAMILY
73+
__SIMD32_TYPE *simd;
6874

6975
/* Run the below code for Cortex-M4 and Cortex-M3 */
7076

@@ -77,6 +83,7 @@ void arm_abs_q15(
7783

7884
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
7985
** a second loop below computes the remaining 1 to 3 samples. */
86+
simd = __SIMD32_CONST(pDst);
8087
while(blkCnt > 0u)
8188
{
8289
/* C = |A| */
@@ -86,19 +93,17 @@ void arm_abs_q15(
8693

8794

8895
/* Store the Absolute result in the destination buffer by packing the two values, in a single cycle */
89-
9096
#ifndef ARM_MATH_BIG_ENDIAN
91-
92-
*__SIMD32(pDst)++ =
93-
__PKHBT(((in1 > 0) ? in1 : __QSUB16(0, in1)),
94-
((in2 > 0) ? in2 : __QSUB16(0, in2)), 16);
97+
*simd++ =
98+
__PKHBT(((in1 > 0) ? in1 : (q15_t)__QSUB16(0, in1)),
99+
((in2 > 0) ? in2 : (q15_t)__QSUB16(0, in2)), 16);
95100

96101
#else
97102

98103

99-
*__SIMD32(pDst)++ =
100-
__PKHBT(((in2 > 0) ? in2 : __QSUB16(0, in2)),
101-
((in1 > 0) ? in1 : __QSUB16(0, in1)), 16);
104+
*simd++ =
105+
__PKHBT(((in2 > 0) ? in2 : (q15_t)__QSUB16(0, in2)),
106+
((in1 > 0) ? in1 : (q15_t)__QSUB16(0, in1)), 16);
102107

103108
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
104109

@@ -108,23 +113,24 @@ void arm_abs_q15(
108113

109114
#ifndef ARM_MATH_BIG_ENDIAN
110115

111-
*__SIMD32(pDst)++ =
112-
__PKHBT(((in1 > 0) ? in1 : __QSUB16(0, in1)),
113-
((in2 > 0) ? in2 : __QSUB16(0, in2)), 16);
116+
*simd++ =
117+
__PKHBT(((in1 > 0) ? in1 : (q15_t)__QSUB16(0, in1)),
118+
((in2 > 0) ? in2 : (q15_t)__QSUB16(0, in2)), 16);
114119

115120
#else
116121

117122

118-
*__SIMD32(pDst)++ =
119-
__PKHBT(((in2 > 0) ? in2 : __QSUB16(0, in2)),
120-
((in1 > 0) ? in1 : __QSUB16(0, in1)), 16);
123+
*simd++ =
124+
__PKHBT(((in2 > 0) ? in2 : (q15_t)__QSUB16(0, in2)),
125+
((in1 > 0) ? in1 : (q15_t)__QSUB16(0, in1)), 16);
121126

122127
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
123128

124129
/* Decrement the loop counter */
125130
blkCnt--;
126131
}
127-
132+
pDst = (q15_t *)simd;
133+
128134
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
129135
** No loop unrolling is used. */
130136
blkCnt = blockSize % 0x4u;
@@ -136,7 +142,7 @@ void arm_abs_q15(
136142
in1 = *pSrc++;
137143

138144
/* Calculate absolute value of input and then store the result in the destination buffer. */
139-
*pDst++ = (in1 > 0) ? in1 : __QSUB16(0, in1);
145+
*pDst++ = (in1 > 0) ? in1 : (q15_t)__QSUB16(0, in1);
140146

141147
/* Decrement the loop counter */
142148
blkCnt--;
@@ -164,7 +170,7 @@ void arm_abs_q15(
164170
blkCnt--;
165171
}
166172

167-
#endif /* #ifndef ARM_MATH_CM0 */
173+
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
168174

169175
}
170176

libraries/dsp/cmsis_dsp/BasicMathFunctions/arm_abs_q31.c

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* ----------------------------------------------------------------------
2-
* Copyright (C) 2010 ARM Limited. All rights reserved.
2+
* Copyright (C) 2010-2013 ARM Limited. All rights reserved.
33
*
4-
* $Date: 15. February 2012
5-
* $Revision: V1.1.0
4+
* $Date: 17. January 2013
5+
* $Revision: V1.4.1
66
*
77
* Project: CMSIS DSP Library
88
* Title: arm_abs_q31.c
@@ -11,26 +11,31 @@
1111
*
1212
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
1313
*
14-
* Version 1.1.0 2012/02/15
15-
* Updated with more optimizations, bug fixes and minor API changes.
16-
*
17-
* Version 1.0.10 2011/7/15
18-
* Big Endian support added and Merged M0 and M3/M4 Source code.
19-
*
20-
* Version 1.0.3 2010/11/29
21-
* Re-organized the CMSIS folders and updated documentation.
22-
*
23-
* Version 1.0.2 2010/11/11
24-
* Documentation updated.
25-
*
26-
* Version 1.0.1 2010/10/05
27-
* Production release and review comments incorporated.
28-
*
29-
* Version 1.0.0 2010/09/20
30-
* Production release and review comments incorporated.
31-
*
32-
* Version 0.0.7 2010/06/10
33-
* Misra-C changes done
14+
* Redistribution and use in source and binary forms, with or without
15+
* modification, are permitted provided that the following conditions
16+
* are met:
17+
* - Redistributions of source code must retain the above copyright
18+
* notice, this list of conditions and the following disclaimer.
19+
* - Redistributions in binary form must reproduce the above copyright
20+
* notice, this list of conditions and the following disclaimer in
21+
* the documentation and/or other materials provided with the
22+
* distribution.
23+
* - Neither the name of ARM LIMITED nor the names of its contributors
24+
* may be used to endorse or promote products derived from this
25+
* software without specific prior written permission.
26+
*
27+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38+
* POSSIBILITY OF SUCH DAMAGE.
3439
* -------------------------------------------------------------------- */
3540

3641
#include "arm_math.h"
@@ -66,7 +71,7 @@ void arm_abs_q31(
6671
uint32_t blkCnt; /* loop counter */
6772
q31_t in; /* Input value */
6873

69-
#ifndef ARM_MATH_CM0
74+
#ifndef ARM_MATH_CM0_FAMILY
7075

7176
/* Run the below code for Cortex-M4 and Cortex-M3 */
7277
q31_t in1, in2, in3, in4;
@@ -85,10 +90,10 @@ void arm_abs_q31(
8590
in3 = *pSrc++;
8691
in4 = *pSrc++;
8792

88-
*pDst++ = (in1 > 0) ? in1 : __QSUB(0, in1);
89-
*pDst++ = (in2 > 0) ? in2 : __QSUB(0, in2);
90-
*pDst++ = (in3 > 0) ? in3 : __QSUB(0, in3);
91-
*pDst++ = (in4 > 0) ? in4 : __QSUB(0, in4);
93+
*pDst++ = (in1 > 0) ? in1 : (q31_t)__QSUB(0, in1);
94+
*pDst++ = (in2 > 0) ? in2 : (q31_t)__QSUB(0, in2);
95+
*pDst++ = (in3 > 0) ? in3 : (q31_t)__QSUB(0, in3);
96+
*pDst++ = (in4 > 0) ? in4 : (q31_t)__QSUB(0, in4);
9297

9398
/* Decrement the loop counter */
9499
blkCnt--;
@@ -105,14 +110,14 @@ void arm_abs_q31(
105110
/* Initialize blkCnt with number of samples */
106111
blkCnt = blockSize;
107112

108-
#endif /* #ifndef ARM_MATH_CM0 */
113+
#endif /* #ifndef ARM_MATH_CM0_FAMILY */
109114

110115
while(blkCnt > 0u)
111116
{
112117
/* C = |A| */
113118
/* Calculate absolute value of the input (if -1 then saturated to 0x7fffffff) and then store the results in the destination buffer. */
114119
in = *pSrc++;
115-
*pDst++ = (in > 0) ? in : ((in == 0x80000000) ? 0x7fffffff : -in);
120+
*pDst++ = (in > 0) ? in : ((in == INT32_MIN) ? INT32_MAX : -in);
116121

117122
/* Decrement the loop counter */
118123
blkCnt--;

0 commit comments

Comments
 (0)