Byte to int32/big and little endian

2023-02-25 Thread Tim Hardisty
As is so often the case, I need to pack an array of 4x uint8_t  into a 
uint32_t. Obviously there are many ways to do this and we all have our 
favourite. For NuttX:

1) have I missed a library function that does this already?
2) to cope with big and little end is there a NuttX CONFIG or other parameter 
that will give the endian-ness of the arch being built to ensure the byte 
packing is done correctly?

Thx, TimH.



W25Nx NAND flash support

2023-02-25 Thread Michal Lenc
Hello,



I am looking into usage of w25nx NAND flash communicating over QSPI. What is
the current support of NAND flash memories in NuttX? I found out some
warnings in drivers/mtd/README.txt regarding the lack of a file system that
could handle NAND memories but I am not sure if they are still actual or 
those problems were solved. There are some header files and source code 
files for NAND memory support but some of them seem to be incomplete (like 
nand_initialize() function for example https://github.com/apache/nuttx/blob/
master/include/nuttx/mtd/nand.h#L105).




Would the implementation of w25nx flash require some further involvement in
file system support or just the implementation of w25nx driver itself
(similar to already implemented w25q NOR flash)?




Thanks.

Best regards,
Michal Lenc


Re: Byte to int32/big and little endian

2023-02-25 Thread Karel Kočí
Hi

I would use union (that is host ordering) and to convert to specific ordering 
you can use functions like htobe32 (big endian) and htole32 (little endian), 
those are available.

K.K.

Excerpts from Tim Hardisty's message of February 25, 2023 11:26 am:
> As is so often the case, I need to pack an array of 4x uint8_t  into a 
> uint32_t. Obviously there are many ways to do this and we all have our 
> favourite. For NuttX:
> 
> 1) have I missed a library function that does this already?
> 2) to cope with big and little end is there a NuttX CONFIG or other parameter 
> that will give the endian-ness of the arch being built to ensure the byte 
> packing is done correctly?
> 
> Thx, TimH.
> 
> 


pgpql9kuxbWMq.pgp
Description: PGP signature


Re: W25Nx NAND flash support

2023-02-25 Thread Alan C. Assis
Hi Michal,

There is some discussion about it here:
https://www.mail-archive.com/dev@nuttx.apache.org/msg04981.html

and here:
https://lists.apache.org/thread/kh5t6fn24q97d3qxzthksld4l3jtw27c

In a nutshell:

1) If parallel NAND Flash is used your MCU will need first the NAND
Flash controller driver. SPI and QSPI NAND are different story;
2) NuttX needs the basic NAND Bad-Block search function infrastructure
(look nand_devscan() is not updating the bad-block table)
3) NuttX needs a File System able to handle NAND Flash

