function rtwTargetInfo(varargin)
%RTWTARGETINFO Target info callback

% Copyright 2020 The MathWorks, Inc.
% check if STM32 soc and SLC Spkg for Nucleo is installed
if ~isempty(which('soc.stm32.internal.getRootFolder'))
    return;
end
codertarget.TargetRegistry.addToTargetRegistry(@loc_registerThisTarget);
codertarget.TargetBoardRegistry.addToTargetBoardRegistry(@loc_registerBoardsForThisTarget);
end

% -------------------------------------------------------------------------
function ret =loc_registerThisTarget
ret.Name = 'STM32SIM';
ret.ShortName = 'nucleo';
[targetFilePath, ~, ~] = fileparts(fileparts(mfilename('fullpath')));
ret.TargetFolder = targetFilePath;
end

% -------------------------------------------------------------------------
function boardInfo = loc_registerBoardsForThisTarget()
target = 'STM32SIM';
[targetFolder, ~, ~] = fileparts(mfilename('fullpath'));
[targetFolder, ~, ~] = fileparts(targetFolder);
boardFolder = codertarget.target.getTargetHardwareRegistryFolder(targetFolder);
boardInfo = codertarget.target.getTargetHardwareInfo(targetFolder, boardFolder, target);
end