Skip to content

Commit be25863

Browse files
authored
Merge pull request #249 from lf-lang/vscode-remote-ssh
On-target development section
2 parents b524ff1 + 1df0d84 commit be25863

File tree

5 files changed

+75
-0
lines changed

5 files changed

+75
-0
lines changed
281 KB
Loading
Loading
2.97 KB
Loading
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: On-target Development
3+
description: Using VS Code for "on-target" development.
4+
---
5+
6+
# Develop Lingua Franca on Remote Targets
7+
Microsoft Visual Studio Code can be used to connect to a remote target or a virtual machine, which provides a convenient way of developing Lingua Franca applications "on target". The steps here are an alternative to cross-compilation or installing local toolchains, as the tools run natively on a remote target or virtual machine.
8+
9+
## Configure your Target
10+
11+
You may [manually install Lingua Franca](./../installation), or, if you want to use a provisioning tool, see [xronos-inc/xronos_lfc_ansible](https://github.com/xronos-inc/xronos_lfc_ansible) for an Ansible script to install Lingua Franca tools on a remote target.
12+
13+
If you would like to configure a virtual machine, see [xronos-inc/lfc-multipass](https://github.com/xronos-inc/lfc-multipass) for a cloud-init script to install Lingua Franca tools using multipass.
14+
15+
Once you have your remote target, be it a virtual machine or a machine accessible over a network, you can connect to it using Visual Studio Code and the Remote SSH extension.
16+
17+
## Install the Microsoft Remote-SSH extension
18+
19+
Open VS Code, launch Quick Open (Ctrl + P) and enter:
20+
21+
`ext install ms-vscode-remote.remote-ssh`
22+
23+
After installation is complete you'll see the Remote SSH status bar icon:
24+
25+
![remote status bar](./../assets/images/remote-ssh/remote-status-bar.png)
26+
27+
## Connect VS Code to your remote system via SSH
28+
29+
In VS Code, click on the "Remote SSH" status bar icon and select "Connect to Host..." then "Add New SSH Host". When prompted for the host, enter
30+
31+
`ssh ubuntu@[remotehost]`
32+
33+
where `remotehost` is the hostname or IP address of your remote target.
34+
35+
A new VS Code window will open, and the address of your remote target should appear in the Remote SSH status bar:
36+
37+
![remote status bar](./../assets/images/remote-ssh/ssh-status-bar.png)
38+
39+
## Install the Lingua Franca VS Code extension
40+
41+
open VS Code, launch Quick Open (Ctrl + P) and enter:
42+
43+
`ext install lf-lang.vscode-lingua-franca`
44+
45+
## Run the Hello World Application
46+
47+
In VS Code, create the folder `helloworld` on your remote target, then create a file within that folder called `helloworld.lf` with the following contents:
48+
49+
```lf-cpp
50+
target Cpp
51+
52+
main reactor {
53+
reaction(startup) {=
54+
std::cout << "Hello World." << std::endl;
55+
=}
56+
}
57+
```
58+
59+
Similar hello world programs can be created for any of the supported target languages.
60+
61+
Open `helloworld.lf`. You should see the visual rendering of the application on the right pane of Visual Studio. On remote targets with slow internet connections, or slower processors, this may take a few seconds for the first rendering.
62+
63+
Build by pressing Ctrl + Shift + P followed by `Lingua Franca: Build and Run`. The program will be compiled and executed on your remote target with build output and terminal output visible within VS Code.
64+
65+
![hello world example](./../assets/images/remote-ssh/helloworld.png)
66+
67+
## References
68+
69+
- [How to set up Lingua Franca](./../installation)
70+
- [How to create a VSCode Linux remote environment](https://ubuntu.com/blog/how-to-create-a-vscode-linux-remote-environment)
71+
- [Remote development over SSH](https://code.visualstudio.com/docs/remote/ssh-tutorial)

docs/sidebars.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ const sidebars: SidebarsConfig = {
216216
"type": "doc",
217217
"id": "developer/debugging-generated-code"
218218
},
219+
{
220+
"type": "doc",
221+
"id": "developer/on-target-development"
222+
},
219223
{
220224
"type": "doc",
221225
"id": "developer/regression-tests"

0 commit comments

Comments
 (0)