$USD
  • EUR€
  • £GBP
  • $USD
PROJECTS LattePanda

Setting-up a Development Environment on LattePanda Alpha with Windows 10

DFRobot Nov 12 2018 931

In this article I will go thru setting-up a generic development environment on Windows 10. I recently received a fantastic SBC from LattePanda called LattePanda Alpha. It has beefy specs and great expandability, totally suited for most tasks, also since it's pocket-sized, it can be carried around as your go-around PC.

My main computer is a 15-inch Macbook Pro but with the huge amount of people developing on Windows and it’s new capabilities and applications, this article make sense even to me as a secondary environment with an alternative OS.

LattePanda Alpha

I will briefly overview the SBC since there are already lots of amazing reviews of this amazing board on the internet.

Some details:
CPU:Intel 7th Gen Core m3–7y30
Core:1.6–2.6GHz Dual-Core,Four-Thread
Graphics:Intel HD Graphics 615, 300–900MHz
RAM:8G LPDDR3 1866MHz Dual-Channel
Memory:64GB eMMC V5.0l
WiFi / Bluetooth / 3 USB 3.0 ports / M.2 slots for storage

It’s specs are similar to the Asus Transformer 3 or the Macbook 12-inch. It even have an embedded Arduino for development!

More details on DFRobot and LattePanda websites.

Package Management

With the advent of package management on other platforms (Homebrew on Mac, apt/yum on Linux), installing applications and utilities became much simpler and straightforward. With Chocolatey, installing on Windows also became a matter of choco install app , simple as that!

To install Chocolatey, just drop into CMD in Administrative Mode, searching for cmd in the search bar and instead of hitting Enter, right-click it and select Run as Administrator.
In the prompt, enter the following command on CMD to install:

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

And it's done! To search for an app, just type choco search app. To install it, choco install app.

To upgrade the packages and Chocolatey itself, use:
choco upgrade allor choco upgrade [package]

If you need more details, check the install page or the main site.

Linux on Windows (yes, you read it right)
Next we will install WSL. It provides all utilities and benefits of running Linux on your Windows box without the hassle of setting up virtual machines, heavy virtualization resource consumption (great for boards like this or laptops), and you even have Linux distribution options.
First you have to enable the WSL on PowerShell in Administrative Mode. To run, search for "powershell" on search bar, right-click it and select "Run as Administrator". On the console, type:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

And reboot after finish. After rebooting, open Windows Store, search for "Linux" and all available distros are shown:

Since I'm used to Debian, this was the distribution I installed. Some minutes later, you have Debian installed and ready to run and create your user. Select your distro and install like any other app from the store.

Add your user to allow passwordless sudo:

echo "$USER ALL=(ALL) NOPASSWD:ALL" |sudo tee -a /etc/sudoers

Customizing the console
The next step to a more useable command line is installing CMDer. It's a very flexible terminal and with it's tabbed interface the productivity is improved. Also let's install a nice font to go with it. With Chocolatey, it's just a matter of:

choco install -y cmder firacode

Refresh the environment with the command refreshenv and run cmder. You can pin it to the bar after start. Let’s configure a few parameters.

Click the bottom-right button and select Settings. in the Settings panel, choose General -> Fonts and set the Main Font to Fira Code Medium. I use size 16.

What is great about CMDer, is that it supports multiple tabs of different consoles. You can have a Linux shell in one tab, a PowerShell on another and a Windows command prompt on another one. It’s a matter of two clicks, one in the + button and another on the terminal type, cmd for command prompt, PowerShell or on WSL your Linux.

Installing Zsh and oh-my-zsh

Zsh is a shell replacement for bash. It provides a lot of new functionality, plugins and prompt customization. Oh-my-zsh is a framework and extension for Zsh to provide these plugins.

First install Zsh and some pre-requisites and utilities. On my Debian Linux, I run:

$ sudo apt-get install git zsh ack jq wget curl htop tree

Then install Oh-my-zsh and change your user’s default shell to it with:

$ curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
$ chsh -s /usr/bin/zsh

Close and reopen the console to run Zsh as default shell, then, install some useful plugins:

