STM32F4 – Looking for a Virtual Image with ARM Toolchain?

WantItNow1WantItNow2WantItNow3

Ok … Ok … OK! Here’s the deal … I prepared a VirtualBox image (2.5 GB!), so you can test drive the whole thing with open source tools. It features:

1. Install Software Dependencies

Install VirtualBox 4.3.14 and extension pack as follows.

    • Download VirtualBox here and install it.
      • Ubuntu or Debian users may install it directly from the repository.
        sudo apt-get install build-essential \
                             virtualbox virtualbox-dkms \
                             virtualbox-guest-dkms \
                             virtualbox-guest-utils \
                             virtualbox-guest-x11 \
                             virtualbox-qt
        
    • Download and install Virtualbox extension pack (to enable USB 2.0).
      VBoxManage extpack install Oracle...95030.vbox-extpack
      # VBoxManage.exe extpack install Or...030.vbox-extpack
      
    • Download the image.
    • Install the

ST-LINK USB driver

      (

important!

    ) and plug-in the STM32F4-Discovery board (USB).

2. Run the Image

  1. Import the STM32F4 VirtualBox image.
    1. File → Import Appliance …
    2. Selected the downloaded file stm32-v1.1.1.ova
    3. Import (and accept the GNU GPL license)
    4. Grab something to eat and wait until done.
  2. Start the virtual machine.
    1. If you skipped the VirtualBox extension pack installation, disable USB 2.0 support by selecting STM32F4 Machine → Settings → USB → Uncheck Enable USB 2.0 (EHCI) Controller.
  3. Login as admin with password admin.
VirtualEnv

Spoiler alert! Ah, too late.

3. Basic Usage

3.1 Adjust Keyboard Layout

The default keyboard layout is EN. If you are not comfortable with it, change it as follows.

  1. Upper Left Corner → right click on the Keyboard (and Earth) icon  → Right Click → Preferences → Select and Input Method → Add → Close.
  2. Upper Left Corner → left click on the Keyboard (and Earth) icon  → Select your language.

3.2 Build Existing Projects

Open a new terminal window with the right click on empty desktop space → select Open Terminal Here.

cd ~/stm32
# Alternative option to cd
# cd /home/admin/stm32
make clean
make

3.3 Deploy an Existing Project

Plug in the STM32F4-Discovery board (USB). Enable the USB port by selecting VirtualBox → Devices → USB Devices → STMicroelectronics STM32 STLink.

cd ~/stm32/examples/OOP
make clean
make
# Useful tip to speed up build time
# 1. Assign more CPUs to Virtualbox.
# 2. make -j <CPUs>

# Deploy the project, but first enable the USB port!
# VirtualBox → Devices → USB Devices
#                             → STMic. STM32 STLink
sudo make deploy
# Enter password: admin

Q: No USB devices are connected. What now?
A: To be able to access USB devices from the virtual image you have to be in the vboxusers group.

3.4 Create a New Project

Install a dependency that I forgot about (oops!).

sudo apt-get install symlinks
# Enter password: admin

Now, create a new project. 🙂

cd ~/stm32/examples
# Create a new directory here.
# Buildbot will search your projects here.
mkdir test
cd test

# Behold the project wizard!
../../mbed-project-wizard/gen-stm32f407-GCC-project.sh
Usage: {mbed-none|mbed-none-lib|
        mbed-freertos|mbed-freertos-lib|
        mbed-mbedrtos|mbed-mbedrtos-lib|
        none-safertos} {|copy}

# Create a new project template with the wizard
../../mbed-project-wizard/gen-stm32f407-GCC-project.sh\
                                              mbed-none

# Edit the source
leafpad src/main.cpp

# Build the project
make
# Other build options:
# - make release-memopt
# - make release-memopt-blame
# - make release
# - make debug

# Deploy the project, but first enable the USB port!
# VirtualBox → Devices → USB Devices
#                             → STMic. STM32 STLink
sudo make deploy
# Enter password: admin

Now, you probably have additional questions:

  • Click here to learn more about the project wizard.
  • Click here and here to learn, how to use the project template.
  • Click here to learn more about mbed framework.
  • Click here to learn more about real time operating systems (RTOS).
  • Click here to learn more about different build options.
  • Click here to learn more about debugging.

4. Build and Test Automation

I provide a Buildbot for build and test automation. It works as follows.

  1. Start the build master and worker.
    cd ~/stm32bb
    buildbot start master
    buildslave start slave
    
  2. Open the web browser.
    firefox http://localhost:8010
    
  3. Log in
    Buildbot1
  4. Click: Waterfall link → test-build-local → scroll down → Force Build → Waterfall link.
    Buildbot2
  5. Refresh (F5). When finished, click stdio link to inspect the results. Find the test results of the newly created project (hint: search the text for the string “examples/test”).

5. Image Updates

Feel free to use this VirtualBox image at your convenience. It is based on the v1.1.1 branch of my github repository. However, I will not update this virtual image any further, because it involves manual and tedious work.

areR1z6_460sa_v1

I hope the image will work better than this. 🙂

An alternative is to build it for yourself using this Vagrantfile or Dockerfile (it’s easy!). The former builds a VirtualBox image, the latter builds a LXC container. It’s even easier to work with the latest pre-built docker image, which is automatically built after every commit in the repository. Don’t rely on the pre-built vagrant image too much, because it is not regularly updated. Both, Vagrant and Docker are Windows, Linux and Mac OS friendly. Check it out! 😉

Update. Alternatively, you may check the running environment in your web browser via Cloud9 (register and request the workspace access).

Run the STM32F4 Development Environment on Your Web Browser (via Cloud9).

Advertisements

About istarc

Embedded Systems Developer.
This entry was posted in Embedded Systems, STM32F4 and tagged , , , , , , , , . Bookmark the permalink.

2 Responses to STM32F4 – Looking for a Virtual Image with ARM Toolchain?

  1. Nicholas Shrake says:

    Hey Istarc,

    Great resource! Thanks a lot for posting this.

    Your vagrant image works great! I was going to take a look and try stripping out most stuff and making it CLI to easy development on my old slow MBP.

    If you add the following to your Vagrantfile the STM32F4 will be auto-mounted in the Vagrant on-boot and when hot-plugging the USB.

    vb.customize [‘usbfilter’, ‘add’, ‘0’, ‘–target’, :id, ‘–name’, ‘stm32f4’, ‘–vendorid’, ‘0x0483’]

    Keep up the good work!

    • istarc says:

      Hi Nicholas,

      Thanks for your feedback and contribution! 🙂 Your auto-mount feature improves usability and I will include it in the next release.

      Best regards, Iztok

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s