Download Oracle VM VirtualBox and install it
Download Ubuntu Server 18.04.3 image file
Download Putty
Open VirtualBox and click New
Give it a name (example: LinuxDev), and choose Linux 2.6 / 3.x / 4.x (64-bit)
Give it enough ram, more is better, leave something for your host, click next
Chose option create a virtual hard disk now
Chose VDI option
Chose Dynamicaly allocated
Chose location for it and size of virtual. You fill 8GB up quite fast so give it more.
Select created virtual machine and click run
Select Ubuntu image file that you downloaded earlier
Go through setup, no special options are needed, make sure that you install SSH server
Finish installation and close Ubuntu. You can choose option to reboot sooner.
Run Ubuntu in headless mode
Open settings->Network->Advanced->Port forwarding
Add a rule with Name SSH, Host port is 2222, guest port is 22, click Ok
Open Putty and connect to localhost, port 2222, you should save it
Now you can connect to your virtual machine with Putty.
Run sudo apt update and sudo apt upgrade to get packages
Then install other tools:
sudo apt install make git gcc g++ unzip bash wget openocd gdb-multiarch gcc-arm-none-eabi cmake minicom curl python
Installing VistualBox Guest Additions and creating a shared folder
Make sure that Ubuntu is already running, go to VirtualBox and click Show button
Click Devices->Insert Guest Additions CD image
Go back to putty session and write:
sudo mkdir /media/cdrom
sudo mount -t auto /dev/cdrom /media/cdrom
cd /media/cdrom
sudo ./VBoxLinuxAdditions.run
Everything is now prepared on guest side, we can do sudo poweroff
Create a shared folder on desktop called VM_shared
Go to VM VirtualBox Manager, select virtual machine and go into Settings->Shared Folders
Add a shared folder by clicking a plus button on the right, provide a folder path and check Auto-mount, click ok
Run virtual machine in headless mode, connect to it over Putty
We need to add us to a certain group so we can access the folder
sudo adduser vboxsf
Close and reconnect with putty
You should be able to access to shared folder with cd /media/sf_VM_shared
Setting up st-link to flash programs to microcontrollers
Run following commands:
sudo apt-get install libusb-1.0-0-dev
git clone https://github.com/texane/stlink stlink
cd stlink
make
Install binaries:
sudo cp build/Release/st-* /usr/local/bin
Install udev rules
sudo cp etc/udev/rules.d/49-stlinkv* /etc/udev/rules.d/
And restart udev
sudo udevadm control --reload
Connect st-link to PC and open VirtualBox manager.
Go under Settings->USB and click add new device (plus icon), select stlink and add it.
Unplug and plug in again. If you write lsusb in putty you should see Stlink device.