summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-03-29 14:42:03 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-03-29 14:42:03 -0600
commit64f02764e9c2d0d4a2bdc496e9f21b262ef818cc (patch)
treeca3c8230c9507db18c4ea6104ecc23b79a921c73
parent72adecb9057d7015c5d1729ec3752926284bab8c (diff)
downloadpx4-nuttx-64f02764e9c2d0d4a2bdc496e9f21b262ef818cc.tar.gz
px4-nuttx-64f02764e9c2d0d4a2bdc496e9f21b262ef818cc.tar.bz2
px4-nuttx-64f02764e9c2d0d4a2bdc496e9f21b262ef818cc.zip
Cortex-M7: Add support for enabled the D-Cache in write only mode.
SAMV7 Ethernet: I- and D-Cache are now enabled in the netnsh/ configuration. D-Cache is enabled in write-though mode. This mode is necessary because the DMA descriptors are each 8-bytes in size but the D-Cache cache line is 32-bits in size. So it is impossible make coherency for every 8-byte DMA descriptor without write-through.
-rw-r--r--apps/nshlib/nsh_fscmds.c3
-rw-r--r--nuttx/arch/arm/src/samv7/Kconfig4
-rw-r--r--nuttx/configs/samv71-xult/README.txt31
-rw-r--r--nuttx/configs/samv71-xult/netnsh/defconfig6
4 files changed, 20 insertions, 24 deletions
diff --git a/apps/nshlib/nsh_fscmds.c b/apps/nshlib/nsh_fscmds.c
index 570ffa776..3900fc64a 100644
--- a/apps/nshlib/nsh_fscmds.c
+++ b/apps/nshlib/nsh_fscmds.c
@@ -390,7 +390,7 @@ static int ls_recursive(FAR struct nsh_vtbl_s *vtbl, const char *dirpath,
{
/* Yes.. */
- char *newpath;
+ FAR char *newpath;
newpath = nsh_getdirpath(dirpath, entryp->d_name);
/* List the directory contents */
@@ -408,6 +408,7 @@ static int ls_recursive(FAR struct nsh_vtbl_s *vtbl, const char *dirpath,
free(newpath);
}
}
+
return ret;
}
diff --git a/nuttx/arch/arm/src/samv7/Kconfig b/nuttx/arch/arm/src/samv7/Kconfig
index 41e40b5df..08d8f7570 100644
--- a/nuttx/arch/arm/src/samv7/Kconfig
+++ b/nuttx/arch/arm/src/samv7/Kconfig
@@ -120,10 +120,10 @@ config SAMV7_EMAC
select ARMV7M_DCACHE_WRITETHROUGH if ARMV7M_DCACHE
---help---
NOTE that write-through caching is automatically selected. This is
- to work around issues with the RX and TX descriptors with are 8-bits
+ to work around issues with the RX and TX descriptors with are 8-bytes
in size. But the D-Cache cache line size is 32-bytes. That means
that you cannot reload, clean or invalidate a descriptor without also
- effecting three neighboring desciptors. Setting write through mode
+ effecting three neighboring descriptors. Setting write through mode
eliminates the need for cleaning. If only reloading and invalidating
are done, then there is no problem.
diff --git a/nuttx/configs/samv71-xult/README.txt b/nuttx/configs/samv71-xult/README.txt
index 0efaff880..f242c1faa 100644
--- a/nuttx/configs/samv71-xult/README.txt
+++ b/nuttx/configs/samv71-xult/README.txt
@@ -88,28 +88,21 @@ The BASIC nsh configuration is fully function (as desribed below under
So there is still plenty to be done.
6. There is a port of the SAMA5D4-EK Ethernet driver to the SAMV71-XULT.
- Some basic functionality is present, but there is at least two,
- probably related issues:
+ This driver appears to be 100% functional with the following caveats:
- There is a compiler optimization problem. At -O2, there is odd
behavior on pings and ARP messages. But the behavior is OK with
- optimization disabled. This may or may not be a compiler issue; it
- may be a timing issue.
-
- Symptoms vary from build to build but usually result in a hang.
-
- - The driver does not work with I- and D-Caches enabled. The behavior
- is just as for when compiler optimization is enabled. I have not
- yet found in coherency issues so this might also be timing related.
-
- At -O2, many packets can be exchanged but eventually there is a
- hardfault, presumably because of a misdirected DMA.
-
- I have no hard evidence, but I believe that the nature of the problem
- related to fact that each descriptor in the arrays are 8-bytes each,
- but cache operations are performed on 32-byte memory chunks. So it is
- impossible to clean or invalidate a single descriptor without also
- cleaning or invalidaing adjacent descriptors.
+ optimization set to -O2. This may or may not be a compiler
+ optimization issue (it could also be a timing issue or a need
+ for some additional volatile qualifiers).
+
+ - I- and D-Caches are enabled but the D-Cache must be enabled in
+ write-trough mode. This is to work around issues with the RX and TX
+ descriptors with are 8-bytes in size. But the D-Cache cache line size
+ is 32-bytes. That means that you cannot reload, clean or invalidate a
+ descriptor without also effecting three neighboring descriptors.
+ Setting write through mode eliminates the need for cleaning the D-Cache.
+ If only reloading and invalidating are done, then there is no problem.
7. The USBHS device controller driver (DCD) is complete but non-functional.
At this point, work has stopped because I am stuck. The problem is that
diff --git a/nuttx/configs/samv71-xult/netnsh/defconfig b/nuttx/configs/samv71-xult/netnsh/defconfig
index e74dd1913..989aad989 100644
--- a/nuttx/configs/samv71-xult/netnsh/defconfig
+++ b/nuttx/configs/samv71-xult/netnsh/defconfig
@@ -122,8 +122,9 @@ CONFIG_ARCH_DPFPU=y
#
CONFIG_ARMV7M_HAVE_ICACHE=y
CONFIG_ARMV7M_HAVE_DCACHE=y
-# CONFIG_ARMV7M_ICACHE is not set
-# CONFIG_ARMV7M_DCACHE is not set
+CONFIG_ARMV7M_ICACHE=y
+CONFIG_ARMV7M_DCACHE=y
+CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
CONFIG_ARMV7M_HAVE_ITCM=y
CONFIG_ARMV7M_HAVE_DTCM=y
# CONFIG_ARMV7M_ITCM is not set
@@ -572,6 +573,7 @@ CONFIG_ETH0_PHY_KSZ8061=y
# CONFIG_ETH0_PHY_DP83848C is not set
# CONFIG_ETH0_PHY_LAN8720 is not set
# CONFIG_ETH0_PHY_LAN8740 is not set
+# CONFIG_ETH0_PHY_LAN8740A is not set
# CONFIG_ETH0_PHY_DM9161 is not set
# CONFIG_PIPES is not set
# CONFIG_PM is not set