User Tools

Site Tools


projects:virtualmachine:tutorials:vmware-win7

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
projects:virtualmachine:tutorials:vmware-win7 [2015-02-18 16:31]
call_me_a_cab
projects:virtualmachine:tutorials:vmware-win7 [2016-07-12 09:19] (current)
arnaud
Line 1: Line 1:
 +====== How to setup and install the VM in VMware, Windows 7 & First steps to learn to program the CF2 ======
  
 +<WRAP center round important 60%>
 +This tutorial is covering a previous version of the virtual machine and the development part might be outdated. Once you have the VM up and running you can look at the [[https://​www.bitcraze.io/​getting-started-with-development/​|development getting started guide]].
 +</​WRAP>​
 +
 +
 +__**Noob Guide – Windows 7.
 +Install the VM, set it up (to your preferences) and get started with programming the Crazyflie 2.0 (by the end of this guide, you will have flashed a custom firmware into your Crazyflie 2.0!!).
 +**__
 +
 +===== Installing VMware player and importing the Bitcraze VM 6.0. =====
 +
 +
 +
 +
 +Download VMware Player from [[https://​my.vmware.com/​web/​vmware/​downloads|Here.]] (version 7 only supports 64 bit, Version 6 and below available for 32 & 64) 
 +
 +Download the Bitcraze Virtual machine from [[http://​wiki.bitcraze.se/​projects:​virtualmachine:​index|Here.]]
 +
 +Save the Bitcraze VM to somewhere you will remember (C:​\Users\YourUserName\Downloads,​ probably)
 +Install the VMware player on your system.
 +
 +When the install finishes, Open VMware player and click on “open existing virtual machine”, navigate to where you stored the Bitcraze VM download from earlier and open it. Leave the Name and Storage path at default (recommended) and click “Import”.
 +
 +If (when) you get an error about the file not passing OVF specification,​ click retry. VMware player will now import the Bitcraze virtual machine into the player. Please be patient, there is basically a whole Operating system being installed behind the scenes.
 +
 +Once the import finishes you’ll see the Bitcraze VM appear in the machine pane on the left of the VMware main window. ​
 +
 +//​**Congratulations! You now have a dual operating system PC – Windows and Linux!**//
 +
 +Your windows operating system is of course your physical computer as it always was, we will now refer to it as the “Host” computer.
 +Your new Linux PC is the one we just imported into VMware, it’s running a version of Linux called xubuntu 14.10; we will now be referring to this as the “guest” computer.
 +
 +Now, before we fire up the guest PC, I know there will be a lot of you who drive into the settings for a little look around so, let’s cover that first.
 +Click on “edit virtual machine settings”.
 +The first thing you’ll probably want to do if you’re anything like me is, increase Memory for the virtual machine to the “Maximum recommended memory”. Bear in mind that the more memory you allocate to the guest machine, the less available for the host, and after all, the host is going to be running the whole show so be cautious here. Besides, xubuntu is not as visually flashy and polished as the windows that we’re familiar with, but we’re on the road to being developers and makers now so we don’t really need fireworks anymore do we ;). Basically 1GB of RAM is plenty for the guest so let’s leave it for now.
 +
 +Another thing we can do here is allocate hardware devices to the guest. Let’s add the sound card from the host so that we can listen to some music or watch YouTube if we need a break from coding later.
 +
 +Click on “Add” under the hardware pane on the left.
 +You’ll see a list of hardware appear, click on “sound card”, then click next. Leave the host default selected (unless you have multiple flashy sound cards and would like to use one of those for the guest) and click finish.
 +Click “OK” to exit the settings window and let’s fire up the guest.
 +
 +==== Installing the VMtools package to enable more features. ====
 +
 +
 +Double click on the Bitcraze VM we imported and watch it boot.
 +
 +With a bit of luck, you’ll get a software update popup window asking if you would like to download and install VMware tools for Linux. This is important so click “download and install”.
 +
 +Whilst the tools are downloading,​ have a play – maximise the VM player window – notice the guest desktop did not resize? Try clicking full screen in the VMplayer bar at the top – still no luck? Disappointed?​ I was Too! This is where VMware tools comes in 
 +
 +Once the download of the tools has finished (If you didn’t get the popup window, you can find it in the VMplayer menu on the top bar), click on the Player drop down menu at the top and under “Manage” click “Install VMware tools”.
 +
 +Click install in the popup window.
 +
 +The guest will mount a virtual cd which contains the tools you downloaded, once the window opens, double click the archine file (.tar.gz). The guest will open the archive and present a window containing the files inside the archive. In the window, click “Extract”. The Extract window will open and ask where you want to extract the files to.
 +
 +I prefer to navigate to “Desktop” under the “Places” pane, create a folder there called VMtools but it’s up to you. Once you found a place you’re happy to extract the files to, click on it and click “Extract”.
 +
 +Once the extract finishes, the guest OS will very kindly ask you if you would like to see the files. (Starting to hate Windows yet? ;) ) Click “show the files”.
 +
 +Open the first folder of the un-archived download and open the file called “INSTALL” The text document that opens gives the install instructions. Have a read and then let’s do it!
 +
 +//**Two important Linux concepts are coming up: Bash – using the command line shell & SU (Super User) – using the shell to perform tasks by typing (coding in essence).
 +**//
 +
 +Select the line of text “./​vmware-install.pl” and copy it. Now close the document to get back to the folder containing it.
 +
 +Right click inside the folder and select “open terminal here”. You will see a terminal window open with a command line at the current directory. ​
 +
 +Alternatively you could open a terminal at the desktop and use the command “cd” followed by the directory path you wish to get to IE “cd Desktop/​VMtools/​vmware-tools-distro” ​ followed by pressing return.
 +
 +//Note: Bash commands such as “cd” and Directory paths such as “Desktop/​VMtools/​vmware-tools-distro” are case sensitive.//​
 +
 +Now let’s install the Vmtools. Once the terminal window is in the correct directory, try typing “./​vmware-install.pl” just like the instructions told us to.
 +
 +You will most likely get an error here asking you to run the command as the super user (the instructions did warn us).
 +
 +Try again but first precede the command with the “sudo” (Super user do – basically the Linux equivalent of Windows’ Run as administrator) command, IE “sudo ./​vmware-install.pl”
 +
 +The terminal asks for the password to Bitcraze (Bitcraze is the username for the user account in the OS). The password is crazyflie.
 +
 +Type the password and hit enter. As the install instructions told us, you can just hit enter to all the options the installer gives you. Give it some time to install the files and then you should get the message saying it completed successfully.
 +
 +Hit enter to leave the rest of the options at default and when you see a blank line back at the directory you started, you’re done.
 +
 +That’s the first session of bashing away at the keys (not why it’s called bash) in the terminal out the way. Feels good right?
 +
 +Exit the terminal and, if you see a cd rom icon on the desktop titled “VMware Tools” Right click it and click “eject” to un-mount the install file. You can also delete the VMtools folder and the archive from earlier if you wish.
 +
 +Restart the guest by clicking the xubuntu equivalent of the start menu in the top right and then clicking restart.
 +
 +Once the guest has restarted try clicking in and out of full screen mode and marvel as the desktop resizes to fit the window.
 +
 +Have a play around in the settings, you may wish to change the keyboard layout to match your locale, change the time zone, setup the software updater or whatever really.
 +
 +=== Creating a custom Firmware and flashing to the CF2 via the crazyradio (PA in my case) ===
 +
 +
 +We’re now going to use eclipse IDE (IDE means Integrated Development Environment) to flash the latest firmware to the CF2 and then make a small change. We will change the default LED expansion ring effect from whatever it currently is (This tends to change as the community adds an effect, they normally make it the default one – fair play really) to 0 which is all LED’s off.
 +
 +Firstly let’s make sure that eclipse has the latest firmware with cool new features (not yet implemented into an “official” release). After all, now that we’re devs, we deserve the cutting edge right?
 +
 +On the Guest machine desktop, double click the icon “Update all projects”. This runs a bash script that compares the local versions of the firmware and project files to the ones on GitHub and downloads any changes. Once that’s done, hit any key to close the terminal window and fire up Eclipse.
 +
 +Eclipse can be daunting at first but don’t worry, you’ll be more confident in 10 minutes when we’ve done some code mods and flashed them ;)
 +
 +The upper left pane is the project pane, select the project called “crazyflie-firmware” and right click and copy it, then paste a copy back to the project pane to end up with a new project called “copy of crazyflie-firmware”
 +
 +We’re going to use this copied project to “mess” around with just in case we make a typo or mess it up some other way, that way at least we still have the original.
 +
 +Click on the arrow to expand the project and have a look around, read the readme file.
 +
 +Now let’s make that change to the LED ring. In the copied project folder navigate to “modules/​src” and open the “neopixelring.c” file. This is the firmware that controls the LED expansion ring. 
 +
 +As with nearly all microcontroller code, this is written in the C programming language.
 +
 +Sometimes eclipse collapses the first comments section of the code, in the code pane, at the top click the little “+” to expand if needed.
 +
 +Now, ignoring the first comments part encased between “/*” and “*/​”,​scroll down to the first parts of the code to find the includes, these tell the code that some stuff it needs to run is found within other code files. They’re not really relevant to this guide so we’ll skip past them for now.
 +
 +Scrolling down we find some defines. These are macros to create shorthand for code that will be use a lot to save typing everything repeatedly. Skip these also for now.
 +
 +Next we find some static functions, this is where we will make our modest change.
 +
 +At time of writing on line 77 you'll find “static uint32_t effect = 9;”. This is where the default effect is set. 
 +
 +Go ahead and change the “9” to “0” to enable the 0 effect as default.
 +
 +Click save in eclipse and it’s done. 
 +
 +== Now to get our new firmware into our CF2. ==
 +
 +
 +In the “make” pane (lower left) expand the copied firmware project to reveal the make targets.
 +
 +First we want Eclipse to compile our human readable code (C Language) into microcontroller code (Binary Code), double click “Make CLOAD” to compile a version for radio flashing. Once the console pane reports “Build Finished”,​ it’s ready to be flashed.
 +
 +Before we go ahead and flash the custom firmware we need to make sure the CrazyRadio is up and running in the guest.
 +Plug in the CrazyRadio, in the VMware status bar, click the “Player” drop down menu and select “Nordic ASA Crazyradio…” under “removable devices (AKA “pass” it to the host).
 +
 +Now the CrazyRadio is set up, let’s flash that crazy little drone.
 +
 +Power off your CrazyFlie, and then power back on but holding the power switch until the “M2” LED starts to blink slowly.
 +
 +Back in Eclipse, in the Make pane, click “flash using radio” (make sure it’s the copy project that we built earlier), You’ll see “M4” flash green during the process and then the CF will restart in “firmware mode” running your brand new custom firmware.
 +
 +**Congrats and happy hacking**