Commit Graph

33264 Commits

Author SHA1 Message Date
Gregory Nutt
6a12213fbb fs/spiffs: I have been test with apps/examples/fstest which provides a good exercise but of the FS internals but not of the user interface. I build an SPIFFS aware NSH configuration and found and fixed a number of glaring usability errors: (1) Missing logic to stat the SPIFFS root directory, (2) Confusion in use to two similarly named struct field... caused files to be unexpectedly deleted. (3) Fixed a sempahore deadlock condition. And (5) Fix /procfs/mount. It was unaware of the SPIFFS file system type. 2018-09-28 17:35:25 -06:00
Gregory Nutt
e90723307e fs/spiffs: Fix an error in who the deferred 'unlink' is handling in close(). Modify read() and write behavior() so that they do not return so many partial reads and writes. 2018-09-28 13:21:44 -06:00
Gregory Nutt
294456fa20 fs/spiffs: Add logic to dump the logical context of the FLASH. 2018-09-28 11:23:42 -06:00
Dave Marples
91eb792e56 Corrections for the i.MXRT Ethernet:
(1) Now the Ethernet is completely re-initialized when an error occurs by means of taking the interface down and back up but the PHY is _not_ renegotiated for that case because that is very time consuming and an error in the Ethernet is no reflection on the state of the PHY anyway.

(2) Explicitly sets the expected PHY address to zero (this could be moved into the config) rather than searching for it which takes ages, and it's zero anyway for this board (that's the broadcast address, and anything that cannot respond on that has multiple PHYs, so that would be a new board).

(3) Allows for the renegotiation of the PHY to be optional when a reset is needed. If a non-renegotiated reset doesn't result in good comms to the PHY then it'll automatically be escalated to a renegotiated one.

(4) Only performs a reset for errors that need it (the CRITICAL_ERROR define).  The list of errors that need reset are somewhat arbitrarily chosen based on my prejudices and might need to be revisited, but certainly the jabber errors don't need reset, the partial packet is thrown away by the layer above anyway.

(5) Re-loads the multicast table on reset.

