RE: FAT/MTD/USBMSD...still.

2022-01-14 Thread Tim
As I ponder this:

1) Is it possible Windows 10 (and possibly Linux these days) doesn't like
FAT12? I can't find a definitive answer, but believe it should be OK
2) Is it reasonable for me to expect mkfatfs to be able to create FAT16 on a
32Mbyte flash device with 512byte sectors (and 64k erase sector/4k
sub-sector erase)?

mkfatfs will only ever format this flash device as FAT12 whatever I try, so
I wanted to try FAT16 to eliminate 1) as a possibility

nsh> mkfatfs -F 16 /dev/mtdblock0
mkfatfs_tryfat16: WARNING:  Too few or too many clusters for FAT16: 4081 <
2046 < 2302
mkfatfs_clustersearch: WARNING:  Cannot format FAT16 at 32 sectors/cluster
mkfatfs_tryfat16: WARNING:  Too few or too many clusters for FAT16: 4081 <
1023 < 1278
mkfatfs_clustersearch: WARNING:  Cannot format FAT16 at 64 sectors/cluster
mkfatfs_tryfat16: WARNING:  Too few or too many clusters for FAT16: 4081 <
511 < 766
mkfatfs_clustersearch: WARNING:  Cannot format FAT16 at 128 sectors/cluster
mkfatfs_configfatfs: WARNING:  Failed to set cluster size

I believe that a 32Byte device should format as FAT16 with 4085 clusters,
and 16*512 byte sectors, but mkfatfs is only attempting calculations for
32/64/128 sectors/cluster.

If I make a change in "mkfatfs_clustersearchlimits" to allow 16
sectors/cluster to be tried for a device with 64k sectors, it will create
FAT16...

...but the file (a 1Mbyte .wav file) is still corrupted and it is very slow
to write a file (via USB) to the msd (gets to 99% quickly then takes minutes
for the last 1%). 

A 24k jpg file gets corrupted similarly too.

Windows still says there's a problem with the drive and wants to fix it, but
Explorer will show the files that have been copied to this msd.

The corruption is always after the first 16k boundary on the msd.

I don't think this is FAT12 vs FAT16.

Uboot tests show this memory is OK. I have ordered a 1Gbit device to try (in
case the device on this board is damaged, or NuttX just doesn't like 256Mbit
M25P devices for some reason!!).

But still hopeful of some suggestions!

>-Original Message-
>From: Tim 
>Sent: 12 January 2022 17:42
>To: dev@nuttx.apache.org
>Subject: FAT/MTD/USBMSD...still.
>
>Yep, me again!
>
>USB device is working. I can create a ram disk, format it as FAT, set it as
a LUN
>device and Windows and Linux see it as an MSD device. I can read and write
to it,
>reliably.
>
>I have an MT25QL256A device (32Mbyte) which is correctly connected to the
>SAMA5D17 via SPI0, has a block driver, and I can format it as FAT
>
>nsh> df
>  BlockNumber
>Size Blocks   Used   Available Mounted on
>16384   2046  22044   /mnt/fs
>  1024   1004  21002   /mnt/ramfs
> 0 0   0  0   /proc
>
>When I run msconn it is pretty much always seen by Linux, but it's very
>unpredictable with Win10 (get the connection sound, device manager sees it
as a
>drive, but doesn't reliably do the Windows equivalent of mounting it.
>Mostly.
>
>If I copy a 1Mbyte file to it (Ubuntu 20.04) it seems to write the file -
it appears in
>"Files" in Ubuntu. But if I try and eject the MSD, it tells me one or more
>applications are keeping the device busy.
>
>Windows behaviour is much quirkier but similar. The file seems not to
write, or
>Windows wants to fix errors, or just sits there. Eventually, if detected
properly,
>the file appears not to write, but an msdis followed by msconn shows it is
>therebut it is corrupted if I compare to the original file written. The
size is right
>but it is not the same contents.
>
>Go back to Linux, and it no longer wants to see the MSD, unless I reformat
it via
>nsh.
>
>My belief is that the USB MSD, or FAT, or this flash device, is somehow not
>working right for me. Everything else has absolutely been me not setting up
>something right, or a stack issue, or not understanding dumb things, but I
have
>eventually got there (with help from you guys...thanks!). Right now,
though, this
>has me completely stumped again :(
>
>Anyone seen anything like this before and got any suggestions of things for
me to
>look at or try tomorrow?
>




debug scheme via Ethernet and gdb or gdb-stub

2022-01-14 Thread xyluo
Hello,
Some times it is useful to debug application via ethernet based on standard gdb 
protocol. But currently the gdb or gdb-stub was not found in nuttx's apps 
tarball. If gdb-stub would be ported to nuttx as a user program, what else need 
to be done to support this scheme? and can nuttx provide the functions required 
by gdb-stub? It seems that nuttx does not provide the system call 'ptrace'.
Best regards,xyluo

Re: debug scheme via Ethernet and gdb or gdb-stub

2022-01-14 Thread Gregory Nutt
Yes you would have to implement ptrace.

On Fri, Jan 14, 2022 at 5:59 PM xyluo  wrote:

> Hello,
> Some times it is useful to debug application via ethernet based on
> standard gdb protocol. But currently the gdb or gdb-stub was not found in
> nuttx's apps tarball. If gdb-stub would be ported to nuttx as a user
> program, what else need to be done to support this scheme? and can nuttx
> provide the functions required by gdb-stub? It seems that nuttx does not
> provide the system call 'ptrace'.
> Best regards,xyluo


Re: debug scheme via Ethernet and gdb or gdb-stub

2022-01-14 Thread Brennan Ashton
Yep this is something I have looked into before as well and a ticket with
some discussion I had opened.

https://github.com/apache/incubator-nuttx/issues/2028

It's something I will probably revisit sometime, but not something I am
actively working on.

--Brennan

On Fri, Jan 14, 2022, 4:02 PM Gregory Nutt  wrote:

> Yes you would have to implement ptrace.
>
> On Fri, Jan 14, 2022 at 5:59 PM xyluo  wrote:
>
> > Hello,
> > Some times it is useful to debug application via ethernet based on
> > standard gdb protocol. But currently the gdb or gdb-stub was not found in
> > nuttx's apps tarball. If gdb-stub would be ported to nuttx as a user
> > program, what else need to be done to support this scheme? and can nuttx
> > provide the functions required by gdb-stub? It seems that nuttx does not
> > provide the system call 'ptrace'.
> > Best regards,xyluo
>


Re: Support of SPARC architecture

2022-01-14 Thread fft
I have commit code to add SPARC support 
 
-- Original --
From:  "Alan Carvalho de Assis"https://www.gaisler.com/index.php/products/processors
>
> BTW the chip of AT697F of ESA(European Space
> Agency) is also based on LEON 2 see:
>
> 
https://amstel.estec.esa.int/tecedm/website/conferences/PresentationDays/AT697_Atmel.pdf
>
>I finished the whole work last year, Include
> architecture support code and board support code, I even completed and
> verified the Tickless OS mode and ELF file separate load on this SPARC V8
> chip. Due to some reasons, the project leader did not adopt nuttx in the
> end, and I want to contribute code to the community.
>
>
> The Toolchain of SPARC V8 is standard SPARC gnu gcc
> released by Gaisler which can be download at:
>
>
> https://www.gaisler.com/index.php/downloads/compilers
>
>
> I initiated this discussion to seek your opinions,
> whether NuttX agree to include the SPARC arch in the scope of support ?
>
>
> Best regards,
> Zou