Picon

Re: SMARTFS issue...

Thanks Ken for your confirmation. I just did a test by bringing the changes you made by comparing 7.4 and 7.3. Its works.

One more question for you. For the part with 4KB erase subsector, what will be the optimal logical sector size to set?

Thanks.

On Sep 21, 2014 6:10 PM, "Ken Pettit pettitkd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [nuttx]" <nuttx-hHKSG33TihhbjbujkaE4pw@public.gmane.org> wrote:
 
[Attachment(s) from Ken Pettit included below]

Lee,

Ha ha!  Great sleuthing on your part regarding the SMART MTD bug fix that was applied post Nuttx 7.3.  I confirmed on my 1M Flash part that the issues you were seeing are in fact resolved by this bug fix.  It is a simple 2-line change relating to block count calculation base on current file offset that is only used when CONFIG_MTD_BYTE_WRITE is not set.  So you can either apply the patch to 7.3 or simply enable BYTE_WRITE to fix the problem (or both).  Setting BYTE WRITE makes a lot of sense anyway as it reduces SPI traffic / FLASH access times.

I have attached the original patch that I sent Greg some time ago with the fix (which he applied to 7.3 apparently).  Sorry this slipped by me … I've had quite a bit going on this year :)

Ken

On Sun, Sep 21, 2014 at 11:30 AM, Ken Pettit <pettitkd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hi Lee,

i did do some testing with 7.3, but I think that was all sim testing.  i had forgotten about that bug fix ... it could be the culprit.  I will test here on my board with 7.3, no BYTE_WRITE and large SMARTFS sector size and report back.

Ken

Sent from my iPad

On Sep 21, 2014, at 10:31 AM, "'Lee Chen' achieveforce-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [nuttx]" <nuttx <at> yahoogroups.com> wrote:

 

Hi Ken,
 
I am reading the README file for Nuttx v7.4. You seem having a fix for SMARTFS as follows:
 
* *File System / Block Drivers*\:
   * SmartFS\: Fix for a bug that would show up if `CONFIG_MTD_BYTE_WRITE` was not selected and the SMART sector size was larger than the MTD device's block size (like it would be if using SMARTFS on larger flash devices). From Ken Pettit.
 
I am wondering what version of the Nuttx you are testing with, maybe v7.4? Could it be the reasey on that I am experiencing the issue since I am using Nuttx v7.3.
 
Thanks.
 
From: Lee Chen
Sent: Sunday, September 21, 2014 9:01 AM
Subject: Re: [nuttx] SMARTFS issue...
 
Hi Ken,
 
Thanks for the info. Answer your questions below:
 
3.  How much RAM doe you have on your board?  Enough to implement a RAM based SMARTFS drive using the rammtd.c driver instead of m25px.c?
There is 32MB SDRAM onboard, but the RAM-based SMARTFS does not help here because it goes away on power down. It needs to store files over power cycles.
 
Also, I tried to use the RAMMTD to simulate the SMARTFS. It does not have the issue. The CONFIG_RAMMTD_BLOCKSIZE is set to 1024 and CONFIG_RAMMTD_ERASESIZE to 64KB. (There is some ambiguity here regarding the terms used. It seems that CONFIG_RAMMTD_BLOCKSIZE has to be smaller than CONFIG_RAMMTD_ERASESIZE according to the assertions defined in the code. I assume CONFIG_RAMMTD_BLOCKSIZE is the equivalent “sector size” in SMARTFS mtd layer.)
 
4.  Are you using a commercial board that I could get?
Unfortunately it is not an off-the-shelf board.
 
5.  Did you make any changes to m25pxc?
Functionality-wise, no. But certainly for the driver to work with this specific chip, chip ID has to be defined (0xBA instead of 0x20). Also, for subsector support for this chip, definitions of M25P_M25P64_SUBSECTOR_SHIFT=12 M25P_M25P64_NSUBSECTORS=2048 have to be added. priv->subsectorshift = M25P_M25P64_SUBSECTOR_SHIFT has to be added to the m25p_readid function for the M25P_M25P64_CAPACITY case.
 
Sent: Saturday, September 20, 2014 11:38 PM
Subject: Re: [nuttx] SMARTFS issue...
 
 

Hi Lee,
 
Okay, answering 2 emails here:
 
1.  The 10 bytes of FF at the end of a 512 byte block actually makes sense assuming there is something in your setup that is working on a 512 byte foundry, which appears to be what's happening.
 
2.  The part number of the 1M Byte flash I have on the Mikroe board is EN25F80 from Eon Silicon Solutions Inc. who seem to sell only to OEMs.  I have also used SMARTFS successfully on an 8 MByte part:  SST25VF064C.
 
A couple of questions:
 
3.  How much RAM doe you have on your board?  Enough to implement a RAM based SMARTFS drive using the rammtd.c driver instead of m25px.c?
 
4.  Are you using a commercial board that I could get?
 
5.  Did you make any changes to m25pxc?
 
Ken
 
On Sat, Sep 20, 2014 at 8:17 PM, 'Lee Chen' achieveforce <at> gmail.com [nuttx] <nuttx-hHKSG33TihhbjbujkaE4pw@public.gmane.org> wrote:
 
Hi Ken,
 
Could you please tell me the part number of the 1MB SPI NOR Flash you have on your ref board?
 
Thanks.
 
