Install Python
Python is a popular programming language. Because it is interpreted, you need to install Python on your computer to run Python programs.
Why Am I Installing Python?
If you already have Python 2.7.x installed, skip to the next step: Required Hardware. To check if you have Python installed and in the right place, open a command prompt (DOS window) and type:
C:\Python27\python.exe --version
It should print out something like:
Python 2.7.8
The IAR toolchain generates a file compliant with the "Executable and Linkable Format" (ELF). An additional step is to convert this ELF file to a binary file you can load into your device. Part of that conversion involves calculating a signature and writing that at the beginning of the binary file. This operation is done by the dustElfToBin.py
Python utility, present in the
onchipsdk/
tools/
Check that IAR_ARM_BASE environment variable exists and is set to contain the directory where IAR is installed. The conversion script uses this variable to find and execute IAR elftobin.exe utility. See Setting up the IAR_ARM_BASE Environment Variable for details.
All
On-Chip Software Development Kit
projects are pre-configured to run this utility as "Post-build" step. For example, in the configuration of the00-hello
sample application:The "Post-build command line" contains:
C:\Python27\python.exe "$PROJ_DIR$\..\..\..\tools\dustElfToBin\dustElfToBin.py" "$TARGET_PATH$"
In the command above, $TARGET_PATH$
is replaced by the name of the ELF file by IAR.
Note on using Anaconda
C:\Python27\python.exe
. If you are using Anaconda, python is in a different location and you will need to create a C:\Python27\ folder and create a symlink to the location of the python executable using the mklink
DOS command.Installation Instructions
You can download Python 2.7 from https://www.python.org/downloads/.
Python is free and open-source. It is also used by the SmartMesh SDK and DustLink projects present on this site. If you're using any of those, Python 2.7 is probably already installed.
The Python 3.x and Python 2.7.x branches are maintained in parallel. Make sure to download the latest Python 2.7.x version, and to install it in C:\Python27
(the default).
When you build an
On-Chip Software Development Kit
project, you will see a command line (black) window "flash" twice at the end of the build process. This is thedustElfToBin.py
utility running. After the build process, the output folder contains two files.In the case of 00-hello
(see screenshot below), this is:
ocfdk_00_hello.out
, the ELF file generated by IARocfdk_00_hello.bin
, the corresponding binary file generated by thedustElfToBin.py
utility
If you get an error message similar to the one below, IAR couldn't find (or run) the C:\Python27\python.exe
program. Make sure it is installed at that location, and permissions are set such that IAR can use it.