CMSIS Core Macro System
This module provides the infrastructure for including CMSIS-DSP headers and setting up the C++ environment.
Implementation Note: The useCmsisModules macro uses raw {.emit.} pragmas to inject C++ #include directives. This approach is necessary because:
- CMSIS-DSP headers must be available at C++ compile time before any function declarations are processed by the Nim C++ backend
- Nim's standard {.header.} pragma cannot be used directly on importc procedures that reference CMSIS types/functions
- The emit pragma allows precise control over the order and placement of includes in the generated C++ code
Per AGENTS.md guidelines, raw emit is justified here because:
- This is infrastructure code (not application logic)
- The mechanism is well-documented and its purpose is clear
- Standard alternatives (header pragma) don't work for CMSIS integration
Procs
proc getCmsisHeaders(moduleName: string): string {....raises: [], tags: [], forbids: [].}
- Returns the C++ header includes needed for a specific CMSIS module Source Edit
Macros
macro useCmsisModules(modules: varargs[untyped]): untyped
-
Selective inclusion of CMSIS-DSP modules.
Injects the required #include statements.
Source Edit