nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

[QUESTION] State of nxflat

Open tinnedkarma opened this issue 1 month ago • 7 comments

Description

Hello all,

Been reading the docs lately, both the "new" one (the one in the current nuttx tree) and the old one (https://cwiki.apache.org/confluence/display/NUTTX/Nuttx).

There is detailed documentation about nxflat, reasoning, usage, pros/cons.

But, looking at what is currently in the nuttx tree makes me wonder if it is still supported, or completely abandoned.

  • binfmt had two distinct directories, libnxflat and libelf.
    • the libelf currently resides in libs/libc/libelf (sometime ago it used to be called modlib if I'm not mistaken?)
    • libnxflat stays untouched in the binfmt dir, which led me to think there is no more interest for it
  • With the current suggested nuttx workspace layout, nxflat cannot be used.
    • The source code for nxflat can be added to the final nuttx target/bin file, but no tooling present to actually build the nxflat compatible file, that can be written to the device and loaded by the nuttx binary
    • Those tools still resides at https://bitbucket.org/nuttx/buildroot/src/master/, but the whole concept of buildroot toolchain seems scraped

Outside the mailing list and other forms of mails, there is small to none additional info about the state of nxflat.

So my question is, what happened to nxflat file format, seems deprecated or abandoned in the nuttx tree. Is it recommended for new designs, should we avoid it?

If this is indeed the case, I would suggest at least mentioning this in the current documentation, or schedule it for removal, as it being present is misleading for newcomers. I could find much more documentation about nxflat compared to the elf alternative.

Verification

  • [x] I have verified before submitting the report.

tinnedkarma avatar Nov 12 '25 19:11 tinnedkarma

@tinnedkarma I think your observations are mostly correct. I think nxflat was a project from @patacongo that started even before NuttX. But I think nobody is using it currently and if I remember correctly there were some issues presenting it to work with current gcc toolchains (it needs a specific toolchain that Greg was compiling using buildroot).

I agree with your suggestion if there is not simple way to fix it. Maybe you can take a look, since you raised this question :-)

Did you try to compile and use it?

acassis avatar Nov 13 '25 12:11 acassis

Hello @acassis,

I've stopped relatively quick to get the example working, after finding out what the necessary tools were no longer moved in the current tree.

I'll give the example another try, with recent gcc toolchain on stm32f103, see if it behaves differently, but the issue was reported after gcc 4.3.3 so there little hope to get it working on newer versions

https://groups.google.com/g/nuttx/c/bQX8F8lvSOo

tinnedkarma avatar Nov 13 '25 13:11 tinnedkarma

Hi @tinnedkarma there are my interesting information in this thread you found. Maybe @michi-jung can refresh about this test with this subject.

acassis avatar Nov 13 '25 14:11 acassis

The NxFlat tools are available here: https://bitbucket.org/nuttx/buildroot/src/master/toolchain/nxflat/ They are embedded with some other tools be can easily be extracted.


From: Alan C. Assis @.> Sent: Thursday, November 13, 2025 6:29 AM To: apache/nuttx @.> Cc: patacongo @.>; Mention @.> Subject: Re: [apache/nuttx] [QUESTION] State of nxflat (Issue #17323)

[https://avatars.githubusercontent.com/u/37000?s=20&v=4]acassis left a comment (apache/nuttx#17323)https://github.com/apache/nuttx/issues/17323#issuecomment-3528086301

Hi @tinnedkarmahttps://github.com/tinnedkarma there are my interesting information in this thread you found. Maybe @michi-junghttps://github.com/michi-jung can refresh about this test with this subject.

— Reply to this email directly, view it on GitHubhttps://github.com/apache/nuttx/issues/17323#issuecomment-3528086301, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABFUG6TEJ4GI65O3IQJ3TGL34SITNAVCNFSM6AAAAACL5MVVB2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKMRYGA4DMMZQGE. You are receiving this because you were mentioned.Message ID: @.***>

patacongo avatar Nov 13 '25 16:11 patacongo

Some minor corrections. NxFlat was created after NuttX. It has a predecessor call XFlat that you may be thinking of https://sourceforge.net/projects/xflat/

The only GCC issue is that there was a sequence of several GCC release that were broken but have long since been fixed. It should be ready to use. The current GCC AFAIK is fine.

References (old): https://cwiki.apache.org/confluence/display/NUTTX/NxFlat https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=139630111 (includes a discussion of the toolchain issues


From: Alan C. Assis @.> Sent: Thursday, November 13, 2025 4:56 AM To: apache/nuttx @.> Cc: patacongo @.>; Mention @.> Subject: Re: [apache/nuttx] [QUESTION] State of nxflat (Issue #17323)

[https://avatars.githubusercontent.com/u/37000?s=20&v=4]acassis left a comment (apache/nuttx#17323)https://github.com/apache/nuttx/issues/17323#issuecomment-3527687860

@tinnedkarmahttps://github.com/tinnedkarma I think your observations are mostly correct. I think nxflat was a project from @patacongohttps://github.com/patacongo that started even before NuttX. But I think nobody is using it currently and if I remember correctly there were some issues presenting it to work with current gcc toolchains (it needs a specific toolchain that Greg was compiling using buildroot).

I agree with your suggestion if there is not simple way to fix it. Maybe you can take a look, since you raised this question :-)

Did you try to compile and use it?

— Reply to this email directly, view it on GitHubhttps://github.com/apache/nuttx/issues/17323#issuecomment-3527687860, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABFUG6UL566MODEG3X7L5KL34R5XTAVCNFSM6AAAAACL5MVVB2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKMRXGY4DOOBWGA. You are receiving this because you were mentioned.Message ID: @.***>

patacongo avatar Nov 13 '25 17:11 patacongo

Thank you @patacongo !!! In fact I confused it with xflat that came earlier

acassis avatar Nov 13 '25 17:11 acassis

Nuttx now supports loading ELFs using a PIC (Position Independent Code) approach. This allows ELFs stored in ROMFS or TMPFS to be run via XIP. An example is available here: https://nuttx.apache.org/docs/latest/platforms/arm/mps/boards/mps3-an547/index.html

It can load PIC ELFs or run the entire Nuttx image as a PIC. @tinnedkarma

anjiahao1 avatar Nov 20 '25 05:11 anjiahao1