How to build NuttX on Windows 10

First let me to make things clear: I stopped using Windows operating system about 18 years ago, when in 2000 Chernobyl virus erased the BIOS Flash and the Hard Disk of my computer that was running Windows 98 at that time.

But because many people are asking me to show how to compile NuttX on Windows, I will show how you can do it using Windows 10 (sorry Windows 7, Windows Vista, Windows XP, Windows 2000, Windows Millennium, Windows 98, Windows 95, Windows 3.1, … and DOS users, but it only works on Windows 10).

You need to enable to “Developer Mode” of Windows: click on Window icon at bottom left corner of your screen and then click on “Windows Settings” (gear icon).

Settings:

In the “Windows Settings” click on “Update & Security”.

Update & Security:

Inside it click in “For Developers”.

For developers:

And enable the option “Developer Mode”.

Developer mode:

After that you need to enable the Windows Subsystem for Linux. Open the “Control Panel”.

Control Panel:

Enter inside “Programs”.

Programs:

Click on “Turn Windows features on or off”.

Turn Windows features on or off:

Then it will open the “Windows Features” window, scroll down until you find “Windows Subsystem for Linux”.

Enable the Windows Subsystem for Linux:

Then click to enable it:

At this moment the Windows will ask to restart, click in the Restart button.

When the system restarted you can run the “bash” command:

It will show the message explaining the a Linux distribution is not installed:

Open the browser and go to: https://aka.ms/wslstore

The the Microsoft Store will open automatically:

Click in the Ubuntu distribution, and the click on Get button:

When it finishes the download click on Launch button:

It will run the installation script, when it finishes you can close it and run the Ubuntu command:

Then the Linux terminal will open:

Now you can follow these steps to compile NuttX:

$ sudo apt-get update

$ sudo apt-get install automake bison build-essential flex gcc-arm-none-eabi gperf git libncurses5-dev libtool libusb-dev libusb-1.0.0-dev pkg-config

Create the nuttx workspace:

mkdir ~/nuttxspace

cd ~/nuttxspace

The Windows Subsystem for Linux doesn’t support USB devices (except USB Pendrive), then we don’t need to install OpenOCD. We will use the JLink too on Windows itself.

Clone the NuttX repositories:

$ cd ~/nuttxspace

$ git clone https://github.com/apache/incubator-nuttx nuttx

$ git clone https://github.com/apache/incubator-nuttx-apps apps

$ git clone https://bitbucket.org/nuttx/tools

Configure, compile and install the Kconfig-Frontends (needed by NuttX’s menuconfig)

$ cd ~/nuttxspace

$ cd tools/kconfig-frontends/

$ ./configure

$ make

$ sudo make install

$ sudo ldconfig

Now we can compile NuttX for XMC4-Relax board!

Run the configure script:

$ cd ~/nuttxspace

$ cd nuttx

$ ./tools/configure.sh xmc4500-relax/nsh

Run menuconfig and change the build to Linux and UART3 as serial console:

$ make menuconfig

Build Setup  --->
    Build Host Platform (Linux)

System Type  --->
    XMC4xxx Peripheral Support  --->
        [ ] USIC0
        [*] USIC1  (press SPACE to select)
        [ ] USIC2

    XMC4xxx USIC Configuration  --->
        USIC1 Channel 0 Configuration (Not used)  --->
        USIC1 Channel 1 Configuration (UART3)  --->

Device Drivers  --->
    [*] Serial Driver Support  --->
        Serial console (UART3)  --->

Time to compile it:

$ make

If everything compiled correctly you get a nuttx.bin:

$ ls -l nuttx.bin
-rwxrwxr-x 1 alan alan 79804 Jan  8 12:25 nuttx.bin

Just copy this nuttx.bin binary to Windows side:

$ cp nuttx.bin /mnt/c/ProgramData/

You will need to configure Windows Explorer to show Hidden files, this way you could see the nuttx.bin at C:\ProgramData

5 thoughts on “How to build NuttX on Windows 10

  1. nice post!
    I’m looking for info on developing ( debugging ) applications in NuttX on Windows 10. I use a STM32F429DISCO, I can build, copy the binary to Windows and load it. Runs fine. What I would like is to be able to build and debug using Eclipse on Windows.
    Do you have any links or other info about this that you would care to share?

  2. Hi Lars,

    I know some people are using Eclipse on Windows to debug NuttX, but I never did it. Feel free to contact me at acassis _at_ gmail _dot_ com and I will put you in contact with a guy that is using it.

Leave a comment