Re: NuttX 9.X C++11 Support

2020-06-20 Thread Gregory Nutt



Okay to clarify newlib is only the C library right? I'm using the 
gcc-arm-none-eabi-9-2019-q4 toolchain which it seems it comes with 
newlib libc but as far as I know I'm not linking to it. Furthermore 
I'm interesting in std C++11 functionality for portability not just 
the the C++11 dialect.


About libcxx it seems to be only working partially with my current 
toolchain (gcc-arm-none-eabi-9-2019-q4):

With minimal testing I'm already getting these problems:
- iostream gives linker errors with locale e.g. "multiple definition 
of `duplocale'"

- optional.cxx doesn't compile, although disabling it can compile further
- linking with libsupc++ gives linker errors e.g. 
"std::set_unexpected(void (*)())'"

- GCC9 requires to enable fpermissive CXX flags

Do I have to use another toolchain? (Although NuttX getting started 
guide is reffering to gcc-arm-none-eabi-9) or do I have to downgrade 
my NuttX kernel (libcxx hasn't seen any update in 2-3 years maybe that 
has to do with?) 


Many parts of newlib are not compatible with the NuttX C library.  If 
you link them together, you asking for some nasty surprises down the 
road.  For example, what is the binary representation of type FILE?  I 
guarantee the two representations are not compatible.  What if a newlib 
functions receives a NuttX argument of type FILE (or vise versa)?  I was 
expect a crash.


Of course, many things will work.  Like string manipulation functions 
and probably the math library (people use the newlib math library, but 
that has never been proven to be safe).  The fact that many things from 
the binary incompatbile newlib work lulls people into believing it is a 
technically viable solution. It is not.


Certainly if you are mixing incompatible binaries you are creating an 
unsafe system.  I would not think such a think could ever be flight or 
safety certifiable.


In order to avoid binary incompatibly, all libraries must be linked with 
only code from the NuttX C library (and nothing from newlib).  The C++ 
standard library must be created by compiling it with header files from 
the NuttX C library.


Currently, the *only* toolchain that does that correctly is the NuttX 
buildroot toolchain: https://bitbucket.org/nuttx/buildroot/src/master/  
It does not contain newlib and imports the NuttX header files when it 
builds. So it is 100% newlib free.  It is a pure NuttX tools chaing.  
The binary that it generates is an arm-nuttx-eabi-gcc toolchain.  Ff you 
create the C++ standard library using these header files, it is 
guaranteed to be 100% binary compatible.


Most people ignore this good advice.  I think that they do not grasp the 
incredible risk that they are taking.


Greg




Re: NuttX 9.X C++11 Support

2020-06-20 Thread Maciej Wójcik
Right, newlib is C library. I feel dumb right now, because it seems I
didn't know what I was using.

But it is still something that C++ library provided by ARM GCC distribution
was only working for me with both main package of ARM GCC and additional
ARM newlib package installed. I was not digging into it because it was
working.

Maybe C++ library which they provide doesn't work without newlib.

As Greg said, don't use it. I will also explore other options now.


On Sat, 20 Jun 2020, 19:08 Peter van der Perk, 
wrote:

> Okay to clarify newlib is only the C library right? I'm using the
> gcc-arm-none-eabi-9-2019-q4 toolchain which it seems it comes with
> newlib libc but as far as I know I'm not linking to it. Furthermore
> I'm interesting in std C++11 functionality for portability not just
> the the C++11 dialect.
>
> About libcxx it seems to be only working partially with my current
> toolchain (gcc-arm-none-eabi-9-2019-q4):
> With minimal testing I'm already getting these problems:
> - iostream gives linker errors with locale e.g. "multiple definition
> of `duplocale'"
> - optional.cxx doesn't compile, although disabling it can compile further
> - linking with libsupc++ gives linker errors e.g.
> "std::set_unexpected(void (*)())'"
> - GCC9 requires to enable fpermissive CXX flags
>
> Do I have to use another toolchain? (Although NuttX getting started
> guide is reffering to gcc-arm-none-eabi-9) or do I have to downgrade
> my NuttX kernel (libcxx hasn't seen any update in 2-3 years maybe that
> has to do with?)
>
>
> Quoting Gregory Nutt :
>
> > Use of newlib with NuttX should be avoid.  It is not binary
> > compatible with NuttX.  See
> >
> https://cwiki.apache.org/confluence/display/NUTTX/Integrating+with+Newlib
> >
> > This should be used instead:
> >
> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=139629545
> >
> > On 6/19/2020 3:54 PM, Maciej Wójcik wrote:
> >> I was using newlib. It is bundled with ARM GCC toolchain, at least on
> >> Ubuntu and Arch. Worked out of the box, except I remember having minor
> >> build issues from time to time, when adding additional headers. This
> >> question was appearing here in the past. I am also not sure what is the
> >> official answer.
> >>
> >> If I remember correctly many libraries work, but none of them is
> supported
> >> by NuttX. By not supported, I mean people are still trying to help with
> >> issues, but there is no official recommendation nor guarantee.
> >>
> >> C++ STL implementations are big projects, constantly changing and
> >> toolchains are not always sane in terms which headers they are trying to
> >> use. For example they may take a bit of NuttX libc, and mix it with a
> bit
> >> of its own headers. Then feed it to C++ STL giving unpredictable result
> in
> >> the end.
> >>
> >> I am not sure if anything that I am writing above makes sense :D In
> >> practice newlib was working, but probably not good for critical
> >> applications. I would also be happy to hear what is the official
> statement
> >> on it now.
> >>
> >> By the way, such GCC with newlib offers all higher C++ standards, not
> just
> >> C++11.
> >>
> >> On Fri, 19 Jun 2020, 23:13 ,  wrote:
> >>
> >>> For a personal project I want to use C++11, however which C++ library
> >>> works best for that? Looking at the NuttX documentation it refers me
> >>> to a "Contemporary port of the C++11 LLVM libcxx", but this guide
> >>> (
> >>>
> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=139629545
> )
> >>>
> >>> is based on a older NuttX fork.
> >>>
> >>> Nevertheless I've tried to follow the steps on NuttX Master, which
> >>> works partially works with some extra modifications (had to enable
> >>> fpermissive), after basic testing it seems C++11 threads () is
> >>> working. But when I use std::cout () compiling gives me the
> >>> following linker error:
> >>>
> >>> arm-none-eabi-ld:
> >>> /home/peter/brickpoweredugv/nuttx/staging/libxx.a(ios.o): in function
> >>> `std::char_traits::eof()':
> >>>
> /home/peter/brickpoweredugv/nuttx/include/libcxx/support/xlocale/__nop_locale_mgmt.h:20:
> >>> multiple definition of `duplocale';
> >>>
> /home/peter/brickpoweredugv/nuttx/staging/libapps.a(connector.home.peter.brickpoweredugv.apps.brickpoweredugv.o):/home/peter/brickpoweredugv/nuttx/include/libcxx/support/xlocale/__nop_locale_mgmt.h:20:
> >>> first defined
> >>> here
> >>> arm-none-eabi-ld:
> >>> /home/peter/brickpoweredugv/nuttx/staging/libxx.a(ios.o): in function
> >>> `freelocale':
> >>>
> >>> Thus my question is, is someone actively using libcxx with C++11 in
> >>> upstream NuttX and does it work well? Or do I have to use another
> >>> libc++ implementation
> >>>
> >>> Yours sincerely,
> >>>
> >>> Peter van der Perk
> >>>
> >>>
>
>
>
>


Re: NuttX 9.X C++11 Support

2020-06-20 Thread Peter van der Perk
Okay to clarify newlib is only the C library right? I'm using the  
gcc-arm-none-eabi-9-2019-q4 toolchain which it seems it comes with  
newlib libc but as far as I know I'm not linking to it. Furthermore  
I'm interesting in std C++11 functionality for portability not just  
the the C++11 dialect.


About libcxx it seems to be only working partially with my current  
toolchain (gcc-arm-none-eabi-9-2019-q4):

With minimal testing I'm already getting these problems:
- iostream gives linker errors with locale e.g. "multiple definition  
of `duplocale'"

