前言
自定义目标系统文件由五大文件组成:
- xx.tlc 系统目标文件
- xx_callback_handler.m RTW工具箱回调函数
- xx_make_rtw_hook.m tlc文件调用
- xx_file_process.tlc 文件处理TLC文件
- xx_srmain.tlc 控制主函数文件的生成
-
这个文件主要是用在代码生成阶段的底层代码生成,实现应用层+底层代码一键生成。
当配置好tlc文件后,将该tlc文件移植到Matlab的工作路径,然后点击Browse就能选择自己编写的tlc文件了。
%% SYSTLC: Customize the target system configuration TMF: none MAKE: make_rtw EXTMODE: ext_comm %%用于RTW属性设置窗口的显示内容 TMF,MAKE文件的设置 %selectfile NULL_FILE %assign CodeFormat = "Embedded-C" %assign TargetType = "RT" %assign Language = "C" %if !EXISTS("AutoBuildProcedure") %if EXISTS("GenerateSampleERTMain") %assign AutoBuildProcedure = !GenerateSampleERTMain %else %% This is for the targets that use jxert.tlc and are required to work %% without Embedded Coder. This is to enable auto build procedure since %% the GenerateSampleERTMain is always set to true for these targets. %assign AutoBuildProcedure = TLC_TRUE %endif %endif %include "codegenentry.tlc" %%以上配置代码生成格式、类型、语言等内容 /% BEGIN_RTW_OPTIONS rtwgensettings.BuildDirSuffix = '_jxert_rtw'; rtwgensettings.DerivedFrom = 'ert.tlc'; rtwgensettings.Version = '1'; rtwgensettings.SelectCallback = ['jxert_callback_handler(hDlg, hSrc)']; END_RTW_OPTIONS %/ %%这部分内容是对一些 RTW 生成属性的配置(RTW_OPTIONS) %%rtwgensettings.BuildDirSuffix = '_jxert_rtw'; 表示生成的文件夹后缀 %%rtwgensettings.DerivedFrom = 'ert.tlc'; 设置继承ert.tlc %%rtwgensettings.Version = '1'; 必须设置为1 才能启用回调 %%rtwgensettings.SelectCallback = ['jxert_callback_handler(hDlg, hSrc)']; 表示选择 jxert.tlc 目标系统的时候 %%matlab 将自动执行 jxert_callback_handler 函数中的程序
这里用的是TLC语言,感兴趣的可以去搜搜用法。
- SYSTLC:显示在浏览器中的描述符。
- TMF:要在编译过程中使用的模板联编文件 (TMF) 的名称。选择目标后,此文件名将显示在 Configuration Parameters 对话框的 Code Generation 窗格的Template makefile字段中。不需要生成exe时设置none
- MAKE:要在编译过程中使用的 make 命令。选择目标后,此命令将显示在 Configuration Parameters 对话框的 Code Generation 窗格的 Make command 字段中。
- EXTMODE:与目标关联的外部模式接口文件(如果有)的名称。如果您的目标不支持外部模式,请使用 no_ext_comm。