Why can Nuttx only be compiled in Linux platform

196 views
Skip to first unread message

Min Yang

unread,
Jun 6, 2020, 3:42:01 PM6/6/20
to NuttX
Hello,

I'm wondering why Nuttx can only be compiled in Linux instead of Windows. I can think of two reasons, but it's just my guess. 
1. the environment of compiling and linking is different than windows.
2. Nuttx code might call some Linux library.

Thanks,
Min

Gregory Nutt

unread,
Jun 6, 2020, 3:46:10 PM6/6/20
to nu...@googlegroups.com
Not true, NuttX can be compiled on many difference platforms. See the
top-level README.  Linux, Windows Cygwin, Windows MSYS2, Windows WSL,
and macOS are the most common.  But there is also support for FreeBSD,
Solaris, Windows native and maybe more. Those last three are less seldom
use and would probably requires some effort to get back in shape.  But
they are well verfied in the past.

I personally use Cygwin under Windows for all development.  I use Linux
only for testing.  60% of the user base downloads on Windows machines. 
So Windows is probably the most frequently used platform.  But the
default platform is Linux.  You have to select your platform when you
configure as discussed in the top-level README.txt file.


Alan Carvalho de Assis

unread,
Jun 6, 2020, 3:51:51 PM6/6/20
to nu...@googlegroups.com
Also it is important to say that all PR received at tested on Linux,
Windows and MacOS before been incorporated on NuttX.

Sometime we don't wait for the MacOS build to complete because it is too slow!

For newbie users that don't have Linux I created a step-by-step
tutorial using the Windows Ubuntu Shell:

https://acassis.wordpress.com/2018/01/10/how-to-build-nuttx-on-windows-10/

BR,

Alan
> --
> You received this message because you are subscribed to the Google Groups
> "NuttX" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nuttx+un...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nuttx/9a458669-a887-9ad0-baad-194c8d29f1d7%40gmail.com.
>

Michelle(Min) Yang

unread,
Jun 6, 2020, 4:02:32 PM6/6/20
to nu...@googlegroups.com
Hi Alan and Gregory,

Thanks for your quick reply.
Yes, I have compiled Nuttx using Windows WSL and used virtual machine to run Nuttx. And it went well. I guess what I am trying to ask is the fundamental compiler/linking/computer questions.
I understand that we can install Linux-compatible subsystem on windows to run Nuttx. But why isn't it possible to port to windows IDE, like Keil windows version?
Nuttx is a Posix operating system. Is it because of compiler/linking difference between windows system or Linux? Or is it because Nuttx use Linux library which of course can't be supported in windows?

Thanks,
Min

You received this message because you are subscribed to a topic in the Google Groups "NuttX" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nuttx/bFuRZ69Sx_A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nuttx+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nuttx/CAG4Y6eS-K8pDzYzprN8Ws6J%2B-2b7Y-9d4OBgaP9bfZQ9mm9qqg%40mail.gmail.com.


--

CES 2020 Innovation Awards Honoree
zGlue ChipBuilder™ |  Design-Code-Make
Visit us at CES, Sands, Halls A-D #44543
…………………………………………………
Michelle(Min) Yang | FAE ManagerzGlue | 408.838.8485

 

Brennan Ashton

unread,
Jun 6, 2020, 4:09:38 PM6/6/20
to NuttX, d...@nuttx.apache.org
Min,
People do build NuttX natively on Windows. I know that people in the past have also used it with IAR so I see no reason that it cannot be used with Keil with some work (usually around the linker scripts).  Supporting Windows natively is something that we voted on recommitting to support so any issue are certainly bugs. 

I have also CCd the new mailing list d...@nuttx.apache.org where most development work is happening. 

-Brennan

Gregory Nutt

unread,
Jun 6, 2020, 4:13:19 PM6/6/20
to nu...@googlegroups.com

>
> Yes, I have compiled Nuttx using Windows WSL and used virtual machine
> to run Nuttx. And it went well. I guess what I am trying to ask is the
> fundamental compiler/linking/computer questions.
> I understand that we can install Linux-compatible subsystem on windows
> to run Nuttx. But why isn't it possible to port to windows IDE, like
> Keil windows version?

