Skip to content

Commit

Permalink
Merge pull request #29 from sync2brain/pack_mldatx
Browse files Browse the repository at this point in the history
Pack firmware mldatx file in toolbox
  • Loading branch information
pablorcum authored Aug 24, 2023
2 parents c127e9c + 3677424 commit 8952b58
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
work
toolbox/html
toolbox/dependencies/firmware

# Autosave files
*.asv
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
3. If you are working on Windows, please set the Development-to-Target Computer Ethernet Interface as `Private`. Follow the steps documented [here](https://www.mathworks.com/help/slrealtime/ug/troubleshoot-communication-failure-through-firewall.html).

## Initial toolbox configuration
1. Download `bossdevice-api-installer.mltbx` and the firmware `mainmodel.mldatx` from the latest [release](https://github.com/sync2brain/bossdevice-api-matlab/releases) available in the GitHub project.
1. Download `bossdevice-api-installer.mltbx` from the latest [release](https://github.com/sync2brain/bossdevice-api-matlab/releases) available in the GitHub project.
2. Start MATLAB and install the bossdevice API toolbox with double click on `bossdevice-api-installer.mltbx`.
3. In the MATLAB Command Window, call `bd = bossdevice` to add the bossdevice with the default settings to the list of targets. It will also try to establish connection. If you want to change either the name of the bossdevice or its default IP address in your local MATLAB settings, call `bd = bossdevice('bossdevice','192.168.7.5')` replacing the function arguments with the name and IP address you want to set on the real-time device.
4. Click on the update command if prompted to update the software dependencies on the bossdevice.
Expand Down
10 changes: 9 additions & 1 deletion buildUtilities/releaseTask.m
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
function toolboxOptions = releaseTask(toolboxVersion, authorName)
function toolboxOptions = releaseTask(toolboxVersion, authorName, shareFolder)
%GENERATETOOLBOX Function that generates a toolbox for the boss device API

arguments
toolboxVersion string {mustBeTextScalar} = '0.0'
authorName string {mustBeTextScalar} = "sync2brain" % Use committer name when packaging from CI
shareFolder {mustBeFolder} = getenv('firmwareSharePath')
end

% Get current project object
projObj = currentProject;

% Copy firmware in local share folder to toolbox to facilitate distribution
if ~isempty(shareFolder)
copyfile(shareFolder,fullfile(projObj.RootFolder,'toolbox/dependencies/firmware/'));
else
warning('Share folder not found. Firmware dependencies will not be packaged in toolbox.');
end

% Remove v from toolboxVersion
options.toolboxVersion = erase(toolboxVersion,"v");

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Ref="toolbox/dependencies/firmware" Type="Relative"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="7b27b9ba-3b11-4cd5-ab8b-e41b1f5d5d33" type="Reference"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="design"/>
</Category>
</Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location=".gitkeep" type="File"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="1" type="DIR_SIGNIFIER"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="firmware" type="File"/>
5 changes: 5 additions & 0 deletions toolbox/bossdevice.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,13 @@ function clearPersonalSettings()
end

% Search firmware binary and prompt user if not found in MATLAB path
toolboxPath = fileparts(which(mfilename));
firmwareSharePath = fullfile(toolboxPath,'dependencies','firmware',matlabRelease.Release,[obj.appName,'.mldatx']);

if exist([obj.appName,'.mldatx'],"file")
obj.firmwareFilepath = obj.appName;
elseif isfile(firmwareSharePath)
obj.firmwareFilepath = firmwareSharePath;
elseif ~batchStartupOptionUsed
[filename, firmwareFilepath] = uigetfile([obj.appName,'.mldatx'],...
'Select the firmware binary to load on the bossdevice');
Expand Down
Empty file.

0 comments on commit 8952b58

Please sign in to comment.