- optional.cxx doesn't compile, although disabling it can compile further
- linking with libsupc++ gives linker errors e.g.  
"std::set_unexpected(void (*)())'"

- GCC9 requires to enable fpermissive CXX flags

Do I have to use another toolchain? (Although NuttX getting started  
guide is reffering to gcc-arm-none-eabi-9) or do I have to downgrade  
my NuttX kernel (libcxx hasn't seen any update in 2-3 years maybe that  
has to do with?)



Quoting Gregory Nutt :

Use of newlib with NuttX should be avoid.  It is not binary  
compatible with NuttX.  See  
https://cwiki.apache.org/confluence/display/NUTTX/Integrating+with+Newlib


This should be used instead:  
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=139629545


On 6/19/2020 3:54 PM, Maciej Wójcik wrote:

I was using newlib. It is bundled with ARM GCC toolchain, at least on
Ubuntu and Arch. Worked out of the box, except I remember having minor
build issues from time to time, when adding additional headers. This
question was appearing here in the past. I am also not sure what is the
official answer.

If I remember correctly many libraries work, but none of them is supported
by NuttX. By not supported, I mean people are still trying to help with
issues, but there is no official recommendation nor guarantee.

C++ STL implementations are big projects, constantly changing and
toolchains are not always sane in terms which headers they are trying to
use. For example they may take a bit of NuttX libc, and mix it with a bit
of its own headers. Then feed it to C++ STL giving unpredictable result in
the end.

