Linux Quick Start: Difference between revisions

From Miosix Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 14: Line 14:
''' QSTLink2 '''
''' QSTLink2 '''


If you want to program STM32 microcontrollers, you will also need a tool to the transfer your programs to the microcontroller. A popular choice for board like the ''stm32f4discovery'' that have an embedded STLinkV2 USB programmer/debugger is [[https://code.google.com/p/qstlink2 QSTLink2]]. The installation on Ubuntu/Debian requires to add a ''ppa'' and install it via ''apt-get''. Also, it is recomended to install the udev rules, which allow QSTLink2 to connect to the USB port without the need to run it from root.
If you want to program STM32 microcontrollers, you will also need a tool to the transfer your programs to the microcontroller. A popular choice for boards like the ''stm32f4discovery'' that have an embedded STLinkV2 USB programmer/debugger is [[https://code.google.com/p/qstlink2 QSTLink2]]. The installation on Ubuntu/Debian requires to add a ''ppa'' and install it via ''apt-get''. Also, it is recomended to install the udev rules, which allow QSTLink2 to connect to the USB port without the need to run it from root.


<source lang="bash">
<source lang="bash">
Line 25: Line 25:
</source>
</source>


An alternative tool to program STM32 microcontrollers using the serial port bootloader is [[https://code.google.com/p/stm32flash stm32flash]]. Finally, for historical reasons, the Miosix Toolchain includes the lpc21isp to program LPC2000 microcontrollers using their serial bootloader.
An alternative tool to program STM32 microcontrollers using the serial port bootloader is [[https://code.google.com/p/stm32flash stm32flash]]. Finally, for historical reasons, the Miosix Toolchain includes ''lpc21isp'', a tool to program LPC2000 microcontrollers using their serial bootloader.


''' Serial port setup '''
''' Serial port setup '''


Miosix redirects ''stdin''/''stdout'' to a serial port by default on most boards, so it is important to set up serial ports correctly. On most Linux distros, the serial ports, both the physical ones like ''/dev/ttyS0'' and the USB to serial adapters like ''/dev/ttyUSB0'' are owned by the ''dialout'' group, so you need to add your user to that group before you can access them.
Miosix redirects ''stdin''/''stdout'' to a serial port by default on most boards, so it is important to set up serial ports correctly on your development machine. On most Linux distros serial ports, both the physical ones like ''/dev/ttyS0'' and the USB to serial adapters like ''/dev/ttyUSB0'' are owned by the ''dialout'' group, so you need to add your user to that group before you can access them.


<source lang="bash">
<source lang="bash">
Line 38: Line 38:


<source lang="bash">
<source lang="bash">
sudo apt-get install screen
sudo apt-get install screen # For Ubuntu/Debian
sudo pacman -S screen      # For Arch Linux
</source>
</source>


=== Install the Miosix Toolchain ===
=== Install the Miosix Toolchain ===


Download the latest version of the [[http://miosix.org/toolchain/MiosixToolchainInstaller.run Miosix Toolchain]] here, and launch it. The installer will ask for your root password to copy the compiler to the ''/opt/arm-miosix-eabi'' directory, and put symlinks to ''/usr/bin''.  
Download the latest version of the [[http://miosix.org/toolchain/MiosixToolchainInstaller.run Miosix Toolchain]] and launch it. The installer will ask for your root password to copy the compiler to the ''/opt/arm-miosix-eabi'' directory, and put symlinks to ''/usr/bin''.  


<source lang="bash">
<source lang="bash">
Line 50: Line 51:
</source>
</source>


If you do not trust the installer and want to verify its content, or you want to install it locally, it is possible to extract the content of the installer with the following command. Keep in mind that for a local install you will need to set the ''PATH'' environment variable to the ''arm-miosix-eabi/bin'' directory.
If you do not trust the installer and want to verify its content, or you want to install it locally, it is possible to extract the content of the installer with the following command.


<source lang="bash">
<source lang="bash">
sh MiosixToolchainInstaller.run --noexec --target arm-miosix-eabi
sh MiosixToolchainInstaller.run --noexec --target arm-miosix-eabi
</source>
</source>
Keep in mind that for a local install you will need to set the ''PATH'' environment variable to the ''arm-miosix-eabi/bin'' directory.


=== Get the Miosix kernel sources ===
=== Get the Miosix kernel sources ===


The preferred version to download the Miosix kernel is through [[https://en.wikipedia.org/wiki/Git_%28software%29 git]]. If you do not already have it installed you can install it now
The preferred way to download the Miosix kernel is through [[https://en.wikipedia.org/wiki/Git_%28software%29 git]]. If you do not already have it installed you can install it now


<source lang="bash">
<source lang="bash">
Line 75: Line 78:


=== Testing it out ===
=== Testing it out ===
You have finished the installation of the Miosix Toolchain. To test it you may want to try [[Led Blinking|blinking a LED]], or you may want to [[IDE Configuration|install and configure an IDE]], or the [[Miosix in-circuit debugging|debugger]].

Revision as of 23:10, 12 April 2014

This page explains how to install the precompiled Miosix Toolchain. If you prefer compiling GCC from sources, see Building GCC from sources.

Before you begin

32 bit Linux distros

The precompiled Miosix Toolchain is compiled for 32bit x86, to be compatible with as many Linux installations as possible. If you have a 64bit OS, you need to install a few 32bit libraries to be able to use it.

sudo apt-get install libstdc++6:i386 # Install 32bit compatibility libraries for Ubuntu/Debian
sudo pacman -S lib32-libstdc++5      # Install 32bit compatibility libraries for Arch Linux

QSTLink2

If you want to program STM32 microcontrollers, you will also need a tool to the transfer your programs to the microcontroller. A popular choice for boards like the stm32f4discovery that have an embedded STLinkV2 USB programmer/debugger is [QSTLink2]. The installation on Ubuntu/Debian requires to add a ppa and install it via apt-get. Also, it is recomended to install the udev rules, which allow QSTLink2 to connect to the USB port without the need to run it from root.

sudo add-apt-repository ppa:mobyfab/qstlink2
sudo apt-get update
sudo apt-get install qstlink2
wget https://raw.githubusercontent.com/mobyfab/QStlink2/master/res/49-stlinkv2.rules
sudo mv 49-stlinkv2.rules /etc/udev/rules.d
sudo chown root:root /etc/udev/rules.d/49-stlinkv2.rules

An alternative tool to program STM32 microcontrollers using the serial port bootloader is [stm32flash]. Finally, for historical reasons, the Miosix Toolchain includes lpc21isp, a tool to program LPC2000 microcontrollers using their serial bootloader.

Serial port setup

Miosix redirects stdin/stdout to a serial port by default on most boards, so it is important to set up serial ports correctly on your development machine. On most Linux distros serial ports, both the physical ones like /dev/ttyS0 and the USB to serial adapters like /dev/ttyUSB0 are owned by the dialout group, so you need to add your user to that group before you can access them.

sudo usermod -a -G dialout `id -un` # Add yourself to the dialout group

Note that you may need to reboot your computer before the change takes effect. Also, you need a program to interact with the serial port, like GNU screen.

sudo apt-get install screen # For Ubuntu/Debian
sudo pacman -S screen       # For Arch Linux

Install the Miosix Toolchain

Download the latest version of the [Miosix Toolchain] and launch it. The installer will ask for your root password to copy the compiler to the /opt/arm-miosix-eabi directory, and put symlinks to /usr/bin.

wget http://miosix.org/toolchain/MiosixToolchainInstaller.run
sh MiosixToolchainInstaller.run

If you do not trust the installer and want to verify its content, or you want to install it locally, it is possible to extract the content of the installer with the following command.

sh MiosixToolchainInstaller.run --noexec --target arm-miosix-eabi

Keep in mind that for a local install you will need to set the PATH environment variable to the arm-miosix-eabi/bin directory.

Get the Miosix kernel sources

The preferred way to download the Miosix kernel is through [git]. If you do not already have it installed you can install it now

sudo apt-get install git # For Ubuntu/Debian
sudo pacman -S git       # For Arch Linux

Currently, Miosix 2.0 is in the testing branch of the git repository, while the default one, the master branch, contains Miosix 1.x. So, you need to explicitly switch to the testing branch after downloading the kernel.

git clone https://git.gitorious.org/miosix-kernel/miosix-kernel.git
cd miosix-kernel
git fetch origin
git checkout -b testing origin/testing

Testing it out

You have finished the installation of the Miosix Toolchain. To test it you may want to try blinking a LED, or you may want to install and configure an IDE, or the debugger.