Strange Error from codegen: "Error indenting generated C code"
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm getting a strange error from the codegen tool.
Using the command:
outDir = 'C:\somedir';
strFileName = 'main.m';
codegen('-g','-c','-v','-config','config','-d',outDir,strFileName);
I get this error:
??? Error indenting generated C code.
Error in ==> main Line: 1 Column: 1
Code generation failed: Open error report.
Any help with this would be greatly appreciated.
Here is the main.m file:
%#codegen
function [ ] = main( )
global delay counter
mc_pll_init(); % Initialize the hardware
mc_lcd_init(); % Initialize the LCD
mc_led_init();
mc_lcd_println('Real Time Interrupt',0);
mc_lcd_println(' ',1);
delay = 0;
counter = 0;
%setup realtime interrupt
RTICTL = uint8(hex2dec('28')); % set RTI timming: 8MHz / (9 * 2^11) = 434.02778 MHz or 2.304 ms
CRGINT = uint8(hex2dec('80')); % enable RTI interrupt
CRGFLG = uint8(hex2dec('80')); % clear rti flag */
cnt = 1;
while (1)
PORTB = uint8(cnt);
mc_lcd_println('cnt = %-16d', cnt, 1);
cnt = cnt * 2;
if (cnt > 255)
cnt = 1;
end
mc_timer_wait(20);
end
end
and here is the configuration of the coder object config passed in the command line (any configuration settings not listed are default):
config = coder.CodeConfig;
config.Name = 'Real-Time Workshop';
config.Description = 'Generic Real-Time Target';
config.TargetLang = 'C';
config.Verbose = true;%false;
config.GenCodeOnly = true;
config.GenerateMakefile = false;
config.GenerateReport = false;
config.LaunchReport = false;
config.FilePartitionMethod = 'SingleFile';
config.MaxIdLength = 31;
config.CCompilerOptimization = 'off';
config.CCompilerCustomOptimizations = '';
config.MakeCommand = 'make_rtw';
config.TemplateMakefile = 'grt_default_tmf';
config.PostCodeGenCommand = '';
config.CustomHeaderCode = '';
config.CustomSourceCode = sprintf('#include "MCU.h"');
config.CustomInitializer = '';
config.CustomTerminator = '';
config.CustomInclude = '';
config.CustomSource = '';
config.CustomLibrary = '';
config.ReservedNameArray = '';
config.ConstantFoldingTimeout = 10000;
config.InlineThreshold = 10;
config.InlineThresholdMax = 200;
config.InlineStackLimit = 4000;
config.SaturateOnIntegerOverflow = true;
config.StackUsageMax = 200000;
config.EnableVariableSizing = true;
0 commentaires
Réponses (1)
Akshat Dalal
le 26 Fév 2025
Hi John,
The following discussion thread might be helpful: https://stackoverflow.com/questions/22013266/matlab-coder-error-indenting-generated-c-code
0 commentaires
Voir également
Catégories
En savoir plus sur Simulink Coder dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!