ComputeGraph improvements.

More customization options
pull/64/head
Christophe Favergeon 3 years ago
parent 568e45afc6
commit f2f099f886

@ -209,6 +209,14 @@ When `debugLimit` is > 0, the number of iterations of the scheduling is limited
When true, generate some code to dump the FIFO content at runtime. Only useful for debug. When true, generate some code to dump the FIFO content at runtime. Only useful for debug.
In C code generation, it is only available when using the mode `codeArray == False`.
When this mode is enabled, the first line of the scheduler file is :
`#define DEBUGSCHED 1`
and it also enable some debug code in `GenericNodes.h`
#### schedName (default = "scheduler") #### schedName (default = "scheduler")
Name of the scheduler function used in the generated code. Name of the scheduler function used in the generated code.
@ -247,6 +255,10 @@ Enable the generation of `CMSIS EventRecorder` intrumentation in the code.
Name of custom header in generated C code. If you use several scheduler, you may want to use different headers for each one. Name of custom header in generated C code. If you use several scheduler, you may want to use different headers for each one.
##### postCustomCName (default = "")
Name of custom header in generated C code coming after all of the other includes.
##### genericNodeCName (default = "GenericNodes.h") ##### genericNodeCName (default = "GenericNodes.h")
Name of GenericNodes header in generated C code. If you use several scheduler, you may want to use different headers for each one. Name of GenericNodes header in generated C code. If you use several scheduler, you may want to use different headers for each one.
@ -261,6 +273,14 @@ Name of scheduler cpp and header in generated C code. If you use several schedul
If the option is set to `xxx`, the names generated will be `xxx.cpp` and `xxx.h` If the option is set to `xxx`, the names generated will be `xxx.cpp` and `xxx.h`
##### CAPI (default = True)
By default, the scheduler function is callable from C. When false, it is a standard C++ API.
##### CMSISDSP (default = True)
If you don't use any of the datatypes or functions of the CMSIS-DSP, you don't need to include the `arm_math.h` in the scheduler file. This option can thus be set to `False`.
#### Options for Python code generation only #### Options for Python code generation only
##### pyOptionalArgs (default = "") ##### pyOptionalArgs (default = "")

@ -63,7 +63,13 @@ print("Schedule length = %d" % sched.scheduleLength)
print("Memory usage %d bytes" % sched.memory) print("Memory usage %d bytes" % sched.memory)
# #
#conf.codeArray=True
#conf.postCustomCName = "post.h"
#conf.CAPI = True
#conf.prefix="global"
#conf.dumpFIFO = True
#conf.CMSISDSP = False
#conf.switchCase = False
sched.ccode("generated",conf) sched.ccode("generated",conf)
with open("test.dot","w") as f: with open("test.dot","w") as f:

@ -107,6 +107,9 @@ class Configuration:
self.customCName = "custom.h" self.customCName = "custom.h"
self.customPythonName = "custom" self.customPythonName = "custom"
# Name of post custom files
self.postCustomCName = ""
# Name of generic nodes headers # Name of generic nodes headers
self.genericNodeCName = "GenericNodes.h" self.genericNodeCName = "GenericNodes.h"
@ -114,6 +117,12 @@ class Configuration:
self.schedulerCFileName = "scheduler" self.schedulerCFileName = "scheduler"
self.schedulerPythonFileName = "sched" self.schedulerPythonFileName = "sched"
# True is C API for the scheduler
self.CAPI = True
# By default arm_math.h is included
self.CMSISDSP = True
@property @property
def debug(self): def debug(self):
return (self.debugLimit > 0) return (self.debugLimit > 0)

@ -14,10 +14,12 @@ The support classes and code is covered by CMSIS-DSP license.
{% if config.cOptionalArgs %},{{config.cOptionalArgs}}{% endif %} {% if config.cOptionalArgs %},{{config.cOptionalArgs}}{% endif %}
{% endmacro -%} {% endmacro -%}
{% if config.CAPI -%}
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
#endif #endif
{% endif %}
{% if config.eventRecorder %} {% if config.eventRecorder %}
#include "EventRecorder.h" #include "EventRecorder.h"
@ -32,9 +34,11 @@ extern "C"
extern uint32_t {{config.schedName}}(int *error{{optionalargs()}}); extern uint32_t {{config.schedName}}(int *error{{optionalargs()}});
{% if config.CAPI -%}
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
{% endif %}
#endif #endif

@ -11,11 +11,16 @@ The support classes and code is covered by CMSIS-DSP license.
#define DEBUGSCHED 1 #define DEBUGSCHED 1
{% endif %} {% endif %}
{% if config.CMSISDSP -%}
#include "arm_math.h" #include "arm_math.h"
{% endif %}
#include "{{config.customCName}}" #include "{{config.customCName}}"
#include "{{config.genericNodeCName}}" #include "{{config.genericNodeCName}}"
#include "{{config.appNodesCName}}" #include "{{config.appNodesCName}}"
#include "{{config.schedulerCFileName}}.h" #include "{{config.schedulerCFileName}}.h"
{% if config.postCustomCName -%}
#include "{{config.postCustomCName}}"
{% endif %}
{% include "defineConfig.h" %} {% include "defineConfig.h" %}

@ -11,11 +11,16 @@ The support classes and code is covered by CMSIS-DSP license.
#define DEBUGSCHED 1 #define DEBUGSCHED 1
{% endif %} {% endif %}
{% if config.CMSISDSP -%}
#include "arm_math.h" #include "arm_math.h"
{% endif %}
#include "{{config.customCName}}" #include "{{config.customCName}}"
#include "{{config.genericNodeCName}}" #include "{{config.genericNodeCName}}"
#include "{{config.appNodesCName}}" #include "{{config.appNodesCName}}"
#include "{{config.schedulerCFileName}}.h" #include "{{config.schedulerCFileName}}.h"
{% if config.postCustomCName -%}
#include "{{config.postCustomCName}}"
{% endif %}
{% include "defineConfig.h" %} {% include "defineConfig.h" %}

@ -1,2 +1,2 @@
# Python wrapper version # Python wrapper version
__version__ = "1.9.1" __version__ = "1.9.2"

Loading…
Cancel
Save