I am using Simulink to do code gen and build SW for my TI hardware. I am able to successfully build my code by including a custom define flag to the build process:
This ensure that I have this definition in the generated make file
However I want to include this define programatically. How can I do this through matlab code?
I tried using the below and it did not work
myModelBuildInfo = RTW.BuildInfo;
addDefines(myModelBuildInfo,'-DBOOTLOADER_CAN_FLASH','OPTS');

 채택된 답변

Fangjun Jiang
Fangjun Jiang 2021년 1월 28일

0 개 추천

That info is saved with your model, you can set it up
set_param('ModelName','CustomDefine','-DBOOTLOADER')

댓글 수: 4

Mashrur Alam
Mashrur Alam 2021년 1월 28일
Thanks! This solved my issue. Is there a similar way to change the name of the build output? Say from 'my_model_name.exe' to 'foo.exe'?
Fangjun Jiang
Fangjun Jiang 2021년 1월 29일
I think you can specify it through a makefile, then tell rtwbuild to use that makefile.
Correct the makefile sets the output file name like so:
PRODUCT = $(RELATIVE_PATH_TO_ANCHOR)/Rotary_Prototype.out
However I want to set the file name (and folder name too) programatically through matlab. I tried the below but it did not work.
set_param(bdroot,'MakeCommand', 'make_rtw PRODUCT=$(RELATIVE_PATH_TO_ANCHOR)/foo.out')
depending on your toolchain setting, set 'BuildConfiguration' to be 'Specify', then set the last line of 'CustomToolchainOptions', where you can specify the makefile name in {'-f $(MAKEFILE)'}
>> get_param(bdroot,'BuildConfiguration')
ans =
'Specify'
>> get_param(bdroot,'CustomToolchainOptions')
ans =
1×14 cell array
Columns 1 through 4
{'C Compiler'} {'-c -w -noregist…'} {'Linker'} {'-s -L$(LCC_LIB)…'}
Columns 5 through 8
{'Shared Library …'} {'-dll -entry Lib…'} {'Archiver'} {0×0 char}
Columns 9 through 13
{'Download'} {0×0 char} {'Execute'} {0×0 char} {'Make Tool'}
Column 14
{'-f $(MAKEFILE)'}

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

질문:

2021년 1월 28일

댓글:

2021년 1월 30일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by