You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/vscode/migrating.md
+83-30Lines changed: 83 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,38 +24,82 @@ This step will create a boilerplate project in a working state, ready to add you
24
24
25
25
## Add the source
26
26
27
-
Depending on the complexity of your project, adding the source should be quite straightforward. For a new PlatformIO Arduino project, the directory tree should look like this:
28
-
29
-
```text
30
-
├── .gitignore
31
-
├── include
32
-
│ └── README
33
-
├── lib
34
-
│ └── README
35
-
├── .pio
36
-
│ └── build
37
-
│ ├── project.checksum
38
-
│ └── uno
39
-
│ └── idedata.json
40
-
├── platformio.ini
41
-
├── src
42
-
│ └── main.cpp
43
-
├── test
44
-
│ └── README
27
+
Depending on the complexity of your project, adding the source should be quite straightforward.
45
28
46
-
```
47
-
48
-
In this case you would delete the `/src/main.cpp` and replace it with the '.ino' file from the project you downloaded.
49
-
50
-
:::tip
29
+
<Tabs>
30
+
<TabItemvalue="pio"label="PlatformIO"default>
51
31
52
-
PlatformIO encourages the use of standard C++ files (`.cpp`). To convert your `.ino` file, you can rename it and change the extension to '.cpp', but you will also need to add a line to include the standard Arduino headers at the beginning of the file:
53
-
```
54
-
#include <Arduino.h>
55
-
```
56
-
Any user functions should also be declared before they are called. There is a more detailed example of this in the [PlatformIO documentation FAQ](https://docs.platformio.org/en/latest/faq/ino-to-cpp.html).
32
+
For a new PlatformIO Arduino project, the directory tree should look like this:
33
+
34
+
```text
35
+
├── .gitignore
36
+
├── include
37
+
│ └── README
38
+
├── lib
39
+
│ └── README
40
+
├── .pio
41
+
│ └── build
42
+
│ ├── project.checksum
43
+
│ └── uno
44
+
│ └── idedata.json
45
+
├── platformio.ini
46
+
├── src
47
+
│ └── main.cpp
48
+
├── test
49
+
│ └── README
50
+
51
+
```
52
+
53
+
In this case you would delete the `/src/main.cpp` and replace it with the '.ino' file from the project you downloaded.
54
+
55
+
:::tip
56
+
57
+
PlatformIO encourages the use of standard C++ files (`.cpp`). To convert your `.ino` file, you can rename it and change the extension to '.cpp', but you will also need to add a line to include the standard Arduino headers at the beginning of the file:
58
+
```
59
+
#include <Arduino.h>
60
+
```
61
+
Any user functions should also be declared before they are called. There is a more detailed example of this in the [PlatformIO documentation FAQ](https://docs.platformio.org/en/latest/faq/ino-to-cpp.html).
62
+
63
+
:::
64
+
</TabItem>
65
+
<TabItemvalue="ESP-IDF"label="ESP-IDF">
66
+
For ESP-IDF the default project directory tree looks like this:
67
+
68
+
```text
69
+
├── build
70
+
│ ├── app-flash_args
71
+
│ ├── bootloader
72
+
│ ├── bootloader-flash_args
73
+
│ ├── bootloader-prefix
74
+
| ...
75
+
│ ├── cmake_install.cmake
76
+
│ ├── compile_commands.json
77
+
│ ├── config
78
+
│ │ ├── kconfig_menus.json
79
+
│ │ ├── sdkconfig.cmake
80
+
│ │ ├── sdkconfig.h
81
+
│ │ └── sdkconfig.json
82
+
│ ├── config.env
83
+
│ ├── esp-idf
84
+
│ ...
85
+
├── CMakeLists.txt
86
+
├── main
87
+
│ ├── CMakeLists.txt
88
+
│ └── main.c
89
+
├── README.md
90
+
└── sdkconfig
91
+
```
92
+
:::note
93
+
This is not the entire tree, as it is very large!
94
+
:::
95
+
96
+
The `build` directory is where the built artifacts will be created, which you will need to refer to in a later step.
97
+
98
+
All of the source files should go in `main.c`. If you have multiple source files, you should also update the `CMakelists.txt` file in the same directory to include any other files which need to be built.
99
+
100
+
</TabItem>
101
+
</Tabs>
57
102
58
-
:::
59
103
60
104
## Verify/add libraries
61
105
@@ -101,6 +145,16 @@ The online simulator controls its own build environment. To work locally in VS C
101
145
102
146
The structure and contents of the `wokwi.toml` file are covered in the [VS Code project configuration page](/vscode/project-config). In the previous step you already built the firmware files needed.
103
147
148
+
:::tip
149
+
150
+
You can also generate the `wokwi.toml` file using the Wokwi CLI if it is installed (see [install instructions here](/wokwi-ci/cli-installation)), by running the command:
151
+
152
+
```shell
153
+
wokwi-cli init
154
+
```
155
+
:::
156
+
157
+
104
158
At this point you should also add the `diagram.json` file from your downloaded project. This must be in the same directory as the `wokwi.toml` file.
105
159
106
160
## Test the simulator
@@ -112,4 +166,3 @@ When you select the `diagram.json` file in the VS Code editor, it will automatic
112
166
Use the start button in this window to start the simulation. The simulation should run exactly as it did in the online Wokwi simulator.
113
167
114
168
Note: You will need a license to edit the diagram in this view ([see the Wokwi pricing page](https://wokwi.com/pricing?ref=docs_migrating)).
0 commit comments