<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://miosix.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Silseva</id>
	<title>Miosix Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://miosix.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Silseva"/>
	<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=Special:Contributions/Silseva"/>
	<updated>2026-04-15T00:35:37Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=Main_Page&amp;diff=270</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=Main_Page&amp;diff=270"/>
		<updated>2016-12-17T20:27:52Z</updated>

		<summary type="html">&lt;p&gt;Silseva: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Welcome to the Miosix wiki. This wiki contains the documentation for the Miosix kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;div style=&amp;quot;background-color:#FFA0A0;&amp;quot;&amp;gt;&lt;br /&gt;
IMPORTANT NOTICE: &amp;lt;br&amp;gt;&lt;br /&gt;
Recently ST Microeletronics has changed the firmware used for ST-LINK utility on its Discovery boards. For this reason, if you have bought a STM32 Discovery board recently, it&#039;s highly possible that you may encounter problems in uploading your firmware using the Qstlink GUI utility. &amp;lt;br&amp;gt;&lt;br /&gt;
Until an update of the Qstlink utility is released (which not depends upon us), in [[ST-LINK utility update|this page]] you can find a temporary fix for this issue. &lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Getting started =&lt;br /&gt;
Follow the [[Quick start]] to install the Miosix Toolchain and compile the Miosix 2.0 kernel.&lt;br /&gt;
&lt;br /&gt;
= Software =&lt;br /&gt;
* Have a look at the Miosix [[API list|APIs]] and [[Library list|libraries]] that you can use for your applications.&lt;br /&gt;
* The page on [[Synchronization primitives]] lists the possible ways to shnchronize beween multiple threads or between a thread and an interrupt routine.&lt;br /&gt;
* How to [[Miosix code size optimization|reduce the kernel code size]] for deeply embedded applications.&lt;br /&gt;
&lt;br /&gt;
= Hardware =&lt;br /&gt;
Check out which microcontroller [[Board list|boards]] are supported by Miosix.&lt;br /&gt;
&lt;br /&gt;
= Account creation =&lt;br /&gt;
Due to spam (within two days from setting up the wiki) account registration is disabled. If you want to create an account, ask to fede.tft&amp;amp;&amp;amp;miosix.org (s/&amp;amp;&amp;amp;/@/)&lt;br /&gt;
&lt;br /&gt;
= Index =&lt;br /&gt;
* [[Special:Categories|Categories]]&lt;br /&gt;
* [[Special:AllPages|All Pages]]&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=Main_Page&amp;diff=269</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=Main_Page&amp;diff=269"/>
		<updated>2016-12-17T20:26:25Z</updated>

		<summary type="html">&lt;p&gt;Silseva: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Welcome to the Miosix wiki. This wiki contains the documentation for the Miosix kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;div style=&amp;quot;background-color:#FFA0A0;&amp;quot;&amp;gt;&lt;br /&gt;
IMPORTANT NOTICE: &amp;lt;br&amp;gt;&lt;br /&gt;
Recently ST Microeletronics has changed the firmware used for ST-LINK utility on its Discovery boards. For this reason, if you have bought a STM32 Discovery board recently, it&#039;s highly possible that you may encounter problems in uploading your firmware using the Qstlink GUI utility. &amp;lt;br&amp;gt;&lt;br /&gt;
Until an update of the Qstlink utility is released (which not depends upon us), in [[New ST-LINK firmware|this page]] you can find a temporary fix for this issue. &lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Getting started =&lt;br /&gt;
Follow the [[Quick start]] to install the Miosix Toolchain and compile the Miosix 2.0 kernel.&lt;br /&gt;
&lt;br /&gt;
= Software =&lt;br /&gt;
* Have a look at the Miosix [[API list|APIs]] and [[Library list|libraries]] that you can use for your applications.&lt;br /&gt;
* The page on [[Synchronization primitives]] lists the possible ways to shnchronize beween multiple threads or between a thread and an interrupt routine.&lt;br /&gt;
* How to [[Miosix code size optimization|reduce the kernel code size]] for deeply embedded applications.&lt;br /&gt;
&lt;br /&gt;
= Hardware =&lt;br /&gt;
Check out which microcontroller [[Board list|boards]] are supported by Miosix.&lt;br /&gt;
&lt;br /&gt;
= Account creation =&lt;br /&gt;
Due to spam (within two days from setting up the wiki) account registration is disabled. If you want to create an account, ask to fede.tft&amp;amp;&amp;amp;miosix.org (s/&amp;amp;&amp;amp;/@/)&lt;br /&gt;
&lt;br /&gt;
= Index =&lt;br /&gt;
* [[Special:Categories|Categories]]&lt;br /&gt;
* [[Special:AllPages|All Pages]]&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=MacOS_Quick_Start&amp;diff=268</id>
		<title>MacOS Quick Start</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=MacOS_Quick_Start&amp;diff=268"/>
		<updated>2016-12-16T08:49:44Z</updated>

		<summary type="html">&lt;p&gt;Silseva: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ATTENTION: This page is still a WIP. Usual disclaimers about not taking responsibility for your system disruption applies.&lt;br /&gt;