# Install Spaceship Prompt
git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt"
# Link the theme
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
# Configure the prompt as default
sed s/'ZSH_THEME.*'/'ZSH_THEME=spaceship"' -i ~/.zshrc
# Install the auto suggestion plugin
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Zsh is very customizable, you can check the plugins I use and my config on my repo. Also there are lots of references for it here.

Make CMDer run with Zsh

Some final adjustments are needed to make CMDer run and call Zsh.

On Startup -> Tasks, add a new task using the "+" button, with the following parameters and commands:
Parameters: 

-icon “%USERPROFILE%\AppData\Local\lxss\bash.ico”

Command: 

%windir%\system32\bash.exe ~ -cur_console:p

Name it zsh and Save. And change this new “Task” to be the default one on launch:

Then, add to the end of the file ~/.bashrc the commands below so bash will call zsh on start:

cat <<EOT >> ~/.bashrc
if test -t 1; then
  exec zsh
fi
EOT

CMDer, paired with FiraCode font, Zsh and it’s plugins and themes provide a fantastic experience where you have suggestions on the command line and lots of info in the prompt for example on Git repositories like the screen below:

Check out my dotfiles and the way I customize my environment on Github.

Configuring your editor
My editor of choice is Visual Studio Code. I used Sublime Text previously (and VIM previous to that) and now I believe VSCode provides fantastic functionality and a great community that develops extensions. As usual, VSCode ia installed with Chocolatey in CMD:

choco install vscode

And you can start installing all extensions you want/need for your own code. Here are the ones I use:

ActiveFileInStatusBar v1.0.3
ansible v0.2.8
beautify v1.4.7
blank-line-organizer v0.1.5
Bookmarks v9.1.0
bracket-jumper v1.1.8
bracket-pair-colorizer v1.0.60
code-settings-sync v3.2.0
devicetree v0.1.1
erlang v0.4.6
Go v0.6.93
highlight-words v0.0.8
json-tools v1.0.2
LogFileHighlighter v2.4.2
markdown-all-in-one v1.7.0
material-icon-theme v3.6.0
notetree v0.0.4
python v2018.9.2
trailing-spaces v0.2.11
vsc-material-theme v2.5.1
vscode-ansible v0.5.2
vscode-dired v0.0.4
vscode-docker v0.3.1
vscode-fileutils v2.11.0
vscode-markdown-to-clipboard v0.0.2
vscode-markdownlint v0.21.0
vscode-yaml v0.0.17
word-count v0.1.1
xml v2.3.2

One of the most important is “Settings Sync” where you can sync all configuration and extensions and keep them in a private Gist. Check it out it’s instructions on install and config here.

Installing your language of choice
Finally, with the power of Chocolatey, installing your language of choice is just a matter of choco install langin CMD. For example:

Go

$ choco install golang -y
Chocolatey v0.10.11
Installing the following packages:
golang
By installing you accept licenses for the packages.
Progress: Downloading golang 1.11.2... 100%
golang v1.11.2 [Approved]
golang package files install completed. Performing other installation steps.
Downloading golang 64 bit
  from 'https://dl.google.com/go/go1.11.2.windows-amd64.msi'
Progress: 100% - Completed download of C:\Users\LattePanda\AppData\Local\Temp\chocolatey\golang\1.11.2\go1.11.2.windows-amd64.msi (110.72 MB).
Download of go1.11.2.windows-amd64.msi (110.72 MB) completed.
Hashes match.
Installing golang...
golang has been installed.
  golang may be able to be automatically uninstalled.
Environment Vars (like PATH) have changed. Close/reopen your shell to
 see the changes (or in powershell/cmd.exe just type `refreshenv`).
 The install of golang was successful.
  Software installed as 'msi', install location is likely default.
Chocolatey installed 1/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
$ refreshenv
Refreshing environment variables from registry for cmd.exe. Please wait...Finished..
$ go version
go version go1.11.2 windows/amd64

As a comparison to show the processing power of the LattePanda Alpha, here is a benchmark for the crypto library on Go 1.11.2 comparing the FireFly RK3399, an hexa-core ARM64 SBC, the LattePanda Alpha and my 2018 15-inch Macbook Pro:

RK3399

$ GOMAXPROCS=12 go test crypto/tls -bench BenchmarkThroughput
goos: linux
goarch: arm64
pkg: crypto/tls
BenchmarkThroughput/MaxPacket/1MB-12                  50          33703977 ns/op          31.11 MB/s
BenchmarkThroughput/MaxPacket/2MB-12                  30          50824996 ns/op          41.26 MB/s
BenchmarkThroughput/MaxPacket/4MB-12                  20          85682448 ns/op          48.95 MB/s
BenchmarkThroughput/MaxPacket/8MB-12                  10         102965754 ns/op          81.47 MB/s
BenchmarkThroughput/MaxPacket/16MB-12                 10         244088459 ns/op          68.73 MB/s
BenchmarkThroughput/MaxPacket/32MB-12                  3         421936369 ns/op          79.52 MB/s
BenchmarkThroughput/MaxPacket/64MB-12                  2         539435723 ns/op         124.41 MB/s
BenchmarkThroughput/DynamicPacket/1MB-12             100          35732477 ns/op          29.35 MB/s
BenchmarkThroughput/DynamicPacket/2MB-12              30          54333698 ns/op          38.60 MB/s
BenchmarkThroughput/DynamicPacket/4MB-12              20          81900204 ns/op          51.21 MB/s
BenchmarkThroughput/DynamicPacket/8MB-12              10         124982969 ns/op          67.12 MB/s
BenchmarkThroughput/DynamicPacket/16MB-12              5         210974887 ns/op          79.52 MB/s
BenchmarkThroughput/DynamicPacket/32MB-12              3         411488915 ns/op          81.54 MB/s
BenchmarkThroughput/DynamicPacket/64MB-12              2         651450802 ns/op         103.01 MB/s
PASS
ok      crypto/tls      32.295s

LattePanda Alpha

$ go test crypto/tls -bench BenchmarkThroughput
goos: windows
goarch: amd64
pkg: crypto/tls
BenchmarkThroughput/MaxPacket/1MB-12                 200           7624757 ns/op         137.52 MB/s
BenchmarkThroughput/MaxPacket/2MB-12                 100          12471020 ns/op         168.16 MB/s
BenchmarkThroughput/MaxPacket/4MB-12                  50          23020256 ns/op         182.20 MB/s
BenchmarkThroughput/MaxPacket/8MB-12                  30          42115840 ns/op         199.18 MB/s
BenchmarkThroughput/MaxPacket/16MB-12                 20          81859070 ns/op         204.95 MB/s
BenchmarkThroughput/MaxPacket/32MB-12                 10         147322600 ns/op         227.76 MB/s
BenchmarkThroughput/MaxPacket/64MB-12                  5         309309160 ns/op         216.96 MB/s
BenchmarkThroughput/DynamicPacket/1MB-12             200           7511359 ns/op         139.60 MB/s
BenchmarkThroughput/DynamicPacket/2MB-12             100          12716297 ns/op         164.92 MB/s
BenchmarkThroughput/DynamicPacket/4MB-12             100          22653105 ns/op         185.15 MB/s
BenchmarkThroughput/DynamicPacket/8MB-12              30          43283273 ns/op         193.81 MB/s
BenchmarkThroughput/DynamicPacket/16MB-12             20          82670375 ns/op         202.94 MB/s
BenchmarkThroughput/DynamicPacket/32MB-12             10         160725040 ns/op         208.77 MB/s
BenchmarkThroughput/DynamicPacket/64MB-12              5         318751400 ns/op         210.54 MB/s
PASS
ok      crypto/tls      29.013s

Macbook Pro

