for MIOS32 application development on Windows
The QuickStart Guide still needs to be done.
The technical jargon:
This is the Core Tools section in a walkthrough on the process of developing MIOS32 Applications,
on Microsoft Windows XP,
primarily in C, utilising the MIOS32 Operating System.
The IDE platform used will be NotePad++
and the applications will be built
for the MIDIBox Hardware Platform (MBHP)
stuffed with a STM32.
C code will be compiled with CodeSourcery G++ Lite,
using MSYS to generate and run DOS-Console-based makefile scripts,
and MIOS Studio will be used for debugging on MBHP.
Enough of that.
This file is for newbies too, since once the environment is correctly set up, it is very easy to use.
I hope you find this document helpful, and that you will feel free to make suggestions or criticism or corrections or any kind of modifications as you see fit :)
It is important that you start with a clean installation. We all hate to do this, but you should start by uninstalling any of the following applications first, and then rebooting your PC.
This tool is needed to extract compressed files. If you already have winzip or winrar then you won't need this. I recommend the latest version MSI installer for ease of use.
MSYS provides us with a POSIX (UNIX style) environment for our Windows PC. This packages includes tools such as make and sed and sh, which are required to correctly run gputils later on. I recommend the latest version, but v1.0.11 has tested OK.
The MIDIbox community have created a modified GNU Compiler Collection, ready for use with the ARM Cortex M3 platform. The toolchain contains all of the tools required to build MIOS32 applications including GCC and NEWLIB. MSYS is still currently required although may be added to a later version of the toolchain.
The Toolchain has currently been compiled for Windows (2000+), Mac OS X (Leopard or newer) and Linux x86 (built on Ubuntu).
The download directory for the toolchain is http://www.midibox.org/mios32_toolchain
Download the latest “windows” file and unzip into your favorite directory, If you unzip into c:\ the toolchain will create c:\gcc-arm-none-eabi-4_7-2013q3-20130916-win32 and various sub-directories containing the toolchain files. Rename the directory gcc-arm-none-eabi-4_7-2013q3-20130916-win32 to mios32_toolchain.
You must add the “bin” directory to your windows path, a temporary way is to type the following in a Windows Command Prompt window: (change c:\mios32_toolchain to wherever you extracted your toolchain)
SET PATH= %PATH%;c:\mios32_toolchain\bin
If you want to make this change permanent (you probably will) follow this Microsoft KB article http://support.microsoft.com/kb/310519 This article will also help you when adding the MIOS32 specific variables later on.
PATH Environment variables take a little bit of attention.
First, a bit about what it is: The environment variable 'PATH' is a 'search path' that is used whenever you run a command in your DOS console. If the program you are trying to run (like GPASM or SDCC) is not in the current working directory, then the system will look for that program in each of the directories specified in the PATH.
There are actually two PATH variables, and the User PATH Variable is appended to the System PATH Variable, and each directory in those variables will be searched in order.
For our purposes, it is necessary to ensure that the above tools have entries in the PATH, and that they are in the correct order. Usually, there is no need to have user-specific PATH variables, so the following procedure will do away with them, and we will just work with the System PATH for the sake of simplicity:
Now we can work with just the one PATH variable and continue to ensure that the required directories exist in the path in the right order.
It is STRONGLY recommended to put this directory at the BEGINNING of the PATH Variable!
Merge everything in notepad.
Once you have the path edited correctly:
MIOS32 requires some additional environment variables to be set. We will cover only the settings for using the CORE32 board here:
Before compiling code, set the MIOS32 environment variables:
DOS: (we assume, that the repository has been downloaded to D:\)
set MIOS32_PATH=/D/mios32/trunk set MIOS32_BIN_PATH=D:\mios32\trunk\bin
Additional environment variables to configure the environment: (they have to be set, otherwise compiler will fail)
MBHP_CORE_STM32:
set MIOS32_GCC_PREFIX=arm-none-eabi set MIOS32_FAMILY=STM32F10x set MIOS32_PROCESSOR=STM32F103RE set MIOS32_BOARD=MBHP_CORE_STM32 set MIOS32_LCD=universal
MBHP_CORE_LPC17:
set MIOS32_GCC_PREFIX=arm-none-eabi set MIOS32_FAMILY=LPC17xx set MIOS32_PROCESSOR=LPC1769 set MIOS32_BOARD=MBHP_CORE_LPC17 set MIOS32_LCD=universal
MBHP_CORE_STM32F4:
set MIOS32_GCC_PREFIX=arm-none-eabi set MIOS32_FAMILY=STM32F4xx set MIOS32_PROCESSOR=STM32F407VG set MIOS32_BOARD=MBHP_CORE_STM32F4 set MIOS32_LCD=universal
You can set these in the Windows preferences (just like the PATH variable) by clicking “Add New” and entering the respective pairs. You can do that either in user variables or system variables; I prefer having these in the user environment variables, since that way I can set up settings for other targets in another user account.
Alternatively, you can copy all those set instructions into a batch file and run that before compiling any MIOS32 apps.
Because you are reading this (or editing it) I'll assume that like many of us, you are a geek… and like many of us, you have various compilers for various languages installed. The copy of make we use, could be preceded by other rogue copies of make, and if this happens, like it has to many of us, your app won't compile.
It may be worth checking this out, it's a quick procedure:
make --version
>make --version GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program built for i686-pc-msys >
The first and last lines must be the same as the above. If not, you need to check your PATH environment variable. make should be running from c:\MSYS\1.0\bin. Other versions of make may (will) not work. We need v3.81.
On at least one occasion, it has been seemingly impossible to bypass another make version - in this case it was the borland make - Delphi users be aware!!
In this case, the only solution was to supply the full path to make.exe - so anywhere you would type “make”, you now type “c:\MSYS\1.0\bin\make.exe”. This should not normally be necessary, and should be avoided unless you're a big guru like this guy, and can get away with it ;)
The repository stores all the latest source files. Including demos, examples and applications.
See the SVN Page for details
If you made it this far, you've actually done enough. You can code C apps in wordpad.exe, run 'make' to create your app.
I'd recommend taking a look at Notepad++, which is a real nice programming editor.
You should visit The MIOS Studio 2 Page for instructions on how to install MIOS Studio to upload the app.
You may also like to see the documents for the additional tools:
TortoiseSVN
MIOS Studio
If you'd like to have a more advanced tool set in your hands, please read on to install and configure an IDE.
NotePad++ - An open-source tool suitable for C apps.
Eclipse - A popular open-source IDE. Project configurations exist in the repository for app_skeleton and app_skeleton_cpp. This IDE also supports OpenOCD integration for on-chip debugging your MIOS32 application through a JTAG interface. Setting up projects in Eclipse, as well as JTAG source level debugging is documented here.