&lt;br /&gt;
=== Before you begin ===&lt;br /&gt;
&lt;br /&gt;
This procedure has been tested on OS X El Capitain 10.11. The Miosix toolchain has been successfully compiled using GCC 4.9.3, which can be installed using the Homebrew package manager.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Xcode&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install Xcode by downloading it from the Mac App Store [https://itunes.apple.com/au/app/xcode/id497799835?mt=12 here]. This is needed for installing the XCode command line tools which in turn is needed by Homebrew. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Xcode Command Line Tools&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install the Command Line Tools by running the following command in terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
xcode-select --install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is recommended to run the command even if Xcode and the Command Line Tools were already installed on your system, since the Command Line Tools installation may have been messed up by upgrading to 10.11 from a previous release.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Homebrew&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Grab a copy of Homebrew and run the install script in one step using this command in terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ruby -e &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it complains about permission issues, then you have to fix it before you can continue. In Mac OS X El Capitan 10.11, Apple introduced a new feature called System Integrity Protector (SIP), which prevents from writing to many system directories such as /usr, /System, /bin, regardless of whether or not you are root. Apple is leaving /usr/local open for developers to use, so Homebrew can still be used as expected; however, performing a few steps may be required depending on you system, as outlined in the official Homebrew documentation [https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/El_Capitan_and_Homebrew.md here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System dependencies installation ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install GNU tar&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Running the Miosix toolchain compilation script may give you an error related to extracting a file. Therefore, using GNU tar instead of Apple tar is suggested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command in terminal to add the repository containing GNU tar to Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew tap homebrew/dupes&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command in terminal to grab the most recent packages list from Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew update&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command to install GNU tar:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew install gnu-tar&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install GCC 4.9.3&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Running the Miosix toolchain compilation script using Apple GCC has proven unsuccessful. That&#039;s why we need to install GCC 4.9.3 from Homebrew. Perform the steps below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command in terminal to add the repository containing GCC 4.9.3 to Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew tap homebrew/versions&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command in terminal to grab the most recent packages list from Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew update&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command to install GCC 4.9.3:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew install gcc49&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Symlink GCC 4.9.3 executables&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
First, you need to create appropriate symlinks within /usr/local/bin from the versioned name of gcc executables to generic ones. Run these commands from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ln -s /usr/local/bin/gcc-4.9 /usr/local/bin/gcc&lt;br /&gt;
ln -s /usr/local/bin/gcc-4.9 /usr/local/bin/cc&lt;br /&gt;
ln -s /usr/local/bin/g++-4.9 /usr/local/bin/g++&lt;br /&gt;
ln -s /usr/local/bin/cpp-4.9 /usr/local/bin/cpp&lt;br /&gt;
ln -s /usr/local/bin/c++-4.9 /usr/local/bin/c++&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please notice that gcc-4.9 has not been symlinked to ld has someone may expect, since it has proven prone to errors during the Miosix toolchain compilation. Instead, we are gonna use Apple own Clang ld as a linker.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Edit $PATH variable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now you need to make sure that /usr/local/bin gets inspected before /usr/bin when looking for gcc, so that Homebrew GCC 4.9.3 will be called instead of Apple GCC. In order to do so, we are gonna modify the $PATH terminal variable. Run from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get into your home folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
edit .bash_profile&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To edit the bash profile script. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You need to add the following lines as they are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#homebrew gcc&lt;br /&gt;
export PATH=/usr/local/bin:$PATH&lt;br /&gt;
#gnu-tar&lt;br /&gt;
export PATH=/usr/local/opt/gnu-tar/libexec/gnubin:$PATH&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and close the file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
source .bash_profile&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in order to reload the bash profile script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check the installed packages&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If everything went as supposed, running from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
gcc -v&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
should return some text including:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
gcc version 4.9.3 (Homebrew gcc49 4.9.3)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While running from terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ld -v&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
should return some text including:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LTO support using: Apple LLVM 7.0.0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And finally running from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
tar --version&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
should return some text including:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
tar (GNU tar)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Toolchain compilation and installation ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Toolchain sources download&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to download the kernel and toolchains sources, you need git. If you don&#039;t have it already, you can install it using Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew install git&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From terminal, cd to a folder of your choice, making sure that the path from root to it doesn&#039;t contain spaces or special characters. Then run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git clone https://miosix.org/git-public/miosix-kernel.git&lt;br /&gt;
cd miosix-kernel&lt;br /&gt;
git fetch origin&lt;br /&gt;
## To select the development version of the kernel&lt;br /&gt;
#git checkout -b testing origin/testing&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that currently, the &#039;&#039;master&#039;&#039; branch contains the stable 2.0 kernel, while the &#039;&#039;testing&#039;&#039; branch contains the current development version. Usually the latter contains the latest updates made, especially support packages for new boards, so its advised to use the code contained in this branch.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Toolchain dependencies download&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You need to fix a link in the Miosix toolchain dependencies download script, located at:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
miosix-kernel/miosix/_tools/compiler/download.sh&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
wget http://www.mpfr.org/mpfr-current/mpfr-3.1.2.tar.xz&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
wget http://www.mpfr.org/mpfr-3.1.2/mpfr-3.1.2.tar.xz&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you need to run the dependencies download script. From terminal, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sh miosix-kernel/miosix/_tools/compiler/download.sh&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
from the folder where you performed the git clone command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Toolchain compilation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
System-wide installation of the toolchain is currently untested. It is then suggested to install it locally and then add its location the the $PATH.&lt;br /&gt;
First, edit the install script located at:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
miosix-kernel/miosix/_tools/compiler/install-script.sh&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
such that at the end the first few lines looks as follow:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Uncomment if installing globally on the system&lt;br /&gt;
#INSTALL_DIR=/opt&lt;br /&gt;
#SUDO=sudo&lt;br /&gt;
# Uncomment if installing locally, sudo isn&#039;t necessary&lt;br /&gt;
INSTALL_DIR=`pwd`/gcc&lt;br /&gt;
SUDO=&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can now finally run the compilation script. From terminal, run: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sh miosix-kernel/miosix/_tools/compiler/install-script.sh&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At the end, if everything worked correctly, you&#039;ll find the toolchain at:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
miosix-kernel/miosix/_tools/compiler/gcc/arm-miosix-eabi/bin&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Toolchain compilation and installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now you need to add the toolchain to your path. Edit the bash profile script and add the following lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#arm-miosix-eabi&lt;br /&gt;
export PATH={my-folder-of-choice-path}/miosix-kernel/miosix/_tools/compiler/gcc/arm-miosix-eabi/bin:$PATH&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where you have to replace {my-folder-of-choice-path} with the path of the folder where you run the git clone command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
source .bash_profile&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in order to reload the bash profile script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Cleanup&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You are now free to go back to Apple tar and GCC. In order to do so, edit the bash profile script and remove the following lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#homebrew gcc&lt;br /&gt;
export PATH=/usr/local/bin:$PATH&lt;br /&gt;
#gnu-tar&lt;br /&gt;
export PATH=/usr/local/opt/gnu-tar/libexec/gnubin:$PATH&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
source .bash_profile&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in order to reload the bash profile script.&lt;br /&gt;
&lt;br /&gt;
=== Kernel compilation ===&lt;br /&gt;
&lt;br /&gt;
In order to configure and compile the kernel, please follow the steps outlined in the [[Linux Quick Start|Linux Quick Start]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Flash and debug an STM32F4DISCOVERY board ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tools installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to be able to flash and debug an STM32F4DISCOVERY board, you need the stlink tools suite. You can grab it from Homebrew running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew install stlink&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lastly, if you have a brand new board and QSTlink doesn&#039;t work you may take a look at [[ST-LINK utility update|this page]].&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=Windows_Quick_Start&amp;diff=267</id>
		<title>Windows Quick Start</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=Windows_Quick_Start&amp;diff=267"/>
		<updated>2016-12-16T08:48:34Z</updated>

		<summary type="html">&lt;p&gt;Silseva: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Before you begin ===&lt;br /&gt;
&lt;br /&gt;
Before you can install the Miosix Toolchain on Windows, you will need to install [https://en.wikipedia.org/wiki/Git_%28software%29 git], which is necessary to download the Miosix kernel and keep it up to date, [https://en.wikipedia.org/wiki/Perl Perl], which is a scripting language used when compiling the kernel, and the STLink drivers if you want to program stm32 boards that have an USB-based STLinkV2 programmer/debugger.&lt;br /&gt;
&lt;br /&gt;
* For git, it is recomended to install it from [http://www.git-scm.com/download/win git-scm.com]. Please &#039;&#039;&#039;do not&#039;&#039;&#039; uncheck the &#039;&#039;Windows Explorer integration&#039;&#039; feature during the installation, as you will need it to install the kernel sources.&lt;br /&gt;
* [http://strawberryperl.com Strawberry perl] is the recomended perl version for Miosix on Windows&lt;br /&gt;
* The STLink drivers can be found on the [http://www.st.com/web/en/catalog/tools/PF258168# ST website].&lt;br /&gt;
&lt;br /&gt;
Finally, it is recomended to download a better text editor than Notepad or WordPad, as you will need it to edit the Miosix configuration files. [http://www.notepad-plus-plus.org/ Notepad++] is a good option, but many other options exist. Just &#039;&#039;&#039;don&#039;t use notepad&#039;&#039;&#039;, because it does not recognize Unix [https://en.wikipedia.org/wiki/Line_ending line-endings] and will show you Miosix source files as if they were composed of a single line of text.&lt;br /&gt;
&lt;br /&gt;
Once you have downloaded and installed the aforementioned software, you can proceed with the installation of the Miosix Toolchain.&lt;br /&gt;
&lt;br /&gt;
=== Install the Miosix Toolchain ===&lt;br /&gt;
&lt;br /&gt;
Download the [[Miosix Toolchain]] and run it. At the end you will need to reboot your computer (sorry, it&#039;s Windows...)&lt;br /&gt;
&lt;br /&gt;
=== Get the Miosix kernel sources ===&lt;br /&gt;
&lt;br /&gt;
Go to the directory where you want to dowload the Miosix kernel, for example the Documents directory, and right-click on it. Select &#039;&#039;Git bash&#039;&#039; to open a git shell. There you can type the commands to download the kernel.&lt;br /&gt;
&lt;br /&gt;
[[File:Gitbashwindows.png]]&lt;br /&gt;
&lt;br /&gt;
The Miosix git repository used to be hosted at [http://gitorious.org gitorious.org], but the service was shut down. For this reason, the kernel is now hosted directly at miosix.org. There is also a [https://github.com/fedetft/miosix-kernel github mirror] and the two repositories will be always kept in sync. Currently, the &#039;&#039;master&#039;&#039; branch contains the stable 2.0 kernel, while the &#039;&#039;testing&#039;&#039; branch contains the current development version. Kernel versions prior to 2.0 are deprecated.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git clone https://miosix.org/git-public/miosix-kernel.git&lt;br /&gt;
cd miosix-kernel&lt;br /&gt;
git fetch origin&lt;br /&gt;
## To select the development version of the kernel&lt;br /&gt;
#git checkout -b testing origin/testing&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that it is possible to paste commands in the shell (so as to avoid typing them, which can be tedious and lead to typos), but you have to do it one line of text at a time, and to paste you need to use the &#039;&#039;Shift+Ins&#039;&#039; shortcut, not the usual &#039;&#039;Ctrl+v&#039;&#039; one. The last command, &#039;&#039;exit&#039;&#039;, will close the shell.&lt;br /&gt;
&lt;br /&gt;
Note that there is also a &#039;Git GUI&#039; in the right click menu, but since I don&#039;t know how to use it, you&#039;re on your own if you choose that route.&lt;br /&gt;
&lt;br /&gt;
=== Configuring and compiling the kernel ===&lt;br /&gt;
&lt;br /&gt;
More in-depth information on how th configure the kernel for your board can be found in the [[Board list]], but for now we will assume you have an stm32f4discovery, which is a common board, and briefly show how to get to a blinking LED example.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Top-level directory&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
First of all the miosix-kernel directory is often referred to as the &#039;&#039;&#039;top-level directory&#039;&#039;&#039; of the kernel. It contains, among other, the &#039;&#039;main.cpp&#039;&#039; file which is where you can start writing your application code, the &#039;&#039;Makefile&#039;&#039; where you can add additional C++ and C source files to be compiled, and the &#039;&#039;miosix&#039;&#039; directory which contains the kernel.&lt;br /&gt;
&lt;br /&gt;
[[File:Miosixtopleveldirectorywindows.png]]&lt;br /&gt;
&lt;br /&gt;
All paths in this wiki, unless they start with a &#039;/&#039; (for Linux) or &#039;C:\&#039; (For Windows), are intended relative to Miosix&#039;s top-level directory, so if we&#039;re talking about the &#039;miosix/config/Makefile.inc&#039; file you can find it within the directory where you have downloaded the kernel from git.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Configuring the kernel&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The kernel is configured by editing two files, named [[Makefile.inc|miosix/config/Makefile.inc]] and [[miosix_settingls.h|miosix/config/miosix_settings.h]]. Open the first one in Notepad++, and select your board. To do so, look for the &#039;&#039;OPT_BOARD&#039;&#039; section of the file, which looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
##&lt;br /&gt;
## Target board, choose one. This also implicitly select the target&lt;br /&gt;
## architecture&lt;br /&gt;
##&lt;br /&gt;
#OPT_BOARD := lpc2138_miosix_board&lt;br /&gt;
OPT_BOARD := stm32f103ze_stm3210e-eval&lt;br /&gt;
#OPT_BOARD := stm32f103ve_mp3v2&lt;br /&gt;
#OPT_BOARD := stm32f100rb_stm32vldiscovery&lt;br /&gt;
#OPT_BOARD := stm32f103ve_strive_mini&lt;br /&gt;
#OPT_BOARD := stm32f103ze_redbull_v2&lt;br /&gt;
#OPT_BOARD := stm32f407vg_stm32f4discovery&lt;br /&gt;
#OPT_BOARD := stm32f207ig_stm3220g-eval&lt;br /&gt;
#OPT_BOARD := stm32f207zg_ethboard_v2&lt;br /&gt;
#OPT_BOARD := stm32f207ze_als_camboard&lt;br /&gt;
#OPT_BOARD := stm32l151_als_mainboard&lt;br /&gt;
#OPT_BOARD := stm32f407vg_bitsboard&lt;br /&gt;
#OPT_BOARD := stm32f205rg_sony-newman&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
In Makefile syntax a &#039;#&#039; sign denotes a comment, so to select a board you have to comment out (by prepending a &#039;#&#039;) the default board selected, and uncomment (by removing the &#039;#&#039; at the start of the line) your board, which in this example is the &#039;&#039;stm32f407vg_stm32f4discovery&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Next, edit the &#039;&#039;miosix_settings.h&#039;&#039; file using Notepad++ and uncomment (by removing the &#039;//&#039; at the start of the line) the following line&lt;br /&gt;
&amp;lt;source lang=&amp;quot;CPP&amp;quot;&amp;gt;&lt;br /&gt;
//#define JTAG_DISABLE_SLEEP&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
(which is towards the end of the file). This is a C++ header file, so the comment syntax is &#039;//&#039;. More information on the meaning of this line can be found in [[miosix_settings.h]], but a short summary is that this line prevents the kernel from shutting down the CPU when it has nothing to do, which saves power but interferes with the programming/debugging protocol used to program the board via QSTLink2.&lt;br /&gt;
&lt;br /&gt;
Also, comment out the &#039;&#039;#error&#039;&#039; line towards the beginning of the file. This line exists to cause a compilation error if the user forgets to edit the &#039;&#039;miosix_settings.h&#039;&#039; file. The result should look like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;CPP&amp;quot;&amp;gt;&lt;br /&gt;
// Before you can compile the kernel you have to configure it by editing this&lt;br /&gt;
// file. After that, comment out this line to disable the reminder error.&lt;br /&gt;
// The PARSING_FROM_IDE is because Netbeans gets confused by this, it is never&lt;br /&gt;
// defined when compiling the code.&lt;br /&gt;
#ifndef PARSING_FROM_IDE&lt;br /&gt;
//#error This error is a reminder that you have not edited miosix_settings.h yet.&lt;br /&gt;
#endif //PARSING_FROM_IDE&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Blink a LED&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Open the &#039;&#039;main.cpp&#039;&#039; file in the top-level directory using Notepad++, and replace its content with the following program:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;CPP&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;miosix.h&amp;gt;&lt;br /&gt;
using namespace miosix;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
    for(;;)&lt;br /&gt;
    {&lt;br /&gt;
        ledOn();&lt;br /&gt;
        Thread::sleep(1000);&lt;br /&gt;
        ledOff();&lt;br /&gt;
        Thread::sleep(1000);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The Miosix board support package defines the &#039;&#039;ledOn()&#039;&#039; and &#039;&#039;ledOff()&#039;&#039; functions to control a LED on the board for all the boards that have at least one software-accessible LED.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Compiling&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To compile the kernel, open a DOS shell in the Miosix top-level directory (you can &#039;Shift+Right click&#039; in the top-level directory and choose &#039;Open command window here&#039; in modern versions of Windows), otherwise you will have to &#039;&#039;cd&#039;&#039; your way into that directory.&lt;br /&gt;
&lt;br /&gt;
[[File:Openterminalwindows.png]]&lt;br /&gt;
&lt;br /&gt;
To compile the kernel type &#039;&#039;make&#039;&#039; in the DOS prompt. If all goes well, the result should look like this.&lt;br /&gt;
&lt;br /&gt;
[[File:Makeoutputwindows.png]]&lt;br /&gt;
&lt;br /&gt;
Otherwise, compiler errors will appear in the DOS prompt. The number that appears under &#039;&#039;text&#039;&#039; in the make output is the size in bytes of your application plus the kernel. If you think that 90KBytes is a bit too much for a blinking led, don&#039;t worry. The kernel by default includes support for C stdio functions, filesystem code including Unicode support and the C++ exception handling runtime, all of which can be disabled to significantly [[Miosix code size optimization|reduce code size]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Programming&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There are two ways to program the stm32f4discovery board. One is to use QSTLink2 directly from the DOS prompt you already have open by typing &#039;make program&#039; (connect the USB cable first!), the other is through QSTLink2&#039;s GUI. You can find QSTLink2 in the start menu&lt;br /&gt;
&lt;br /&gt;
[[File:Qstlink2startmenuwindows.png]]&lt;br /&gt;
&lt;br /&gt;
Once you start it, you have to click on &#039;&#039;Connect&#039;&#039;, and it should find your &#039;&#039;stm32f4discovery&#039;&#039; board. After that, click on &#039;&#039;Send&#039;&#039; and select the &#039;&#039;main.bin&#039;&#039; file in the Miosix top-level directory.&lt;br /&gt;
&lt;br /&gt;
[[File:Qstlink2flashingwindows.png]]&lt;br /&gt;
&lt;br /&gt;
Note that, regardless of using QSTLink2 form the DOS prompt or the GUI, there is a bug that in some circumstances blocks the microcontroller until the next powercycle. Therefore, after having programmed the microcontroller, it is recomended to unplug and reconnect the USB cable to powercycle the &#039;&#039;stm32f4discovery&#039;&#039; board. At that point, you shuold see the red LED blinking.&lt;br /&gt;
&lt;br /&gt;
Lastly, if you have a brand new board and QSTlink doesn&#039;t work you may take a look at [[ST-LINK utility update|this page]].&lt;br /&gt;
&lt;br /&gt;
=== What&#039;s next? ===&lt;br /&gt;
&lt;br /&gt;
You have finished the installation of the Miosix Toolchain. You may want to [[Quick start#IDE Configuration|install and configure an IDE]], or the [[Quick start#In-circuit debugger|debugger]].&lt;br /&gt;
&lt;br /&gt;
=== Uninstall the Miosix Toolchain ===&lt;br /&gt;
&lt;br /&gt;
To uninstall the Miosix Toolchain, you can find the uninstaller in the start menu under &#039;&#039;Miosix Toolchain&#039;&#039;. Note that Git, Perl and the STLink drivers have their own uninstallers. Also, the &#039;&#039;miosix-kernel&#039;&#039; in the &#039;&#039;Documents&#039;&#039; directory will not be removed.&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation and Configuration]]&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=Linux_Quick_Start&amp;diff=266</id>
		<title>Linux Quick Start</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=Linux_Quick_Start&amp;diff=266"/>
		<updated>2016-12-16T08:48:04Z</updated>

		<summary type="html">&lt;p&gt;Silseva: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page explains how to install the precompiled Miosix Toolchain. If you prefer compiling GCC from sources, see [[Building GCC from sources]].&lt;br /&gt;
&lt;br /&gt;
=== Before you begin ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;64 bit Linux distros&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo apt-get install libstdc++6:i386 # Install 32bit compatibility libraries for Ubuntu/Debian&lt;br /&gt;
sudo pacman -S lib32-libstdc++5      # Install 32bit compatibility libraries for Arch Linux&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; QSTLink2 &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
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 &#039;&#039;stm32f4discovery&#039;&#039; 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 &#039;&#039;ppa&#039;&#039; and install it via &#039;&#039;apt-get&#039;&#039;. 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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo add-apt-repository ppa:fpoussin/ppa&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
sudo apt-get install qstlink2&lt;br /&gt;
wget https://raw.githubusercontent.com/mobyfab/QStlink2/master/res/49-stlinkv2.rules&lt;br /&gt;
sudo mv 49-stlinkv2.rules /etc/udev/rules.d&lt;br /&gt;
sudo chown root:root /etc/udev/rules.d/49-stlinkv2.rules&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 &#039;&#039;lpc21isp&#039;&#039;, a tool to program LPC2000 microcontrollers using their serial bootloader.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Serial port setup &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Miosix redirects &#039;&#039;stdin&#039;&#039;/&#039;&#039;stdout&#039;&#039; 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 &#039;&#039;/dev/ttyS0&#039;&#039; and the USB to serial adapters like &#039;&#039;/dev/ttyUSB0&#039;&#039; are owned by the &#039;&#039;dialout&#039;&#039; group, so you need to add your user to that group before you can access them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo usermod -a -G dialout `id -un` # Add yourself to the dialout group&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 &#039;&#039;GNU screen&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo apt-get install screen # For Ubuntu/Debian&lt;br /&gt;
sudo pacman -S screen       # For Arch Linux&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install the Miosix Toolchain ===&lt;br /&gt;
&lt;br /&gt;
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 &#039;&#039;/opt/arm-miosix-eabi&#039;&#039; directory, and put symlinks to &#039;&#039;/usr/bin&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
wget https://miosix.org/toolchain/MiosixToolchainInstaller.run&lt;br /&gt;
sh MiosixToolchainInstaller.run&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sh MiosixToolchainInstaller.run --noexec --target arm-miosix-eabi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Keep in mind that for a local install you will need to set the &#039;&#039;PATH&#039;&#039; environment variable to the &#039;&#039;arm-miosix-eabi/bin&#039;&#039; directory.&lt;br /&gt;
&lt;br /&gt;
=== Get the Miosix kernel sources ===&lt;br /&gt;
&lt;br /&gt;
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&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo apt-get install git # For Ubuntu/Debian&lt;br /&gt;
sudo pacman -S git       # For Arch Linux&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Miosix git repository used to be hosted at [http://gitorious.org gitorious.org], but the service was shut down. For this reason, the kernel is now hosted directly at miosix.org. There is also a [https://github.com/fedetft/miosix-kernel github mirror] and the two repositories will be always kept in sync. Currently, the &#039;&#039;master&#039;&#039; branch contains the stable 2.0 kernel, while the &#039;&#039;testing&#039;&#039; branch contains the current development version. Kernel versions prior to 2.0 are deprecated.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git clone https://miosix.org/git-public/miosix-kernel.git&lt;br /&gt;
cd miosix-kernel&lt;br /&gt;
git fetch origin&lt;br /&gt;
## To select the development version of the kernel&lt;br /&gt;
#git checkout -b testing origin/testing&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring and compiling the kernel ===&lt;br /&gt;
&lt;br /&gt;
More in-depth information on how th configure the kernel for your board can be found in the [[Board list]], but for now we will assume you have an stm32f4discovery, which is a common board, and briefly show how to get to a blinking LED example.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Top-level directory&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
First of all the miosix-kernel directory is often referred to as the &#039;&#039;&#039;top-level directory&#039;&#039;&#039; of the kernel. It contains, among other, the &#039;&#039;main.cpp&#039;&#039; file which is where you can start writing your application code, the &#039;&#039;Makefile&#039;&#039; where you can add additional C++ and C source files to be compiled, and the &#039;&#039;miosix&#039;&#039; directory which contains the kernel.&lt;br /&gt;
&lt;br /&gt;
[[File:Miosixtopleveldirectorylinux.png]]&lt;br /&gt;
&lt;br /&gt;
All paths in this wiki, unless they start with a &#039;/&#039; (for Linux) or &#039;C:\&#039; (For Windows), are intended relative to Miosix&#039;s top-level directory, so if we&#039;re talking about the &#039;miosix/config/Makefile.inc&#039; file you can find it within the directory where you have downloaded the kernel from git.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Configuring the kernel&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The kernel is configured by editing two files, named [[Makefile.inc|miosix/config/Makefile.inc]] and [[miosix_settings.h|miosix/config/miosix_settings.h]]. Open the first one, and select your board. To do so, look for the &#039;&#039;OPT_BOARD&#039;&#039; section of the file, which looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
##&lt;br /&gt;
## Target board, choose one. This also implicitly select the target&lt;br /&gt;
## architecture&lt;br /&gt;
##&lt;br /&gt;
#OPT_BOARD := lpc2138_miosix_board&lt;br /&gt;
OPT_BOARD := stm32f103ze_stm3210e-eval&lt;br /&gt;
#OPT_BOARD := stm32f103ve_mp3v2&lt;br /&gt;
#OPT_BOARD := stm32f100rb_stm32vldiscovery&lt;br /&gt;
#OPT_BOARD := stm32f103ve_strive_mini&lt;br /&gt;
#OPT_BOARD := stm32f103ze_redbull_v2&lt;br /&gt;
#OPT_BOARD := stm32f407vg_stm32f4discovery&lt;br /&gt;
#OPT_BOARD := stm32f207ig_stm3220g-eval&lt;br /&gt;
#OPT_BOARD := stm32f207zg_ethboard_v2&lt;br /&gt;
#OPT_BOARD := stm32f207ze_als_camboard&lt;br /&gt;
#OPT_BOARD := stm32l151_als_mainboard&lt;br /&gt;
#OPT_BOARD := stm32f407vg_bitsboard&lt;br /&gt;
#OPT_BOARD := stm32f205rg_sony-newman&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
In Makefile syntax a &#039;#&#039; sign denotes a comment, so to select a board you have to comment out (by prepending a &#039;#&#039;) the default board selected, and uncomment (by removing the &#039;#&#039; at the start of the line) your board, in this case, which in this example will assume is the &#039;&#039;stm32f407vg_stm32f4discovery&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Next, edit the &#039;&#039;miosix_settings.h&#039;&#039; file and uncomment (by removing the &#039;//&#039; at the start of the line) the following line&lt;br /&gt;
&amp;lt;source lang=&amp;quot;CPP&amp;quot;&amp;gt;&lt;br /&gt;
//#define JTAG_DISABLE_SLEEP&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
(which is towards the end of the file). This is a C++ header file, so the comment syntax is &#039;//&#039;. More information on the meaning of this line can be found in [[miosix_settings.h]], but a short summary is that this line prevents the kernel from putting shutting down the CPU when it has nothing to do, which saves power but interferes with the programming/debugging protocol used to program the board via QSTLink2.&lt;br /&gt;
&lt;br /&gt;
Also, comment out the &#039;&#039;#error&#039;&#039; line towards the beginning of the file. This line exists to cause a compilation error if the user forgets to edit the &#039;&#039;miosix_settings.h&#039;&#039; file. The result should look like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;CPP&amp;quot;&amp;gt;&lt;br /&gt;
// Before you can compile the kernel you have to configure it by editing this&lt;br /&gt;
// file. After that, comment out this line to disable the reminder error.&lt;br /&gt;
// The PARSING_FROM_IDE is because Netbeans gets confused by this, it is never&lt;br /&gt;
// defined when compiling the code.&lt;br /&gt;
#ifndef PARSING_FROM_IDE&lt;br /&gt;
//#error This error is a reminder that you have not edited miosix_settings.h yet.&lt;br /&gt;
#endif //PARSING_FROM_IDE&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Blink a LED&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Open the &#039;&#039;main.cpp&#039;&#039; file in the top-level directory, and replace its content with the following program:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;CPP&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;miosix.h&amp;gt;&lt;br /&gt;
using namespace miosix;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
    for(;;)&lt;br /&gt;
    {&lt;br /&gt;
        ledOn();&lt;br /&gt;
        Thread::sleep(1000);&lt;br /&gt;
        ledOff();&lt;br /&gt;
        Thread::sleep(1000);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The Miosix board support package defines the &#039;&#039;ledOn()&#039;&#039; and &#039;&#039;ledOff()&#039;&#039; functions to control a LED on the board for all the boards that have at least one software-accessible LED.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Compiling&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To compile the kernel, open a terminal in the Miosix top-level directory and type &#039;&#039;make&#039;&#039;. If all goes well, the result should look like this.&lt;br /&gt;
&lt;br /&gt;
[[File:Makeoutputlinux.png]]&lt;br /&gt;
&lt;br /&gt;
Otherwise, compiler errors will appear in the shell. The number that appears under &#039;&#039;text&#039;&#039; in the make output is the size in bytes of your application plus the kernel. If you think that 90KBytes is a bit too much for a blinking led, don&#039;t worry. The kernel by default includes support for C stdio functions, filesystem code including Unicode support and the C++ exception handling runtime, all of which can be disabled to significantly [[Miosix code size optimization|reduce code size]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Programming&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There are two ways to program the stm32f4discovery board. One is to use QSTLink2 directly from the shell you already have open by typing &#039;make program&#039; (connect the USB cable first!), the other is through QSTLink2&#039;s GUI.&lt;br /&gt;
&lt;br /&gt;
[[File:Findqstlink2guilinux.png]]&lt;br /&gt;
&lt;br /&gt;
Once you start it, you have to click on &#039;&#039;Connect&#039;&#039;, and it should find your &#039;&#039;stm32f4discovery&#039;&#039; board. After that, click on &#039;&#039;Send&#039;&#039; and select the &#039;&#039;main.bin&#039;&#039; file in the Miosix top-level directory.&lt;br /&gt;
&lt;br /&gt;
[[File:Qstlink2flashinglinux.png]]&lt;br /&gt;
&lt;br /&gt;
Note that, regardless of using QSTLink2 form the shell or the GUI, there is a bug that in some circumstances blocks the microcontroller until the next powercycle. Therefore, after having programmed the microcontroller, is is recomended to unplug and reconnect the USB cable to powercycle the &#039;&#039;stm32f4discovery&#039;&#039; board. At that point, you shuold see the red LED blinking.&lt;br /&gt;
&lt;br /&gt;
Lastly, if you have a brand new board and QSTlink doesn&#039;t work you may take a look at [[ST-LINK utility update|this page]].&lt;br /&gt;
&lt;br /&gt;
=== What&#039;s next? ===&lt;br /&gt;
&lt;br /&gt;
You have finished the installation of the Miosix Toolchain. You may want to [[Quick start#IDE Configuration|install and configure an IDE]], or the [[Quick start#In-circuit debugger|debugger]].&lt;br /&gt;
&lt;br /&gt;
=== Uninstall the compiler ===&lt;br /&gt;
&lt;br /&gt;
If for some reason you need to uninstall the compiler, there is an uninstall script in the &#039;&#039;/opt/arm-miosix-eabi&#039;&#039; directory (Note: if you have built the compiler from sources the uninstall script may not be there). Running the script will uninstall the compiler and the symbolic links in the &#039;&#039;/usr/bin&#039;&#039; directory. Just like the install script, the uninstaller will ask for your root password to be able to remove the installed files.&lt;br /&gt;
&lt;br /&gt;
There is no need to uninstall and old compiler to install a new one, the installer will take care of that automatically. However, if you have installed the compiler and now you want to build it from sources, you first need to uninstall the old compiler.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd /opt/arm-miosix-eabi&lt;br /&gt;
./uninstall.sh&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have chosen to install the compiler locally (i.e: not in the &#039;/opt/arm-miosix-eabi&#039; directory), simply remove the compiler directory.&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation and Configuration]]&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=Stm32f407vg_stm32f4discovery&amp;diff=265</id>
		<title>Stm32f407vg stm32f4discovery</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=Stm32f407vg_stm32f4discovery&amp;diff=265"/>
		<updated>2016-12-16T08:43:08Z</updated>

		<summary type="html">&lt;p&gt;Silseva: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This is a cheap self contained [http://www.st.com/web/catalog/tools/PF252419 discovery board] with a powerful processor, and a Linux-friendly [http://www.st.com/web/catalog/tools/PF219866 ST-LINK/V2] programmer/in circuit debugger.&lt;br /&gt;
The board is equipped with&lt;br /&gt;
* A [http://www.st.com/web/catalog/mmc/FM141/SC1169/SS1577/LN11/PF252140 STM32F407VG] microcontroller with a 168MHz ARM Cortex-M4F core, 1024KB Flash, 192KB RAM, 4KB battery-backed RAM in LQFP100 package.&lt;br /&gt;
* A LIS302DL accelerometer, MP45DT02 mems microphone, CS43L22 audio DAC, 4 user LEDs, user button, reset button, a second USB connector as the microcontroller supports USB.&lt;br /&gt;
&lt;br /&gt;
[[File:Stm32f4discovery.jpg|frameless]]&lt;br /&gt;
&lt;br /&gt;
== Configuring the kernel ==&lt;br /&gt;
&lt;br /&gt;
The minimum configuration required is to edit the [[Makefile.inc|miosix/config/Makefile.inc]] file to uncomment the &#039;&#039;OPT_BOARD := stm32f407vg_stm32f4discovery&#039;&#039; line. If you had compiled the kernel before, it is recommended to do a &#039;&#039;make clean&#039;&#039; (or in the Netbeans IDE, to click on the &amp;quot;Clean project&amp;quot; button) to avoid leaving object files around. After, do a &#039;&#039;make&#039;&#039; to compile.&lt;br /&gt;
&lt;br /&gt;
In addition, this board has a couple of board-specific options in the Makefile.inc file. For convenience, the relevant part of that configuration file is reported here so as to be easily located within the file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;CPP&amp;quot;&amp;gt;&lt;br /&gt;
##---------------------------------------------------------------------------&lt;br /&gt;
## stm32f407vg_stm32f4discovery&lt;br /&gt;
##&lt;br /&gt;
ifeq ($(OPT_BOARD),stm32f407vg_stm32f4discovery)&lt;br /&gt;
&lt;br /&gt;
  ## Linker script type, there are two options&lt;br /&gt;
  ## 1) Code in FLASH, stack + heap in internal RAM (file *_rom.ld)&lt;br /&gt;
  ## 2) Code + stack + heap in internal RAM (file *_ram.ld)&lt;br /&gt;
  LINKER_SCRIPT_PATH := arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/&lt;br /&gt;
  LINKER_SCRIPT := $(LINKER_SCRIPT_PATH)stm32_1m+192k_rom.ld&lt;br /&gt;
  #LINKER_SCRIPT := $(LINKER_SCRIPT_PATH)stm32_1m+192k_ram.ld&lt;br /&gt;
&lt;br /&gt;
  ## This causes the interrupt vector table to be relocated in SRAM, must be&lt;br /&gt;
  ## uncommented when using the ram linker script&lt;br /&gt;
  #SRAM_BOOT := -DVECT_TAB_SRAM&lt;br /&gt;
&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As can be seen, there are two options for this board: LINKER_SCRIPT and SRAM_BOOT. The comments explain in detail the meaning of there options, so it isn&#039;t necessary to further explain them. &lt;br /&gt;
&lt;br /&gt;
After modifying configuration files it is recommended to do a make clean; make (or in the Netbeans IDE, to click on the &amp;quot;Clean and build project&amp;quot; button) to be sure that changes are applied.&lt;br /&gt;
&lt;br /&gt;
== Loading code ==&lt;br /&gt;
&lt;br /&gt;
As explained before, there are more than one linker script for this board, and the selected linker script affects the way code should be loaded on the board.&lt;br /&gt;
&lt;br /&gt;
===stm32_1m+192k_rom.ld===&lt;br /&gt;
This is the default linker script, and puts the code in FLASH, so you need to program the microcontroller&#039;s FLASH every time you change your code, but code will run faster and won&#039;t be lost at each reboot.&lt;br /&gt;
&lt;br /&gt;
A simple way to load code in FLASH is to use the [https://github.com/fpoussin/QStlink2 QStlink2] tool. Also, if you have a brand new board and QStlink fails you may take a look at [[ST-LINK utility update|this page]]&lt;br /&gt;
&lt;br /&gt;
===stm32_1m+192k_ram.ld===&lt;br /&gt;
This linker script is very useful for debugging code on this board, as it locates everything (code, stack, heap) in the microcontroller&#039;s RAM. It has the disadvantage that the loaded code is lost upon reboot (being in a volatile memory), but for debugging, it is not an issue.&lt;br /&gt;
&lt;br /&gt;
== Reading printf output ==&lt;br /&gt;
&lt;br /&gt;
The board has no serial to USB adapter onboard, so you need to use an external one, connected to USART3, in detail PB10 (TXD) and PB11 (RXD). The choice of USART3 was done due to the fact that USART1 pins are not free on this board.&lt;br /&gt;
&lt;br /&gt;
On Linux you can use screen. Open a terminal and type &#039;&#039;screen /dev/ttyUSB0 115200&#039;&#039; (Note that to quit from screen you need to type &amp;quot;Ctrl-C, \&amp;quot;). You&#039;ll need to change /dev/ttyUSB0 with your serial port device name.&lt;br /&gt;
&lt;br /&gt;
On windows you can use HyperTerminal, you need to configure it to use the required baud rate, no flow control, and select the correct COM port device name.&lt;br /&gt;
&lt;br /&gt;
== In Circuit Debugging ==&lt;br /&gt;
&lt;br /&gt;
Before you begin you should note that the Miosix kernel will put the CPU to a low power state when no thread is running. This low power state will usually confuse debuggers and make them lose sync with the CPU. To avoid this you need to edit the [[miosix_settings.h|miosix/config/miosix_settings.h]] file and uncomment &#039;&#039;#define JTAG_DISABLE_SLEEP&#039;&#039; line. This will prevent the kernel from putting the CPU in its low power state making debugging possible.&lt;br /&gt;
Also, to be able to precisely single-step your code you need to disable compiler optimizations as gdb is incapable of reliably debug an optimized code. The option is in the miosix/config/Makefile.inc file and is the &#039;&#039;OPT_OPTIMIZATION := -O0&#039;&#039; that should be uncommented while the other lines related to the same option should be commented out.&lt;br /&gt;
&lt;br /&gt;
After modifying configuration files it is recommended to do a &#039;&#039;make clean; make&#039;&#039; (or in the Netbeans IDE, to click on the &amp;quot;Clean and build project&amp;quot; button) to be sure that changes are applied.&lt;br /&gt;
&lt;br /&gt;
Since the board has an on board SWD in circuit debugger, simply plugging the USB cable is all you need from an hardware point of view.&lt;br /&gt;
On the software side, you need to open two shells. In one do a&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;BASH&amp;quot;&amp;gt;&lt;br /&gt;
sudo openocd -f miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/stm32f4discovery.cfg&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will start the OpenOCD program that will connect to the board and listen for GDB connections.&lt;br /&gt;
&lt;br /&gt;
In the second shell type the following commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;BASH&amp;quot;&amp;gt;&lt;br /&gt;
arm-miosix-eabi-gdb main.elf&lt;br /&gt;
target remote :3333&lt;br /&gt;
monitor soft_reset_halt&lt;br /&gt;
break main&lt;br /&gt;
continue&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first command will start the gdb debugger. The following commands are typed into the gdb console, and tell it to connect to OpenOCD, and reset the board and stop the program at the beginning of main()&lt;br /&gt;
To load the program to be debugged, you can either do a make program before and then start debugging, or you can directly write the FLASH memory from within gdb with this command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;BASH&amp;quot;&amp;gt;&lt;br /&gt;
monitor flash write_image erase main.bin 0x08000000 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From there on, have a look at [[Quick_start]] for debugger commands.&lt;br /&gt;
&lt;br /&gt;
== (Optional) Configuring the Netbeans IDE ==&lt;br /&gt;
To have a fully working code completion that can also resolve the board-specific symbols, right click on the project, go to Set Configuration and select the right board.&lt;br /&gt;
&lt;br /&gt;
[[File: Netbeans-config.png]]&lt;br /&gt;
&lt;br /&gt;
== SD Card ==&lt;br /&gt;
&lt;br /&gt;
This board lacks an SD connector, so the filesystem support does not work out of the box (upon boot the kernel will say that filesystem mounting failed). However, it is possible to connect one to specific GPIO pins.&lt;br /&gt;
&lt;br /&gt;
The SD or microSD connector VCC and GND pins need to be connected to 3V and GND pins on the board. Add a 100nF capacitor between VCC and GND, as close as possible to the SD connector. This will be useful to overcome current absorption peaks from the SD card.&lt;br /&gt;
&lt;br /&gt;
Then connect the following GPIOs to the SD connector.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! SD !! STM32 !! Optional&lt;br /&gt;
|-&lt;br /&gt;
| CLK || PC12 || &lt;br /&gt;
|-&lt;br /&gt;
| CMD || PD2 || &lt;br /&gt;
|-&lt;br /&gt;
| D0 || PC8 || &lt;br /&gt;
|-&lt;br /&gt;
| D1 || PC9 || Y&lt;br /&gt;
|-&lt;br /&gt;
| D2 || PC10 || Y&lt;br /&gt;
|-&lt;br /&gt;
| D3 || PC11 || Y&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each connection needs a pullup resistor between ~47Kohm and 100Kohm.&lt;br /&gt;
&lt;br /&gt;
To increase read/write speed it is possible to connect the optional GPIOs thereby communicating with the SD in 4-bit mode.&lt;br /&gt;
Note that by default in this board the SD driver uses 1 bit mode. To enable 4-bit mode you need to edit the &#039;&#039;miosix/config/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/board_settings.h&#039;&#039; and comment out the &#039;&#039;#define SD_ONE_BIT_DATABUS&#039;&#039; line.&lt;br /&gt;
&lt;br /&gt;
Also note that filesystem support is enabled by default, so the pins marked as not optional are used by the filesystem driver. If you do not want to connect an SD card, and want to use those GPIOs, you should disable the filesystem support in [[miosix_settings.h|miosix/config/miosix_settings.h]].&lt;br /&gt;
&lt;br /&gt;
== Resource ==&lt;br /&gt;
stm32f4discovery [http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/DM00039084.pdf Datasheet]&lt;br /&gt;
&lt;br /&gt;
[[Category:Boards]]&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=Stm32f429zi_stm32f4discovery&amp;diff=264</id>
		<title>Stm32f429zi stm32f4discovery</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=Stm32f429zi_stm32f4discovery&amp;diff=264"/>
		<updated>2016-12-16T08:42:20Z</updated>

		<summary type="html">&lt;p&gt;Silseva: updated code uploading guide&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This is a cheap self contained [http://www2.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-discovery-kits/32f429idiscovery.html discovery board] with a powerful processor, and a Linux-friendly [http://www.st.com/web/catalog/tools/PF219866 ST-LINK/V2] programmer/in circuit debugger.&lt;br /&gt;
The board is equipped with&lt;br /&gt;
* A [http://www2.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f4-series/stm32f429-439/stm32f429zi.html STM32F429ZI] microcontroller with a 180MHz ARM Cortex-M4F core, 2048KB Flash, 256KB RAM, 4KB battery-backed RAM in LQFP144 package.&lt;br /&gt;
* An external 64Mb SRAM, L3GD20 3-axis digital output gyroscope, 2.4&amp;quot; QVGA TFT LCD, 2 user LEDs, user button, reset button, a second USB connector as the microcontroller supports USB.&lt;br /&gt;
&lt;br /&gt;
[[File:Stm32f429disco.jpg|frameless]]&lt;br /&gt;
&lt;br /&gt;
== Configuring the kernel ==&lt;br /&gt;
&lt;br /&gt;
The minimum configuration required is to edit the [[Makefile.inc|miosix/config/Makefile.inc]] file to uncomment the &#039;&#039;OPT_BOARD := stm32f429zi_stm32f4discovery&#039;&#039; line. If you had compiled the kernel before, it is recommended to do a &#039;&#039;make clean&#039;&#039; (or in the Netbeans IDE, to click on the &amp;quot;Clean project&amp;quot; button) to avoid leaving object files around. After, do a &#039;&#039;make&#039;&#039; to compile.&lt;br /&gt;
&lt;br /&gt;
In addition, this board has a couple of board-specific options in the Makefile.inc file. For convenience, the relevant part of that configuration file is reported here so as to be easily located within the file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;CPP&amp;quot;&amp;gt;&lt;br /&gt;
##---------------------------------------------------------------------------&lt;br /&gt;
## stm32f429zi_stm32f4discovery&lt;br /&gt;
##&lt;br /&gt;
ifeq ($(OPT_BOARD),stm32f429zi_stm32f4discovery)&lt;br /&gt;
&lt;br /&gt;
    ## Linker script type, there are three options&lt;br /&gt;
    ## 1) Code in FLASH, stack + heap in internal RAM (file *_rom.ld)&lt;br /&gt;
    ##    the most common choice, available for all microcontrollers&lt;br /&gt;
    ## 2) Code in FLASH, stack + heap in external RAM (file *8m_xram.ld)&lt;br /&gt;
    ##    You must uncomment -D__ENABLE_XRAM below in this case.&lt;br /&gt;
    ## 3) Code in FLASH, stack + heap in external RAM (file *6m_xram.ld)&lt;br /&gt;
    ##    Same as above, but leaves the upper 2MB of RAM for the LCD.&lt;br /&gt;
    LINKER_SCRIPT_PATH := arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/&lt;br /&gt;
    #LINKER_SCRIPT := $(LINKER_SCRIPT_PATH)stm32_2m+256k_rom.ld&lt;br /&gt;
    #LINKER_SCRIPT := $(LINKER_SCRIPT_PATH)stm32_2m+8m_xram.ld&lt;br /&gt;
    LINKER_SCRIPT := $(LINKER_SCRIPT_PATH)stm32_2m+6m_xram.ld&lt;br /&gt;
&lt;br /&gt;
    ## Uncommenting __ENABLE_XRAM enables the initialization of the external&lt;br /&gt;
    ## 8MB SDRAM memory. Do not uncomment this even if you don&#039;t use a linker&lt;br /&gt;
    ## script that requires it, as it is used for the LCD framebuffer.&lt;br /&gt;
    XRAM := -D__ENABLE_XRAM&lt;br /&gt;
    &lt;br /&gt;
    ## Select clock frequency. Warning: the default clock frequency for&lt;br /&gt;
    ## this board is 168MHz and not 180MHz because, due to a limitation in&lt;br /&gt;
    ## the PLL, it is not possible to generate a precise 48MHz output when&lt;br /&gt;
    ## running the core at 180MHz. If 180MHz is chosen the USB peripheral will&lt;br /&gt;
    ## NOT WORK and the SDIO and RNG will run ~6% slower (45MHz insteand of 48)&lt;br /&gt;
    #CLOCK_FREQ := -DHSE_VALUE=8000000 -DSYSCLK_FREQ_180MHz=180000000&lt;br /&gt;
    CLOCK_FREQ := -DHSE_VALUE=8000000 -DSYSCLK_FREQ_168MHz=168000000&lt;br /&gt;
    #CLOCK_FREQ := -DHSE_VALUE=8000000 -DSYSCLK_FREQ_100MHz=100000000&lt;br /&gt;
&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As can be seen, there are two options for this board: LINKER_SCRIPT and SRAM_BOOT. The comments explain in detail the meaning of there options, so it isn&#039;t necessary to further explain them. &lt;br /&gt;
&lt;br /&gt;
After modifying configuration files it is recommended to do a make clean; make (or in the Netbeans IDE, to click on the &amp;quot;Clean and build project&amp;quot; button) to be sure that changes are applied.&lt;br /&gt;
&lt;br /&gt;
== Loading code ==&lt;br /&gt;
&lt;br /&gt;
As explained before, there are more than one linker script for this board, and the selected linker script affects the way code should be loaded on the board.&lt;br /&gt;
&lt;br /&gt;
A simple way to load code in FLASH is to use the [https://github.com/fpoussin/QStlink2 QStlink2] tool. Also, if you have a brand new board and QStlink fails you may take a look at [[ST-LINK utility update|this page]]&lt;br /&gt;
&lt;br /&gt;
== Reading printf output ==&lt;br /&gt;
&lt;br /&gt;
The board has no serial to USB adapter onboard, so you need to use an external one, connected to USART3, in detail PA9 (TXD) and PA10 (RXD).&lt;br /&gt;
&lt;br /&gt;
On Linux you can use screen. Open a terminal and type &#039;&#039;screen /dev/ttyUSB0 19200&#039;&#039; (Note that to quit from screen you need to type &amp;quot;Ctrl-C, \&amp;quot;). You&#039;ll need to change /dev/ttyUSB0 with your serial port device name.&lt;br /&gt;
&lt;br /&gt;
On windows you can use HyperTerminal, you need to configure it to use the required baud rate, no flow control, and select the correct COM port device name.&lt;br /&gt;
&lt;br /&gt;
== In Circuit Debugging ==&lt;br /&gt;
&lt;br /&gt;
Before you begin you should note that the Miosix kernel will put the CPU to a low power state when no thread is running. This low power state will usually confuse debuggers and make them lose sync with the CPU. To avoid this you need to edit the [[miosix_settings.h|miosix/config/miosix_settings.h]] file and uncomment &#039;&#039;#define JTAG_DISABLE_SLEEP&#039;&#039; line. This will prevent the kernel from putting the CPU in its low power state making debugging possible.&lt;br /&gt;
Also, to be able to precisely single-step your code you need to disable compiler optimizations as gdb is incapable of reliably debug an optimized code. The option is in the miosix/config/Makefile.inc file and is the &#039;&#039;OPT_OPTIMIZATION := -O0&#039;&#039; that should be uncommented while the other lines related to the same option should be commented out.&lt;br /&gt;
&lt;br /&gt;
After modifying configuration files it is recommended to do a &#039;&#039;make clean; make&#039;&#039; (or in the Netbeans IDE, to click on the &amp;quot;Clean and build project&amp;quot; button) to be sure that changes are applied.&lt;br /&gt;
&lt;br /&gt;
Since the board has an on board SWD in circuit debugger, simply plugging the USB cable is all you need from an hardware point of view.&lt;br /&gt;
On the software side, you need to open two shells. In one do a&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;BASH&amp;quot;&amp;gt;&lt;br /&gt;
sudo openocd -f miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32f4discovery.cfg&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will start the OpenOCD program that will connect to the board and listen for GDB connections.&lt;br /&gt;
&lt;br /&gt;
In the second shell type the following commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;BASH&amp;quot;&amp;gt;&lt;br /&gt;
arm-miosix-eabi-gdb main.elf&lt;br /&gt;
target remote :3333&lt;br /&gt;
monitor soft_reset_halt&lt;br /&gt;
break main&lt;br /&gt;
continue&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first command will start the gdb debugger. The following commands are typed into the gdb console, and tell it to connect to OpenOCD, and reset the board and stop the program at the beginning of main()&lt;br /&gt;
To load the program to be debugged, you can either do a make program before and then start debugging, or you can directly write the FLASH memory from within gdb with this command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;BASH&amp;quot;&amp;gt;&lt;br /&gt;
monitor flash write_image erase main.bin 0x08000000 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From there on, have a look at [[Quick_start]] for debugger commands.&lt;br /&gt;
&lt;br /&gt;
== (Optional) Configuring the Netbeans IDE ==&lt;br /&gt;
To have a fully working code completion that can also resolve the board-specific symbols, right click on the project, go to Set Configuration and select the right board.&lt;br /&gt;
&lt;br /&gt;
[[File: Netbeans-config.png]]&lt;br /&gt;
&lt;br /&gt;
== SD Card (FIXME!!!!) == &lt;br /&gt;
&lt;br /&gt;
This board lacks an SD connector, so the filesystem support does not work out of the box (upon boot the kernel will say that filesystem mounting failed). However, it is possible to connect one to specific GPIO pins.&lt;br /&gt;
&lt;br /&gt;
The SD or microSD connector VCC and GND pins need to be connected to 3V and GND pins on the board. Add a 100nF capacitor between VCC and GND, as close as possible to the SD connector. This will be useful to overcome current absorption peaks from the SD card.&lt;br /&gt;
&lt;br /&gt;
Then connect the following GPIOs to the SD connector.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! SD !! STM32 !! Optional&lt;br /&gt;
|-&lt;br /&gt;
| CLK || PC12 || &lt;br /&gt;
|-&lt;br /&gt;
| CMD || PD2 || &lt;br /&gt;
|-&lt;br /&gt;
| D0 || PC8 || &lt;br /&gt;
|-&lt;br /&gt;
| D1 || PC9 || Y&lt;br /&gt;
|-&lt;br /&gt;
| D2 || PC10 || Y&lt;br /&gt;
|-&lt;br /&gt;
| D3 || PC11 || Y&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each connection needs a pullup resistor between ~47Kohm and 100Kohm.&lt;br /&gt;
&lt;br /&gt;
To increase read/write speed it is possible to connect the optional GPIOs thereby communicating with the SD in 4-bit mode.&lt;br /&gt;
Note that by default in this board the SD driver uses 1 bit mode. To enable 4-bit mode you need to edit the &#039;&#039;miosix/config/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/board_settings.h&#039;&#039; and comment out the &#039;&#039;#define SD_ONE_BIT_DATABUS&#039;&#039; line.&lt;br /&gt;
&lt;br /&gt;
Also note that filesystem support is enabled by default, so the pins marked as not optional are used by the filesystem driver. If you do not want to connect an SD card, and want to use those GPIOs, you should disable the filesystem support in [[miosix_settings.h|miosix/config/miosix_settings.h]].&lt;br /&gt;
&lt;br /&gt;
== Resource ==&lt;br /&gt;
stm32f4discovery [http://www2.st.com/content/ccc/resource/technical/document/user_manual/6b/25/05/23/a9/45/4d/6a/DM00093903.pdf/files/DM00093903.pdf/jcr:content/translations/en.DM00093903.pdf Datasheet]&lt;br /&gt;
&lt;br /&gt;
[[Category:Boards]]&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=Stm32f407vg_stm32f4discovery&amp;diff=263</id>
		<title>Stm32f407vg stm32f4discovery</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=Stm32f407vg_stm32f4discovery&amp;diff=263"/>
		<updated>2016-12-16T08:39:58Z</updated>

		<summary type="html">&lt;p&gt;Silseva: qstlink update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This is a cheap self contained [http://www.st.com/web/catalog/tools/PF252419 discovery board] with a powerful processor, and a Linux-friendly [http://www.st.com/web/catalog/tools/PF219866 ST-LINK/V2] programmer/in circuit debugger.&lt;br /&gt;
The board is equipped with&lt;br /&gt;
* A [http://www.st.com/web/catalog/mmc/FM141/SC1169/SS1577/LN11/PF252140 STM32F407VG] microcontroller with a 168MHz ARM Cortex-M4F core, 1024KB Flash, 192KB RAM, 4KB battery-backed RAM in LQFP100 package.&lt;br /&gt;
* A LIS302DL accelerometer, MP45DT02 mems microphone, CS43L22 audio DAC, 4 user LEDs, user button, reset button, a second USB connector as the microcontroller supports USB.&lt;br /&gt;
&lt;br /&gt;
[[File:Stm32f4discovery.jpg|frameless]]&lt;br /&gt;
&lt;br /&gt;
== Configuring the kernel ==&lt;br /&gt;
&lt;br /&gt;
The minimum configuration required is to edit the [[Makefile.inc|miosix/config/Makefile.inc]] file to uncomment the &#039;&#039;OPT_BOARD := stm32f407vg_stm32f4discovery&#039;&#039; line. If you had compiled the kernel before, it is recommended to do a &#039;&#039;make clean&#039;&#039; (or in the Netbeans IDE, to click on the &amp;quot;Clean project&amp;quot; button) to avoid leaving object files around. After, do a &#039;&#039;make&#039;&#039; to compile.&lt;br /&gt;
&lt;br /&gt;
In addition, this board has a couple of board-specific options in the Makefile.inc file. For convenience, the relevant part of that configuration file is reported here so as to be easily located within the file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;CPP&amp;quot;&amp;gt;&lt;br /&gt;
##---------------------------------------------------------------------------&lt;br /&gt;
## stm32f407vg_stm32f4discovery&lt;br /&gt;
##&lt;br /&gt;
ifeq ($(OPT_BOARD),stm32f407vg_stm32f4discovery)&lt;br /&gt;
&lt;br /&gt;
  ## Linker script type, there are two options&lt;br /&gt;
  ## 1) Code in FLASH, stack + heap in internal RAM (file *_rom.ld)&lt;br /&gt;
  ## 2) Code + stack + heap in internal RAM (file *_ram.ld)&lt;br /&gt;
  LINKER_SCRIPT_PATH := arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/&lt;br /&gt;
  LINKER_SCRIPT := $(LINKER_SCRIPT_PATH)stm32_1m+192k_rom.ld&lt;br /&gt;
  #LINKER_SCRIPT := $(LINKER_SCRIPT_PATH)stm32_1m+192k_ram.ld&lt;br /&gt;
&lt;br /&gt;
  ## This causes the interrupt vector table to be relocated in SRAM, must be&lt;br /&gt;
  ## uncommented when using the ram linker script&lt;br /&gt;
  #SRAM_BOOT := -DVECT_TAB_SRAM&lt;br /&gt;
&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As can be seen, there are two options for this board: LINKER_SCRIPT and SRAM_BOOT. The comments explain in detail the meaning of there options, so it isn&#039;t necessary to further explain them. &lt;br /&gt;
&lt;br /&gt;
After modifying configuration files it is recommended to do a make clean; make (or in the Netbeans IDE, to click on the &amp;quot;Clean and build project&amp;quot; button) to be sure that changes are applied.&lt;br /&gt;
&lt;br /&gt;
== Loading code ==&lt;br /&gt;
&lt;br /&gt;
As explained before, there are more than one linker script for this board, and the selected linker script affects the way code should be loaded on the board.&lt;br /&gt;
&lt;br /&gt;
===stm32_1m+192k_rom.ld===&lt;br /&gt;
This is the default linker script, and puts the code in FLASH, so you need to program the microcontroller&#039;s FLASH every time you change your code, but code will run faster and won&#039;t be lost at each reboot.&lt;br /&gt;
&lt;br /&gt;
A simple way to load code in FLASH is to use the [https://github.com/fpoussin/QStlink2 QStlink2] tool. If you have a brand new board and QStlink fails you may take a look at [[ST-LINK utility update|this page]]&lt;br /&gt;
&lt;br /&gt;
===stm32_1m+192k_ram.ld===&lt;br /&gt;
This linker script is very useful for debugging code on this board, as it locates everything (code, stack, heap) in the microcontroller&#039;s RAM. It has the disadvantage that the loaded code is lost upon reboot (being in a volatile memory), but for debugging, it is not an issue.&lt;br /&gt;
&lt;br /&gt;
== Reading printf output ==&lt;br /&gt;
&lt;br /&gt;
The board has no serial to USB adapter onboard, so you need to use an external one, connected to USART3, in detail PB10 (TXD) and PB11 (RXD). The choice of USART3 was done due to the fact that USART1 pins are not free on this board.&lt;br /&gt;
&lt;br /&gt;
On Linux you can use screen. Open a terminal and type &#039;&#039;screen /dev/ttyUSB0 115200&#039;&#039; (Note that to quit from screen you need to type &amp;quot;Ctrl-C, \&amp;quot;). You&#039;ll need to change /dev/ttyUSB0 with your serial port device name.&lt;br /&gt;
&lt;br /&gt;
On windows you can use HyperTerminal, you need to configure it to use the required baud rate, no flow control, and select the correct COM port device name.&lt;br /&gt;
&lt;br /&gt;
== In Circuit Debugging ==&lt;br /&gt;
&lt;br /&gt;
Before you begin you should note that the Miosix kernel will put the CPU to a low power state when no thread is running. This low power state will usually confuse debuggers and make them lose sync with the CPU. To avoid this you need to edit the [[miosix_settings.h|miosix/config/miosix_settings.h]] file and uncomment &#039;&#039;#define JTAG_DISABLE_SLEEP&#039;&#039; line. This will prevent the kernel from putting the CPU in its low power state making debugging possible.&lt;br /&gt;
Also, to be able to precisely single-step your code you need to disable compiler optimizations as gdb is incapable of reliably debug an optimized code. The option is in the miosix/config/Makefile.inc file and is the &#039;&#039;OPT_OPTIMIZATION := -O0&#039;&#039; that should be uncommented while the other lines related to the same option should be commented out.&lt;br /&gt;
&lt;br /&gt;
After modifying configuration files it is recommended to do a &#039;&#039;make clean; make&#039;&#039; (or in the Netbeans IDE, to click on the &amp;quot;Clean and build project&amp;quot; button) to be sure that changes are applied.&lt;br /&gt;
&lt;br /&gt;
Since the board has an on board SWD in circuit debugger, simply plugging the USB cable is all you need from an hardware point of view.&lt;br /&gt;
On the software side, you need to open two shells. In one do a&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;BASH&amp;quot;&amp;gt;&lt;br /&gt;
sudo openocd -f miosix/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/stm32f4discovery.cfg&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will start the OpenOCD program that will connect to the board and listen for GDB connections.&lt;br /&gt;
&lt;br /&gt;
In the second shell type the following commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;BASH&amp;quot;&amp;gt;&lt;br /&gt;
arm-miosix-eabi-gdb main.elf&lt;br /&gt;
target remote :3333&lt;br /&gt;
monitor soft_reset_halt&lt;br /&gt;
break main&lt;br /&gt;
continue&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first command will start the gdb debugger. The following commands are typed into the gdb console, and tell it to connect to OpenOCD, and reset the board and stop the program at the beginning of main()&lt;br /&gt;
To load the program to be debugged, you can either do a make program before and then start debugging, or you can directly write the FLASH memory from within gdb with this command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;BASH&amp;quot;&amp;gt;&lt;br /&gt;
monitor flash write_image erase main.bin 0x08000000 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From there on, have a look at [[Quick_start]] for debugger commands.&lt;br /&gt;
&lt;br /&gt;
== (Optional) Configuring the Netbeans IDE ==&lt;br /&gt;
To have a fully working code completion that can also resolve the board-specific symbols, right click on the project, go to Set Configuration and select the right board.&lt;br /&gt;
&lt;br /&gt;
[[File: Netbeans-config.png]]&lt;br /&gt;
&lt;br /&gt;
== SD Card ==&lt;br /&gt;
&lt;br /&gt;
This board lacks an SD connector, so the filesystem support does not work out of the box (upon boot the kernel will say that filesystem mounting failed). However, it is possible to connect one to specific GPIO pins.&lt;br /&gt;
&lt;br /&gt;
The SD or microSD connector VCC and GND pins need to be connected to 3V and GND pins on the board. Add a 100nF capacitor between VCC and GND, as close as possible to the SD connector. This will be useful to overcome current absorption peaks from the SD card.&lt;br /&gt;
&lt;br /&gt;
Then connect the following GPIOs to the SD connector.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! SD !! STM32 !! Optional&lt;br /&gt;
|-&lt;br /&gt;
| CLK || PC12 || &lt;br /&gt;
|-&lt;br /&gt;
| CMD || PD2 || &lt;br /&gt;
|-&lt;br /&gt;
| D0 || PC8 || &lt;br /&gt;
|-&lt;br /&gt;
| D1 || PC9 || Y&lt;br /&gt;
|-&lt;br /&gt;
| D2 || PC10 || Y&lt;br /&gt;
|-&lt;br /&gt;
| D3 || PC11 || Y&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each connection needs a pullup resistor between ~47Kohm and 100Kohm.&lt;br /&gt;
&lt;br /&gt;
To increase read/write speed it is possible to connect the optional GPIOs thereby communicating with the SD in 4-bit mode.&lt;br /&gt;
Note that by default in this board the SD driver uses 1 bit mode. To enable 4-bit mode you need to edit the &#039;&#039;miosix/config/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/board_settings.h&#039;&#039; and comment out the &#039;&#039;#define SD_ONE_BIT_DATABUS&#039;&#039; line.&lt;br /&gt;
&lt;br /&gt;
Also note that filesystem support is enabled by default, so the pins marked as not optional are used by the filesystem driver. If you do not want to connect an SD card, and want to use those GPIOs, you should disable the filesystem support in [[miosix_settings.h|miosix/config/miosix_settings.h]].&lt;br /&gt;
&lt;br /&gt;
== Resource ==&lt;br /&gt;
stm32f4discovery [http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/DM00039084.pdf Datasheet]&lt;br /&gt;
&lt;br /&gt;
[[Category:Boards]]&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=ST-LINK_utility_update&amp;diff=262</id>
		<title>ST-LINK utility update</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=ST-LINK_utility_update&amp;diff=262"/>
		<updated>2016-12-16T08:36:48Z</updated>

		<summary type="html">&lt;p&gt;Silseva: added page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Recently ST Microelectronics has updated the firmware used for the ST-LINK utility that is present on all the STM32 Discovery boards. Unfortunately this update in not compatible with the QStlink GUI tool recommended in this wiki to upload your firmware into the Discovery board&#039;s microcontroller.&lt;br /&gt;
&lt;br /&gt;
The boards with the new firmware are identified by one of these facts:&lt;br /&gt;
* the board order code has the word &amp;quot;DISC1&amp;quot; at its end, as an example: &amp;quot;STM32F429I-DISC1&amp;quot;&lt;br /&gt;
* the ST-LINK firmware version is &amp;quot;ST-LINK/V2-B&amp;quot;&lt;br /&gt;
* when the board is connected to a computer is seen by the operating system as an USB key.&lt;br /&gt;
&lt;br /&gt;
Luckily a new procedure to flash the board using QStlink has been found, even if at this moment it has been tested only under Linux (if someone manages to flash a board with this procedure under other operating systems, please report it to us and we will update this page).&lt;br /&gt;
&lt;br /&gt;
===== New flashing procedure =====&lt;br /&gt;
&lt;br /&gt;
* Connect the board to the PC&lt;br /&gt;
* Ignore the fact that it&#039;s recognised as an USB key, but don&#039;t unmount it&lt;br /&gt;
* Open the terminal&lt;br /&gt;
* Move to the folder that contains the .bin file you wish to upload&lt;br /&gt;
* Type &#039;&#039;&#039;&#039;&#039;sudo qstlink2 -cwV [filename].bin&#039;&#039;&#039;&#039;&#039;, where [filename] is the name of the new firmware&#039;s file&lt;br /&gt;
* If the board doesn&#039;t execute the firmware you have just uploaded press the &#039;&#039;reset&#039;&#039; button or try resetting the power unplugging and reconnecting the USB cable&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=Main_Page&amp;diff=261</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=Main_Page&amp;diff=261"/>
		<updated>2016-12-16T08:10:52Z</updated>

		<summary type="html">&lt;p&gt;Silseva: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Welcome to the Miosix wiki. This wiki contains the documentation for the Miosix kernel.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;div style=&amp;quot;background-color:#FFA0A0;&amp;quot;&amp;gt;&lt;br /&gt;
IMPORTANT NOTICE: &amp;lt;br&amp;gt;&lt;br /&gt;
Recently ST Microeletronics has changed the firmware used for ST-LINK utility on its Discovery boards. For this reason, if you have bought a STM32 Discovery board recently, it&#039;s highly possible that you may encounter problems in uploading your firmware using the Qstlink GUI utility. &amp;lt;br&amp;gt;&lt;br /&gt;
Until an update of the Qstlink utility is released (which not depends upon us), in [[New ST-LINK firmware|this page]] you can find a temporary fix for this issue. &lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Getting started =&lt;br /&gt;
Follow the [[Quick start]] to install the Miosix Toolchain and compile the Miosix 2.0 kernel.&lt;br /&gt;
&lt;br /&gt;
= Software =&lt;br /&gt;
* Have a look at the Miosix [[API list|APIs]] and [[Library list|libraries]] that you can use for your applications.&lt;br /&gt;
* The page on [[Synchronization primitives]] lists the possible ways to shnchronize beween multiple threads or between a thread and an interrupt routine.&lt;br /&gt;
* How to [[Miosix code size optimization|reduce the kernel code size]] for deeply embedded applications.&lt;br /&gt;
&lt;br /&gt;
= Hardware =&lt;br /&gt;
Check out which microcontroller [[Board list|boards]] are supported by Miosix.&lt;br /&gt;
&lt;br /&gt;
= Account creation =&lt;br /&gt;
Due to spam (within two days from setting up the wiki) account registration is disabled. If you want to create an account, ask to fede.tft&amp;amp;&amp;amp;miosix.org (s/&amp;amp;&amp;amp;/@/)&lt;br /&gt;
&lt;br /&gt;
= Index =&lt;br /&gt;
* [[Special:Categories|Categories]]&lt;br /&gt;
* [[Special:AllPages|All Pages]]&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=Main_Page&amp;diff=260</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=Main_Page&amp;diff=260"/>
		<updated>2016-12-16T08:04:31Z</updated>

		<summary type="html">&lt;p&gt;Silseva: added Qstlink caveat&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Welcome to the Miosix wiki. This wiki contains the documentation for the Miosix kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;div style=&amp;quot;background-color:#FFA0A0;&amp;quot;&amp;gt;&lt;br /&gt;
IMPORTANT NOTICE: &amp;lt;br&amp;gt;&lt;br /&gt;
Recently ST Microeletronics has changed the firmware used for ST-LINK utility on its Discovery boards. For this reason, if you have bought a STM32 Discovery board recently, it&#039;s highly possible that you may encounter problems in uploading your firmware using the Qstlink GUI utility. &amp;lt;br&amp;gt;&lt;br /&gt;
Until an update of the Qstlink utility is released (which not depends upon us), in [[Qstlink workaround|this page]] you can find a temporary fix for this issue. &lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Getting started =&lt;br /&gt;
Follow the [[Quick start]] to install the Miosix Toolchain and compile the Miosix 2.0 kernel.&lt;br /&gt;
&lt;br /&gt;
= Software =&lt;br /&gt;
* Have a look at the Miosix [[API list|APIs]] and [[Library list|libraries]] that you can use for your applications.&lt;br /&gt;
* The page on [[Synchronization primitives]] lists the possible ways to shnchronize beween multiple threads or between a thread and an interrupt routine.&lt;br /&gt;
* How to [[Miosix code size optimization|reduce the kernel code size]] for deeply embedded applications.&lt;br /&gt;
&lt;br /&gt;
= Hardware =&lt;br /&gt;
Check out which microcontroller [[Board list|boards]] are supported by Miosix.&lt;br /&gt;
&lt;br /&gt;
= Account creation =&lt;br /&gt;
Due to spam (within two days from setting up the wiki) account registration is disabled. If you want to create an account, ask to fede.tft&amp;amp;&amp;amp;miosix.org (s/&amp;amp;&amp;amp;/@/)&lt;br /&gt;
&lt;br /&gt;
= Index =&lt;br /&gt;
* [[Special:Categories|Categories]]&lt;br /&gt;
* [[Special:AllPages|All Pages]]&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=MacOS_Quick_Start&amp;diff=259</id>
		<title>MacOS Quick Start</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=MacOS_Quick_Start&amp;diff=259"/>
		<updated>2016-11-14T15:16:11Z</updated>

		<summary type="html">&lt;p&gt;Silseva: /* Toolchain compilation and installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ATTENTION: This page is still a WIP. Usual disclaimers about not taking responsibility for your system disruption applies.&lt;br /&gt;
&lt;br /&gt;
=== Before you begin ===&lt;br /&gt;
&lt;br /&gt;
This procedure has been tested on OS X El Capitain 10.11. The Miosix toolchain has been successfully compiled using GCC 4.9.3, which can be installed using the Homebrew package manager.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Xcode&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install Xcode by downloading it from the Mac App Store [https://itunes.apple.com/au/app/xcode/id497799835?mt=12 here]. This is needed for installing the XCode command line tools which in turn is needed by Homebrew. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Xcode Command Line Tools&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install the Command Line Tools by running the following command in terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
xcode-select --install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is recommended to run the command even if Xcode and the Command Line Tools were already installed on your system, since the Command Line Tools installation may have been messed up by upgrading to 10.11 from a previous release.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Homebrew&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Grab a copy of Homebrew and run the install script in one step using this command in terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ruby -e &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it complains about permission issues, then you have to fix it before you can continue. In Mac OS X El Capitan 10.11, Apple introduced a new feature called System Integrity Protector (SIP), which prevents from writing to many system directories such as /usr, /System, /bin, regardless of whether or not you are root. Apple is leaving /usr/local open for developers to use, so Homebrew can still be used as expected; however, performing a few steps may be required depending on you system, as outlined in the official Homebrew documentation [https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/El_Capitan_and_Homebrew.md here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System dependencies installation ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install GNU tar&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Running the Miosix toolchain compilation script may give you an error related to extracting a file. Therefore, using GNU tar instead of Apple tar is suggested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command in terminal to add the repository containing GNU tar to Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew tap homebrew/dupes&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command in terminal to grab the most recent packages list from Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew update&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command to install GNU tar:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew install gnu-tar&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install GCC 4.9.3&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Running the Miosix toolchain compilation script using Apple GCC has proven unsuccessful. That&#039;s why we need to install GCC 4.9.3 from Homebrew. Perform the steps below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command in terminal to add the repository containing GCC 4.9.3 to Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew tap homebrew/versions&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command in terminal to grab the most recent packages list from Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew update&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command to install GCC 4.9.3:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew install gcc49&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Symlink GCC 4.9.3 executables&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
First, you need to create appropriate symlinks within /usr/local/bin from the versioned name of gcc executables to generic ones. Run these commands from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ln -s /usr/local/bin/gcc-4.9 /usr/local/bin/gcc&lt;br /&gt;
ln -s /usr/local/bin/gcc-4.9 /usr/local/bin/cc&lt;br /&gt;
ln -s /usr/local/bin/g++-4.9 /usr/local/bin/g++&lt;br /&gt;
ln -s /usr/local/bin/cpp-4.9 /usr/local/bin/cpp&lt;br /&gt;
ln -s /usr/local/bin/c++-4.9 /usr/local/bin/c++&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please notice that gcc-4.9 has not been symlinked to ld has someone may expect, since it has proven prone to errors during the Miosix toolchain compilation. Instead, we are gonna use Apple own Clang ld as a linker.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Edit $PATH variable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now you need to make sure that /usr/local/bin gets inspected before /usr/bin when looking for gcc, so that Homebrew GCC 4.9.3 will be called instead of Apple GCC. In order to do so, we are gonna modify the $PATH terminal variable. Run from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get into your home folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
edit .bash_profile&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To edit the bash profile script. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You need to add the following lines as they are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#homebrew gcc&lt;br /&gt;
export PATH=/usr/local/bin:$PATH&lt;br /&gt;
#gnu-tar&lt;br /&gt;
export PATH=/usr/local/opt/gnu-tar/libexec/gnubin:$PATH&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and close the file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
source .bash_profile&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in order to reload the bash profile script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check the installed packages&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If everything went as supposed, running from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
gcc -v&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
should return some text including:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
gcc version 4.9.3 (Homebrew gcc49 4.9.3)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While running from terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ld -v&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
should return some text including:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LTO support using: Apple LLVM 7.0.0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And finally running from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
tar --version&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
should return some text including:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
tar (GNU tar)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Toolchain compilation and installation ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Toolchain sources download&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to download the kernel and toolchains sources, you need git. If you don&#039;t have it already, you can install it using Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew install git&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From terminal, cd to a folder of your choice, making sure that the path from root to it doesn&#039;t contain spaces or special characters. Then run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git clone https://miosix.org/git-public/miosix-kernel.git&lt;br /&gt;
cd miosix-kernel&lt;br /&gt;
git fetch origin&lt;br /&gt;
## To select the development version of the kernel&lt;br /&gt;
#git checkout -b testing origin/testing&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that currently, the &#039;&#039;master&#039;&#039; branch contains the stable 2.0 kernel, while the &#039;&#039;testing&#039;&#039; branch contains the current development version. Usually the latter contains the latest updates made, especially support packages for new boards, so its advised to use the code contained in this branch.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Toolchain dependencies download&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You need to fix a link in the Miosix toolchain dependencies download script, located at:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
miosix-kernel/miosix/_tools/compiler/download.sh&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
wget http://www.mpfr.org/mpfr-current/mpfr-3.1.2.tar.xz&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
wget http://www.mpfr.org/mpfr-3.1.2/mpfr-3.1.2.tar.xz&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you need to run the dependencies download script. From terminal, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sh miosix-kernel/miosix/_tools/compiler/download.sh&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
from the folder where you performed the git clone command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Toolchain compilation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
System-wide installation of the toolchain is currently untested. It is then suggested to install it locally and then add its location the the $PATH.&lt;br /&gt;
First, edit the install script located at:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
miosix-kernel/miosix/_tools/compiler/install-script.sh&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
such that at the end the first few lines looks as follow:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Uncomment if installing globally on the system&lt;br /&gt;
#INSTALL_DIR=/opt&lt;br /&gt;
#SUDO=sudo&lt;br /&gt;
# Uncomment if installing locally, sudo isn&#039;t necessary&lt;br /&gt;
INSTALL_DIR=`pwd`/gcc&lt;br /&gt;
SUDO=&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can now finally run the compilation script. From terminal, run: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sh miosix-kernel/miosix/_tools/compiler/install-script.sh&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At the end, if everything worked correctly, you&#039;ll find the toolchain at:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
miosix-kernel/miosix/_tools/compiler/gcc/arm-miosix-eabi/bin&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Toolchain compilation and installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now you need to add the toolchain to your path. Edit the bash profile script and add the following lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#arm-miosix-eabi&lt;br /&gt;
export PATH={my-folder-of-choice-path}/miosix-kernel/miosix/_tools/compiler/gcc/arm-miosix-eabi/bin:$PATH&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where you have to replace {my-folder-of-choice-path} with the path of the folder where you run the git clone command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
source .bash_profile&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in order to reload the bash profile script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Cleanup&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You are now free to go back to Apple tar and GCC. In order to do so, edit the bash profile script and remove the following lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#homebrew gcc&lt;br /&gt;
export PATH=/usr/local/bin:$PATH&lt;br /&gt;
#gnu-tar&lt;br /&gt;
export PATH=/usr/local/opt/gnu-tar/libexec/gnubin:$PATH&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
source .bash_profile&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in order to reload the bash profile script.&lt;br /&gt;
&lt;br /&gt;
=== Kernel compilation ===&lt;br /&gt;
&lt;br /&gt;
In order to configure and compile the kernel, please follow the steps outlined in the [[Linux Quick Start|Linux Quick Start]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Flash and debug an STM32F4DISCOVERY board ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tools installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to be able to flash and debug an STM32F4DISCOVERY board, you need the stlink tools suite. You can grab it from Homebrew running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew install stlink&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=MacOS_Quick_Start&amp;diff=258</id>
		<title>MacOS Quick Start</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=MacOS_Quick_Start&amp;diff=258"/>
		<updated>2016-11-14T15:07:01Z</updated>

		<summary type="html">&lt;p&gt;Silseva: added testing branch&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ATTENTION: This page is still a WIP. Usual disclaimers about not taking responsibility for your system disruption applies.&lt;br /&gt;
&lt;br /&gt;
=== Before you begin ===&lt;br /&gt;
&lt;br /&gt;
This procedure has been tested on OS X El Capitain 10.11. The Miosix toolchain has been successfully compiled using GCC 4.9.3, which can be installed using the Homebrew package manager.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Xcode&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install Xcode by downloading it from the Mac App Store [https://itunes.apple.com/au/app/xcode/id497799835?mt=12 here]. This is needed for installing the XCode command line tools which in turn is needed by Homebrew. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Xcode Command Line Tools&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install the Command Line Tools by running the following command in terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
xcode-select --install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is recommended to run the command even if Xcode and the Command Line Tools were already installed on your system, since the Command Line Tools installation may have been messed up by upgrading to 10.11 from a previous release.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Homebrew&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Grab a copy of Homebrew and run the install script in one step using this command in terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ruby -e &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it complains about permission issues, then you have to fix it before you can continue. In Mac OS X El Capitan 10.11, Apple introduced a new feature called System Integrity Protector (SIP), which prevents from writing to many system directories such as /usr, /System, /bin, regardless of whether or not you are root. Apple is leaving /usr/local open for developers to use, so Homebrew can still be used as expected; however, performing a few steps may be required depending on you system, as outlined in the official Homebrew documentation [https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/El_Capitan_and_Homebrew.md here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System dependencies installation ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install GNU tar&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Running the Miosix toolchain compilation script may give you an error related to extracting a file. Therefore, using GNU tar instead of Apple tar is suggested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command in terminal to add the repository containing GNU tar to Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew tap homebrew/dupes&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command in terminal to grab the most recent packages list from Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew update&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command to install GNU tar:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew install gnu-tar&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install GCC 4.9.3&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Running the Miosix toolchain compilation script using Apple GCC has proven unsuccessful. That&#039;s why we need to install GCC 4.9.3 from Homebrew. Perform the steps below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command in terminal to add the repository containing GCC 4.9.3 to Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew tap homebrew/versions&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command in terminal to grab the most recent packages list from Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew update&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run this command to install GCC 4.9.3:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew install gcc49&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Symlink GCC 4.9.3 executables&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
First, you need to create appropriate symlinks within /usr/local/bin from the versioned name of gcc executables to generic ones. Run these commands from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ln -s /usr/local/bin/gcc-4.9 /usr/local/bin/gcc&lt;br /&gt;
ln -s /usr/local/bin/gcc-4.9 /usr/local/bin/cc&lt;br /&gt;
ln -s /usr/local/bin/g++-4.9 /usr/local/bin/g++&lt;br /&gt;
ln -s /usr/local/bin/cpp-4.9 /usr/local/bin/cpp&lt;br /&gt;
ln -s /usr/local/bin/c++-4.9 /usr/local/bin/c++&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please notice that gcc-4.9 has not been symlinked to ld has someone may expect, since it has proven prone to errors during the Miosix toolchain compilation. Instead, we are gonna use Apple own Clang ld as a linker.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Edit $PATH variable&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now you need to make sure that /usr/local/bin gets inspected before /usr/bin when looking for gcc, so that Homebrew GCC 4.9.3 will be called instead of Apple GCC. In order to do so, we are gonna modify the $PATH terminal variable. Run from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get into your home folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
edit .bash_profile&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To edit the bash profile script. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You need to add the following lines as they are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#homebrew gcc&lt;br /&gt;
export PATH=/usr/local/bin:$PATH&lt;br /&gt;
#gnu-tar&lt;br /&gt;
export PATH=/usr/local/opt/gnu-tar/libexec/gnubin:$PATH&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and close the file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
source .bash_profile&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in order to reload the bash profile script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check the installed packages&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If everything went as supposed, running from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
gcc -v&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
should return some text including:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
gcc version 4.9.3 (Homebrew gcc49 4.9.3)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While running from terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ld -v&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
should return some text including:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LTO support using: Apple LLVM 7.0.0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And finally running from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
tar --version&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
should return some text including:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
tar (GNU tar)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Toolchain compilation and installation ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Toolchain sources download&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to download the kernel and toolchains sources, you need git. If you don&#039;t have it already, you can install it using Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew install git&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From terminal, cd to a folder of your choice, making sure that the path from root to it doesn&#039;t contain spaces or special characters. Then run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git clone https://miosix.org/git-public/miosix-kernel.git&lt;br /&gt;
cd miosix-kernel&lt;br /&gt;
git fetch origin&lt;br /&gt;
## To select the development version of the kernel&lt;br /&gt;
#git checkout -b testing origin/testing&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Toolchain dependencies download&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You need to fix a link in the Miosix toolchain dependencies download script, located at:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
miosix-kernel/miosix/_tools/compiler/download.sh&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
wget http://www.mpfr.org/mpfr-current/mpfr-3.1.2.tar.xz&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
wget http://www.mpfr.org/mpfr-3.1.2/mpfr-3.1.2.tar.xz&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you need to run the dependencies download script. From terminal, run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sh miosix-kernel/miosix/_tools/compiler/download.sh&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
from the folder where you performed the git clone command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Toolchain compilation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
System-wide installation of the toolchain is currently untested. It is then suggested to install it locally and then add its location the the $PATH.&lt;br /&gt;
First, edit the install script located at:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
miosix-kernel/miosix/_tools/compiler/install-script.sh&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
such that at the end the first few lines looks as follow:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Uncomment if installing globally on the system&lt;br /&gt;
#INSTALL_DIR=/opt&lt;br /&gt;
#SUDO=sudo&lt;br /&gt;
# Uncomment if installing locally, sudo isn&#039;t necessary&lt;br /&gt;
INSTALL_DIR=`pwd`/gcc&lt;br /&gt;
SUDO=&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can now finally run the compilation script. From terminal, run: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sh miosix-kernel/miosix/_tools/compiler/install-script.sh&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At the end, if everything worked correctly, you&#039;ll find the toolchain at:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
miosix-kernel/miosix/_tools/compiler/gcc/arm-miosix-eabi/bin&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Toolchain compilation and installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now you need to add the toolchain to your path. Edit the bash profile script and add the following lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#arm-miosix-eabi&lt;br /&gt;
export PATH={my-folder-of-choice-path}/miosix-kernel/miosix/_tools/compiler/gcc/arm-miosix-eabi/bin:$PATH&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where you have to replace {my-folder-of-choice-path} with the path of the folder where you run the git clone command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
source .bash_profile&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in order to reload the bash profile script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Cleanup&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You are now free to go back to Apple tar and GCC. In order to do so, edit the bash profile script and remove the following lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#homebrew gcc&lt;br /&gt;
export PATH=/usr/local/bin:$PATH&lt;br /&gt;
#gnu-tar&lt;br /&gt;
export PATH=/usr/local/opt/gnu-tar/libexec/gnubin:$PATH&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run from terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
source .bash_profile&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in order to reload the bash profile script.&lt;br /&gt;
&lt;br /&gt;
=== Kernel compilation ===&lt;br /&gt;
&lt;br /&gt;
In order to configure and compile the kernel, please follow the steps outlined in the [[Linux Quick Start|Linux Quick Start]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Flash and debug an STM32F4DISCOVERY board ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tools installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to be able to flash and debug an STM32F4DISCOVERY board, you need the stlink tools suite. You can grab it from Homebrew running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew install stlink&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=API_list&amp;diff=255</id>
		<title>API list</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=API_list&amp;diff=255"/>
		<updated>2016-04-15T17:38:40Z</updated>

		<summary type="html">&lt;p&gt;Silseva: added interrupt tutorial link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a list of some of the Miosix APIs, currently far form being complete&lt;br /&gt;
&lt;br /&gt;
* The [[Serial port tutorial]] explains how to interface to a computer through the C functions &#039;&#039;printf()/scanf()&#039;&#039; or the C++ &#039;&#039;cin/cout&#039;&#039; objects.&lt;br /&gt;
* The [[Filesystem tutorial]] explains how to read/write to files on a SD or MicroSD card using the standard C/C++ API.&lt;br /&gt;
* The [[Pthread tutorial]] shows the basics of multithreading in Miosix using the standard [https://en.wikipedia.org/wiki/Pthread Pthread] API.&lt;br /&gt;
* The [[Native thread tutorial]] shows how to use the Miosix-specific thread API.&lt;br /&gt;
* The [[Event API]] allows to do thread pools using std::bind() and std::function().&lt;br /&gt;
* The [[GPIO tutorial]] shows how to interface with external hardware devices using the GPIO API.&lt;br /&gt;
* The [[HD44780 LCD tutorial]] shows how to connect a standard alphanumeric LCD to a board running Miosix.&lt;br /&gt;
* The [[Servo tutorial]] shows how to interface with servomotors from Miosix.&lt;br /&gt;
* The [[Interrupt tutorial]] shows how to handle interrupts generated from on-chip peripherals.&lt;br /&gt;
&lt;br /&gt;
[[Category:API]]&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=Stm32f429zi_stm32f4discovery&amp;diff=218</id>
		<title>Stm32f429zi stm32f4discovery</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=Stm32f429zi_stm32f4discovery&amp;diff=218"/>
		<updated>2016-04-07T12:45:04Z</updated>

		<summary type="html">&lt;p&gt;Silseva: added board image&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This is a cheap self contained [http://www2.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-discovery-kits/32f429idiscovery.html discovery board] with a powerful processor, and a Linux-friendly [http://www.st.com/web/catalog/tools/PF219866 ST-LINK/V2] programmer/in circuit debugger.&lt;br /&gt;
The board is equipped with&lt;br /&gt;
* A [http://www2.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f4-series/stm32f429-439/stm32f429zi.html STM32F429ZI] microcontroller with a 180MHz ARM Cortex-M4F core, 2048KB Flash, 256KB RAM, 4KB battery-backed RAM in LQFP144 package.&lt;br /&gt;
* An external 64Mb SRAM, L3GD20 3-axis digital output gyroscope, 2.4&amp;quot; QVGA TFT LCD, 2 user LEDs, user button, reset button, a second USB connector as the microcontroller supports USB.&lt;br /&gt;
&lt;br /&gt;
[[File:Stm32f429disco.jpg|frameless]]&lt;br /&gt;
&lt;br /&gt;
== Configuring the kernel ==&lt;br /&gt;
&lt;br /&gt;
The minimum configuration required is to edit the [[Makefile.inc|miosix/config/Makefile.inc]] file to uncomment the &#039;&#039;OPT_BOARD := stm32f429zi_stm32f4discovery&#039;&#039; line. If you had compiled the kernel before, it is recommended to do a &#039;&#039;make clean&#039;&#039; (or in the Netbeans IDE, to click on the &amp;quot;Clean project&amp;quot; button) to avoid leaving object files around. After, do a &#039;&#039;make&#039;&#039; to compile.&lt;br /&gt;
&lt;br /&gt;
In addition, this board has a couple of board-specific options in the Makefile.inc file. For convenience, the relevant part of that configuration file is reported here so as to be easily located within the file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;CPP&amp;quot;&amp;gt;&lt;br /&gt;
##---------------------------------------------------------------------------&lt;br /&gt;
## stm32f429zi_stm32f4discovery&lt;br /&gt;
##&lt;br /&gt;
ifeq ($(OPT_BOARD),stm32f429zi_stm32f4discovery)&lt;br /&gt;
&lt;br /&gt;
    ## Linker script type, there are three options&lt;br /&gt;
    ## 1) Code in FLASH, stack + heap in internal RAM (file *_rom.ld)&lt;br /&gt;
    ##    the most common choice, available for all microcontrollers&lt;br /&gt;
    ## 2) Code in FLASH, stack + heap in external RAM (file *8m_xram.ld)&lt;br /&gt;
    ##    You must uncomment -D__ENABLE_XRAM below in this case.&lt;br /&gt;
    ## 3) Code in FLASH, stack + heap in external RAM (file *6m_xram.ld)&lt;br /&gt;
    ##    Same as above, but leaves the upper 2MB of RAM for the LCD.&lt;br /&gt;
    LINKER_SCRIPT_PATH := arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/&lt;br /&gt;
    #LINKER_SCRIPT := $(LINKER_SCRIPT_PATH)stm32_2m+256k_rom.ld&lt;br /&gt;
    #LINKER_SCRIPT := $(LINKER_SCRIPT_PATH)stm32_2m+8m_xram.ld&lt;br /&gt;
    LINKER_SCRIPT := $(LINKER_SCRIPT_PATH)stm32_2m+6m_xram.ld&lt;br /&gt;
&lt;br /&gt;
    ## Uncommenting __ENABLE_XRAM enables the initialization of the external&lt;br /&gt;
    ## 8MB SDRAM memory. Do not uncomment this even if you don&#039;t use a linker&lt;br /&gt;
    ## script that requires it, as it is used for the LCD framebuffer.&lt;br /&gt;
    XRAM := -D__ENABLE_XRAM&lt;br /&gt;
    &lt;br /&gt;
    ## Select clock frequency. Warning: the default clock frequency for&lt;br /&gt;
    ## this board is 168MHz and not 180MHz because, due to a limitation in&lt;br /&gt;
    ## the PLL, it is not possible to generate a precise 48MHz output when&lt;br /&gt;
    ## running the core at 180MHz. If 180MHz is chosen the USB peripheral will&lt;br /&gt;
    ## NOT WORK and the SDIO and RNG will run ~6% slower (45MHz insteand of 48)&lt;br /&gt;
    #CLOCK_FREQ := -DHSE_VALUE=8000000 -DSYSCLK_FREQ_180MHz=180000000&lt;br /&gt;
    CLOCK_FREQ := -DHSE_VALUE=8000000 -DSYSCLK_FREQ_168MHz=168000000&lt;br /&gt;
    #CLOCK_FREQ := -DHSE_VALUE=8000000 -DSYSCLK_FREQ_100MHz=100000000&lt;br /&gt;
&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As can be seen, there are two options for this board: LINKER_SCRIPT and SRAM_BOOT. The comments explain in detail the meaning of there options, so it isn&#039;t necessary to further explain them. &lt;br /&gt;
&lt;br /&gt;
After modifying configuration files it is recommended to do a make clean; make (or in the Netbeans IDE, to click on the &amp;quot;Clean and build project&amp;quot; button) to be sure that changes are applied.&lt;br /&gt;
&lt;br /&gt;
== Loading code ==&lt;br /&gt;
&lt;br /&gt;
As explained before, there are more than one linker script for this board, and the selected linker script affects the way code should be loaded on the board.&lt;br /&gt;
&lt;br /&gt;
== Reading printf output ==&lt;br /&gt;
&lt;br /&gt;
The board has no serial to USB adapter onboard, so you need to use an external one, connected to USART3, in detail PA9 (TXD) and PA10 (RXD).&lt;br /&gt;
&lt;br /&gt;
On Linux you can use screen. Open a terminal and type &#039;&#039;screen /dev/ttyUSB0 19200&#039;&#039; (Note that to quit from screen you need to type &amp;quot;Ctrl-C, \&amp;quot;). You&#039;ll need to change /dev/ttyUSB0 with your serial port device name.&lt;br /&gt;
&lt;br /&gt;
On windows you can use HyperTerminal, you need to configure it to use the required baud rate, no flow control, and select the correct COM port device name.&lt;br /&gt;
&lt;br /&gt;
== In Circuit Debugging ==&lt;br /&gt;
&lt;br /&gt;
Before you begin you should note that the Miosix kernel will put the CPU to a low power state when no thread is running. This low power state will usually confuse debuggers and make them lose sync with the CPU. To avoid this you need to edit the [[miosix_settings.h|miosix/config/miosix_settings.h]] file and uncomment &#039;&#039;#define JTAG_DISABLE_SLEEP&#039;&#039; line. This will prevent the kernel from putting the CPU in its low power state making debugging possible.&lt;br /&gt;
Also, to be able to precisely single-step your code you need to disable compiler optimizations as gdb is incapable of reliably debug an optimized code. The option is in the miosix/config/Makefile.inc file and is the &#039;&#039;OPT_OPTIMIZATION := -O0&#039;&#039; that should be uncommented while the other lines related to the same option should be commented out.&lt;br /&gt;
&lt;br /&gt;
After modifying configuration files it is recommended to do a &#039;&#039;make clean; make&#039;&#039; (or in the Netbeans IDE, to click on the &amp;quot;Clean and build project&amp;quot; button) to be sure that changes are applied.&lt;br /&gt;
&lt;br /&gt;
Since the board has an on board SWD in circuit debugger, simply plugging the USB cable is all you need from an hardware point of view.&lt;br /&gt;
On the software side, you need to open two shells. In one do a&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;BASH&amp;quot;&amp;gt;&lt;br /&gt;
sudo openocd -f miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32f4discovery.cfg&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will start the OpenOCD program that will connect to the board and listen for GDB connections.&lt;br /&gt;
&lt;br /&gt;
In the second shell type the following commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;BASH&amp;quot;&amp;gt;&lt;br /&gt;
arm-miosix-eabi-gdb main.elf&lt;br /&gt;
target remote :3333&lt;br /&gt;
monitor soft_reset_halt&lt;br /&gt;
break main&lt;br /&gt;
continue&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first command will start the gdb debugger. The following commands are typed into the gdb console, and tell it to connect to OpenOCD, and reset the board and stop the program at the beginning of main()&lt;br /&gt;
To load the program to be debugged, you can either do a make program before and then start debugging, or you can directly write the FLASH memory from within gdb with this command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;BASH&amp;quot;&amp;gt;&lt;br /&gt;
monitor flash write_image erase main.bin 0x08000000 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From there on, have a look at [[Quick_start]] for debugger commands.&lt;br /&gt;
&lt;br /&gt;
== (Optional) Configuring the Netbeans IDE ==&lt;br /&gt;
To have a fully working code completion that can also resolve the board-specific symbols, right click on the project, go to Set Configuration and select the right board.&lt;br /&gt;
&lt;br /&gt;
[[File: Netbeans-config.png]]&lt;br /&gt;
&lt;br /&gt;
== SD Card (FIXME!!!!) == &lt;br /&gt;
&lt;br /&gt;
This board lacks an SD connector, so the filesystem support does not work out of the box (upon boot the kernel will say that filesystem mounting failed). However, it is possible to connect one to specific GPIO pins.&lt;br /&gt;
&lt;br /&gt;
The SD or microSD connector VCC and GND pins need to be connected to 3V and GND pins on the board. Add a 100nF capacitor between VCC and GND, as close as possible to the SD connector. This will be useful to overcome current absorption peaks from the SD card.&lt;br /&gt;
&lt;br /&gt;
Then connect the following GPIOs to the SD connector.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! SD !! STM32 !! Optional&lt;br /&gt;
|-&lt;br /&gt;
| CLK || PC12 || &lt;br /&gt;
|-&lt;br /&gt;
| CMD || PD2 || &lt;br /&gt;
|-&lt;br /&gt;
| D0 || PC8 || &lt;br /&gt;
|-&lt;br /&gt;
| D1 || PC9 || Y&lt;br /&gt;
|-&lt;br /&gt;
| D2 || PC10 || Y&lt;br /&gt;
|-&lt;br /&gt;
| D3 || PC11 || Y&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each connection needs a pullup resistor between ~47Kohm and 100Kohm.&lt;br /&gt;
&lt;br /&gt;
To increase read/write speed it is possible to connect the optional GPIOs thereby communicating with the SD in 4-bit mode.&lt;br /&gt;
Note that by default in this board the SD driver uses 1 bit mode. To enable 4-bit mode you need to edit the &#039;&#039;miosix/config/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/board_settings.h&#039;&#039; and comment out the &#039;&#039;#define SD_ONE_BIT_DATABUS&#039;&#039; line.&lt;br /&gt;
&lt;br /&gt;
Also note that filesystem support is enabled by default, so the pins marked as not optional are used by the filesystem driver. If you do not want to connect an SD card, and want to use those GPIOs, you should disable the filesystem support in [[miosix_settings.h|miosix/config/miosix_settings.h]].&lt;br /&gt;
&lt;br /&gt;
== Resource ==&lt;br /&gt;
stm32f4discovery [http://www2.st.com/content/ccc/resource/technical/document/user_manual/6b/25/05/23/a9/45/4d/6a/DM00093903.pdf/files/DM00093903.pdf/jcr:content/translations/en.DM00093903.pdf Datasheet]&lt;br /&gt;
&lt;br /&gt;
[[Category:Boards]]&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=File:Stm32f429disco.jpg&amp;diff=217</id>
		<title>File:Stm32f429disco.jpg</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=File:Stm32f429disco.jpg&amp;diff=217"/>
		<updated>2016-04-07T12:44:11Z</updated>

		<summary type="html">&lt;p&gt;Silseva: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
	<entry>
		<id>https://miosix.org/wiki/index.php?title=Stm32f429zi_stm32f4discovery&amp;diff=216</id>
		<title>Stm32f429zi stm32f4discovery</title>
		<link rel="alternate" type="text/html" href="https://miosix.org/wiki/index.php?title=Stm32f429zi_stm32f4discovery&amp;diff=216"/>
		<updated>2016-04-07T12:40:56Z</updated>

		<summary type="html">&lt;p&gt;Silseva: Created STM32F429 discovery page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This is a cheap self contained [http://www2.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-discovery-kits/32f429idiscovery.html discovery board] with a powerful processor, and a Linux-friendly [http://www.st.com/web/catalog/tools/PF219866 ST-LINK/V2] programmer/in circuit debugger.&lt;br /&gt;
The board is equipped with&lt;br /&gt;
* A [http://www2.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f4-series/stm32f429-439/stm32f429zi.html STM32F429ZI] microcontroller with a 180MHz ARM Cortex-M4F core, 2048KB Flash, 256KB RAM, 4KB battery-backed RAM in LQFP144 package.&lt;br /&gt;
* An external 64Mb SRAM, L3GD20 3-axis digital output gyroscope, 2.4&amp;quot; QVGA TFT LCD, 2 user LEDs, user button, reset button, a second USB connector as the microcontroller supports USB.&lt;br /&gt;
&lt;br /&gt;
[[File:FIXME|frameless]]&lt;br /&gt;
&lt;br /&gt;
== Configuring the kernel ==&lt;br /&gt;
&lt;br /&gt;
The minimum configuration required is to edit the [[Makefile.inc|miosix/config/Makefile.inc]] file to uncomment the &#039;&#039;OPT_BOARD := stm32f429zi_stm32f4discovery&#039;&#039; line. If you had compiled the kernel before, it is recommended to do a &#039;&#039;make clean&#039;&#039; (or in the Netbeans IDE, to click on the &amp;quot;Clean project&amp;quot; button) to avoid leaving object files around. After, do a &#039;&#039;make&#039;&#039; to compile.&lt;br /&gt;
&lt;br /&gt;
In addition, this board has a couple of board-specific options in the Makefile.inc file. For convenience, the relevant part of that configuration file is reported here so as to be easily located within the file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;CPP&amp;quot;&amp;gt;&lt;br /&gt;
##---------------------------------------------------------------------------&lt;br /&gt;
## stm32f429zi_stm32f4discovery&lt;br /&gt;
##&lt;br /&gt;
ifeq ($(OPT_BOARD),stm32f429zi_stm32f4discovery)&lt;br /&gt;
&lt;br /&gt;
    ## Linker script type, there are three options&lt;br /&gt;
    ## 1) Code in FLASH, stack + heap in internal RAM (file *_rom.ld)&lt;br /&gt;
    ##    the most common choice, available for all microcontrollers&lt;br /&gt;
    ## 2) Code in FLASH, stack + heap in external RAM (file *8m_xram.ld)&lt;br /&gt;
    ##    You must uncomment -D__ENABLE_XRAM below in this case.&lt;br /&gt;
    ## 3) Code in FLASH, stack + heap in external RAM (file *6m_xram.ld)&lt;br /&gt;
    ##    Same as above, but leaves the upper 2MB of RAM for the LCD.&lt;br /&gt;
    LINKER_SCRIPT_PATH := arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/&lt;br /&gt;
    #LINKER_SCRIPT := $(LINKER_SCRIPT_PATH)stm32_2m+256k_rom.ld&lt;br /&gt;
    #LINKER_SCRIPT := $(LINKER_SCRIPT_PATH)stm32_2m+8m_xram.ld&lt;br /&gt;
    LINKER_SCRIPT := $(LINKER_SCRIPT_PATH)stm32_2m+6m_xram.ld&lt;br /&gt;
&lt;br /&gt;
    ## Uncommenting __ENABLE_XRAM enables the initialization of the external&lt;br /&gt;
    ## 8MB SDRAM memory. Do not uncomment this even if you don&#039;t use a linker&lt;br /&gt;
    ## script that requires it, as it is used for the LCD framebuffer.&lt;br /&gt;
    XRAM := -D__ENABLE_XRAM&lt;br /&gt;
    &lt;br /&gt;
    ## Select clock frequency. Warning: the default clock frequency for&lt;br /&gt;
    ## this board is 168MHz and not 180MHz because, due to a limitation in&lt;br /&gt;
    ## the PLL, it is not possible to generate a precise 48MHz output when&lt;br /&gt;
    ## running the core at 180MHz. If 180MHz is chosen the USB peripheral will&lt;br /&gt;
    ## NOT WORK and the SDIO and RNG will run ~6% slower (45MHz insteand of 48)&lt;br /&gt;
    #CLOCK_FREQ := -DHSE_VALUE=8000000 -DSYSCLK_FREQ_180MHz=180000000&lt;br /&gt;
    CLOCK_FREQ := -DHSE_VALUE=8000000 -DSYSCLK_FREQ_168MHz=168000000&lt;br /&gt;
    #CLOCK_FREQ := -DHSE_VALUE=8000000 -DSYSCLK_FREQ_100MHz=100000000&lt;br /&gt;
&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As can be seen, there are two options for this board: LINKER_SCRIPT and SRAM_BOOT. The comments explain in detail the meaning of there options, so it isn&#039;t necessary to further explain them. &lt;br /&gt;
&lt;br /&gt;
After modifying configuration files it is recommended to do a make clean; make (or in the Netbeans IDE, to click on the &amp;quot;Clean and build project&amp;quot; button) to be sure that changes are applied.&lt;br /&gt;
&lt;br /&gt;
== Loading code ==&lt;br /&gt;
&lt;br /&gt;
As explained before, there are more than one linker script for this board, and the selected linker script affects the way code should be loaded on the board.&lt;br /&gt;
&lt;br /&gt;
== Reading printf output ==&lt;br /&gt;
&lt;br /&gt;
The board has no serial to USB adapter onboard, so you need to use an external one, connected to USART3, in detail PA9 (TXD) and PA10 (RXD).&lt;br /&gt;
&lt;br /&gt;
On Linux you can use screen. Open a terminal and type &#039;&#039;screen /dev/ttyUSB0 19200&#039;&#039; (Note that to quit from screen you need to type &amp;quot;Ctrl-C, \&amp;quot;). You&#039;ll need to change /dev/ttyUSB0 with your serial port device name.&lt;br /&gt;
&lt;br /&gt;
On windows you can use HyperTerminal, you need to configure it to use the required baud rate, no flow control, and select the correct COM port device name.&lt;br /&gt;
&lt;br /&gt;
== In Circuit Debugging ==&lt;br /&gt;
&lt;br /&gt;
Before you begin you should note that the Miosix kernel will put the CPU to a low power state when no thread is running. This low power state will usually confuse debuggers and make them lose sync with the CPU. To avoid this you need to edit the [[miosix_settings.h|miosix/config/miosix_settings.h]] file and uncomment &#039;&#039;#define JTAG_DISABLE_SLEEP&#039;&#039; line. This will prevent the kernel from putting the CPU in its low power state making debugging possible.&lt;br /&gt;
Also, to be able to precisely single-step your code you need to disable compiler optimizations as gdb is incapable of reliably debug an optimized code. The option is in the miosix/config/Makefile.inc file and is the &#039;&#039;OPT_OPTIMIZATION := -O0&#039;&#039; that should be uncommented while the other lines related to the same option should be commented out.&lt;br /&gt;
&lt;br /&gt;
After modifying configuration files it is recommended to do a &#039;&#039;make clean; make&#039;&#039; (or in the Netbeans IDE, to click on the &amp;quot;Clean and build project&amp;quot; button) to be sure that changes are applied.&lt;br /&gt;
&lt;br /&gt;
Since the board has an on board SWD in circuit debugger, simply plugging the USB cable is all you need from an hardware point of view.&lt;br /&gt;
On the software side, you need to open two shells. In one do a&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;BASH&amp;quot;&amp;gt;&lt;br /&gt;
sudo openocd -f miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32f4discovery.cfg&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will start the OpenOCD program that will connect to the board and listen for GDB connections.&lt;br /&gt;
&lt;br /&gt;
In the second shell type the following commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;BASH&amp;quot;&amp;gt;&lt;br /&gt;
arm-miosix-eabi-gdb main.elf&lt;br /&gt;
target remote :3333&lt;br /&gt;
monitor soft_reset_halt&lt;br /&gt;
break main&lt;br /&gt;
continue&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first command will start the gdb debugger. The following commands are typed into the gdb console, and tell it to connect to OpenOCD, and reset the board and stop the program at the beginning of main()&lt;br /&gt;
To load the program to be debugged, you can either do a make program before and then start debugging, or you can directly write the FLASH memory from within gdb with this command &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;BASH&amp;quot;&amp;gt;&lt;br /&gt;
monitor flash write_image erase main.bin 0x08000000 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From there on, have a look at [[Quick_start]] for debugger commands.&lt;br /&gt;
&lt;br /&gt;
== (Optional) Configuring the Netbeans IDE ==&lt;br /&gt;
To have a fully working code completion that can also resolve the board-specific symbols, right click on the project, go to Set Configuration and select the right board.&lt;br /&gt;
&lt;br /&gt;
[[File: Netbeans-config.png]]&lt;br /&gt;
&lt;br /&gt;
== SD Card (FIXME!!!!) == &lt;br /&gt;
&lt;br /&gt;
This board lacks an SD connector, so the filesystem support does not work out of the box (upon boot the kernel will say that filesystem mounting failed). However, it is possible to connect one to specific GPIO pins.&lt;br /&gt;
&lt;br /&gt;
The SD or microSD connector VCC and GND pins need to be connected to 3V and GND pins on the board. Add a 100nF capacitor between VCC and GND, as close as possible to the SD connector. This will be useful to overcome current absorption peaks from the SD card.&lt;br /&gt;
&lt;br /&gt;
Then connect the following GPIOs to the SD connector.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! SD !! STM32 !! Optional&lt;br /&gt;
|-&lt;br /&gt;
| CLK || PC12 || &lt;br /&gt;
|-&lt;br /&gt;
| CMD || PD2 || &lt;br /&gt;
|-&lt;br /&gt;
| D0 || PC8 || &lt;br /&gt;
|-&lt;br /&gt;
| D1 || PC9 || Y&lt;br /&gt;
|-&lt;br /&gt;
| D2 || PC10 || Y&lt;br /&gt;
|-&lt;br /&gt;
| D3 || PC11 || Y&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each connection needs a pullup resistor between ~47Kohm and 100Kohm.&lt;br /&gt;
&lt;br /&gt;
To increase read/write speed it is possible to connect the optional GPIOs thereby communicating with the SD in 4-bit mode.&lt;br /&gt;
Note that by default in this board the SD driver uses 1 bit mode. To enable 4-bit mode you need to edit the &#039;&#039;miosix/config/arch/cortexM4_stm32f4/stm32f407vg_stm32f4discovery/board_settings.h&#039;&#039; and comment out the &#039;&#039;#define SD_ONE_BIT_DATABUS&#039;&#039; line.&lt;br /&gt;
&lt;br /&gt;
Also note that filesystem support is enabled by default, so the pins marked as not optional are used by the filesystem driver. If you do not want to connect an SD card, and want to use those GPIOs, you should disable the filesystem support in [[miosix_settings.h|miosix/config/miosix_settings.h]].&lt;br /&gt;
&lt;br /&gt;
== Resource ==&lt;br /&gt;
stm32f4discovery [http://www2.st.com/content/ccc/resource/technical/document/user_manual/6b/25/05/23/a9/45/4d/6a/DM00093903.pdf/files/DM00093903.pdf/jcr:content/translations/en.DM00093903.pdf Datasheet]&lt;br /&gt;
&lt;br /&gt;
[[Category:Boards]]&lt;/div&gt;</summary>
		<author><name>Silseva</name></author>
	</entry>
</feed>