Updated Compiling Tasmota on Gitpod (markdown)

Michael Ingraham 2019-09-17 09:09:01 -04:00
parent d9dc960030
commit 8a6800eab8
1 changed files with 43 additions and 39 deletions

@ -1,71 +1,75 @@
Even though Tasmota offers several pre-compiled firmware variants, sometimes the ready-to-flash binaries aren't enough. Even though Tasmota offers several pre-compiled firmware variants, sometimes the ready-to-flash binaries aren't enough.
Do you want to enable or disable some features, or simply change some parameters? Then you need to compile a binary yourself. If you need to enable or disable some features, or simply change some parameters, then you need to compile a firmware binary yourself.
If you are not experienced enough or don't want to install an IDE (Integrated Development Environment) like PlatformIO or Arduino-IDE on your computer, you can compile your own firmware in a breeze on [Gitpod](https://www.gitpod.io/). If you are not experienced enough or don't want to install an IDE (Integrated Development Environment) like PlatformIO or Arduino-IDE on your computer, compiling your own firmware is a breeze using [Gitpod](https://www.gitpod.io/).
#### Gitpod: Gitpod is a web browser based online IDE. All you need to use it is to link your GitHub account (or make a new one [here](https://github.com/join?source=header)). Gitpod will take care of all the necessary software package dependencies for you.
Gitpod is a web browser based online IDE. All you need to use it is to link your GitHub account (or make a new one [here](https://github.com/join?source=header)).
![Gitpod login](https://i.imgur.com/irTdi4A.png) ![Gitpod login](https://i.imgur.com/irTdi4A.png)
After you successfully sign in, you can start your personal project. The fastest way to load Tasmota into Gitpod is with one of the following links: After you successfully sign in, you can start your personal project. The fastest way to load Tasmota into Gitpod is with one of the following links:
- [TasmoCompiler](https://github.com/benzino77/tasmocompiler/blob/master/README.md): [`https://gitpod.io/#https://github.com/benzino77/tasmocompiler`](https://gitpod.io/#https://github.com/benzino77/tasmocompiler)
- Master Release: [`https://gitpod.io#https://github.com/arendst/Sonoff-Tasmota/tree/master`](https://gitpod.io#https://github.com/arendst/Sonoff-Tasmota/tree/master)
- Development Branch: [`https://gitpod.io#https://github.com/arendst/Sonoff-Tasmota/tree/development`](https://gitpod.io#https://github.com/arendst/Sonoff-Tasmota/tree/development) - Development Branch: [`https://gitpod.io#https://github.com/arendst/Sonoff-Tasmota/tree/development`](https://gitpod.io#https://github.com/arendst/Sonoff-Tasmota/tree/development)
- Master Release: [`https://gitpod.io#https://github.com/arendst/Sonoff-Tasmota/tree/master`](https://gitpod.io#https://github.com/arendst/Sonoff-Tasmota/tree/master)
- [TasmoCompiler](https://github.com/benzino77/tasmocompiler/blob/master/README.md): [`https://gitpod.io/#https://github.com/benzino77/tasmocompiler`](https://gitpod.io/#https://github.com/benzino77/tasmocompiler)
Gitpod will take care of all the necessary software package dependencies for you. **Browser Extension**
Gitpod has a browser extension (Chrome and Firefox) which is handy to directly load a GitHub project into your personal Gitpod work-space.
![Gitpod link](https://i.imgur.com/uEHszIn.png)
After loading the project, you will be greeted by the main window, presenting three panels: [More information on the Gitpod browser extension](https://www.gitpod.io/docs/20_Browser_Extension/).
## Using Gitpod
After Gitpod loads the project, you will be greeted by the main window. Gitpod will then automatically compile `sonoff.bin`. Wait for the compilation to complete.
The display consists of three panels:
1. Explorer 1. Explorer
2. Editor 2. Editor
3. Terminal 3. Terminal
![Gitpod main screen](https://i.imgur.com/nfAYnwM.png) ![Gitpod main screen](https://i.imgur.com/nfAYnwM.png)
Explorer is the first place you need to look to edit your configuration. ### Customize Firmware Features and Settings
:warning: ATTENTION: The proper method of customizing firmware compilation options is to use the `user_config_override.h` file. Most customizations should not require changes to the `my_user_config.h` file. To modify the stock configuration:
#### :warning: ATTENTION:
The proper method of customizing firmware compilation options is to use the `user_config_override.h` file. Most customizations should not require changes to the `my_user_config.h` file. To modify the stock configuration:
1. Select the `/sonoff` folder in the Explorer (1) pane 1. Select the `/sonoff` folder in the Explorer (1) pane
2. Create a new file called `user_config_override.h` 2. Create a new file called `user_config_override.h`
3. In the Editor (2) pane, change, add, or remove anything you need in your configuration file to define your own settings. Refer to the `user_config_override_sample.h` file as well as `my_user_config.h` for `#define` options. You can find a list of Tasmota features supported listed [here](https://github.com/arendst/Sonoff-Tasmota/wiki/Builds). Define the features you require in your configuration file. 3. In the Editor (2) pane, add, change, or remove anything you need in your configuration file to define your own settings. Refer to the `user_config_override_sample.h` file as well as `my_user_config.h` for `#define` options ([sample](https://pastebin.com/M5KPPWAJ)). You can find a list of Tasmota features and settings listed [here](https://github.com/arendst/Sonoff-Tasmota/wiki/Builds). Define the features you require in your configuration file.
4. Open the `platformio.ini` file located in the `/Sonoff-Tasmota` root directory (scroll to the bottom of the file Explorer pane) 4. Click 'File' on the menu bar and 'Save' your edits.
5. In the Editor (2) pane, a leading semicolon `;` comments out (disables) a statement:
- In the `[common]` section, enable `-DUSE_CONFIG_OVERRIDE` if using your own `user_config_overrid.h` ### Prepare the IDE for Compilation
1. Open the `platformio.ini` file located in the `/Sonoff-Tasmota` root directory (scroll to the bottom of the file Explorer (1) pane). In this file, removing a leading semicolon `;` enables a statement.
2. In the Editor (2) pane:
- If you are using your own `user_config_overrid.h`, you must tell the compiler to use it. Find the `[common]` section in the file. Enable `-DUSE_CONFIG_OVERRIDE`
![Edit platformio.ini](https://i.imgur.com/AQml2kI.png) ![Edit platformio.ini](https://i.imgur.com/AQml2kI.png)
- In the `[core_active]` section, enable the `platform` and `build_flags` lines for the desired core - By default, the 2.6 Core will be compiled. If you wish to use a different Core, find the `[core_active]` section in the file and enable the `platform` and `build_flags` lines for the desired Core.
3. Click 'File' on the menu bar and 'Save' your edits
When you are done, save all of your edits (user_config_override & platformio.ini). Now you're ready to compile. ### Compile Your Firmware
This action is done in the Terminal pane (3) with very simple commands.
#### COMPILING YOUR BINARY:
This action is done in the Terminal pane (3) with very simple commands. The simplest one is `platformio run -e sonoff`
![compile command](https://i.imgur.com/wXA4hvd.png) ![compile command](https://i.imgur.com/wXA4hvd.png)
With this command, Gitpod will compile the Tasmota firmware with the features you selected. If you need a different variant, you can specify this option on the command line: The simplest one is `platformio run -e sonoff`. With this command, Gitpod will compile the Tasmota firmware with the features you selected. If you need a different variant, you can specify this option on the command line:
`platformio run -e <variant-name>` `platformio run -e <variant-name>`
For example: Examples:
`platformio run -e sonoff-sensors` - `platformio run -e sonoff-sensors`
or - `platformio run -e sonoff-DE`
`platformio run -e sonoff-DE`
Compilation normally takes only a couple of minutes. The time if takes is directly related to the configurations you selected; the more features selected means more time is needed to compile. When done, you will find you binary (`firmware.bin`) in `/Sonoff-Tasmota/.pioenvs/<variant-name>/` Compilation normally takes only a couple of minutes. The time if takes is directly related to the configurations you selected; the more features selected means more time is needed to compile. When done, you will find a firmware file names `firmware.bin` in the `/Sonoff-Tasmota/.pioenvs/<variant-name>/` folder.
![folders](https://i.imgur.com/SEqyGy2.png) ![folders](https://i.imgur.com/SEqyGy2.png)
Download the `firmware.bin` file to your computer and you are now ready to flash your device. Use [`esptool`](https://github.com/arendst/Sonoff-Tasmota/wiki/Esptool) or any other firmware upload [method](https://github.com/arendst/Sonoff-Tasmota/wiki/Flashing). Download `firmware.bin` to your computer by right-clicking on the file and selecting 'Download'. You are now ready to flash your device.
Watch a [livestream video by digiblurDIY](https://www.youtube.com/watch?v=vod3Woj_vrs) of compiling Tasmota using Gitpod. Watch a [livestream video by digiblurDIY](https://www.youtube.com/watch?v=vod3Woj_vrs) of compiling Tasmota using Gitpod.
#### Browser Extension: ### Flash Your Device
Gitpod has a browser extension (Chrome and Firefox) useful to directly load a GitHub project into your personal work-space. #### OTA Flash
If you already have Tasmota flashed on your device, you can use the `File Upload` OTA method to load the new firmware binary file.
![Gitpod link](https://i.imgur.com/uEHszIn.png) 1. Download [`sonoff-minimal.bin`](http://thehackbox.org.tasmota/020300/sonoff-minimal.bin)
2. Make a backup of the device configuration using the web UI `Configuration` menu option.
More information [here](https://www.gitpod.io/docs/20_Browser_Extension/). 3. Upload `sonoff-minimal` to your device using the web UI `Firmware Upgrade` selection. Choose `Upgrade by file upload`.
3. After `sonoff-minimal` is successfully loaded, select `Firmware Upgrade` once again and upload the new firmware file that was just compiled using Gitpod.
#### Serial Flash
Follow the same [procedure for flashing](https://github.com/arendst/Sonoff-Tasmota/wiki/Flashing) as you would any new device.