Differences

This shows you the differences between two versions of the page.

Link to this comparison view

resources:public:building_just_nuttx_on_linux [2015/12/17 19:40]
karcot
resources:public:building_just_nuttx_on_linux [2015/12/17 19:41] (current)
karcot
Line 1: Line 1:
 +======Building NuttX on Linux======
 +How to build just NuttX on an Ubuntu 12.04 LTS desktop?
 +
 +=======Obtain and extract the Codesourcery toolchain=====
 +You can also download a locally saved copy from {{:resources:public:arm-2014.05-28-arm-none-eabi-i686-pc-linux-gnu.tar.bz2| here.}}
 +
 +Or
 +
 +Download from Mentor Graphics the Codesourcery Lite toolchain
 +http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/
 +You will need to register with them and they will send an email with a link for you to download the tar package for Linux. I obtained this
 +
 +**arm-2014.05-28-arm-none-eabi-i686-pc-linux-gnu.tar.bz2**
 +
 +We assume that the tar file has been downloaded to your Downloads. Then extract the contents using the command line 
 +
 +**> tar xvf arm-2014.05-28-arm-none-eabi-i686-pc-linux-gnu.tar.bz2**
 +
 +A directory will be created called **arm-2014.05** which contains all the tools required to build NuttX.
 +
 +Copy and paste the following lines in the terminal. **UPDATE** These lines cannot be copy pasted because wiki screws up formatting
 +and the characters and when these lines are copied and pasted in the terminal bad the PATH is screwed up and terminal stops
 +recognizing any commands. But the image below show the exact lines that need to be typed.
 +
 +
 +> exportline="export PATH=$HOME/Downloads/arm-2014.05/bin:\$PATH"
 +> if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
 +> . ~/.profile
 +
 +{{:resources:public:set_path_to_codesourcery_toolchain.png?800|}}
 +
 +
 +
 +At this point you have installed the compiler and the tools in your Downloads directory and added the path
 +of the installed directory to your PATH environment variable
 +
 +=====Download the nuttx source code=====
 +
 +------------------------------------------------------------------
 +Follow instructions from
 +
 +http://nuttx.org/doku.php?id=downloads
 +
 +to clone the repository. Use the **Local Sub-Modules** section to get the code. I prefer the look of the old SourceForge system.
 +You also need to add the apps submodule. To do that use the following.
 +
 +**cd nuttx**
 +
 +**git submodule add https://bitbucket.org/nuttx/apps apps**
 +
 +
 +At this point if you do "ls" in the created git directory you will have
 +
 +apps   misc    nuttx    NxWidgets
 +
 +=====Configure nuttx to build for the STM32F4Discovery board=====
 +** cd nuttx/tools**
 +
 +** ./configure.sh stm32f4discovery/nsh**
 +
 +nuttx/tools contains configure.sh to configure the build for a particular board. All the configure script is
 +doing is copying the defconfig, Make.defs, and setenv.sh from the nuttx/configs/stm32f4discovery/nsh to the 
 +nuttx/ directory.
 +It renames the defconfig in the stm32f4discovery/nsh to .config in the nuttx directory.
 +
 +
 +=====Install the kconfig-frontends=====
 +** sudo apt-get install gperf libncurses5-dev**
 +
 +
 +gperf is a perfect hash function generator and libncurses5-dev is a library that provides functions for
 +text based graphical user interface
 +
 +You may also need to install flex and bison for lexical parsing and stuff
 +
 +** sudo apt-get install flex bison**
 +=====configure make and install kconfig-frontends=====
 +cd to the directory where apps misc nuttx NxWidgets are present
 +
 +** ls **
 +
 +apps  misc  nuttx  NxWidgets
 +
 +
 +
 +then
 +
 +** cd to misc/tools/kconfig-frontends **
 +
 +the source code for kconfig-frontends lives there and you will configure, make and make install the tool
 +
 +
 +** ./configure --enable-mconf --disable-gconf --disable-qconf**
 +
 +The options have double dashes not a single dash  in front.
 +
 +** make**
 +
 +install the compiled lib and app in the appropriate places
 +
 +** sudo make install **
 +
 +
 +=====Run ldconfig as root so that the right paths are made available=====
 +** sudo ldconfig **
 +
 +This will cause stuff in etc/ld.so.conf.d/ to be updated so that the shared library libkconfig-parser-3.12.0.so is found by the
 +loader when you run make menuconfig
 +
 +=====Run make menuconfig=====
 +Run make menuconfig to pick the correct toolchain
 +
 +** cd nuttx **
 +
 +** make menuconfig **
 +
 +You will a screen like this
 +
 +{{:resources:public:kconfig-frontends.png?600|}}
 +
 +
 +
 +and under **System Type-->ToolChain Selection** pick CodeSourcery GNU toolchain under Linux. Save and exit out of kconfig-frontends.
 +
 +Type 
 +
 +**make**
 +
 +to build nuttx. *nuttx.bin and nuttx.hex** files should be generated. These can be flashed to the discovery board.
 +
 +
 +To flash the code you will need to follow my instructions on [[resources:public:building_st_link_on_linux|Building STLink on Linux to program the STM32-Discovery board]]
 +
 +
 +References:
 +http://fob.po8.org/node/613
 +
 +http://startingelectronics.com/tutorials/STM32-microcontrollers/programming-STM32-flash-in-Linux/
 +
  
resources/public/building_just_nuttx_on_linux.txt ยท Last modified: 2015/12/17 19:41 by karcot
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki