Ozone in a WSL environment

From SEGGER Wiki
Jump to: navigation, search

WSL is the Windows subsystem for Linux.

Disclaimer

WSL currently is not an intended target for Ozone and therefore operating Ozone in a WSL environment is neither tested nor documented. If you execute Ozone in a WSL environment you do this at your own risk.

Ozone in Windows, Source Files and Build Artifacts in Linux

Ozone is installed under Windows. Source files and compiler reside in the Linux subsystem. The compiler is executed in the Linux subsystem. The source files and build artifacts are accessible via the Linux path in the Linux subsystem (e.g. "/home/wsl/project/"). The same files are accessible via the Windows path on the Windows host (e.g. "//wsl.localhost/home/wsl/project/").

It should be possible to directly load the ELF file in Ozone via

 File.Open ("<Windows path>/<yourfile.elf>");

Since the compiler was executed in the Linux subsystem, the Linux paths are encoded into the ELF file. Therefore, Ozone, executing on the Windows host, will not be able to find the source files. You might see a message in the console window indicating that a source file could not be found:

 File.open("<Linux path>/<sourcefile.c>"): File not found

In such a case you need to tell Ozone where to find the missing sources. Since in this example absolute paths are used, path substitution is the means of choice:

 Project.AddPathSubstitute ("<Linux path>", "<Windows path>"); 

For our particular example this would be:

 Project.AddPathSubstitute ("/home/wsl/project/", "//wsl.localhost/home/wsl/Project/); 

This will have the effect that any file residing in the directory structure behind/under "/home/wsl/project/" will be found by Ozone.

There might also be files in different directory trees. As long as they are accessible from the Windows host you can tell Ozone where to find them. You may wish to utilize the other means of controlling file path resolution Ozone provides. The Ozone user's manual describes that topic in detail, please start reading at section 5.14.

You might also encounter files that are not accessible from the Windows host (e.g. library files coming with your compiler or IDE). Ozone will not be able to handle those files. In such a case you may try to copy the respective files to a folder which is visible from the Windows host and use path substitution for accessing those files. Of course you need to know exactly what you are doing in order to make sure that the correct files are foisted to the Windows host.

If you are unsure which file paths are encoded into the ELF file, please have a look at the Source Files window in Ozone. Here all source files are listed in a table; the column "Path" displays the path. You may need to scroll to the right end of the window to see the column. In case it is hidden please use the context menu of the table headline to show the column.

Note

Please note the following excerpt from the Microsoft WSL documentation:

 We recommend against working across operating systems with your files, unless you have a specific reason for doing so. [1]

Ozone, Source Files and Build Artifacts in Linux

It should be possible to install Ozone on the Linux subsystem by following the instructions for Linux installation found in the Ozone user's manual.

Since Ozone is executing in the same environment the build took place, the file paths encoded into the ELF file are directly visible to and accessible by Ozone. There should be no need for path substitution or applying other means for locating missing source files.

If the J-Link/J-Trace is connected to the host via USB it might not be visible in the Linux subsystem, so Ozone cannot access it. For instruction on connecting the USB device to your Linux subsystem please refer to the WSL documentation. Once the J-Link/J-Trace is connected to the Linux subsystem and Ozone can see it, it should be possible to operate Ozone and J-Link as on any other Linux system.

If the J-Link/J-trace is connected via Ethernet it should be visible in the Linux subsystem. If not, please refer to the WSL documentation on how to resolve that. Again, once the J-Link/J-Trace is visible to Ozone you should be able to operate Ozone normally.