matlab script for coder configuration for stm32h7 embedded mcu
7 次查看(过去 30 天)
显示 更早的评论
I got a error during setting coder.config like below
error message is "Unable to find the STM32CubeMX project file. Either selected project file does not exist or incorrect file is selected.
Use help codegen for more information on using this command."
I am trying to make a code for my embeddedboard stm32h7, with matlab coder.
but.. failed
How i can generate c-code for embeded board in matlab coder ( not simulink )
////////////////////////////////////////////////////////////////////////////////////////////////////////////
cfg = coder.config('lib','ecoder',true);
% open('cfg');
% STM32H7 MCU에 적합한 하드웨어 설정
cfg.Hardware = coder.hardware( "STM32H7xx Based (Single-core)" );
cfg.DynamicMemoryAllocation = "Threshold";
cfg.EnableDynamicMemoryAllocation = false;
cfg.GenerateReport = false;
cfg.GenCodeOnly = true;
cfg.GenerateMakefile = true;
cfg.TargetLang = 'C';
% % Makefile 등 추가 생성이 필요한 경우
% cfg.GenerateMakefile = true;
% cfg.Toolchain = 'GNU Tools for ARM Embedded Processors'; % 또는 사용 중인 Toolchain 명시
fprintf('C 코드 생성...\n');
try
% codegen ekf -args {arg_mode, arg_sensor_data, arg_time_sec} -config cfg -o ekf_lib
codegen ekf -args {arg_mode, arg_sensor_data, arg_time_sec} -config cfg -o ekf_lib
fprintf(' -> C 코드 생성 성공!\n');
catch e
fprintf('!!! 코드 생성 중 오류 발생 !!!\n');
rethrow(e);
end
////////////////////////////////////////////////////////////////////////////////////////////////////////////
0 个评论
回答(1 个)
Nithin
2025-7-14
Seems like you have missed selecting the corresponding STM32CubeMX file for your MATLAB Coder project. You can follow the steps detailed in the below page to ensure all the necessary configurations for your MATLAB Coder project are done:
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!