I am not sure if anything that I am writing above makes sense :D In
practice newlib was working, but probably not good for critical
applications. I would also be happy to hear what is the official statement
on it now.

By the way, such GCC with newlib offers all higher C++ standards, not just
C++11.

On Fri, 19 Jun 2020, 23:13 ,  wrote:


For a personal project I want to use C++11, however which C++ library
works best for that? Looking at the NuttX documentation it refers me
to a "Contemporary port of the C++11 LLVM libcxx", but this guide
(
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=139629545)

is based on a older NuttX fork.

Nevertheless I've tried to follow the steps on NuttX Master, which
works partially works with some extra modifications (had to enable
fpermissive), after basic testing it seems C++11 threads () is
working. But when I use std::cout () compiling gives me the
following linker error:

arm-none-eabi-ld:
/home/peter/brickpoweredugv/nuttx/staging/libxx.a(ios.o): in function
`std::char_traits::eof()':
/home/peter/brickpoweredugv/nuttx/include/libcxx/support/xlocale/__nop_locale_mgmt.h:20:
multiple definition of `duplocale';
/home/peter/brickpoweredugv/nuttx/staging/libapps.a(connector.home.peter.brickpoweredugv.apps.brickpoweredugv.o):/home/peter/brickpoweredugv/nuttx/include/libcxx/support/xlocale/__nop_locale_mgmt.h:20:
first defined
here
arm-none-eabi-ld:
/home/peter/brickpoweredugv/nuttx/staging/libxx.a(ios.o): in function
`freelocale':

Thus my question is, is someone actively using libcxx with C++11 in
upstream NuttX and does it work well? Or do I have to use another
libc++ implementation

Yours sincerely,

Peter van der Perk








Re: The new Apache NuttX Logo

2020-06-20 Thread Alan Carvalho de Assis
Hi liked the Puffin and the Flying Bee Hummingbird ideas.

The Puffin are really cute animal and will be a great mascot. And the
Flying Bee Hummingbird pass the idea of a tiny animal and freedom.

BR,

Alan

On 6/20/20, tempu...@163.com  wrote:
> Hi,
>
> What about a Flying Bee Hummingbird,
> - being lite while following all the standard of a bird, he is a create
> following god's standard of a specific class.
> - being tiny but doing her bug-killing job quite well, ( I don't hate Atmel
> Studio logo, I like it )
> -flying bird means freedom, following standard does not mean giving up
> freedom...
> - precise / deterministic ( real time ), she stays in front of flowers,
> moves and stay once more, she just do it.
> ...
>
> I think it's quite close to the soul of NuttX ?
>
>
> Cheers / Tempulse
>
>
> -Original Message-
> From: dev-return-4092-tempulse=163@nuttx.apache.org
>  On Behalf Of Miguel
> ángel Herranz
> Sent: Saturday, June 20, 2020 6:58 AM
> To: dev@nuttx.apache.org
> Subject: Re: The new Apache NuttX Logo
>
> Hi, I like the mascot idea, and all the animals proposed. But I liked
> specially the turtle idea, somehow embedded :) Also, the idea of the "nut"
> and the origins in Costa Rica but somehow universal animal lead me to think
> in hermit crabs, specifically juvenile coconut crabs: it seems they use
> coconut shells as house to live in.
>
> Somehow they "match" some of the ideas of NuttX: hermit crabs are quite
> ubiquitous, the are open to new ideas and hacking friendly to adapt whatever
> available to build his house, which is small or big but always tight to the
> needs (like different target chip/boards), also usually externally is a
> shell, or even a "nuttshell" (like coconut shells for crabs in Costa Rica).
> Also crabs looks quite "robotic" to me, and some crustaceans like mantis
> shrimps are very fast and precise, yet simple and not very dangerous
> animals, though definitively not the typical pet. So a crab happily embedded
> in his coconut shell could be a funny idea of a logo to me, if someone
> artistically inclined want to extend it :)
>
> Cheers,
> /Miguel
>
> El vie., 19 jun. 2020 21:05, Erdem MEYDANLI  escribió:
>
>> >>>
>> My favorite animal, my "totem animal" is a turtle. Unfortunately, a
>> turtle is not a good representation for a real time operating system!
>> 
>>
>> A Mutant Ninja Turtle. Noted.
>>
>> >>
>> NuttX was created in Costa Rica so an animal from Costa Rica does not
>> seem inappropriate.
>> <<
>>
>> Indeed, before you refer to it, I have been considering something
>> originating in 'Costa Rica' in detail. As a cat lover, Margay Cats are
>> on my radar. Please watch this:
>> https://www.youtube.com/watch?v=0RewQMq13pw
>>
>> BR,
>> Erdem
>>
>> Gregory Nutt , 19 Haz 2020 Cum, 15:25 tarihinde
>> şunu
>> yazdı:
>>
>> > I once was told that it was Linus Torvalds who insisted on the
>> > Pengquin mascot.  My favorit animal, my "totem animal" is  turtle.
>> > Unfortunately, a turtle is not a good representation for a real time
>> > operating system!
>> > Unless it were a Mutant Ninja turtle ;)
>> > >
>> > >> NuttX is a very international project. The sun never sets on
>> > >> NuttX developers. We are on every continent (except perhaps
>> > >> Antarctica). So
>> if
>> > >> the mascot is an animal, I think we don't want something
>> > >> indigenous to
>> > only
>> > >> one place. But I don't know what to suggest here...
>> > NuttX was created in Costa Rica so an animal from Costa Rica does
>> > not seem in appropriate.  Here the most beloved animals are (1) the
>> > rainforest frogs,  the red-eyed rain forest frog in particular:
>> >
>> >
>> https://kids.nationalgeographic.com/content/dam/kids/photos/animals/Am
>> phibians/Q-Z/red-eyed-tree-frog-on-leaves-3-2.ngsversion.1568211399457
>> .adapt.1900.1.jpg
>> > , (2) the toucan:
>> >
>> >
>> http://www.pacifico-costarica.com/wp-content/uploads/2015/07/live-beli
>> ze-keel-billed-toucan-national-bird.jpg
>> ,
>> >
>> > and (2) the three-toed sloth.   The slot is, again, not an appropriate
>> > image since it implies slow and lazy.
>> > > Maybe we should then consider an animal from Antarctica, or one
>> > > that's known to have a species there, to at least have a mascot
>> > > from that continent.
>> > > Maybe puffins? [1]  They are small, fast and can live in both sea
>> > > and
>> > land.
>> > > They also to some extent, and with some imagination, resemble
>> > > little penguins, which may also convey the "think tiny Linux" motto.
>> >
>> > I like Puffins.  They also share the habitat with Penguins which is
>> > a good thing.
>> >
>> > I think of all of those, however, the red-eyed rainforest frog
>> > appeals to me most.  He is already a caricature of himself.
>> >
>> > Greg
>> >
>> >
>> >
>>
>
>
>


RE: The new Apache NuttX Logo

2020-06-20 Thread tempulse
Hi, 

What about a Flying Bee Hummingbird, 
- being lite while following all the standard of a bird, he is a create 
following god's standard of a specific class.
- being tiny but doing her bug-killing job quite well, ( I don't hate Atmel 
Studio logo, I like it )
-flying bird means freedom, following standard does not mean giving up 
freedom...
- precise / deterministic ( real time ), she stays in front of flowers, moves 
and stay once more, she just do it.
...

I think it's quite close to the soul of NuttX ?


Cheers / Tempulse


-Original Message-
From: dev-return-4092-tempulse=163@nuttx.apache.org 
 On Behalf Of Miguel ángel 
Herranz
Sent: Saturday, June 20, 2020 6:58 AM
To: dev@nuttx.apache.org
Subject: Re: The new Apache NuttX Logo

Hi, I like the mascot idea, and all the animals proposed. But I liked specially 
the turtle idea, somehow embedded :) Also, the idea of the "nut"
and the origins in Costa Rica but somehow universal animal lead me to think in 
hermit crabs, specifically juvenile coconut crabs: it seems they use coconut 
shells as house to live in.

Somehow they "match" some of the ideas of NuttX: hermit crabs are quite 
ubiquitous, the are open to new ideas and hacking friendly to adapt whatever 
available to build his house, which is small or big but always tight to the 
needs (like different target chip/boards), also usually externally is a shell, 
or even a "nuttshell" (like coconut shells for crabs in Costa Rica). Also crabs 
looks quite "robotic" to me, and some crustaceans like mantis shrimps are very 
fast and precise, yet simple and not very dangerous animals, though 
definitively not the typical pet. So a crab happily embedded in his coconut 
shell could be a funny idea of a logo to me, if someone artistically inclined 
want to extend it :)

Cheers,
/Miguel

El vie., 19 jun. 2020 21:05, Erdem MEYDANLI  escribió:

> >>>
> My favorite animal, my "totem animal" is a turtle. Unfortunately, a 
> turtle is not a good representation for a real time operating system!
> 
>
> A Mutant Ninja Turtle. Noted.
>
> >>
> NuttX was created in Costa Rica so an animal from Costa Rica does not 
> seem inappropriate.
> <<
>
> Indeed, before you refer to it, I have been considering something 
> originating in 'Costa Rica' in detail. As a cat lover, Margay Cats are 
> on my radar. Please watch this: 
> https://www.youtube.com/watch?v=0RewQMq13pw
>
> BR,
> Erdem
>
> Gregory Nutt , 19 Haz 2020 Cum, 15:25 tarihinde 
> şunu
> yazdı:
>
> > I once was told that it was Linus Torvalds who insisted on the 
> > Pengquin mascot.  My favorit animal, my "totem animal" is  turtle. 
> > Unfortunately, a turtle is not a good representation for a real time 
> > operating system!
> > Unless it were a Mutant Ninja turtle ;)
> > >
> > >> NuttX is a very international project. The sun never sets on 
> > >> NuttX developers. We are on every continent (except perhaps 
> > >> Antarctica). So
> if
> > >> the mascot is an animal, I think we don't want something 
> > >> indigenous to
> > only
> > >> one place. But I don't know what to suggest here...
> > NuttX was created in Costa Rica so an animal from Costa Rica does 
> > not seem in appropriate.  Here the most beloved animals are (1) the 
> > rainforest frogs,  the red-eyed rain forest frog in particular:
> >
> >
> https://kids.nationalgeographic.com/content/dam/kids/photos/animals/Am
> phibians/Q-Z/red-eyed-tree-frog-on-leaves-3-2.ngsversion.1568211399457
> .adapt.1900.1.jpg
> > , (2) the toucan:
> >
> >
> http://www.pacifico-costarica.com/wp-content/uploads/2015/07/live-beli
> ze-keel-billed-toucan-national-bird.jpg
> ,
> >
> > and (2) the three-toed sloth.   The slot is, again, not an appropriate
> > image since it implies slow and lazy.
> > > Maybe we should then consider an animal from Antarctica, or one 
> > > that's known to have a species there, to at least have a mascot 
> > > from that continent.
> > > Maybe puffins? [1]  They are small, fast and can live in both sea 
> > > and
> > land.
> > > They also to some extent, and with some imagination, resemble 
> > > little penguins, which may also convey the "think tiny Linux" motto.
> >
> > I like Puffins.  They also share the habitat with Penguins which is 
> > a good thing.
> >
> > I think of all of those, however, the red-eyed rainforest frog 
> > appeals to me most.  He is already a caricature of himself.
> >
> > Greg
> >
> >
> >
>