Sent: Saturday, September 20, 2014 7:02 PM
Subject: Re: [nuttx] SMARTFS issue...
 
 
Hi Lee,
 
Sounds like a good plan.  I tried with BYTE_WRITE disabled an the board and all still functioned as is should.  I even created a 2324 and a 3311 byte file to test with but still no issues.  I guess if the SPI speed has no effect on you side, then just go with BYTE_WRITE enable as the fix, test it out pretty well and move on :)  Having BYTE_WRITE enable is the correct choice anyway.
 
Ken
 
On Sat, Sep 20, 2014 at 3:04 PM, Lee Chen achieveforce <at> gmail.com [nuttx] <nuttx-hHKSG33TihhbjbujkaE4pw@public.gmane.org> wrote:
 

Hi Ken,

The spi speed of 30MHz is within the specs of the nor flash chip and the MCU. Sure, there could be the layout issue that would lower the actual speed. Although it might not be the case for this board, I am going to lower the spi clock with byte write disabled and 1024 sector size to see if the issue still happens.

Thanks.

On Sep 20, 2014 4:42 PM, "Gmail pettitkd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [nuttx]" <nuttx-hHKSG33TihhbjbujkaE4pw@public.gmane.org> wrote:
 
Hi Lee,
 
I had tried it with no errors with CONFIG_MTD_BYTE_WRITE both enabled and disabled in sim with a RAMMTD, though not on an actual SPI FLASH device.  Logically, in my mind at least, the enable / disable state doesn't explain the errors you were seeing.  This config option reduces SPI traffic significantly for FLASH parts that support it by only writing the one or two bytes that need to be updated.  Otherwise the code does a page read (256 bytes for example) a modify and a page write.  I'm wondering if enabling this is simply masking a SPI issue caused by less traffic.
 
I will try with BYTE WRITE disabled on my STM32 board.
 
Ken

Sent from my iPhone

On Sep 20, 2014, at 12:23 PM, "'Lee Chen' achieveforce <at> gmail.com [nuttx]" <nuttx-hHKSG33TihhbjbujkaE4pw@public.gmane.org> wrote:

 
Hi Ken,
 
Except using BeyondCompare on PC than “cmp” on Nuttx , I did everything as you said below.
 
After quite a bit scrutinizing last night, I think I found the cause of the issue. I enabled the CONFIG_MTD_BYTE_WRITE, it now works fine with 512, 1024 logical sector size. Now, I am wondering if you can see the same issue on your ref board by disabling CONFIG_MTD_BYTE_WRITE. Also, you may be able to explain in theory if it makes sense that enabling CONFIG_MTD_BYTE_WRITE fixes the issue.
 
Thanks.
 
 
Sent: Saturday, September 20, 2014 11:40 AM
Subject: Re: [nuttx] SMARTFS issue...
 
 
Hey Lee,
 
Well, it sounds like you are doing everything correctly, yet getting different results using SMARTFS.  Last night I reconfigured one of my STM32F4 boards with a 1M Byte SPI Flash to match your configuration and couldn't produce any failures.  I have a pretty busy day today but later tonight I'll try testing with a couple of files the sizes you specified to see if maybe there is some corner case condition.
 
Did you say that you tried the following and it didn't work?:
 
nsh> cp /mnt/sda/hello /tmp
nsh> cp /mnt/sda/mutex /tmp
nsh> cp /tmp/hello /mnt/nor
nsh> cp /tmp/mutex /mnt/nor
nsh> cmp /tmp/hello /mnt/nor/hello
nsh> cmp /tmp/mutex /mnt/nor/mutex
 
Ken
 
On Sat, Sep 20, 2014 at 7:27 AM, 'Lee Chen' achieveforce-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [nuttx] <nuttx-hHKSG33TihhbjbujkaE4pw@public.gmane.org> wrote:
 
Hi Ken,
 
I really appreciate your help on this.
 
I know it’s more likely something wrong in my configuration, but you know, I am only several weeks old on Nuttx so forgive my silly questions/mistakes/problems. So far I like it a lot, the way Nuttx works and the prompt response from the community. Hopefully I can catch up the speed and be contributing as well soon.
 
Here are the answers to your questions:
 
1.  What nsh command line command(s) are you using to perform the copy?
     After mounting both the spi nor flash (mounted at /mnt/nor) and the usb thumb drive (mounted at /mnt/sda), I do the following
        cp /mnt/sda/hello /mnt/nor
 
2.  What speed is your SPI running at (though I doubt it's a speed issue)?
     spi speed is at 30MHz.
 
3.  How did you configure the SMART volume in you initialization?  Was it something like:
     exactly as you described:
       a.  Create a SPI device
       b.  Create an m25px MTD device, passing in the SPI device pointer
       c.  Create a SMART MTD device, passing in the m25px device pointer
 
4.  What are the file lengths of the copy operations that work vs. the ones that don't?  Is it possible they are a multiple of 512 bytes?
      “hello” is 2324 bytes, and “mutex” is 3311 bytes.
 
5.  Are you formatting and mounting SMARTFS and then performing all the copies and compares, or are you reformatting it in-between each copy / compare?
     I format using mksmartfs and mount the SMARTFS then copying and comparing.
 
Thanks.
 
Sent: Saturday, September 20, 2014 1:31 AM
Subject: Re: [nuttx] SMARTFS issue...
 
 
Hey Lee,
 
Well, at least this error is different that the other errors, though I'm not sure why just "mutex" would have an issue and not the others.  Okay, you are going to make me switch to an ARM target to figure this out, aren't you :)  So I'm curious how you are actually copying the example apps to the SMARTFS volume.  I don't see that you have binfs binary filesystem configured.  So a couple of questions:
 
