Depending on what code you are trying to add there are different approaches:
- Already mentioned by am304, the Custom Code option in the Configuration Paramters
- With custom S-Functions you write your own blocks with code that gets included in the model. (You may need to learn TLC)
- A more manual approach is customizing the Template Makefile to compile your source files, together with the generated source code from the model.
- The main file (rt_main.c) can also be customized.