I work with coder and will keep the structure of my team.
I’ve added a header file containing some struct only to facilitate decoding of structured register (word and bit level), used by both “state machine block” and “C-Scripts block”.
In my model, e.g for state machine, the #include“My_user_defines.h” in C declaration works fine, I can build my state machine without errors, but at compilation it does not works, as the path from codegen is different!
As workaround, I modified my structure as following:
and modified my include in C declaration of state machine as follow: #include“../include/My_user_defines.h”. In this case, this works correctly when editing the plecs template as well as during compilation, due to same relative path from both location model and codegen.
Is there a way to works without project structure modification (the first project structure)? Is there a solution to add search user files path relative?
Blaise, what target are you using? Can you also share the version of PLECS and the TSP version you are using as well?
When I try to compile with your original arrangement everything works fine. See the attached example which I tested with the most recent public versions of the TI C2000 and STM32 targets. I set the output directory to a non-default folder titled “codegen”. The header and C files are automatically copied into that folder.
I currently use PLECS 5.0.6. I use PLECS C2000 TSP V2.3.3 (PLECS C2000 TSP/cgt/ti-cgt-c2000_22.6.1.LTS).
In my case, I want to declare one local variable in C-Script. In this case it does’nt work (I can simulate my modell without error, but I can not generate code).
I want submit my exemple in my answer, but I could not send a zip file. How do I have to proceed?
For security reasons *.zip files are disallowed for general users. You can post a *.plecs model and your *.c and *.h files, along with a description of your folder structure in the body of the post.
To completeI my post from yesterday, I send now my two files that are in ProjectRoot (only .plecs and .h file, as I don’t need a .c file). The output directory is named codegen
I can start a simulation without error, but I can not build the project. Here an extract of Diagnostics tab:
Error in build step 4 (Make): Make process exited with code 2:
“C:/Program Files/Plexim/PLECS 5.0 (64 bit)/make/make” -f RegisterBitOrganisationFail.mk ./output_TI2837x_cpu1/RegisterBitOrganisationFail.elf
…
"RegisterBitOrganisationFail_0.c", line 11: fatal error: cannot open source file “RegisterMapFail.h”
1 catastrophic error detected in the compilation of “RegisterBitOrganisationFail_0.c”.
Compilation terminated.
make[1]: *** [output_TI2837x_cpu1/RegisterBitOrganisationFail_0.obj] Error 1
make: *** [all] Error 2