# Implement custom code in C2000 code generation

**URL:** <https://forum.plexim.com/t/implement-custom-code-in-c2000-code-generation/1075>\
**Category:** TI C2000\
**Tags:** custom, c-script, plecs-coder, c2000, f28379d\
**Created:** [November 5, 2021, 4:06am UTC](https://forum.plexim.com/t/implement-custom-code-in-c2000-code-generation/1075 "2021-11-05T04:06:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndreThoennessen](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@AndreThoennessen](https://forum.plexim.com/u/AndreThoennessen)\
**Post date:** [November 5, 2021, 4:06am UTC](https://forum.plexim.com/t/implement-custom-code-in-c2000-code-generation/1075/1 "2021-11-05T04:06:18Z")

</div>

Hello,

I am trying to implement the EMIF interface of the F28379D in Plecs for C-code-generation to communicate with an FPGA. There is no suitable block in the library browser.

Also, the C script block does not seem to be suitable for including custom C code in the code generation, but is only intended for the Plecs simulation.

Is there any way to include custom code or write a custom library for this purpose?

Thank you,  
André

---

<div class="post-metadata">

**Author:** ![Bryan\_Lieblick](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/bryan_lieblick/32/10_2.png) [@Bryan\_Lieblick](https://forum.plexim.com/u/Bryan_Lieblick)\
**Post date:** [November 5, 2021, 4:32pm UTC](https://forum.plexim.com/t/implement-custom-code-in-c2000-code-generation/1075/2 "2021-11-05T16:32:06Z")

</div>

André,

The EMIF interface is not supported by the C2000 target support package. As you suggested, the C-Script block is not a means to implement this functionality.

Creating a component to support this or any other peripheral is not trivial. Therefore we do not support users in creating their own custom blocks.

Regards,

Bryan

---

<div class="post-metadata">

**Author:** ![AndreThoennessen](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@AndreThoennessen](https://forum.plexim.com/u/AndreThoennessen)\
**Post date:** [November 8, 2021, 4:05am UTC](https://forum.plexim.com/t/implement-custom-code-in-c2000-code-generation/1075/3 "2021-11-08T04:05:12Z")

</div>

It would be nice if there was a generic interface to custom C code.

In the generated C-code I have the possibility to include further C-files. But I don’t see any other way to call the C-files in the Plecs tasks without manually changing the generated code after each build.

---

<div class="post-metadata">

**Author:** ![Bryan\_Lieblick](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/bryan_lieblick/32/10_2.png) [@Bryan\_Lieblick](https://forum.plexim.com/u/Bryan_Lieblick)\
**Post date:** [November 8, 2021, 11:01am UTC](https://forum.plexim.com/t/implement-custom-code-in-c2000-code-generation/1075/4 "2021-11-08T11:01:33Z")

</div>

Thanks for the feedback. The PLECS Coder works based on the functionality you’re looking for, in that it inserts C snippets into the generated code. I’ll send a private email generally describing how it works.
