diff --git a/ARM.CMSIS-DSP.pdsc b/ARM.CMSIS-DSP.pdsc
index 1968e7ec..18afa622 100644
--- a/ARM.CMSIS-DSP.pdsc
+++ b/ARM.CMSIS-DSP.pdsc
@@ -111,6 +111,7 @@
+
diff --git a/ComputeGraph/cg.scvd b/ComputeGraph/cg.scvd
new file mode 100644
index 00000000..8b2edb9b
--- /dev/null
+++ b/ComputeGraph/cg.scvd
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ComputeGraph/cg/static/src/GenericNodes.h b/ComputeGraph/cg/static/src/GenericNodes.h
index 061f8c2e..1274e23d 100644
--- a/ComputeGraph/cg/static/src/GenericNodes.h
+++ b/ComputeGraph/cg/static/src/GenericNodes.h
@@ -389,4 +389,13 @@ public:
}
#endif
+
+#if !defined(CG_BEFORE_ITERATION)
+#define CG_BEFORE_ITERATION
+#endif
+
+#if !defined(CG_AFTER_ITERATION)
+#define CG_AFTER_ITERATION
+#endif
+
#endif
diff --git a/ComputeGraph/documentation/example1.md b/ComputeGraph/documentation/example1.md
index 38d2f074..6c30dd31 100644
--- a/ComputeGraph/documentation/example1.md
+++ b/ComputeGraph/documentation/example1.md
@@ -181,6 +181,7 @@ There are other fields for the configuration:
- `memoryOptimization` : Experimental. It is attempting to reuse buffer memory and share it between several FIFOs
- `pathToSDFModule` : Path to the Python SDF module so that the generated Python code can find it
- `codeArray` : Experimental. When a schedule is very long, representing it as a sequence of function calls is not good for the code size of the generated solution. When this option is enabled, the schedule is described with an array. It implies that the pure function calls cannot be inlined any more and are replaced by new nodes which are automatically generated.
+- `eventRecorder` : Enable the support for the CMSIS Event Recorder.
In the example 1, we are passing a variable to initialize the node of type ProcessingNode. So, it would be great if this variable was an argument of the scheduler function. So we define:
diff --git a/Scripts/git/gen_pack.sh b/Scripts/git/gen_pack.sh
index 5b4ce17f..40b0bdd0 100644
--- a/Scripts/git/gen_pack.sh
+++ b/Scripts/git/gen_pack.sh
@@ -122,6 +122,7 @@ PACK_BASE_FILES="
ComputeGraph/cg/static/nodes/cpp/ToReal.h
ComputeGraph/cg/static/nodes/cpp/Unzip.h
ComputeGraph/cg/static/nodes/cpp/Zip.h
+ ComputeGraph/cg.scvd
"
# Specify file names to be deleted from pack build directory
diff --git a/cmsisdsp/__init__.py b/cmsisdsp/__init__.py
index a7221d06..508fa79a 100755
--- a/cmsisdsp/__init__.py
+++ b/cmsisdsp/__init__.py
@@ -23,7 +23,7 @@ cmsis_dsp_version="1.12.1"
# CMSIS-DSP Commit hash used to build the wrapper
-commit_hash="89610e31cbb3c67067f5bfbcacb338fd7910023e"
+commit_hash="142dcec5c333781c2299fe43824545cc57a5bcb0"
# True if development version of CMSIS-DSP used
# (So several CMSIS-DSP versions may have same version number hence the commit hash)
diff --git a/cmsisdsp/cg/static/scheduler/ccode.py b/cmsisdsp/cg/static/scheduler/ccode.py
index 8777ba89..b0851530 100644
--- a/cmsisdsp/cg/static/scheduler/ccode.py
+++ b/cmsisdsp/cg/static/scheduler/ccode.py
@@ -58,8 +58,8 @@ def gencode(sched,directory,config):
htemplate = env.get_template("code.h")
- cfile=os.path.join(directory,"scheduler.cpp")
- hfile=os.path.join(directory,"scheduler.h")
+ cfile=os.path.join(directory,"%s.cpp" % config.schedulerCFileName)
+ hfile=os.path.join(directory,"%s.h" % config.schedulerCFileName)
nbFifos = len(sched._graph._allFIFOs)
diff --git a/cmsisdsp/cg/static/scheduler/config.py b/cmsisdsp/cg/static/scheduler/config.py
index fac56072..10627da8 100644
--- a/cmsisdsp/cg/static/scheduler/config.py
+++ b/cmsisdsp/cg/static/scheduler/config.py
@@ -74,6 +74,21 @@ class Configuration:
# Display FIFO buffers in graph instead of datatype
self.displayFIFOBuf = False
+ # Enable support for CMSIS Event Recorder
+ self.eventRecorder = False
+
+ # Name of AppNode file
+ self.appNodesCName = "AppNodes.h"
+ self.appNodesPythonName = "appnodes"
+
+ # Name of custom file
+ self.customCName = "custom.h"
+ self.customPythonName = "custom"
+
+ # Name of scheduler source and header files
+ self.schedulerCFileName = "scheduler"
+ self.schedulerPythonFileName = "sched"
+
@property
def debug(self):
diff --git a/cmsisdsp/cg/static/scheduler/pythoncode.py b/cmsisdsp/cg/static/scheduler/pythoncode.py
index 44227f4e..94cadc4d 100644
--- a/cmsisdsp/cg/static/scheduler/pythoncode.py
+++ b/cmsisdsp/cg/static/scheduler/pythoncode.py
@@ -40,7 +40,7 @@ def gencode(sched,directory,config):
template = env.get_template("code.py")
- cfile=os.path.join(directory,"sched.py")
+ cfile=os.path.join(directory,"sched.py" % config.schedulerPythonFileName)
with open(cfile,"w") as f:
diff --git a/cmsisdsp/cg/static/scheduler/templates/code.cpp b/cmsisdsp/cg/static/scheduler/templates/code.cpp
index f296d73e..9c57eedf 100644
--- a/cmsisdsp/cg/static/scheduler/templates/code.cpp
+++ b/cmsisdsp/cg/static/scheduler/templates/code.cpp
@@ -1,26 +1,4 @@
{% extends "commonc.cpp" %}
-/*
-
-Generated with CMSIS-DSP Compute Graph Scripts.
-The generated code is not covered by CMSIS-DSP license.
-
-The support classes and code is covered by CMSIS-DSP license.
-
-*/
-
-{% if config.dumpFIFO %}
-#define DEBUGSCHED 1
-{% endif %}
-
-#include "arm_math.h"
-#include "custom.h"
-#include "GenericNodes.h"
-#include "AppNodes.h"
-#include "scheduler.h"
-
-{% macro optionalargs() -%}
-{% if config.cOptionalArgs %},{{config.cOptionalArgs}}{% endif %}
-{% endmacro -%}
{% block schedArray %}
{% endblock %}
@@ -33,8 +11,21 @@ The support classes and code is covered by CMSIS-DSP license.
{% endif %}
{
/* Run a schedule iteration */
+ {% if config.eventRecorder -%}
+ EventRecord2 (Evt_Scheduler, nbSchedule, 0);
+ {% endif -%}
+ CG_BEFORE_ITERATION;
{% for s in schedule %}
+ {% if config.eventRecorder -%}
+ EventRecord2 (Evt_Node, {{nodes[s].codeID}}, 0);
+ {% endif -%}
{{nodes[s].cRun()}}
+ {% if config.eventRecorder -%}
+ if (cgStaticError<0)
+ {
+ EventRecord2 (Evt_Error, cgStaticError, 0);
+ }
+ {% endif -%}
CHECKERROR;
{% if config.dumpFIFO %}
{% for fifoID in sched.outputFIFOs(nodes[s]) %}
@@ -47,6 +38,7 @@ The support classes and code is covered by CMSIS-DSP license.
{% if config.debug %}
debugCounter--;
{% endif %}
+ CG_AFTER_ITERATION;
nbSchedule++;
}
diff --git a/cmsisdsp/cg/static/scheduler/templates/code.h b/cmsisdsp/cg/static/scheduler/templates/code.h
index 66a05eff..81405573 100644
--- a/cmsisdsp/cg/static/scheduler/templates/code.h
+++ b/cmsisdsp/cg/static/scheduler/templates/code.h
@@ -19,6 +19,17 @@ extern "C"
{
#endif
+{% if config.eventRecorder %}
+#include "EventRecorder.h"
+
+#define EvtSched 0x01
+
+#define Evt_Scheduler EventID (EventLevelAPI, EvtSched, 0x00)
+#define Evt_Node EventID (EventLevelAPI, EvtSched, 0x01)
+#define Evt_Error EventID (EventLevelError, EvtSched, 0x02)
+
+{% endif %}
+
extern uint32_t {{config.schedName}}(int *error{{optionalargs()}});
#ifdef __cplusplus
diff --git a/cmsisdsp/cg/static/scheduler/templates/code.py b/cmsisdsp/cg/static/scheduler/templates/code.py
index 999b7d03..32f0df5c 100644
--- a/cmsisdsp/cg/static/scheduler/templates/code.py
+++ b/cmsisdsp/cg/static/scheduler/templates/code.py
@@ -11,8 +11,8 @@ import sys
import numpy as np
import cmsisdsp as dsp
from cmsisdsp.cg.static.nodes.simu import *
-from appnodes import *
-from custom import *
+from {{config.appNodesPythonName}} import *
+from {{config.customPythonName}} import *
{% macro optionalargs() -%}
{% if config.pyOptionalArgs %}{{config.pyOptionalArgs}}{% endif %}
diff --git a/cmsisdsp/cg/static/scheduler/templates/codeArray.cpp b/cmsisdsp/cg/static/scheduler/templates/codeArray.cpp
index 34697208..7d7007aa 100644
--- a/cmsisdsp/cg/static/scheduler/templates/codeArray.cpp
+++ b/cmsisdsp/cg/static/scheduler/templates/codeArray.cpp
@@ -12,10 +12,10 @@ The support classes and code is covered by CMSIS-DSP license.
{% endif %}
#include "arm_math.h"
-#include "custom.h"
+#include "{{config.customCName}}"
#include "GenericNodes.h"
-#include "AppNodes.h"
-#include "scheduler.h"
+#include "{{config.appNodesCName}}"
+#include "{{config.schedulerCFileName}}.h"
{% macro optionalargs() -%}
{% if config.cOptionalArgs %},{{config.cOptionalArgs}}{% endif %}
@@ -116,15 +116,29 @@ uint32_t {{config.schedName}}(int *error{{optionalargs()}})
{% endif %}
{
/* Run a schedule iteration */
+ {% if config.eventRecorder -%}
+ EventRecord2 (Evt_Scheduler, nbSchedule, 0);
+ {% endif -%}
+ CG_BEFORE_ITERATION;
for(unsigned long id=0 ; id < {{schedLen}}; id++)
{
unsigned int nodeId = schedule[id];
+ {% if config.eventRecorder -%}
+ EventRecord2 (Evt_Node, nodeId, 0);
+ {% endif -%}
cgStaticError = nodeArray[nodeId]->run();
+ {% if config.eventRecorder -%}
+ if (cgStaticError<0)
+ {
+ EventRecord2 (Evt_Error, cgStaticError, 0);
+ }
+ {% endif -%}
CHECKERROR;
}
{% if config.debug %}
debugCounter--;
{% endif %}
+ CG_AFTER_ITERATION;
nbSchedule++;
}
diff --git a/cmsisdsp/cg/static/scheduler/templates/codeSwitch.cpp b/cmsisdsp/cg/static/scheduler/templates/codeSwitch.cpp
index d6685e43..2ef651ad 100644
--- a/cmsisdsp/cg/static/scheduler/templates/codeSwitch.cpp
+++ b/cmsisdsp/cg/static/scheduler/templates/codeSwitch.cpp
@@ -20,25 +20,40 @@ static unsigned int schedule[{{schedLen}}]=
{% endif %}
{
/* Run a schedule iteration */
+ {% if config.eventRecorder -%}
+ EventRecord2 (Evt_Scheduler, nbSchedule, 0);
+ {% endif -%}
+ CG_BEFORE_ITERATION;
for(unsigned long id=0 ; id < {{schedLen}}; id++)
{
+ {% if config.eventRecorder -%}
+ EventRecord2 (Evt_Node, schedule[id], 0);
+ {% endif -%}
switch(schedule[id])
{
{% for nodeID in range(nbNodes) -%}
case {{nodeID}}:
{
{{nodes[nodeID].cRun()}}
- CHECKERROR;
}
break;
- {% endfor %}default:
+ {% endfor -%}
+ default:
break;
}
+ {% if config.eventRecorder -%}
+ if (cgStaticError<0)
+ {
+ EventRecord2 (Evt_Error, cgStaticError, 0);
+ }
+ {% endif -%}
+ CHECKERROR;
}
{% if config.debug %}
debugCounter--;
{% endif %}
+ CG_AFTER_ITERATION;
nbSchedule++;
}
diff --git a/cmsisdsp/cg/static/scheduler/templates/commonc.cpp b/cmsisdsp/cg/static/scheduler/templates/commonc.cpp
index 7ef4f016..c13999dc 100644
--- a/cmsisdsp/cg/static/scheduler/templates/commonc.cpp
+++ b/cmsisdsp/cg/static/scheduler/templates/commonc.cpp
@@ -12,10 +12,12 @@ The support classes and code is covered by CMSIS-DSP license.
{% endif %}
#include "arm_math.h"
-#include "custom.h"
+#include "{{config.customCName}}"
#include "GenericNodes.h"
-#include "AppNodes.h"
-#include "scheduler.h"
+#include "{{config.appNodesCName}}"
+#include "{{config.schedulerCFileName}}.h"
+
+
{% macro optionalargs() -%}
{% if config.cOptionalArgs %},{{config.cOptionalArgs}}{% endif %}
diff --git a/cmsisdsp/version.py b/cmsisdsp/version.py
index 6ed13a85..d018d844 100755
--- a/cmsisdsp/version.py
+++ b/cmsisdsp/version.py
@@ -1,2 +1,2 @@
# Python wrapper version
-__version__ = "1.7.1"
+__version__ = "1.8.0"