Skip to content

Commit

Permalink
[ext] Include device.hpp in CMSIS-DSP arm_math.h
Browse files Browse the repository at this point in the history
  • Loading branch information
calebchalmers authored and salkinium committed Aug 18, 2024
1 parent 1319de9 commit a3ac5db
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 41 deletions.
7 changes: 7 additions & 0 deletions ext/arm/arm_math.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ extern "C"
{
#endif

#include <modm/platform/device.hpp>

/* Local configuration file */
#if __has_include(<arm_math_local.h>)
#include <arm_math_local.h>
#endif

#include "arm_math_types.h"
#include "arm_math_memory.h"

Expand Down
30 changes: 0 additions & 30 deletions ext/arm/arm_math_types.h.in

This file was deleted.

4 changes: 2 additions & 2 deletions ext/arm/cmsis.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ We use only use these parts of CMSIS:
via CMSIS-CORE.
- The `modm:cmsis:device` module provides access to the peripherals of the
`modm:target` devices via the vendor's CMSIS implementation.
- The `modm:cmsis:dsp` module provides a basic digital signal processing library
via CMSIS-DSP.
- The `modm:cmsis:dsp` module provides an optimized compute library via
CMSIS-DSP.

[cmsis]: https://developer.arm.com/embedded/cmsis
[overview]: https://developer.arm.com/-/media/Arm%20Developer%20Community/Images/Block%20Diagrams/Cortex%20Microcontroller%20Software%20Interface%20Standard%20-%20CMSIS/CMSIS%20Diagram%20v2.png
4 changes: 1 addition & 3 deletions ext/arm/dsp.lb
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,12 @@ def build(env):
for path in Path(localpath("cmsis-dsp/CMSIS-DSP/Include/")).iterdir():
if path.is_file() and not ("_f16" in path.name and not env["with_f16"]):
# We need to replace this file to include the <cmsis_dsp_local.h>
if path.name in ["arm_math_types.h", "arm_math.h", "arm_math_f16.h"]: continue;
if path.name in ["arm_math.h", "arm_math_f16.h"]: continue;
env.copy(path, path.name)

env.copy("cmsis-dsp/CMSIS-DSP/Include/dsp/none.h", "dsp/none.h")
env.copy("cmsis-dsp/CMSIS-DSP/Include/dsp/utils.h", "dsp/utils.h")
env.copy("cmsis-dsp/CMSIS-DSP/Include/dsp/debug.h", "dsp/debug.h")
env.copy("cmsis-dsp/CMSIS-DSP/Include/arm_math_types.h", "arm_math_types_internal.h")

core = env[":target"].get_driver("core")["type"][8:]
core = core.replace("+", "PLUS").replace("f", "").replace("d", "")
Expand All @@ -134,7 +133,6 @@ def build(env):
"includes": includes,
"with_fpu": env.get(":platform:cortex-m:float-abi", "soft") != "soft",
}
env.template("arm_math_types.h.in")
env.template("arm_math.h.in")
if env["with_f16"]: env.template("arm_math_f16.h.in")

Expand Down
14 changes: 8 additions & 6 deletions ext/arm/dsp.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@
This module provides the CMSIS-DSP library.
Please [see the API documentation][docs] for details.

Note that this module splits up the library into submodule to speed up
Note:
- The library should be accessed through the `arm_math.h` and `arm_math_f16.h`
headers, as these include necessary configuration options.
- This module splits up the library into submodules to speed up
compilation by only including the math functions you really need.
You can enable 16-bit floating point support separately via option.
- You can enable 16-bit floating point support via the option `with_f16`.


## Configuration

You can define your own configuration in the `<arm_math_local.h>` file which
will automatically be included at the *beginning* of the `arm_math_types.h` file
which is included by all CMSIS-DSP source files. This way changes to your
CMSIS-DSP configuration will only affect its source files and not recompile your
whole project.
will automatically be included at the *beginning* of the `arm_math.h` and
`arm_math_f16.h` files. This way changes to your CMSIS-DSP configuration will
only affect its source files and not recompile your whole project.

Example `<arm_math_local.h>` configuration:

Expand Down

0 comments on commit a3ac5db

Please sign in to comment.