That has been done in the past for both IAR and Keil. Those ports where
removed because they were never maintained.

There is informatino here:
https://bitbucket.org/patacongo/obsoleted/src/60ec01456d8b09f5b813a5fd8865cdbd5a0ccc20/ChangeLog#lines-357

The native Windows port is available as described in the top-level
README.txt and has been used with Visual Studio IDE in the past.

That native Windows port is seldom used these days and as thing progress
it gets some breakage ("bit rot").  I needs to be refreshed and
reverified.  But full native windows support is available and has been
used with Windows IDEs in the past.

> Nuttx is a Posix operating system. Is it because of compiler/linking
> difference between windows system or Linux? Or is it because Nuttx use
> Linux library which of course can't be supported in windows?

NuttX uses nothing from Linux.  It is an original POSIX OS.  It uses no
libraries of any kind.

There are certain expectations of the build system.  For the Windows
native port, those are met using GNUWin32 which is an old port of some
of the GNU tools to run natively on top of Windows. These are fully
compatible with Windows native mode.  But, in general, the build system
adapts and uses standard commands from CMD.exe.

This is all discussed in the top-level README.txt file.  You need to
spend some time to read that text file.

Greg



patacongo

unread,
Jun 6, 2020, 4:15:46 PM6/6/20
to NuttX
If you are interested in getting the current native Windows build back in production shape, let me know.  I will be happy to help you.  Certainly, with advice and guidance at a minimum.

patacongo

unread,
Jun 6, 2020, 4:42:05 PM6/6/20
to NuttX


If you are interested in getting the current native Windows build back in production shape, let me know.  I will be happy to help you.  Certainly, with advice and guidance at a minimum.


The primary issue with the build system is that most people who contributed changes only use Linux and do not have the breadth of vision to consider other platforms.  So as the Linux build system advances, the Windows native build gets left behind and/or broken.

Aside from getting the build system back in shape, the other issue is the differences between the GCC/IAR/Keil assembler syntax.  The IAR assembly files already exist for the ARMv7-M  famil (see arch/arm/src/armv7-m/gnu and iar) but not for other architectures.

There is also a tools in nuttx/tools/ide-exporter.py that must be used to create the IAR and uVision project.  From tools/README.txt:

