Error encountered while Generating PIL Executable for STM32 Nucleo Board

14 Ansichten (letzte 30 Tage)
Silvia
Silvia vor etwa 8 Stunden
Hello,
I implemented the following code:
clc;
clear;
close all;
% Reference example: example: https://it.mathworks.com/help/coder/ug/generate-code-for-lstm-network-and-deploy-on-cortex-m.html
%% Load Network
load RNN_08Nov_FT.mat
load RNN_08Nov_FT_Unproj.mat
%% Load Test Set
folder = "***";
dataDir = string(folder + "\dataset");
% Prepare DataStore object to consume data
ds_Test = signalDatastore(fullfile(dataDir,"test3"), ...
SignalVariableNames=["noisySignal","cleanSignal"], ...
ReadOutputOrientation="row");
% Take the first test set sample
firstdata = read(ds_Test);
noisyInput = firstdata{1};
cleanTarget = firstdata{2};
%% Generic C code generation
% Create a Code Configuration Object
cfg = coder.config('lib','ecoder',true);
% Configure Object for PIL (processor-in-the-loop) Execution
cfg.VerificationMode = 'PIL';
% Specify 'None' as the TargetLibrary when creating a DeepLearningConfig to
% specify no third-parties deep learning libraries (Generate plain C):
cfg.DeepLearningConfig = coder.DeepLearningConfig('TargetLibrary', 'none');
% Specify Target Hardware
cfg.Hardware = coder.hardware('STM32 Nucleo F401RE');
% Set PIL Communication Interfance (a serial PIL communication interface)
cfg.Hardware.PILInterface = 'Serial';
% Determine the COM port for serial communication
cfg.Hardware.PILCOMPort = 'COM5';
% Limit stack size because the default stack size is much larger than the
% available memory on the hardware. Set to a smaller value (try with 512)
cfg.StackUsageMax = 512;
% View the log
cfg.Verbose = 1;
% Specify the Code Replacement Library for Cortex-M
cfg.CodeReplacementLibrary = 'ARM Cortex-M (CMSIS)';
%% Generate PIL Executable that accepts a single observation of variable sequence length
% Type function loads the network (in .mat file) into a persistent variable
% The function reuses this persistent object on subsequent prediction calls
type rnnFineTuned_predict.m % Fine-tuned prediction function for RNN
% Specify input type and size of the input argument tp the codegen command
% by using the coder.typeof function
noisyInputType = coder.typeof(double(0), [10000 1], [false false]);
% Generate PIL Executable
codegen -config cfg rnnFineTuned_predict -args {noisyInputType} -report
I encountered this error:
"### Generating compilation report ...
An error occurred while calling the SIL or PIL target connectivity implementation.
Error(s) encountered while building "rnnFineTuned_predict""
Searching on MATLAB Answers I saw that there's a way to analyze better the error, running "dbstop if all error" and then running again the model to see if MATLAB stops at the point that the error occurs. And what I receive is:
"### Compiling function(s) rnnFineTuned_predict ...
Caught-error breakpoint was hit in GRUProjectedLayer>iCheckFactorDimensions at line 839. The error was:
Error using coder.internal.cliapi.GuardedProject/compile
Value must be scalar or 1-by-3 row vector"
Can you please help me to analyze this error message?
Thank you in advance,
Silvia

Antworten (0)

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by