summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-01-04 08:38:05 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-01-04 08:38:05 -0600
commit51f0f249a131baae11c2d2d131cf0787cb0f9ee9 (patch)
tree94f72a01f672459b692e0188a30dd1a5b4a93193
parentd991c576818932d6c9ad6a7282a39508dd6b0ddf (diff)
downloadpx4-nuttx-51f0f249a131baae11c2d2d131cf0787cb0f9ee9.tar.gz
px4-nuttx-51f0f249a131baae11c2d2d131cf0787cb0f9ee9.tar.bz2
px4-nuttx-51f0f249a131baae11c2d2d131cf0787cb0f9ee9.zip
README and other cosmetic updates
-rw-r--r--apps/nshlib/nsh_envcmds.c8
-rw-r--r--nuttx/configs/z16f2800100zcog/README.txt102
-rw-r--r--nuttx/tools/mkversion.c2
3 files changed, 110 insertions, 2 deletions
diff --git a/apps/nshlib/nsh_envcmds.c b/apps/nshlib/nsh_envcmds.c
index 02c0ec02e..8ff65d3d5 100644
--- a/apps/nshlib/nsh_envcmds.c
+++ b/apps/nshlib/nsh_envcmds.c
@@ -95,6 +95,7 @@ static inline FAR const char *nsh_getwd(const char *wd)
{
val = g_home;
}
+
return val;
}
#endif
@@ -134,6 +135,7 @@ static inline char *nsh_getdirpath(FAR struct nsh_vtbl_s *vtbl,
{
nsh_output(vtbl, g_fmtcmdoutofmemory, "nsh_getdirpath");
}
+
return alloc;
}
@@ -176,7 +178,7 @@ FAR char *nsh_getfullpath(FAR struct nsh_vtbl_s *vtbl,
}
/* Get the path to the current working directory */
-
+
wd = nsh_getcwd();
/* Fake the '.' directory */
@@ -261,6 +263,7 @@ int cmd_cd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_freefullpath(fullpath);
}
+
return ret;
}
#endif
@@ -283,6 +286,7 @@ int cmd_echo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "%s ", argv[i]);
}
+
nsh_output(vtbl, "\n");
return OK;
}
@@ -315,6 +319,7 @@ int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, g_fmtcmdfailed, argv[0], "setenv", NSH_ERRNO);
}
+
return ret;
}
#endif
@@ -333,6 +338,7 @@ int cmd_unset(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, g_fmtcmdfailed, argv[0], "unsetenv", NSH_ERRNO);
}
+
return ret;
}
#endif
diff --git a/nuttx/configs/z16f2800100zcog/README.txt b/nuttx/configs/z16f2800100zcog/README.txt
index 927985980..35f96a42a 100644
--- a/nuttx/configs/z16f2800100zcog/README.txt
+++ b/nuttx/configs/z16f2800100zcog/README.txt
@@ -120,6 +120,108 @@ nsh
Windows build, but I would expect the same issues as is listed
for the ostest configuration..
+ STATUS:
+ Currently, NSH failes nsh_consoleoutput(). Here is an example.
+ This echo command causes the system to hang:
+
+ nsh> echo abc
+
+ Below is some annotated output from the debugger. Here is the 30,000 ft view:
+
+ - cmd_echo loops for each argv[i], 1 >=i > argc.
+
+ - It calls:
+
+ vtbl->output(vtbl, "%s ", argv[i])
+
+ where the prototype for output is:
+
+ int (*output)(FAR struct nsh_vtbl_s *vtbl, const char *fmt, ...);
+
+ - vtbl->output maps to nsh_consoleoutput() in this case.
+
+ - cmd_echo passes all of the arguments to output in registers.
+
+ - nsh_consoleoutput expects all of the parameters on the stack.
+
+ - nsh_console calls vfprintf() using bad values from the stack.
+
+ - vfprintf crashes and never returns.
+
+ Looks like a compiler bug to me.
+
+ # int cmd_echo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
+ #
+ # All input parameters are in registers
+ #
+ # R1=00802DA0 # vtbl
+ # R2=00000002 # argc
+ # R3=00802D15 # argv
+ # # argv[0]=00802DD7
+ # # argv[1]=00802DDC
+ # # 00802DD7="echo\0abc\0"
+ # SP=00802CDD
+
+ 0001024C 05F0 PUSHMHI <R8-R11> # SP=00802CCD
+ 0001024E 4418 LD R8,R1 # R8=00802DA0 vtbl
+ 00010250 442A LD R10,R2 # R10=00000002 argc
+ 00010252 443B LD R11,R3 # R11=00802D15 argv
+ 00010254 3901 LD R9,#%1 # R9=00000001 arg index
+ 00010256 C00C JP %10270
+
+ 00010270 A5A9 CP R9,R10 # Bottom of loop
+ 00010272 E1F2 JP lt,%10258
+
+ 00010258 48840010 LD R4,%10(R8) # R4=00011156 adddress of output() method
+ 0001025C 4490 LD R0,R9 # R0=00000001 Index of argv[1]
+ 0001025E BC20 SLL R0,#%2 # R0=00000004 Offset to argv[1]
+ 00010260 A0B0 ADD R0,R11 # R0=00802D19 Address of argv[1]
+ 00010262 4481 LD R1,R8 # R1=00802DA0 vtbl address
+ 00010264 452200008ADB LD R2,#%8ADB # R2=00008ADB = "%s "
+ 0001026A 1203 LD R3,(R0) # R3=00802DDC Value of argv[1]
+ 0001026C F214 CALL (R4) # Call vtbl->output(vtbl, "%s ", argv[i]);
+ # vtbl->output is nsh_consoleoutput
+
+ # static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl, const char *fmt, ...)
+ #
+ # All parameters are in registers:
+ #
+ # R1=00802DA0 vtbl address
+ # R2=00008ADB "%s "
+ # R3=00802DDC Value of argv[1]
+
+ # First is a check if the output file is open
+ #
+ # if (nsh_openifnotopen(pstate) != 0)
+ # {
+ # return ERROR;
+ # }
+
+ 00011156 0800 LINK #%0 # SP=00802CC9, R14=00802CC9
+ 00011158 5C81 LD R1,%8(FP) # R1=0000017F Should be value file FILE * for output
+ 0001115A DF96 CALL %11088 # Call nsh_openifnotopen(), returns R0=00000000
+ 0001115C 9000 CP R0,#%0
+ 0001115E E602 JP z,%11164 # Skip over error return
+
+ 00011160 30FF LD R0,#-%1
+ 00011162 C007 JP %11172
+
+ # Then the failing call to vfprintf:
+ #
+ # va_start(ap, fmt);
+ # ret = vfprintf(pstate->cn_outstream, fmt, ap);
+ # va_end(ap);
+ #
+ # return ret;
+
+ 00011164 4D03 LEA R3,%10(FP) # R3=00802CD5 ap=GARBAGE
+ 00011166 5C80 LD R0,%8(FP) # R0=0000017F Should be value of pstate
+ 00011168 48010033 LD R1,%33(R0) # R1=01000000 pstate->cn_outstream. Looks suspicious
+ 0001116C 5CC2 LD R2,%C(FP) # R2=00802DA0
+ 0001116E F10003FB CALL %11968 # Call vfprintf(01000000, 00802DA0, 00802CD5)
+ # All arguments are bad
+ # Does not survive call to vfprintf
+
ostest
------
diff --git a/nuttx/tools/mkversion.c b/nuttx/tools/mkversion.c
index 3c0e6ab6f..2341a6c2a 100644
--- a/nuttx/tools/mkversion.c
+++ b/nuttx/tools/mkversion.c
@@ -53,7 +53,7 @@
* Private Functions
****************************************************************************/
- static inline char *getfilepath(const char *name)
+static inline char *getfilepath(const char *name)
{
snprintf(line, PATH_MAX, "%s/" DEFCONFIG, name);
line[PATH_MAX] = '\0';