ide_exporter.py
---------------

  This Python script will help to create NuttX project in the IAR and
  uVision IDEs.  These are few simple the steps to export the IDE
  workspaces.

  1) Start the NuttX build from the Cygwin command line before trying to
     create your project by running:

       make V=1 |& tee build_log

     This is necessary to certain auto-generated files and directories that
     will be needed.   This will provide the build log to construct the IDE
     project also.

  2) Export the IDE project base on that make log. The script usage:

     usage: ide_exporter.py [-h] [-v] [-o OUT_DIR] [-d] build_log {iar,uvision_armcc,uvision_gcc} template_dir

     positional arguments:
       build_log             Log file from make V=1
       {iar,uvision_armcc,uvision_gcc}
                             The target IDE: iar, uvision_gcc, (uvision_armcc is experimental)
       template_dir          Directory that contains IDEs template projects

     optional arguments:
       -h, --help            show this help message and exit
       -v, --version         show program's version number and exit
       -o OUT_DIR, --output OUT_DIR
                             Output directory
       -d, --dump            Dump project structure tree

     Example:
        cd nuttx
        make V=1 |& tee build_log

        ./tools/ide_exporter.py makelog_f2nsh_c  iar ./boards/<arch>/<chip>/<board>/ide/template/iar -o ./boards/<arch>/<chip>/<board>/ide/nsh/iar

        or

        ./tools/ide_exporter.py makelog_f2nsh_c uvision_gcc ./boards/<arch>/<chip>/<board>/ide/template/uvision_gcc/ -o ./boards/<arch>/<chip>/<board>/ide/nsh/uvision

  3) Limitations:
     - IAR supports C only. Iar C++ does not compatible with g++ so disable
       C++ if you want to use IAR.
     - uvision_armcc : nuttx asm (inline and .asm) can't be compiled with
       armcc so do not use this option.
     - uvision_gcc : uvision project that uses gcc. Need to specify path to
       gnu toolchain.
       In uVison menu, select:

         Project/Manage/Project Items.../FolderExtension/Use GCC compiler/ PreFix, Folder

  4) Template projects' constrains:
     - mcu, core, link script shall be configured in template project
     - Templates' name are fixed:
        - template_nuttx.eww  : IAR nuttx workspace template
        - template_nuttx_lib.ewp : IAR nuttx library project template
        - template_nuttx_main.ewp : IAR nuttx main project template
        - template_nuttx.uvmpw : uVision workspace
        - template_nuttx_lib.uvproj : uVision library project
        - template_nuttx_main.uvproj : uVision main project
     - iar:
        - Library option shall be set to 'None' so that IAR could use nuttx
           libc
        - __ASSEMBLY__ symbol shall be defined in assembler
     - uVision_gcc:
        - There should be one fake .S file in projects that has been defined
          __ASSEMBLY__ in assembler.
        - In Option/CC tab : disable warning
        - In Option/CC tab : select Compile thump code (or Misc control =
          -mthumb)
        - template_nuttx_lib.uvproj shall add 'Post build action' to copy .a
          file to .\lib
        - template_nuttx_main.uvproj Linker:
          - Select 'Do not use Standard System Startup Files' and 'Do not
            use Standard System Libraries'
          - Do not select 'Use Math libraries'
          - Misc control = --entry=__start

    5) How to create template for other configurations:
        1) uVision with gcc toolchain:
            - Copy 3 uVision project files
            - Select the MCU for main and lib project
            - Correct the path to ld script if needed
        2) iar:
            - Check if the arch supports IAR (only armv7-m is support IAR
              now)
            - Select the MCU for main and lib project
            - Add new ld script file for IAR

    NOTE:  Due to bit rot, the template files for the stm3220g-eval and for
    the stm32f429-disco have been removed from the NuttX repository.  For
    reference, they can be found in the Obsoleted repository at
    Obsoleted/stm32f429i_disco/ltcd/template and at
    Obsoleted/stm3220g-eval/template.



Michelle(Min) Yang

unread,
Jun 6, 2020, 5:01:16 PM6/6/20
to nu...@googlegroups.com
Thanks for all your responses. It's very helpful.
Our customers are ok with the Linux subsystem on Windows so I am not going to pursuing the native Windows approach at present. 
But it's good to know that Nuttx does support native Windows.

Best Regards,
Min 

--
You received this message because you are subscribed to a topic in the Google Groups "NuttX" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nuttx/bFuRZ69Sx_A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nuttx+un...@googlegroups.com.

Takashi Yamamoto

unread,
Jun 7, 2020, 12:37:19 AM6/7/20
to nu...@googlegroups.com
On Sun, Jun 7, 2020 at 4:51 AM Alan Carvalho de Assis <aca...@gmail.com> wrote:
>
> Also it is important to say that all PR received at tested on Linux,
> Windows and MacOS before been incorporated on NuttX.

do we have windows tests somewhere?
> To view this discussion on the web visit https://groups.google.com/d/msgid/nuttx/CAG4Y6eS-K8pDzYzprN8Ws6J%2B-2b7Y-9d4OBgaP9bfZQ9mm9qqg%40mail.gmail.com.

Brennan Ashton

unread,
Jun 7, 2020, 1:16:16 AM6/7/20
to NuttX, d...@nuttx.apache.org
On Sat, Jun 6, 2020, 9:37 PM 'Takashi Yamamoto' via NuttX <nu...@googlegroups.com> wrote:
On Sun, Jun 7, 2020 at 4:51 AM Alan Carvalho de Assis <aca...@gmail.com> wrote:
>
> Also it is important to say that all PR received at tested on Linux,
> Windows and MacOS before been incorporated on NuttX.

do we have windows tests somewhere?

Can we please move this to the new mailing list. (CC'd)

There is a WIP PR for adding the Cygwin tests but it is really slow. I need to update it with the new changes to the build system we made and see if the performance is better. 

I was also going to add the msys2 but it's a lower priority for me, if someone wants to do that go for it, happy to review and help but I won't do it on my own until after the next release. 

--Brennan
Reply all
Reply to author
Forward
0 new messages