$ GOMAXPROCS=12 go test crypto/tls -bench BenchmarkThroughput
goos: darwin
goarch: amd64
pkg: crypto/tls
BenchmarkThroughput/MaxPacket/1MB-12         	     500	   3445840 ns/op	 304.30 MB/s
BenchmarkThroughput/MaxPacket/2MB-12         	     300	   5793462 ns/op	 361.99 MB/s
BenchmarkThroughput/MaxPacket/4MB-12         	     100	  10720943 ns/op	 391.23 MB/s
BenchmarkThroughput/MaxPacket/8MB-12         	     100	  21203382 ns/op	 395.63 MB/s
BenchmarkThroughput/MaxPacket/16MB-12        	      30	  38736857 ns/op	 433.11 MB/s
BenchmarkThroughput/MaxPacket/32MB-12        	      20	  75047089 ns/op	 447.11 MB/s
BenchmarkThroughput/MaxPacket/64MB-12        	      10	 146954735 ns/op	 456.66 MB/s
BenchmarkThroughput/DynamicPacket/1MB-12     	     500	   3655005 ns/op	 286.89 MB/s
BenchmarkThroughput/DynamicPacket/2MB-12     	     200	   5942780 ns/op	 352.89 MB/s
BenchmarkThroughput/DynamicPacket/4MB-12     	     100	  11222844 ns/op	 373.73 MB/s
BenchmarkThroughput/DynamicPacket/8MB-12     	     100	  20243372 ns/op	 414.39 MB/s
BenchmarkThroughput/DynamicPacket/16MB-12    	      30	  42529170 ns/op	 394.49 MB/s
BenchmarkThroughput/DynamicPacket/32MB-12    	      20	  76060650 ns/op	 441.15 MB/s
BenchmarkThroughput/DynamicPacket/64MB-12    	      10	 155531252 ns/op	 431.48 MB/s
PASS
ok  	crypto/tls	24.505s

And a comparison between them:

# 12 process benchmarks for the crypto library BenchmarkThroughput

#RK3399 vs LattePanda
➜ benchcmp rk3399.txt latte.txt
benchmark                                     old ns/op     new ns/op     delta
BenchmarkThroughput/MaxPacket/1MB-12          33703977      7624757       -77.38%
BenchmarkThroughput/MaxPacket/2MB-12          50824996      12471020      -75.46%
BenchmarkThroughput/MaxPacket/4MB-12          85682448      23020256      -73.13%
BenchmarkThroughput/MaxPacket/8MB-12          102965754     42115840      -59.10%
BenchmarkThroughput/MaxPacket/16MB-12         244088459     81859070      -66.46%
BenchmarkThroughput/MaxPacket/32MB-12         421936369     147322600     -65.08%
BenchmarkThroughput/MaxPacket/64MB-12         539435723     309309160     -42.66%
BenchmarkThroughput/DynamicPacket/1MB-12      35732477      7511359       -78.98%
BenchmarkThroughput/DynamicPacket/2MB-12      54333698      12716297      -76.60%
BenchmarkThroughput/DynamicPacket/4MB-12      81900204      22653105      -72.34%
BenchmarkThroughput/DynamicPacket/8MB-12      124982969     43283273      -65.37%
BenchmarkThroughput/DynamicPacket/16MB-12     210974887     82670375      -60.82%
BenchmarkThroughput/DynamicPacket/32MB-12     411488915     160725040     -60.94%
BenchmarkThroughput/DynamicPacket/64MB-12     651450802     318751400     -51.07%

benchmark                                     old MB/s     new MB/s     speedup
BenchmarkThroughput/MaxPacket/1MB-12          31.11        137.52       4.42x
BenchmarkThroughput/MaxPacket/2MB-12          41.26        168.16       4.08x
BenchmarkThroughput/MaxPacket/4MB-12          48.95        182.20       3.72x
BenchmarkThroughput/MaxPacket/8MB-12          81.47        199.18       2.44x
BenchmarkThroughput/MaxPacket/16MB-12         68.73        204.95       2.98x
BenchmarkThroughput/MaxPacket/32MB-12         79.52        227.76       2.86x
BenchmarkThroughput/MaxPacket/64MB-12         124.41       216.96       1.74x
BenchmarkThroughput/DynamicPacket/1MB-12      29.35        139.60       4.76x
BenchmarkThroughput/DynamicPacket/2MB-12      38.60        164.92       4.27x
BenchmarkThroughput/DynamicPacket/4MB-12      51.21        185.15       3.62x
BenchmarkThroughput/DynamicPacket/8MB-12      67.12        193.81       2.89x
BenchmarkThroughput/DynamicPacket/16MB-12     79.52        202.94       2.55x
BenchmarkThroughput/DynamicPacket/32MB-12     81.54        208.77       2.56x
BenchmarkThroughput/DynamicPacket/64MB-12     103.01       210.54       2.04x

# Macbook Pro vs LattePanda

➜ benchcmp latte.txt mac.txt
benchmark                                     old ns/op     new ns/op     delta
BenchmarkThroughput/MaxPacket/1MB-12          7624757       3445840       -54.81%
BenchmarkThroughput/MaxPacket/2MB-12          12471020      5793462       -53.54%
BenchmarkThroughput/MaxPacket/4MB-12          23020256      10720943      -53.43%
BenchmarkThroughput/MaxPacket/8MB-12          42115840      21203382      -49.65%
BenchmarkThroughput/MaxPacket/16MB-12         81859070      38736857      -52.68%
BenchmarkThroughput/MaxPacket/32MB-12         147322600     75047089      -49.06%
BenchmarkThroughput/MaxPacket/64MB-12         309309160     146954735     -52.49%
BenchmarkThroughput/DynamicPacket/1MB-12      7511359       3655005       -51.34%
BenchmarkThroughput/DynamicPacket/2MB-12      12716297      5942780       -53.27%
BenchmarkThroughput/DynamicPacket/4MB-12      22653105      11222844      -50.46%
BenchmarkThroughput/DynamicPacket/8MB-12      43283273      20243372      -53.23%
BenchmarkThroughput/DynamicPacket/16MB-12     82670375      42529170      -48.56%
BenchmarkThroughput/DynamicPacket/32MB-12     160725040     76060650      -52.68%
BenchmarkThroughput/DynamicPacket/64MB-12     318751400     155531252     -51.21%

benchmark                                     old MB/s     new MB/s     speedup
BenchmarkThroughput/MaxPacket/1MB-12          137.52       304.30       2.21x
BenchmarkThroughput/MaxPacket/2MB-12          168.16       361.99       2.15x
BenchmarkThroughput/MaxPacket/4MB-12          182.20       391.23       2.15x
BenchmarkThroughput/MaxPacket/8MB-12          199.18       395.63       1.99x
BenchmarkThroughput/MaxPacket/16MB-12         204.95       433.11       2.11x
BenchmarkThroughput/MaxPacket/32MB-12         227.76       447.11       1.96x
BenchmarkThroughput/MaxPacket/64MB-12         216.96       456.66       2.10x
BenchmarkThroughput/DynamicPacket/1MB-12      139.60       286.89       2.06x
BenchmarkThroughput/DynamicPacket/2MB-12      164.92       352.89       2.14x
BenchmarkThroughput/DynamicPacket/4MB-12      185.15       373.73       2.02x
BenchmarkThroughput/DynamicPacket/8MB-12      193.81       414.39       2.14x
BenchmarkThroughput/DynamicPacket/16MB-12     202.94       394.49       1.94x
BenchmarkThroughput/DynamicPacket/32MB-12     208.77       441.15       2.11x
BenchmarkThroughput/DynamicPacket/64MB-12     210.54       431.48       2.05x

As can be seen, the LattePanda is in average 3.2x faster than the RK3399 and my Macbook Pro is 2.1x faster than the Alpha. This is in no way a scientific benchmark but gives an idea of the power of this small board.

Docker
Docker is also just a command away with choco install docker docker-for-windows -y

Logout, log back in and run the Docker for Windows icon created on your desktop. If you get this question, enable Hyper-V and restart:

After reboot, run Docker For Windows icon and Docker will be ready to run:

Docker-machine running

And run a Nginx container to show the functionality: docker run -p 8080:80 nginx then open your browser on https://localhost:8080

Conclusion
This article demonstrate that you can have a very functional, complete and portable development environment on your Windows 10 box allowing any language and tool to be used. Also with a small and portable SBC like the LattePanda Alpha, you have the power and flexibility to bring this anywhere.

With a price around $350,00 it’s not the cheapest computer you can get but it’s hard to beat it’s performance and portability in this price-point. Highly recommended.


REVIEW