(6) Adds a bit more logging into the imxrt Ethernet module.
2018-09-28 07:25:48 -06:00
Gregory Nutt
2ca8c6682c fs/spiffs: fs/spiffs: Fix several bugs: (1) Fix bad statfs return values. (2) Fix an error in spiffs_unlink(). Fix an in error detection logic when closing a file. 2018-09-27 19:29:00 -06:00
Gregory Nutt
2d2dd5e9e3 fs/spiffs: Fix bad check for return value. In NuttX all values greater than or equeal to 0 are successes. 2018-09-27 14:24:46 -06:00
Gregory Nutt
1273f727c0 File System IOCTLs: Three new IOCTLS were added for SPIFFS, two of which were duplicates. 2018-09-27 12:25:23 -06:00
Gregory Nutt
65ef3acf70 fs/spiffs: Still uses some internal error codes that should be replaced with errors from errno.h. For now, I just added a mapping function before any value is returned to the caller: And of these detailed internal errors are simply mapped to -EFTYPE. Most are related to improper internal data structures so -ETYPE is possibly appropriate. Aslo SPIFFs is no longer is EXPERIMENTAL. Many things work but I the code is very immature and many things will not work. 2018-09-27 11:33:09 -06:00
Gregory Nutt
554745946d fs/spiffs: The MTD interfaces needs its own, dedicated page buffer for read-modify-write operations. It cannot share the normal 'working' page buffer because it is sometimes in-use when the MTD interface needs it. Also and more DEBUG output and controls for the MTD interface. 2018-09-27 09:35:58 -06:00
Masayuki Ishikawa
b154c81255 Merged in masayuki2009/nuttx.nuttx/lc823450_mpu_for_flat (pull request #728)
arch/arm/src/lc823450: MPU support for FLAT build

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: GregoryN <gnutt@nuttx.org>
2018-09-27 11:34:22 +00:00
Gregory Nutt
7a2f70495a fs/spiffs: Fix yet another interface with NuttX MTD. This time, the calculation of the number of whole blocks. 2018-09-26 20:00:25 -06:00
Gregory Nutt
5cc68ad3b8 fs/spiffs: Fix yet another interface with NuttX MTD. This time, the calculatio of the terminal block number. 2018-09-26 18:30:46 -06:00
Gregory Nutt
b4488a0549 fs/spiffs: Fix an error in write operation. examples/fstest now gets further before errors occur, but still does not work correctly. 2018-09-26 18:00:46 -06:00
Gregory Nutt
31e6fb561b fs/spiffs: Costmetic name changes more more consistency. 2018-09-26 15:50:55 -06:00
Gregory Nutt
d59893a456 fs/spiffs: Fixes yet another SPIFFS/MTD interfacing bug. 2018-09-26 15:16:38 -06:00
Gregory Nutt
63ba200957 fs/spiffs: Correct error in MTD multi-block read/write logic. 2018-09-26 12:29:42 -06:00
Dave Marples
4eb118afd1 arch/arm/src/imxrt/imxrt_enet.c: Fix a race condition in setting up the Ethernet Tx transfer. 2018-09-26 10:59:47 -06:00
Gregory Nutt
6e4545a924 Upate TODO list to reflect consequences of commit 3b1cc69d68 2018-09-26 10:27:50 -06:00
Ivan Ucherdzhiev
910e7a3899 arch/arm/src/imxrt/imxrt_lpsrtc.c: SVNC LPCR register bits 0 & 1 are NOT reserved and are, in fact, needed to enabled the SRTC. Now the SRTC is working. 2018-09-26 10:13:20 -06:00
Gregory Nutt
6d2cce99e1 fs/spiffs: Fix more problems found in testing. It is getting closer but examples/fstest is still showing problem. 2018-09-26 10:05:43 -06:00
Ivan Ucherdzhiev
955527b14f arch/arm/src/imxrt: Add LPI2C driver. 2018-09-26 07:57:45 -06:00
Gregory Nutt
3b1cc69d68 include/nutt: Fix definitions used to access OS functions within the libraries. In the FLAT build, we must always set the errno and/or create cancellation points because the same library functions are used within the OS as are used by applications. This could cause issues for the OS but corrects some problems at the user interface.
Noted by Federico Braghiroli in Bitbucket issue 121.
2018-09-26 06:58:08 -06:00
Gregory Nutt
71eac2d530 fs/spiffs: Correct the MTD block write logic. 2018-09-25 18:05:45 -06:00
Gregory Nutt
9984e209ab fs/spiffs: Various fixes from initial testing. Still lots of issues. Also changes from further review to get better naming consistency and functional partitioning. 2018-09-25 16:19:03 -06:00
Anthony Merlino
c21dfbb93c Merged in antmerlino/nuttx/libcxx-build-fix (pull request #727)
Fixes issue with libcxx build. This was changed multiple times, but should be fixed now.

Approved-by: GregoryN <gnutt@nuttx.org>
2018-09-25 20:46:02 +00:00
Gregory Nutt
8373784afe Squashed commit of the following:
fs/spiffs:  Finished review, update, and repartitioning of spiffs_core.c.

    fs/spiffs:  Converted macro SPIFFS_VALIDATE_OBJIX to a function.

    fs/spiffs:  Move SPIFFS_VALIDATE_DATA and SPIFFS_CHECK_RES macros inline.
2018-09-25 12:15:24 -06:00
Anthony Merlino
5e69b6e09f Merged in antmerlino/nuttx/getaddrinfo-improvements (pull request #726)
A few improvements to getaddrinfo:

- Use the protocol and socktype hints in returned address
  - Ignore AI_PASSIVE argument if hostname is not NULL

Approved-by: GregoryN <gnutt@nuttx.org>
2018-09-25 17:00:57 +00:00
Harri Luhtala
2d750d461b drivers/net/enc28j60.c: Adjust debug trace levels. Correct typos in some comments. 2018-09-25 07:07:04 -06:00
Harri Luhtala
2d0f1b85e3 net/tcp/tcp_wrbuffer.c: fix buffer release handling on failed buffer alloc. Attempt to release write buffer on failed TCP write I/O buffer alloc and tryalloc failed to wrb->wb_iob assertion. 2018-09-25 07:02:04 -06:00
Dave Marples
681609ad51 arch/arm/src/imxrt/imxrt_enet.c: The board would not come up if I ran Nuttx from cold. I dumped the PHY registers to see what the differences were and the PHY was coming up in NANDTree mode. This is a mode for testing connectivity between the PHY and the MAC. Switching this mode off in the PHY registers has fixed the problem. 2018-09-25 06:52:07 -06:00
Gregory Nutt
ec498d2660 This commit brings in an inital port of the SPIFFS flash file system into NuttX. The file system is still untested at this point (and subject to some additional review). It is, however, marked EXPERIMENTAL should this should not cause a problem for anyone.
Squashed commit of the following:

    fs/spiffs:  Fix last compilation issue.  Now compiles without error.  It is still not quite ready for testing as there is additional code review that must be be performed.  It is now marked as EXPERIMENTAL so that it can be brought onto the master branch with little risk.

    fs/spiffs:  Remove some dead code.

    fs/spiffs:  Weak start of analysis of spiffs_nucleus.c.  Renamed to spiffs_core.c

    fs/spiffs:  Rename spiffs_nucleus.c to spiffs_core.c

    fs/spiffs:  Remove spiffs_config.h.  All configuration settings are now available in the SPIFFS Kconfig options.

    fs/spiffs:  Finished review, update, and repartitioning of spiffs_check.c.  Added spiffs_check.h.

    fs/spiffs:  Finished review, update, and repartitioning of spiffs_cache.c.  Added spiffs_cache.h.

    fs/spiffs:  Clean up some defines used in debug output statements.

    fs/spiffs:  Finished review, update, and repartitioning of spiffs_gc.c.  Added spiffs_gc.h.

    fs/spiffs:  Now that VFS interface is completed, I have begun the long march of repartitioning the remaining functionality, reviewing logic, identifying dead code, and cleaning up loose ends.

    fs/spiffs:  Initial integration of MTD interface, replacing the SPIFFS native flash interface.  Lots of open issues such as the use of pages vs. blocks vs. erase blocks and units of addresses, offsets, and lengths that are passed in function calls.  Remove SPIFFS_USE_MAGIC support.  That option (which default to OFF anyway), wrote a magic value at the beginning of every sector and support verifiable identification of the file system.  It was not being and used and removing it makes life simpler.

    fs/spiffs:  Remove semaphore lock on the file object structure.  Ultimately, the file access must modify the volume and access the volume structue which also has a exclusivity lock.  So use of the volume lock alone should be sufficient.

    Integrated the SPIFFS rename logic into the NuttX VFS.  Removed non-standard application calls or convert them to IOCTL commands.  These were converted to IOCTL commands:  (1) integrity check, (2) garbage collection, and (3) format flash.  These were removed:  (1) Integrity check callback.  These provided a lot of good information about the state of the file system, but such callbacks are not compatible with a POSIX compliant file system.  (2) Index maps.  The index maps were a performance improvement feature.  The user could provide the memory and request that a region of a a file use that memory for improved lookup performance when accessing parts of the file.  The fallback is the less performance lookup by traversing the FLASH memory.  (3) Removed the quick garbage collection interface (the code is still used internally).  Only the full garbage collection is available to the user application via IOCTL.

    configs/sim/spiffs:  A simulator configuration to use for testing SPIFFS.

    fs/spiffs:  Integrate SPIFFS logic into NuttX VFS bind() and unbind() methods.

    fs/mount/fs_mount.c:  Add SPIFFS to the list of drivers that require MTD vs block drivers.

    fs/spiffs:  Trivial changes, mostly from analysis of how to integrate the rename() VFS method.

    fs/spiffs:  Connect NuttX VFS unlink method to the SPIFFS_remove() function.  Lots of name-changing.

    fs/spiffs:  Remove non-standard errno support.  Remove bogus SPIFFS_LOCK() and SPIFFS_UNLOCK() macros.

    fs/spiffs:  Add NuttX VFS implementation for statfs() method.  Clean up some of the accumulating compilation problems.

    fs/spiffs:  Add stat(), truncate() methods.  Dummy out unsupport mkdir() and rmdir() methods.

    fs/spiffs:  Replace some of the custom error numbers with standard error numbers.

    fs/spiffs:  Hooks read(), write(), fstat(), ioctl(), opendir(), closedir(), rewindif(), and readdir() into the NuttX VFS.

    fs/spiffs:  Beginning the organization to work with the NuttX VFS.  Lots of things are get broken!

    fs/spiffs:  Add spiffs.c which will be the interface between SPIFFS and NuttX.  No very close at present, however.

    fs/spiffs:  Clean up some compile problems introduced by coding standard changes.

    fs/spiffs:  A little closer to NuttX coding standard.

    fs/spiffs:  Ran tools/indent.sh against all files.  Closer to NuttX coding standard, but needs a lot more effort to be fully compliant.

    fs/spiffs:  This commit brings in version 0.3.7 of Peter Anderson's SPIFFS.  The initial commit includes the core FS files (with some definitions destributed to their correct header files) and hooks into the build system.
2018-09-24 18:05:09 -06:00
Gregory Nutt
0939fd479f include/sys/socket.h: Renumber the socket types. They must begin at 1, not zero. Socket type zero has a special meaning for some interfaces. For example, getaddrinfo() uses a socket type of zero to many any type of socket. The is no standard name for the any-type-socket, but macOS uses SOCK_UNSPEC. NuttX will do the same. Issue noted by Anthony Merlino. 2018-09-24 14:58:59 -06:00
Gregory Nutt
91410573ef fs/mount/fs_mount.c: Correct an error introduced in the last commit (but only when file systems that need MTD drivers are included. 2018-09-22 14:39:11 -06:00
Gregory Nutt
992b293122 Squashed commit of the following:
fs/driver and fs/mount:  Add mount() support for file systems that require MTD drivers (vs. block drivers).
    fs/drivers:  Add support for named MTD drivers in the psuedo file system.  This will, eventually, allow us to mount file systems that need MTD drivers without having to fake an intervening block driver.
2018-09-22 14:20:18 -06:00
Gregory Nutt
dec7ecbd56 net/tcp/tcp_recvwindow.c: In order to receive data we must not only have IOBs available, but we must also have at least one IOB chain qentry available. Otherwise, we will advertise that we an buffer a lot of data when, in fact, we cannot. This is an expermental fix to a performance problem noted by Masayuki Ishikawa. 2018-09-22 09:33:29 -06:00
Gregory Nutt
510b0f7e07 arch/arm/src: Correct all ARMv7-M architectures. Interrupts were not be disabled correctly on power up. Writing zero to the NVIC SET-ENABLE registers has no effect. In order to disable interrupts, it is necessary to write all ones to the NVIC CLEAR-ENABLE register. Noted by David Sidrane. 2018-09-21 21:32:50 -06:00
Gregory Nutt
6632ac721e arch/arm/src/kinetis: Remove all attempts to reprioritize interrupts. 2018-09-21 13:18:29 -06:00
Gregory Nutt
2c0a0aef9f arch/arm/src/stm32f7: Remove adhoc PM interfaces and add CONFIG_PM serial suspend. 2018-09-21 06:44:23 -06:00
Masayuki Ishikawa
9a71fdc8c1 Merged in masayuki2009/nuttx.nuttx/fix_allocheap_for_lc823450 (pull request #724)
arch/arm/src/lc823450: Fix up_allocate_heap() in lc823450_allocateheap2.c

For lc823450, heap area in flat build mode must start just after
_eronly. Because bss/data area is allocated in lower address than
text area in SRAM. See ld.scripts for details. Also, this change
removes unsed up_allocateheap.c

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: GregoryN <gnutt@nuttx.org>
2018-09-21 12:22:29 +00:00
Gregory Nutt
b823fd83bd arch/arm/src/armv7-a: Replicate the same fix was previously commited for the armv7-r. 2018-09-20 21:40:29 -06:00
EunBong Song
0f18e8cc32 Merged in ebsong/nuttx (pull request #722)
Pull request for mtd/progmem refactoring.

* mtd/progmem: change up_progmem_npages to up_progmem_neraseblocks

    page is a unit for read/write operation.
    eraseblock is a unit for erase operation.
    up_progmem_npages is a little bit confusing because it returns number of
    erase blocks in flash memory. This patch changes up_progmem_npages to
    up_progmem_neraseblocks. There is no logical change.

    Signed-off-by: EunBong Song <eunb.song@samsung.com>

* mtd/progmem: up_progmem_erasesize.

    Change argument name to be more readable.

    Signed-off-by: EunBong Song <eunb.song@samsung.com>

* mtd/progmem: up_progmem_eraseblock

    Change up_progmem_erasepage to up_progmem_eraseblock.
    eraseblock is more readable name than erasepage.

    Signed-off-by: EunBong Song <eunb.song@samsung.com>

* mtd/progmem: change up_progmem_eraseblock's return value.

    up_progmem_eraseblock erase a block. so it's better to return the erase block
    size than page size.

    Signed-off-by: EunBong Song <eunb.song@samsung.com>

* arm/cortex-r : fix wrong cp15_flash_dcache.

    change mcrne to mcr for unconditional dcache.

    Signed-off-by: sungduk.cho <sungduk.cho@samsung.com>

Approved-by: GregoryN <gnutt@nuttx.org>
2018-09-21 03:18:38 +00:00
Gregory Nutt
1802145604 Trivial fixes to spelling errors. 2018-09-20 06:53:13 -06:00
Masayuki Ishikawa
03f5e8e5c2 Merged in masayuki2009/nuttx.nuttx/fix_rndis (pull request #721)
drivers/usbdev: Fix buffer overrun check in rndis.c

The rndis driver has been working since 13 Nov 2017.
However, I finally found that it depends on network and buffer
configurations. If a receiving TCP packet is devided into smaller
ones based on USB max packet size, this condition check works
correctly.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: GregoryN <gnutt@nuttx.org>
2018-09-20 12:50:58 +00:00
Gregory Nutt
913d013d8f Revert last change to the TODO list. There is no issue. 2018-09-19 12:15:04 -06:00
Gregory Nutt
f03ee4875b Update TODO list. 2018-09-18 12:31:27 -06:00
Gregory Nutt
3cebd821cd Update TODO list 2018-09-18 07:09:10 -06:00
Gregory Nutt
3950398841 libs/libc/string/lib_stpncpy.c: Correct the return poineter value for the case where the NUL terminator is transferred. 2018-09-18 06:43:10 -06:00
Gregory Nutt
68d4c1d4ed C library: Add some new functions defined in POSIX.1-2017: stpncpy(), strsignal(), psignal(), psiginfo(). 2018-09-17 13:55:33 -06:00
Juha Niskanen
3d14b63e8f drivers/timers: RTC_PERIODIC is no longer EXPERIMENTAL, remove unimplemented EXPERIMENTAL RTC configuration variables. 2018-09-17 06:27:37 -06:00
Gregory Nutt
7769bd490c sched/signal/sig_nanosleep.c: Fix an error introduced with recent commit. Noted by Jussi Kivilinna. 2018-09-17 06:21:25 -06:00