Currently there is no FS on NuttX able to handle NAND.
So you can port the CHFS from NetBSD or take a look at dhara
(https://github.com/dlbeer/dhara).

Maybe LittleFS or SmartFS could be extended to handle NAND.

BR,

Alan

On 2/25/23, Michal Lenc  wrote:
> Hello,
>
>
>
> I am looking into usage of w25nx NAND flash communicating over QSPI. What
> is
> the current support of NAND flash memories in NuttX? I found out some
> warnings in drivers/mtd/README.txt regarding the lack of a file system that
>
> could handle NAND memories but I am not sure if they are still actual or
> those problems were solved. There are some header files and source code
> files for NAND memory support but some of them seem to be incomplete (like
> nand_initialize() function for example
> https://github.com/apache/nuttx/blob/
> master/include/nuttx/mtd/nand.h#L105).
>
>
>
>
> Would the implementation of w25nx flash require some further involvement in
>
> file system support or just the implementation of w25nx driver itself
> (similar to already implemented w25q NOR flash)?
>
>
>
>
> Thanks.
>
> Best regards,
> Michal Lenc
>


NuttX domains available

2023-02-25 Thread Gregory Nutt
I have two pre-Apache NuttX domains that are parked and one of them 
expires soon. /I will not be renewing them/ so if someone has a 
legitimate use for these domains, I will transfer them to you.  These 
are available:


 * /nuttx.com/ will expire April 2, 2023.  This would would be a good
   place to sell NuttX merch or to make NuttX engineering services
   available.
 * /nuttx.org/- will expire May 30, 2024.  This was the original NuttX
   web site for many years.

Any of you are welcome to the them.  A caution:  The ASF holds the NuttX 
trademark now and could object to some uses of these domains.  You would 
need to coordinate that somehow.


Greg


Re: W25Nx NAND flash support

2023-02-25 Thread Simon Filgis
Hi Michael,

In addition, if you want to load your elf directly to the memory mapped
flash storage, you need some flashloader for your debug tool. I can help
with segger's flashloader if that is of interest. (dsk)
https://www.segger.com/products/debug-probes/j-link/technology/j-link-dsk/

Simon

--
Ingenieurbüro-Filgis
USt-IdNr.: DE305343278
--
sent by mobile phone

Alan C. Assis  schrieb am Sa., 25. Feb. 2023, 14:29:

> Hi Michal,
>
> There is some discussion about it here:
> https://www.mail-archive.com/dev@nuttx.apache.org/msg04981.html
>
> and here:
> https://lists.apache.org/thread/kh5t6fn24q97d3qxzthksld4l3jtw27c
>
> In a nutshell:
>
> 1) If parallel NAND Flash is used your MCU will need first the NAND
> Flash controller driver. SPI and QSPI NAND are different story;
> 2) NuttX needs the basic NAND Bad-Block search function infrastructure
> (look nand_devscan() is not updating the bad-block table)
> 3) NuttX needs a File System able to handle NAND Flash
>
> Currently there is no FS on NuttX able to handle NAND.
> So you can port the CHFS from NetBSD or take a look at dhara
> (https://github.com/dlbeer/dhara).
>
> Maybe LittleFS or SmartFS could be extended to handle NAND.
>
> BR,
>
> Alan
>
> On 2/25/23, Michal Lenc  wrote:
> > Hello,
> >
> >
> >
> > I am looking into usage of w25nx NAND flash communicating over QSPI. What
> > is
> > the current support of NAND flash memories in NuttX? I found out some
> > warnings in drivers/mtd/README.txt regarding the lack of a file system
> that
> >
> > could handle NAND memories but I am not sure if they are still actual or
> > those problems were solved. There are some header files and source code
> > files for NAND memory support but some of them seem to be incomplete
> (like
> > nand_initialize() function for example
> > https://github.com/apache/nuttx/blob/
> > master/include/nuttx/mtd/nand.h#L105).
> >
> >
> >
> >
> > Would the implementation of w25nx flash require some further involvement
> in
> >
> > file system support or just the implementation of w25nx driver itself
> > (similar to already implemented w25q NOR flash)?
> >
> >
> >
> >
> > Thanks.
> >
> > Best regards,
> > Michal Lenc
> >
>


Re: W25Nx NAND flash support

2023-02-25 Thread Gregory Nutt



Maybe LittleFS or SmartFS could be extended to handle NAND.


I believe that LittleFS has been used with NAND with a NAND FLASH 
translation layer.  I am not sure of the state of that work, but I know 
that people have tried it.  Google "LittleFS on NAND flash" and see the 
hits.


If a NAND flash translation layer (NFTL) were ported to NuttX, then you 
should be able to use almost any file system, although some would be 
extremely inefficient with NAND.  The NAND flash layer would need to do 
sparing, wear-leveling, ECC calculations, etc. as needed by NAND.


I have used NXFFS with NAND and it /almost /works.

The basic filesystem issue is that all available filesystems need to do 
read-modify-write operations on flash sections.  And they assume that 
you can always write a '1' bit to a '0' bit.  SmartFS and NXFFS both 
assume this behavior explicitly.  It is a good assumption with NOR 
flash.  The problem is that NAND can only be written a whole sector at a 
time.  This is because the error correction coding (ECC):  If you change 
even one bit in the NAND sector, you have to re-write the whole sector 
with new ECC (because you can't change the '0' bits in the ECC back into 
'1''s without erasing the sector).


Since SmartFS and NXFFS both do bit twiddling in the sectors they would 
be very inefficient with an NFTL:  Each bit twiddle would cause a whole 
sector re-write.  The same is probably true for LittleFS.  Other file 
systems like FAT could also be used if there were an NFTL, however, FAT 
would also be inefficient (each directory update or FAT update and each 
file data size change would cause another sector write).


So the only real solution to support NAND efficiently is use a file 
system that is designed specifically around the peculiarities of NAND.  
That would require some research (Alan has suggested a couple of places 
to start).





Re: NuttX domains available

2023-02-25 Thread Tomek CEDRO
On Sat, Feb 25, 2023 at 2:34 PM Gregory Nutt wrote:
> I have two pre-Apache NuttX domains that are parked and one of them
> expires soon. /I will not be renewing them/ so if someone has a
> legitimate use for these domains, I will transfer them to you.  These
> are available:
>
>   * /nuttx.com/ will expire April 2, 2023.  This would would be a good
> place to sell NuttX merch or to make NuttX engineering services
> available.
>   * /nuttx.org/- will expire May 30, 2024.  This was the original NuttX
> web site for many years.
>
> Any of you are welcome to the them.  A caution:  The ASF holds the NuttX
> trademark now and could object to some uses of these domains.  You would
> need to coordinate that somehow.

Why not redirect them to https://nuttx.apache.org and crowdfund the bills ? :-)

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info


Re: NuttX domains available

2023-02-25 Thread Gregory Nutt




Why not redirect them to https://nuttx.apache.org and crowdfund the bills ? :-)
Anyone who wants to pay for the domains is welcome to do that.  I am 
finished paying.





Re: NuttX domains available

2023-02-25 Thread Tomek CEDRO
On Sat, Feb 25, 2023 at 4:16 PM Gregory Nutt wrote:
> > Why not redirect them to https://nuttx.apache.org and crowdfund the bills ? 
> > :-)
> Anyone who wants to pay for the domains is welcome to do that.  I am
> finished paying.

Sure thing Greg! Maybe Apache could support crowdfunding and hosting?
If not I can handle them :-)

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info


Re: NuttX domains available

2023-02-25 Thread Alan C. Assis
On 2/25/23, Tomek CEDRO  wrote:
> On Sat, Feb 25, 2023 at 4:16 PM Gregory Nutt wrote:
>> > Why not redirect them to https://nuttx.apache.org and crowdfund the
>> > bills ? :-)
>> Anyone who wants to pay for the domains is welcome to do that.  I am
>> finished paying.
>
> Sure thing Greg! Maybe Apache could support crowdfunding and hosting?
> If not I can handle them :-)
>

