matlab script for coder configuration for stm32h7 embedded mcu

7 ビュー (過去 30 日間)
영준 김
영준 김 2025 年 7 月 14 日
回答済み: Nithin 2025 年 7 月 14 日
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
////////////////////////////////////////////////////////////////////////////////////////////////////////////

回答 (1 件)

Nithin
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:

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by