Embedded Software

Embedded Software

Topics relate to SCADE Suite, SCADE Display, SCADE Vision and more

Integrating C Code generated by KCG in Software Application

    • ping
      Subscriber

      Hi everyone

      I have downloaded and installed ANSYS SCADE Suite Version Student 2021 R1. I created a simple operator called "opr_and_gate" which consists of just two boolean inputs, a boolean output and an AND gate.

      I was able to use KCG to generate a number of files in a folder named "KCG". Among these files are "opr_and_gate.c" and "opr_and_gate.h".

      I want to imtegrate this C Code generated by KCG into a software application. Therefore, I wrote a bare C program to include "opr_and_gate.h", and saved it in the "KCG" folder. When I tried to compile it, I got the error below:

      kcg_types.h:168:10: fatal error: kcg_assign.h: No such file or directory

       168 | #include "kcg_assign.h"

      Please help me understand what is the purpose of "kcg_assign.h", and in this case, whether it can just be a blank file.

      I got the following from the SCADE manual, but still don't understand what it means.

      QUOTE:

      The kcg_assign macro must be provided either through the -user_config option mechanism or through a kcg_assign.h file. The macro is used by the generated C code to perform low-level copy of non-scalar data. It uses the C memcpy library function for simulation purposes and has to be redefined by users according to final target environment.

      UNQUOTE

      Thanks.

    • ChristianSchrader
      Ansys Employee
      Hi The standard version of kcg_assign.h can be found here in your SCADE install folder (adapted to your version/install path): C:\Program Files\ANSYS Inc\vXYZ\SCADE\SCADE\include\C. The only thing the file does is define the kcg_assign macro to map to memcpy as available in standard C API for Windows.
      In order to recognize your code properly, I would recommend the following:
      Have KCG folder only contain the generated C code
      Have your own code folder side by side to the KCG folder in the project directory.
      Make a copy of kcg_assign.h into your source folder
      Adapt the include paths of your compiler where necessary
      With that setup you should be good to go.

      Best regards Christian
Viewing 1 reply thread
  • You must be logged in to reply to this topic.