Cutting down on space while generating code.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am doing some on target rapid prototyping with some pretty tight space restrictions. A new release of control software is about to be released and space is going to be at an even greater premium. So may question to the Matlab community is are there any tips or tricks for cutting down on the size of the code generated for our bypassed system? I have already switched to an embedded coder .tlc and enabled inline parameters.
9 Kommentare
Walter Roberson
am 23 Nov. 2011
I would suggest that anyone who is programming at the TLC level probably has a fairly good idea of what they mean by "size of the generated code".
Executable images generated for embedded systems do not usually have much in the way of structure or overhead. The files are often not that much more than some magic numbers followed by a series of "Start at address X and copy in the following Y bytes", though some might be sophisticated enough to mark some areas as being intended for ROM, some areas for EEPROM, some for Flash memory, some for FPGA, and so on (as the loader that reprograms the embedded system might need to know which hardware treatment to use for which section)
Michael needs to know how to minimize the number of bytes generated to go in to EEPROM (or flash, or some other kind of non-volatile memory that the program will reside in.)
The most appropriate techniques probably depend upon the specific embedded board, and on the compiler being used, we do not have information about at present (and most of us probably won't happen to have had hands-on experience with.)
Fangjun Jiang
am 23 Nov. 2011
@Walter, I don't recommend making things complicated. The OP is asking for "cutting down on space". It's just that it is not clear whether it refers to ROM or RAM. And the comment "Memory to store the program onto the microcontroller RAM" is self-conflicting.
Akzeptierte Antwort
Fangjun Jiang
am 23 Nov. 2011
I assume you are using RTW. Follow the documentation Real-Time Workshop->User's Guide->Preparing Models for Code Generation->Configuring a Model for Code Generation->Configuring Code Generation Objectives
Once you select the ert.tlc, you will see the "Set objectives ..." and "Check model ..." buttons in the Real-Time Workshop panel.
Click "Set objectives ...", you will see the options for "Execution efficiency", "ROM efficiency", "RAM efficiency" and etc. I assume you want the ROM efficiency most so select that option, don't select the "Traceability" and "Debugging" as they might increase ROM.
Then you can click the button "Check model ...". It might give you some advice on how to modify your model to achieve your goals. Many times, the effect of choosing code generation options is limited. The way the model is constructed has the most impact on code generation.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Simulink Coder finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!