Skip to content

Commit a0172f0

Browse files
authored
Merge pull request lf-lang#250 from lf-lang/on-target
Add on-target docs also to v0.6.0
2 parents be25863 + db671a8 commit a0172f0

File tree

6 files changed

+85
-0
lines changed

6 files changed

+85
-0
lines changed

docs/developer/on-target-development.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ description: Using VS Code for "on-target" development.
66
# Develop Lingua Franca on Remote Targets
77
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.
88

9+
<p align="center">
10+
<iframe width="560" height="315" src="https://www.youtube.com/embed/yg_sudCyzV4?si=b--gaS0q9e9gbMv-" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; display:block;clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
11+
</p>
12+
913
## Configure your Target
1014

1115
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.
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
A video that demonstrates on-target development is available here:
10+
11+
<p align="center">
12+
<iframe width="560" height="315" src="https://www.youtube.com/embed/yg_sudCyzV4?si=b--gaS0q9e9gbMv-" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; display:block;clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
13+
</p>
14+
15+
## Configure your Target
16+
17+
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.
18+
19+
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.
20+
21+
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.
22+
23+
## Install the Microsoft Remote-SSH extension
24+
25+
Open VS Code, launch Quick Open (Ctrl + P) and enter:
26+
27+
`ext install ms-vscode-remote.remote-ssh`
28+
29+
After installation is complete you'll see the Remote SSH status bar icon:
30+
31+
![remote status bar](./../assets/images/remote-ssh/remote-status-bar.png)
32+
33+
## Connect VS Code to your remote system via SSH
34+
35+
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
36+
37+
`ssh ubuntu@[remotehost]`
38+
39+
where `remotehost` is the hostname or IP address of your remote target.
40+
41+
A new VS Code window will open, and the address of your remote target should appear in the Remote SSH status bar:
42+
43+
![remote status bar](./../assets/images/remote-ssh/ssh-status-bar.png)
44+
45+
## Install the Lingua Franca VS Code extension
46+
47+
open VS Code, launch Quick Open (Ctrl + P) and enter:
48+
49+
`ext install lf-lang.vscode-lingua-franca`
50+
51+
## Run the Hello World Application
52+
53+
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:
54+
55+
```lf-cpp
56+
target Cpp
57+
58+
main reactor {
59+
reaction(startup) {=
60+
std::cout << "Hello World." << std::endl;
61+
=}
62+
}
63+
```
64+
65+
Similar hello world programs can be created for any of the supported target languages.
66+
67+
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.
68+
69+
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.
70+
71+
![hello world example](./../assets/images/remote-ssh/helloworld.png)
72+
73+
## References
74+
75+
- [How to set up Lingua Franca](./../installation)
76+
- [How to create a VSCode Linux remote environment](https://ubuntu.com/blog/how-to-create-a-vscode-linux-remote-environment)
77+
- [Remote development over SSH](https://code.visualstudio.com/docs/remote/ssh-tutorial)

versioned_sidebars/version-0.6.0-sidebars.json

+4
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@
202202
"type": "doc",
203203
"id": "developer/debugging-generated-code"
204204
},
205+
{
206+
"type": "doc",
207+
"id": "developer/on-target-development"
208+
},
205209
{
206210
"type": "doc",
207211
"id": "developer/regression-tests"

0 commit comments

Comments
 (0)