Uploading, downloading, and merging changes to your project in the Intel® XDK

In previous releases, uploading your project files to your board in the Intel® XDK was a one-way process. Now you can also change files directly on your board and have your changes merged from the board to the project on your system. For a brief overview of both workflows and steps to perform an upload or merge, see the following:

You can determine whether your changes are uploaded or merged. You can also automatically run or debug your applications right after uploading them to your board and have any changes to your project automatically saved each time you upload your project to your board. For steps, see Selecting upload and save options.

You can also download files from your board directly to your project or clear the contents of your board's project directory. For steps, see the following:

Working with projects in the Intel® XDK

This section provides an overview of working with projects, including best practices to work directly on the board and in the Intel XDK at the same time.

When you do an upload or a merge, the Intel XDK checks the .appID file in the project work area on your board:

  • If the project ID in this file matches the ID of the project currently open in the Intel XDK (called the current project), then the work area belongs to the current project. In this case, the Intel XDK updates only those files that have changed since the last upload or merge.
  • If the IDs don't match, the files on the board don't belong to the current project, and all the project files must be reuploaded to the board.

The rest of this section assumes the files on the board belong to the current project and the Intel XDK is updating only files that have changed.

Modifying files

In upload mode, the Intel XDK keeps track of changes you make to project files on your system (also called the host). The first time you upload your project to your board, the Intel XDK creates a table of files in the project and their last modified dates. For each subsequent upload, the Intel XDK checks which files have been changed since the last upload, then transfers just those files to your board.

In merge mode, any updated files on the board will also be transferred back to the project.

Updating files

To update a file on your board, modify it on the host, then perform an upload or merge. Don't try to force an update by deleting the file from your board:

  • In upload mode, deleting the file from the board won’t delete the file from the host, but the file will also not be reuploaded.
  • In merge mode, if you remove a file on the board that was previously part of the project, the Intel XDK also removes the file from the project on the host. Take care that you do not accidentally delete your files.

Removing files

To remove a file from your board, delete it from your project, then perform an upload or merge. In merge mode, if you remove a file that was previously part of the project from the board, the Intel XDK also removes the corresponding file from the project on your system.

Working with package.json

The package.json file is treated as a special case and works similarly in both upload and merge modes.

When you modify package.json on the host, the Intel XDK does a full npm cycle, which includes the following:

  • Performs an npm install on the host
  • Uploads the entire node_modules subdirectory to the board
  • Performs an npm build on the board

In merge mode, if you modify package.json on your board, the Intel XDK first downloads the file to the host, then does a full npm cycle, as described above.

If you want to modify a file in the node_modules subtree, do so on the host. Afterwards, modify package.json on the host and perform an upload or merge to transfer the change to your board. If you instead modify the file in the node_modules subtree on your board and try updating the package.json file, your change will be lost during the next upload or merge.

Uploading your project to your board (upload mode)

By default, when you upload your project to your board, the process is one-way: from your project to your board. During the upload process, the Intel XDK checks whether the project has already been uploaded to the board on a previous occasion:

  • If it has, the Intel XDK transfers to the board only those files that have changed. If package.json has changed, the Intel XDK also performs a build.
  • If this is the first time the project is being uploaded to the board, the Intel XDK transfers all project files to the board and performs a build (if needed).

You upload your project to your board by clicking the Upload icon, as shown below:

Example of transferring a project to a board

You can also have the Intel XDK merge changes from your board back to your project, For steps to determine whether the Intel XDK uploads or merges changes by default, see Selecting upload and save options.

Merging changes from your board to your project (merge mode)

In addition to uploading changes you make in your project to your board, as described in the section above, you may sometimes find it convenient to edit files directly on the board. You can then have the files in your project synched with those on the board.

To do this, you use the Also merge changes from board to project option, as described in Selecting upload and save options. When you do, the arrow icon in the lower left corner of the Intel XDK changes to double arrows, signaling that changes to your files will be transferred from your project to your board and vice versa.

Example of the double arrows icon

With this option, when you upload your project to your board, any updated files on the board will also be transferred back to the project. If package.json has changed on the board, the Intel XDK also performs a build and transfers the node_modules files back to the board.

If you have changed a file both in the project and on the board, you will be asked which version you want to keep, as the Intel XDK cannot merge the two sets of changes into a new file.  

Selecting upload and save options

You can select options to determine whether the Intel XDK uploads or merges changed files, as well as how project files are uploaded and saved. For example:

  • By default, when you upload your project to your board, the Intel XDK displays a prompt asking you whether to save any edits you have made. You can disable this prompt.
  • You can have the Intel XDK start running or debugging your application automatically each time you upload your project to your board. For example, if you are debugging code and want to test your application each time you upload a new version to your board, this eliminates the need to click the Debug icon each time.

To select upload and save options

  1. Click the Manage your daemon/IoT device icon Manage your daemon/IoT device icon in the bottom right of the Intel XDK, then select Upload Control. The Upload Options dialog box opens.

    Example of the Upload Options dialog box

  2. Under Select Upload Method, choose one of the following:
    • To perform a one-way upload of project files from your system to your board when you click the upload icon, select From project down to board only.
    • To merge project files from your board to your system in addition to uploading your project to the board, select Also merge changes from board to project.
  3. You can determine whether to run or debug your project immediately each time you upload the project to your board. Under Automatic Start, choose one of the following:
    • To run your project immediately after uploading it to your board, select Automatically run after upload.
    • To begin debugging your project immediately after uploading it to your board, select Automatically debug after upload.
    • To upload your project without running or debugging your project, select Don't automatically start after upload.
  4. By default, the Intel XDK prompts you to save any changes you've made to your project whenever you transfer your project files to your board. You can have the Intel XDK automatically save any changes to your project without displaying a prompt.  
    • To save your changes automatically, select the Save automatically on upload without asking check box.
    • To display the prompt, clear the Save automatically on upload without asking check box.
  5. Click OK to apply your changes.

Downloading files from your board to your project

You can download files from your board into the current project in the Intel XDK. This differs from merging changes from your board into your project in the following ways:

  • The app on the board does not need to be the same as the current project or any existing project in the Intel XDK.
  • The files in the project are overwritten without asking.

To download files from your board to your project

  1. Click the Manage your daemon/IoT device icon Manage your daemon/IoT device icon in the bottom right of the Intel XDK, then select Upload Control. The Upload Options dialog box opens.
  2. Click Download From Board. Your files are downloaded.

Clearing your board's project directory

There may be times when you want to disregard the contents of your board and do a full upload of your project files. For example, you may want to upload the same project to multiple boards. Because the Intel XDK by default only uploads those project files that have changed to your board, you would have to touch every file in the project to get your project fully uploaded to each board.

Instead, you can use the Clear Board Directory option to clear the board project directory. The next time you upload your project to the board, the Intel XDK treats it as a "fresh" install, and uploads all project files to the board.

This command is also useful to remove files from a previous project if you plan to use merge mode. If you do not clear the board project directory, the files from the previous project will be uploaded to the new project on your system since the Intel XDK doesn't know you didn't leave them there deliberately.

To clear your board's project directory

  1. Click the Manage your daemon/IoT device icon Manage your daemon/IoT device icon in the bottom right of the Intel XDK, then select Upload Control. The Upload Options dialog box opens.
  2. Click Clear Board Directory. The directory is cleared.
For more complete information about compiler optimizations, see our Optimization Notice.