Installing the Manage Development Environment on your host computer

Host computer: Ubuntu 14.04 LTS 64bits. Can also be used for Ubuntu 14.04 LTS 32bits.  The list of steps below is sequential. It keeps everything separated and logical if you wish to install only certain tools. It can be optimized by grouping similar tasks (like all the bashrc edits).
A pre-configured VMWare 10 virtual machine with 32 bits Linux used to be available. So much as changed that it needs to be re-done. If you think that this is a good use of my time, please email me and I’ll bump it up my list of priorities.

Getting the sources, installing the common software:

Before you get started:

Get a copy of the FlexSEA source code:
Install Git and get source files
Eclipse:

  • Download Eclipse C++ Luna. Make sure to get the right version for your operating system (32/64bits)!
  • Extract (via GUI) to /FlexSEA. It will create /FlexSEA/eclipse.
  • At this point it probably won’t launch, no valid JRE installed by default
  • Use the Software manager to get a JRE or follow this website to get Java http://tecadmin.net/install-oracle-java-8-jdk-8-ubuntu-via-ppa/ (sudo add-apt-repository ppa:webupd8team/javasudo apt-get updatesudo apt-get install oracle-java8-installer)
  • Eclipse should launch when you double-click on ‘eclipse’ (/home/flexsea/Desktop/FlexSEA/eclipse/eclipse). You can create a shortcut by right clicking on the program and Make Link. I like having that shortcut on the Desktop.
  • By default I’m placing the workspace in /home/flexsea/Desktop/FlexSEA/workspace

Eclipse CDT tools:

  • Launch Eclipse, click on Help => Install new software
  • Paste that URL http://gnuarmeclipse.sourceforge.net/updates in the search box (more details: http://gnuarmeclipse.livius.net/blog/plugins-install/)
  • Wait a few seconds while it refreshes, click on the plugin to install it. Follow the wizard.

FlexSEA-Manage:

ARM GCC (compiler):

  • Note: I learned how to do this by following this tutorial. Refer to it if some of the steps below are not clear.
  • Get sources from there: https://launchpad.net/gcc-arm-embedded/+download. I used gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2
  • Unzip in /FlexSEA/embedded-arm. It will add a folder named /home/flexsea/Desktop/FlexSEA/embedded-arm/gcc-arm-none-eabi-4_9-2014q4.
  • Install 32 bits libs if using a 64 bits OS. ‘ia32-libs’ is obsolete, add the 3 libs that are suggested to you when you try ‘apt-get install ia32-libs’ (follow Hertaville if you need to do this. Alternatively, try to install ia32-libs and follow what the terminal tells you)
  • Update bash:
  • 1) open the file with nano ~/.bashrc
  • 2) Add this line at the end: export PATH=$PATH:/home/flexsea/Desktop/FlexSEA/embedded-arm/gcc-arm-none-eabi-4_9-2014q4/bin
  • 3) Update bash with source ~/.bashrc
  • Test your installation with arm-none-eabi-gcc -v. You should see a big chunk of text that ends with gcc version 4.9.3 20141119 (release) [ARM/embedded-4_9-branch revision 218278] (GNU Tools for ARM Embedded Processors) 

OpenOCD (to debug and program the STM32):

  • To get more info, follow the same Hertaville tutorial as for ARM GCC.
  • Get the sources for 0.8.0: http://sourceforge.net/projects/openocd/files/openocd/
  • Extract to /FlexSEA/embedded-arm/. You’ll get a new directory: /home/flexsea/Desktop/FlexSEA/embedded-arm/openocd-0.8.0
  • We can now install OpenOCD:
  • 1) Dependencies: sudo apt-get install git zlib1g-dev libtool flex bison libgmp3-dev libmpfr-dev libncurses5-dev libmpc-dev autoconf texinfo build-essential libftdi-dev libusb-1.0.0-dev
  • 2) Navigate to /openocd-0.8.0/ and call ./configure –enable-maintainer-mode –enable-stlink  –prefix=/home/flexsea/Desktop/FlexSEA/embedded-arm/openocd-bin (note: the double-hyphens do not show up properly. Here’s the command where they are underlined: ./configure enable-maintainer-mode enable-stlink  prefix=/home/flexsea/Desktop/FlexSEA/embedded-arm/openocd-bin)
  • 3) make
  • 4) make install
  • 5) You will get a new directory: /home/flexsea/Desktop/FlexSEA/embedded-arm/openocd-bin
  • Modify the USB rules:
  • 1) Create the file with sudo nano  /etc/udev/rules.d/stlinkv2.rules
  • 2) add one line of text ATTRS{idVendor}==”0483″, ATTRS{idProduct}==”3748″, MODE=”0666″
  • 3) Update: sudo udevadm control –reload-rules (double-hyphen: sudo udevadm control reload-rules)
  • Update bash:
  • 1) Open the file with nano ~/.bashrc
  • 2) Add this line at the end (just below the GCC ARM line that you added before): export PATH=$PATH:/home/flexsea/Desktop/FlexSEA/embedded-arm/openocd-bin/bin
  • 3) Update bash with source ~/.bashrc
  • Test installation with openocd -s ~/Desktop/FlexSEA/embedded-arm/openocd-bin/share/openocd/scripts/ -f interface/stlink-v2.cfg -f target/stm32f4x_stlink.cfg. You should see Open On-Chip Debugger 0.8.0 (date and time).
  • Debugging:
    • If you get LIBUSB errors copy the rules that came with OpenOCD (OpenOCD/contrib/99-openocd.rules) to /etc/udev/rules.d/. Reload the rules, and/or reboot.

‘Manage’ project under Eclipse:

  • Launch Eclipse then File => Import => General => Existing Projects into Workspace => browse to your directory (Code/flexsea_1_0/manage/) and select the project.
  • You will see the project in the Project Explorer
  • Right click on the /manage project => Properties => C/C++ Build => Settings => Toolchain and update the Global toolchain path by clicking on “global” and navigating up to /home/flexsea/Desktop/FlexSEA/embedded-arm/gcc-arm-none-eabi-4_9-2014q4/bin
  • You can now build the project (hammer icon). You’ll get warnings because I’m a bad programmer but no Errors. A .hex file will be generated.
  • Debugging:
    • If you get an error linked to <cstdlib> in one of the included files change the include to <stdlib.h>
  • The Debug configuration is saved in the Workspace and not in the project file so you have to do it manually: 1) Right click on /manage => Debug As => Debug Configurations… 2) Do exactly like on that picture (more details in  Eclipse OpenOCD GDB Debugging for the Manage Board):

md1

  • To debug, open a terminal, launch openocd (openocd -s ~/Desktop/FlexSEA/embedded-arm/openocd-bin/share/openocd/scripts/ -f interface/stlink-v2.cfg -f target/stm32f4x_stlink.cfg) and leave that window open. In Eclipse click Debug and use the configuration you just made. It will open the Debug perspective and you’ll be able to do step-by step code execution, watch variables, etc.
  • To program the chip:
  • 1) Compile in Release mode.
  • 2) Open a terminal and navigate to /manage/Release/. You should see manage.elf.
  • 3) Use that command: openocd -s ~/Desktop/FlexSEA/embedded-arm/openocd-bin/share/openocd/scripts/ -f interface/stlink-v2.cfg -f target/stm32f4x_stlink.cfg -c init -c “reset halt” -c “sleep 100” -c “wait_halt 2” -c “flash write_image erase manage.elf” -c “sleep 100” -c “verify_image manage.elf” -c “sleep 100” -c “reset run” -c “shutdown”
Comments are closed.