1.  What nsh command line command(s) are you using to perform the copy?
2.  What speed is your SPI running at (though I doubt it's a speed issue)?
3.  How did you configure the SMART volume in you initialization?  Was it something like:
 
    a.  Create a SPI device
    b.  Create an m25px MTD device, passing in the SPI device pointer
    c.  Create a SMART MTD device, passing in the m25px device pointer
 
4.  What are the file lengths of the copy operations that work vs. the ones that don't?  Is it possible they are a multiple of 512 bytes?
5.  Are you formatting and mounting SMARTFS and then performing all the copies and compares, or are you reformatting it in-between each copy / compare?
 
Okay, I'll get my Mikroe STM32F4 board dev environment set back up and try running on an actual FLASH with an actual ARM processor. 
 
Ken
 
 
On Fri, Sep 19, 2014 at 7:43 PM, 'Lee Chen' achieveforce-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [nuttx] <nuttx-hHKSG33TihhbjbujkaE4pw@public.gmane.org> wrote:
 
[Attachment(s) from Lee Chen included below]
Hi Ken,
 
Sorry, I do not have good news for you this time <wlEmoticon-sadsmile[1].png>.
 
I did a test using the SMARTFS with logical sector of 512, which I expected having no issue. But, strangely, I can copy all the other 6 example apps no problem. But for “mutex”, it always has problem. Attached is the comparison between the original “mutex” and the “mutex” copied on the spi nor flash. You can see that at the end of the file there are bunch of FF FF FF...
 
I also did what you mentioned. I copied “mutex” to the sdcard (which is FAT with 512 sector size) then to the spi nor flash. The copy on the sdcard is ok, but the one on the spi nor flash has the same corruption.
 
Thanks.
 
Sent: Friday, September 19, 2014 11:31 AM
Subject: Re: [nuttx] SMARTFS issue...
 
 
Hey Lee,
 
Yeah, I didn't think that had anything to do with it.  After sending that last email last night, I ran a couple of tests with CONFIG_SECT512 and it didn't make any difference.  Sounds like you have a solution by using a logical sector size of 512 and plenty of RAM to take the extra hit by the smaller sector size.  But I'm still wondering what is going on in your configuration that is causing this issue :/
 
Maybe do one final test before I throw my hands up, tilt my head, shrug my shoulders and say "beat me".  Can you try copying the hello application to /tmp first and then do a compare against the SD card image.  Then copy from /tmp to the SMARTFS mount?  Maybe there is something strange going on with copying from a 512 byte block FAT volume at work here.
 
Ken
 
On Fri, Sep 19, 2014 at 8:13 AM, Lee Chen achieveforce-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [nuttx] <nuttx-hHKSG33TihhbjbujkaE4pw@public.gmane.org> wrote:
 
Hi Ken,
 
I disabled the CONFIG_MTD_SECT512 and here is dump again. The FF FF FF... are still there :-(.
 
 
nsh> hexdump /mnt/sda/dump2
/mnt/sda/dump2 at 00000000:

0000: 0c 00 00 00 69 02 0d 00 f6 03 7f 45 4c 46 01 01 ....i......ELF..
0010: 01 00 00 00 00 00 00 00 00 00 01 00 28 00 01 00 ............(...
0020: 00 00 01 00 00 00 00 00 00 00 e8 02 00 00 00 00 ................
0030: 00 05 34 00 00 00 00 00 28 00 0d 00 0a 00 2d e9 ..4.....(.....-.
0040: f0 47 07 46 40 f2 00 04 40 f2 00 00 c0 f2 00 04 .G.F <at> ... <at> .......
0050: c0 f2 00 00 89 46 40 f2 00 06 a0 47 40 f2 00 00 .....F <at> ....G <at> ...
0060: c0 f2 00 06 c0 f2 00 00 b0 47 40 f2 00 00 c0 f2 .........G <at> .....
0070: 00 00 a0 47 40 f2 00 00 39 46 c0 f2 00 00 b0 47 ...G <at> ...9F.....G
0080: 40 f2 00 00 c0 f2 00 00 49 46 b0 47 00 2f 51 dd <at> .......IF.G./Q.
0090: 40 f2 00 00 7a 1e 00 21 c0 f2 00 00 4d 46 02 f0 <at> ...z..!....MF..
00a0: 01 0a b0 47 55 f8 04 1b b0 46 00 29 5e d0 40 f2 ...GU....F.)^. <at> .
00b0: 00 00 c0 f2 00 00 0a 46 b0 47 01 24 bc 42 39 d0 .......F.G.$.B9.
00c0: ba f1 00 0f 12 d0 40 f2 00 00 21 46 c0 f2 00 00 ...... <at> ...!F....
00d0: b0 47 55 f8 04 1b 00 29 3c d0 40 f2 00 00 c0 f2 .GU....)<. <at> .....
00e0: 00 00 0a 46 c0 47 01 34 bc 42 23 d0 40 f2 00 00 ...F.G.4.B#. <at> ...
00f0: 21 46 c0 f2 00 00 b0 47 55 f8 04 3b 40 f2 00 00 !F.....GU..; <at> ...
0100: 19 46 1a 46 c0 f2 00 00 53 b3 c0 47 01 34 40 f2 .F.F....S..G.4 <at> .
0110: 00 00 21 46 c0 f2 00 00 b0 47 55 f8 04 3b 40 f2 ..!F.....GU..; <at> .
0120: 00 00 c0 f2 00 00 19 46 1a 46 9b b1 01 34 c0 47 .......F.F...4.G
0130: bc 42 db d1 40 f2 00 00 39 46 59 f8 27 20 c0 f2 .B.. <at> ...9FY.' ..
0140: 00 00 b0 47 40 f2 00 00 c0 f2 00 00 b0 47 00 20 ...G <at> ........G.
0150: bd e8 f0 87 40 f2 00 00 c0 f2 00 00 c0 47 c2 e7 .... <at> ........G..
0160: 40 f2 00 00 c0 f2 00 00 c0 47 cf e7 40 f2 00 00 <at> ........G.. <at> ...
0170: c0 f2 00 00 b0 47 a0 e7 00 bf 47 65 74 74 69 6e .....G....Gettin
0180: 67 20 72 65 61 64 79 20 74 6f 20 73 61 79 20 22 g ready to say "
0190: 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 22 0a 00 00 Hello, world"...
01a0: 00 00 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 0a ..Hello, world!.
01b0: 00 00 49 74 20 68 61 73 20 62 65 65 6e 20 73 61 ..It has been sa
01c0: 69 64 2e 0a 00 00 61 72 67 63 09 3d 20 25 64 0a id....argc.= %d.
01d0: 00 00 61 72 67 76 09 3d 20 30 78 25 70 0a 00 00 ..argv.= 0x%p...
01e0: 00 00 61 72 67 76 5b 25 64 5d 09 3d 20 00 28 30 ..argv[%d].= .(0
01f0: 78 25 70 29 20 22 25 73 22 0a 00 00 00 00 4e 55 x%p) "%s".....NU
/mnt/sda/dump2 at 00000200:

0000: ff ff ff ff ff ff ff ff ff ff 5b 25 64 5d 09 3d ..........[%d].=
0010: 20 30 78 25 70 0a 00 00 00 00 47 6f 6f 64 62 79  0x%p.....Goodby
0020: 65 2c 20 77 6f 72 6c 64 21 0a 00 00 00 00 00 47 e, world!......G
0030: 43 43 3a 20 28 53 6f 75 72 63 65 72 79 20 43 6f CC: (Sourcery Co
0040: 64 65 42 65 6e 63 68 20 4c 69 74 65 20 32 30 31 deBench Lite 201
0050: 32 2e 30 33 2d 35 36 29 20 34 2e 36 2e 33 00 41 2.03-56) 4.6.3.A
0060: 32 00 00 00 61 65 61 62 69 00 01 28 00 00 00 05 2...aeabi..(....
0070: 43 6f 72 74 65 78 2d 4d 33 00 06 0a 07 4d 09 02 Cortex-M3....M..
0080: 12 04 14 01 15 01 17 03 18 01 19 01 1a 01 1e 02 ................
0090: 22 01 00 2e 73 79 6d 74 61 62 00 2e 73 74 72 74 "...symtab..strt
00a0: 61 62 00 2e 73 68 73 74 72 74 61 62 00 2e 72 65 ab..shstrtab..re
00b0: 6c 2e 74 65 78 74 00 2e 72 6f 64 61 74 61 00 2e l.text..rodata..
00c0: 64 61 74 61 00 2e 63 74 6f 72 73 00 2e 64 74 6f data..ctors..dto
00d0: 72 73 00 2e 62 73 73 00 2e 63 6f 6d 6d 65 6e 74 rs..bss..comment
00e0: 00 2e 41 52 4d 2e 61 74 74 72 69 62 75 74 65 73 ..ARM.attributes
00f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0110: 00 00 00 00 00 00 00 00 00 00 1f 00 00 00 01 00 ................
0120: 00 00 06 00 00 00 00 00 00 00 34 00 00 00 3c 01 ..........4...<.
0130: 00 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 ................
0140: 00 00 1b 00 00 00 09 00 00 00 00 00 00 00 00 00 ................
0150: 00 00 f0 04 00 00 40 01 00 00 0b 00 00 00 01 00 ...... <at> .........
0160: 00 00 04 00 00 00 08 00 00 00 25 00 00 00 01 00 ..........%.....
0170: 00 00 32 00 00 00 3c 01 00 00 70 01 00 00 b4 00 ..2...<...p.....
0180: 00 00 00 00 00 00 00 00 00 00 04 00 00 00 01 00 ................
0190: 00 00 2d 00 00 00 01 00 00 00 03 00 00 00 f0 01 ..-.............
01a0: 00 00 24 02 00 00 00 00 00 00 00 00 00 00 00 00 ..$.............
01b0: 00 00 01 00 00 00 00 00 00 00 33 00 00 00 01 00 ..........3.....
01c0: 00 00 01 00 00 00 f0 01 00 00 24 02 00 00 00 00 ..........$.....
01d0: 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 ................
01e0: 00 00 3a 00 00 00 01 00 00 00 01 00 00 00 f0 01 ..:.............
01f0: 00 00 24 02 00 00 00 00 00 00 00 00 00 00 00 00 ..$.............
 
On Fri, Sep 19, 2014 at 9:43 AM, Lee Chen <achieveforce-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hi Ken,
 
I don't think I modified the m25p driver. The 64Mbit part I mentioned supports the subsector erase. I enabled the CONFIG_M25P_SUBSECTOR_ERASE under SPI-based M25P FLASH in MTD driver section.
 
A wild guess. Is it possible that the simulated FLASH you created does not have the initial values of FF FF FF... as the actual flash part?
 
Thanks.
 
On Fri, Sep 19, 2014 at 3:39 AM, Ken Pettit pettitkd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [nuttx] <nuttx-hHKSG33TihhbjbujkaE4pw@public.gmane.org> wrote:
 
Hey Lee,
 
Okay, now I'm really not sure why your configuration is failing.  I was thinking maybe there is a bug in the interface between the SMARTFS and the m25px.c MTD driver that simply wasn't showing up using the RAM MTD driver.  So I wrote an arch/sim/src/up_spiflash.c simulated SPI FLASH that understands the m25px style SPI commands to implement a FLASH.  Using this simulated FLASH, I still can't cause the error you are seeing.
 
One thing I did notice is that with a 64MBit (8M Byte) part simulated like your's, the m25px.c driver wasn't using the 4K Sector Erase command but rather the 64K Sector Erase.  I can only assume you modified the m25px.c driver so that the 64MBit part also supports the 4K Sector Erase?  After I did this, I validated it was in fact using 4K sectors and was *still* unable to duplicate the error.  I am not copying a "hello" application as I don't have an SD card available in simulation, so I am using 'vi' to create a text file in /tmp and copying that instead.  Perhaps this difference in creating the file is why I'm not able to reproduce the error?
 
Greg, are you interested at all in me submitting the sim SPI FLASH simulation for inclusion in the source tree?  I made it configurable from Kconfig so you can enable it, set the FLASH size, sector size, page size, manufacturer ID, etc. 
 
Ken
 
Ken
 
 
On Thu, Sep 18, 2014 at 1:54 PM, Lee Chen achieveforce-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [nuttx] <nuttx-hHKSG33TihhbjbujkaE4pw@public.gmane.org> wrote:
 

Hi Ken,

Just sent to your personal email.

Thanks.

On Sep 18, 2014 3:45 PM, "Ken Pettit pettitkd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [nuttx]" <nuttx-hHKSG33TihhbjbujkaE4pw@public.gmane.org> wrote:
 
Hey Lee,
 
Okay, this is what I expected to see, but just wanted to be sure it was on the write side vs. the read side.  The 10 FF bytes are at the beginning of a 512 byte block.  This tells me somewhere there is a calculation error during write associated with differing Logical sector size vs physical page size, or something like that. 
 
Each logical sector has a 10 byte header (5 for the SMART MTD layer, 5 for the SMARTFS layer) that contain logical sector numbers, chained sector information, used bytes, release flags, etc.  For some reason, during a write operation, the code is getting confused and thinking there needs to be a 10-byte header at offset 512 when in fact it is the middle of the logical sector.
 
Can you send me your .config file (in a private email to my email address)?
 
Thanks,
Ken
 
On Thu, Sep 18, 2014 at 12:09 PM, valont.valont-/E1597aS9LQAvxtiuMwx3w@public.gmane.org [nuttx] <nuttx-hHKSG33TihhbjbujkaE4pw@public.gmane.org> wrote:
 

 

Hi Ken,

 

I got the dump as following...

 

Thanks.

-Lee

 

/mnt/sda/dump at 00000000:
0000: 0c 00 00 00 69 02 0d 00 f6 03 7f 45 4c 46 01 01 ....i......ELF..
0010: 01 00 00 00 00 00 00 00 00 00 01 00 28 00 01 00 ............(...
0020: 00 00 01 00 00 00 00 00 00 00 e8 02 00 00 00 00 ................
0030: 00 05 34 00 00 00 00 00 28 00 0d 00 0a 00 2d e9 ..4.....(.....-.
0040: f0 47 07 46 40 f2 00 04 40 f2 00 00 c0 f2 00 04 .G.F <at> ... <at> .......
0050: c0 f2 00 00 89 46 40 f2 00 06 a0 47 40 f2 00 00 .....F <at> ....G <at> ...
0060: c0 f2 00 06 c0 f2 00 00 b0 47 40 f2 00 00 c0 f2 .........G <at> .....
0070: 00 00 a0 47 40 f2 00 00 39 46 c0 f2 00 00 b0 47 ...G <at> ...9F.....G
0080: 40 f2 00 00 c0 f2 00 00 49 46 b0 47 00 2f 51 dd <at> .......IF.G./Q.
0090: 40 f2 00 00 7a 1e 00 21 c0 f2 00 00 4d 46 02 f0 <at> ...z..!....MF..
00a0: 01 0a b0 47 55 f8 04 1b b0 46 00 29 5e d0 40 f2 ...GU....F.)^. <at> .
00b0: 00 00 c0 f2 00 00 0a 46 b0 47 01 24 bc 42 39 d0 .......F.G.$.B9.
00c0: ba f1 00 0f 12 d0 40 f2 00 00 21 46 c0 f2 00 00 ...... <at> ...!F....
00d0: b0 47 55 f8 04 1b 00 29 3c d0 40 f2 00 00 c0 f2 .GU....)<. <at> .....
00e0: 00 00 0a 46 c0 47 01 34 bc 42 23 d0 40 f2 00 00 ...F.G.4.B#. <at> ...
00f0: 21 46 c0 f2 00 00 b0 47 55 f8 04 3b 40 f2 00 00 !F.....GU..; <at> ...
0100: 19 46 1a 46 c0 f2 00 00 53 b3 c0 47 01 34 40 f2 .F.F....S..G.4 <at> .
0110: 00 00 21 46 c0 f2 00 00 b0 47 55 f8 04 3b 40 f2 ..!F.....GU..; <at> .
0120: 00 00 c0 f2 00 00 19 46 1a 46 9b b1 01 34 c0 47 .......F.F...4.G
0130: bc 42 db d1 40 f2 00 00 39 46 59 f8 27 20 c0 f2 .B.. <at> ...9FY.' ..
0140: 00 00 b0 47 40 f2 00 00 c0 f2 00 00 b0 47 00 20 ...G <at> ........G.
0150: bd e8 f0 87 40 f2 00 00 c0 f2 00 00 c0 47 c2 e7 .... <at> ........G..
0160: 40 f2 00 00 c0 f2 00 00 c0 47 cf e7 40 f2 00 00 <at> ........G.. <at> ...
0170: c0 f2 00 00 b0 47 a0 e7 00 bf 47 65 74 74 69 6e .....G....Gettin
0180: 67 20 72 65 61 64 79 20 74 6f 20 73 61 79 20 22 g ready to say "
0190: 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 22 0a 00 00 Hello, world"...
01a0: 00 00 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 0a ..Hello, world!.
01b0: 00 00 49 74 20 68 61 73 20 62 65 65 6e 20 73 61 ..It has been sa
01c0: 69 64 2e 0a 00 00 61 72 67 63 09 3d 20 25 64 0a id....argc.= %d.
01d0: 00 00 61 72 67 76 09 3d 20 30 78 25 70 0a 00 00 ..argv.= 0x%p...
01e0: 00 00 61 72 67 76 5b 25 64 5d 09 3d 20 00 28 30 ..argv[%d].= .(0
01f0: 78 25 70 29 20 22 25 73 22 0a 00 00 00 00 4e 55 x%p) "%s".....NU
/mnt/sda/dump at 00000200:
0000: ff ff ff ff ff ff ff ff ff ff 5b 25 64 5d 09 3d ..........[%d].=
0010: 20 30 78 25 70 0a 00 00 00 00 47 6f 6f 64 62 79  0x%p.....Goodby
0020: 65 2c 20 77 6f 72 6c 64 21 0a 00 00 00 00 00 47 e, world!......G
0030: 43 43 3a 20 28 53 6f 75 72 63 65 72 79 20 43 6f CC: (Sourcery Co
0040: 64 65 42 65 6e 63 68 20 4c 69 74 65 20 32 30 31 deBench Lite 201
0050: 32 2e 30 33 2d 35 36 29 20 34 2e 36 2e 33 00 41 2.03-56) 4.6.3.A
0060: 32 00 00 00 61 65 61 62 69 00 01 28 00 00 00 05 2...aeabi..(....
0070: 43 6f 72 74 65 78 2d 4d 33 00 06 0a 07 4d 09 02 Cortex-M3....M..
0080: 12 04 14 01 15 01 17 03 18 01 19 01 1a 01 1e 02 ................
0090: 22 01 00 2e 73 79 6d 74 61 62 00 2e 73 74 72 74 "...symtab..strt
00a0: 61 62 00 2e 73 68 73 74 72 74 61 62 00 2e 72 65 ab..shstrtab..re
00b0: 6c 2e 74 65 78 74 00 2e 72 6f 64 61 74 61 00 2e l.text..rodata..
00c0: 64 61 74 61 00 2e 63 74 6f 72 73 00 2e 64 74 6f data..ctors..dto
00d0: 72 73 00 2e 62 73 73 00 2e 63 6f 6d 6d 65 6e 74 rs..bss..comment
00e0: 00 2e 41 52 4d 2e 61 74 74 72 69 62 75 74 65 73 ..ARM.attributes
00f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0110: 00 00 00 00 00 00 00 00 00 00 1f 00 00 00 01 00 ................
0120: 00 00 06 00 00 00 00 00 00 00 34 00 00 00 3c 01 ..........4...<.
0130: 00 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 ................
0140: 00 00 1b 00 00 00 09 00 00 00 00 00 00 00 00 00 ................
0150: 00 00 f0 04 00 00 40 01 00 00 0b 00 00 00 01 00 ...... <at> .........
0160: 00 00 04 00 00 00 08 00 00 00 25 00 00 00 01 00 ..........%.....
0170: 00 00 32 00 00 00 3c 01 00 00 70 01 00 00 b4 00 ..2...<...p.....
0180: 00 00 00 00 00 00 00 00 00 00 04 00 00 00 01 00 ................
0190: 00 00 2d 00 00 00 01 00 00 00 03 00 00 00 f0 01 ..-.............
01a0: 00 00 24 02 00 00 00 00 00 00 00 00 00 00 00 00 ..$.............
01b0: 00 00 01 00 00 00 00 00 00 00 33 00 00 00 01 00 ..........3.....
01c0: 00 00 01 00 00 00 f0 01 00 00 24 02 00 00 00 00 ..........$.....
01d0: 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 ................
01e0: 00 00 3a 00 00 00 01 00 00 00 01 00 00 00 f0 01 ..:.............
01f0: 00 00 24 02 00 00 00 00 00 00 00 00 00 00 00 00 ..$.............

 
 
 
 
 
 
 
 
 




__._,_.___
Posted by: Lee Chen <achieveforce-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>



__,_._,___
Picon

ProcFS broken

Hey Greg,

I was trying to use the procfs interface to look at some of the SMARTFS diagnostic info I had added but discovered that it is broken.  Looking at the code, it appears the issue is that in the fs/procfs/fs_procfs.c file, the entry ordering of the "procfs_level0_s" and "procfs_level1_s" structs has been modified to organize all uint8_t entries together, the uin16_t entries together, etc.

The first several fields of these structs need to match the fields in "struct procfs_dir_priv_s" defined in include/nuttx/fs/procfs.h.  When I originally wrote this code, I considered if I should make this struct a member of the level0 / level1 structs directly or just copy the entries.  I decided to save some struct member indirection coding (e.g. priv->level vs. priv->base.level).  I also wasn't sure across multiple compilers how the struct entries would be packed / aligned if it contained a 10-12 byte struct entry.  

But now I'm thinking that was a mistake to code it this way because it makes it too easy for errors to creep in when it isn't clear that these structs must have similar format.  I'm going to re-code fs_procfs.c so that it pulls in the procfs_dir_priv_s struct into the level0 / level1 struct directly to fix the bug and make it explicit that procfs_dir_priv_s is a base struct.

Ken


__._,_.___
Posted by: Ken Pettit <pettitkd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>



__,_._,___
Picon

GPIO Keyboard

Hello,


In your porting guide, you say, use kbd_press(), kbd_release(),etc ...

But only USB keyboard use it. it's right?

All implemented keypad create a specific input device, opened by application.


I want implement a "gpio keypad" that represent a part of real keyboard to keep compatibility with all platform.

a "gpio keyboard" will be a list of gpio mapped to real keyboard key like KEYCODE_UP, KEYCODE_DOWN found in enum kbd_keycode_e.


So I will continue to follow the porting guide and i use kbd_... function or I miss understood?


Thanks,

Pierre



__._,_.___
Posted by: pn_bouteville-Qt13gs6zZMY@public.gmane.org



__,_._,___
Picon

TCP over USB - usbnet gadget support

Hallo

I have been playing with embedded processors for a while but I need an RTOS platform for the first time.  Nuttx
looks quite cool and I think we will use it.

I just wonder if someone looked into the usbnet support. We would really like to be able to telnet to the host
over USB.

Cheers
  Dan

------------------------------------
Posted by: Dan Cvrcek <dan@...>
------------------------------------

------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/nuttx/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/nuttx/join
    (Yahoo! ID required)

<*> To change settings via email:
    nuttx-digest@... 
    nuttx-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    nuttx-unsubscribe@...

<*> Your use of Yahoo Groups is subject to:
    https://info.yahoo.com/legal/us/yahoo/utos/terms/

Picon

RFC: A board_late_init for NuttX

Hi Greg,

I created an application to be used as a NuttX entry point instead of NSH:

CONFIG_USER_ENTRYPOINT="myapp_main"

When doing it the nsh_archinitialize() is not called anymore and my
late initialization is lost.

Also putting this late board initialization at stm32_boardinitialize()
doesn't work because the file system is not initialized yet. My code
calls the register_driver() but because there is not fs yet it returns
error -12 (ENOMEM).

I "fixed" it calling my code directly at end of up_initialize() in the
file arch/arm/src/common/up_initialize.c, but I think it is too much
intrusive.

It should be nice if NuttX adds a standard way to call late board
initialization like u-boot does (board_late_init). It could be just a
similar function name called at end of up_initialize() and living at
configs/board/src/chipname_boot.c

What do you think? Does it make sense at all?

BR,

Alan

------------------------------------
Posted by: Alan Carvalho de Assis <acassis@...>
------------------------------------

------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/nuttx/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/nuttx/join
    (Yahoo! ID required)

<*> To change settings via email:
    nuttx-digest@... 
    nuttx-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    nuttx-unsubscribe@...

<*> Your use of Yahoo Groups is subject to:
    https://info.yahoo.com/legal/us/yahoo/utos/terms/

Picon

NxConsole

I have been thinking about change the name of NxConsole to NxTerm since it is really a graphics terminal analogous to an xterm.


Then today, it occurred to me that NuTTY might be better name.  What do you think?  If you use PuTTY has your host serial terminl program then you run NuTTY on PuTTY.


Greg



__._,_.___
Posted by: spudarnia-/E1597aS9LQAvxtiuMwx3w@public.gmane.org



__,_._,___
Picon

Compilation of Avr32Dev1


Hello,

I try to compile the Avr32Dev1, I'am following the link http://nuttx.org/doku.php?id=wiki:howtos:build-and-install-nuttx-for-the-lm3s6965-ek-in-linux to help me in the task.

Unfortunately that doesn't work. When I do

cd $TOPDIR/../misc/buildroot/
make menuconfig
make

it return this error :

checking whether strstr is declared... yes
checking whether snprintf is declared... yes
checking whether vsnprintf is declared... yes
*** BFD does not support target av r32-nuttx-elf.

In the same step and before make menuconfig I can copy a config file
but, unfortunately I don't have config file for avr32 just for avr ?

Thank you

Best

Loic

 


__._,_.___
Posted by: Loic Maury <mauryloic-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>



__,_._,___
Picon

assertion when running hello...

I came across another issue when trying to run the example apps from /apps/examples/elf. After continuously running the apps for a while the nuttx crashes.


I turned on the memory debug, however, it shows an assertion right after running the first app. I am not sure if it is related to the above issue, that is crashing after several runs. Here is the debug output. Your input will be really appreciated.


nsh> /mnt/sda/elf/hello
mm_malloc: Allocated 1000f2f0, size 48
mm_malloc: Allocated 1000f600, size 528
mm_malloc: Allocated 1000f810, size 528
mm_malloc: Allocated 1000fa20, size 512
mm_malloc: Allocated 1000fc20, size 144
mm_free: Freeing 1000f810
mm_free: Freeing 1000fc20mm_free: Freeing 1000f600
mm_free: Freeing 1000f2f0
mm_malloc: Allocated 1000fc20, size 256
mm_malloc: Allocated 20002630, size 2064
mm_malloc: Allocated 1000fd20, size 560
mm_malloc: Allocated 1000f2f0, size 32
mm_malloc: Allocated 1000ff50, size 80
mm_malloc: Allocated 1000ffa0, size 80
mm_mallAssertion failed at file:stdio/lib_rawsostream.c line: 80 task: initd
sp:         20002d30
stack base: 20001d08
stack size: 000007fc
ERROR: Stack pointer is not within the allocated stack
mm_free: Freeing 20001510
mm_free: Freeing 200010d0
oc: Allocated 1000f600, size 80
Getting ready to say "Hello, world"

Hello, world!
It has been said.

argc  &nbs p; = 1
argv    = 0x1000fd04
argv[0] = (0x1000fcfc) "/mntd"
argv[1] = 0x0
Goodbye, world!
mm_free: Freeing 20002630
mm_free: Freeing 1000fc20



(....nsh stops responding here.....)





__._,_.___
Posted by: valont.valont-/E1597aS9LQAvxtiuMwx3w@public.gmane.org



__,_._,___
Picon

SMARTFS issue... [1 Attachment]

I have successfully enabled SMARTFS over a SPI NOR Flash device N25Q064A13ESE40F. I mounted the "/dev/smart0" ok and then I copied the "hello" sample app to it. However, it always failed to run at resolving the symbol, while I can run the "hello" from the USB thumb drive mounted to the system.


After comparing the "hello" copied to the NOR Flash with SMARTFS and the "hello" on the USB drive, I noticed that at two locations, the "hello" on the SMARTFS has "FF FF FF...", which seems that the NOR Flash is not written in those two locations.


I attached a Word doc that has the screen captures of the BeyondCompare, which shows th e difference.


Really appreciate it if someone in the know about the SMARTFS can help on this.





__._,_.___

Attachment(s) from valont.valont-/E1597aS9LQAvxtiuMwx3w@public.gmane.org [nuttx] | View attachments on the web

1 of 1 File(s)

Posted by: valont.valont-/E1597aS9LQAvxtiuMwx3w@public.gmane.org



__,_._,___
Picon

Using CC3000 (wifi) on Arduino Due

Hello,

I would like to use CC3000 (already supported in nuttx) on an Arduino Due board.


I activated it in configuration an i got :

board.c:(.text+0xca): undefined reference to `wireless_archinitialize'

board.c:(.text+0xde): undefined reference to `cc3000_wlan_init'


first step i found wireless_archinitialize in up_wireless.c in spark board.


So i imagined copy up_wireless.c to sam_wireless.c in arduino due board and modify GPIO calls.


It looks like if up_spi.c should be used to.


If someone can confirm, i will try to do that.







__._,_.___
Posted by: comte_fabien-Qt13gs6zZMY@public.gmane.org



__,_._,___
Picon

Write on CAN device hangs (STM32) sometimes [1 Attachment]

Hello,

 after sending a few CAN packets, write hangs. I think I found a
solution - see attached patch (applies to NuttX 7.4).

stm32.can.c: At the end of the interrupt handler, the interrupts are
disabled, if all packets have been transfered when the interrupt handler
was invoked. This is problematic, because the interrupt handler calls
can_txdone of the upper half which can enqueue new packets to send. I
have removed the block altogether, because can_txdone calls can_xmit
which disables interrupts if there are no new packets to send.

can.c: In can_txdone, waiters on the semaphore should be informed
regardless of the return value of can_xmit. First it returns -EIO if
there are no new packets, and second the information of the waiters is
about the last transferred packet.

Please take a look if this makes sense - it seems to work for me.

Martin



__._,_.___

Attachment(s) from Lederhilger Martin | View attachments on the web

1 of 1 File(s)

Posted by: "Lederhilger Martin" <M.Lederhilger-q1S3RHPcI4L8C245oKUbwQC/G2K4zDHf@public.gmane.org>



__,_._,___

Gmane