I agree Apache should take care of it!

If they cannot help I think we can divide the expenses.

BR,

Alan


Re: NuttX domains available

2023-02-25 Thread Alin Jerpelea
Thanks Greg!
Let's see what the foundation says

//Alin

On Sat, 25 Feb 2023, 17:02 Alan C. Assis,  wrote:

> On 2/25/23, Tomek CEDRO  wrote:
> > On Sat, Feb 25, 2023 at 4:16 PM Gregory Nutt wrote:
> >> > Why not redirect them to https://nuttx.apache.org and crowdfund the
> >> > bills ? :-)
> >> Anyone who wants to pay for the domains is welcome to do that.  I am
> >> finished paying.
> >
> > Sure thing Greg! Maybe Apache could support crowdfunding and hosting?
> > If not I can handle them :-)
> >
>
> I agree Apache should take care of it!
>
> If they cannot help I think we can divide the expenses.
>
> BR,
>
> Alan
>


Re: W25Nx NAND flash support

2023-02-25 Thread Michal Lenc
Hi,



thank you all for your inputs and links. I will take a look into it.

Best regards,
Michal Lenc

-- Původní e-mail --
Od: Simon Filgis 
Komu: dev@nuttx.apache.org
Datum: 25. 2. 2023 14:43:33
Předmět: Re: W25Nx NAND flash support
"Hi Michael,

In addition, if you want to load your elf directly to the memory mapped 
flash storage, you need some flashloader for your debug tool. I can help 
with segger's flashloader if that is of interest. (dsk)
https://www.segger.com/products/debug-probes/j-link/technology/j-link-dsk/

Simon

--
Ingenieurbüro-Filgis
USt-IdNr.: DE305343278
--
sent by mobile phone

Alan C. Assis  schrieb am Sa., 25. Feb. 2023, 14:29: 

> Hi Michal,
>
> There is some discussion about it here:
> https://www.mail-archive.com/dev@nuttx.apache.org/msg04981.html
>
> and here:
> https://lists.apache.org/thread/kh5t6fn24q97d3qxzthksld4l3jtw27c
>
> In a nutshell:
>
> 1) If parallel NAND Flash is used your MCU will need first the NAND
> Flash controller driver. SPI and QSPI NAND are different story;
> 2) NuttX needs the basic NAND Bad-Block search function infrastructure 
> (look nand_devscan() is not updating the bad-block table)
> 3) NuttX needs a File System able to handle NAND Flash
>
> Currently there is no FS on NuttX able to handle NAND.
> So you can port the CHFS from NetBSD or take a look at dhara
> (https://github.com/dlbeer/dhara).
>
> Maybe LittleFS or SmartFS could be extended to handle NAND.
>
> BR,
>
> Alan
>
> On 2/25/23, Michal Lenc  wrote:
> > Hello,
> >
> >
> >
> > I am looking into usage of w25nx NAND flash communicating over QSPI. 
What
> > is
> > the current support of NAND flash memories in NuttX? I found out some 
> > warnings in drivers/mtd/README.txt regarding the lack of a file system
> that
> >
> > could handle NAND memories but I am not sure if they are still actual or

> > those problems were solved. There are some header files and source code
> > files for NAND memory support but some of them seem to be incomplete 
> (like
> > nand_initialize() function for example
> > https://github.com/apache/nuttx/blob/
> > master/include/nuttx/mtd/nand.h#L105).
> >
> >
> >
> >
> > Would the implementation of w25nx flash require some further involvement

> in
> >
> > file system support or just the implementation of w25nx driver itself 
> > (similar to already implemented w25q NOR flash)?
> >
> >
> >
> >
> > Thanks.
> >
> > Best regards,
> > Michal Lenc
> >
>
"