From f3866fb55618d507435497695a38729f4e9a38dc Mon Sep 17 00:00:00 2001
From: patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>
Date: Thu, 13 Nov 2008 21:13:53 +0000
Subject: [PATCH] Added CONFIG_USERMAIN_STACKSIZE

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1227 42af7a65-404d-4744-a932-0658087f49c3
---
 ChangeLog                                   |  4 ++++
 Documentation/NuttX.html                    |  6 +++++-
 Documentation/NuttxPortingGuide.html        | 10 +++++++++-
 configs/README.txt                          |  8 +++++++-
 configs/c5471evm/defconfig                  |  9 ++++++++-
 configs/c5471evm/dhcpconfig                 |  9 ++++++++-
 configs/c5471evm/netconfig                  |  9 ++++++++-
 configs/c5471evm/nshconfig                  |  9 ++++++++-
 configs/ez80f910200kitg/ostest/defconfig    |  9 ++++++++-
 configs/m68332evb/defconfig                 |  9 ++++++++-
 configs/mcu123-lpc214x/nsh/defconfig        |  9 ++++++++-
 configs/mcu123-lpc214x/ostest/defconfig     |  9 ++++++++-
 configs/mcu123-lpc214x/usbserial/defconfig  |  9 ++++++++-
 configs/mcu123-lpc214x/usbstorage/defconfig |  9 ++++++++-
 configs/ntosd-dm320/nettest/defconfig       |  9 ++++++++-
 configs/ntosd-dm320/nsh/defconfig           |  9 ++++++++-
 configs/ntosd-dm320/ostest/defconfig        |  9 ++++++++-
 configs/ntosd-dm320/udp/defconfig           |  9 ++++++++-
 configs/ntosd-dm320/uip/defconfig           |  9 ++++++++-
 configs/olimex-strp711/ostest/defconfig     |  9 ++++++++-
 configs/pjrc-8051/defconfig                 |  9 ++++++++-
 configs/sim/mount/defconfig                 | 11 +++++++++--
 configs/sim/nettest/defconfig               | 11 +++++++++--
 configs/sim/nsh/defconfig                   | 11 +++++++++--
 configs/sim/ostest/defconfig                | 11 +++++++++--
 configs/sim/pashello/defconfig              | 11 +++++++++--
 configs/us7032evb1/nsh/defconfig            |  9 ++++++++-
 configs/us7032evb1/ostest/defconfig         |  9 ++++++++-
 configs/xtrs/nsh/defconfig                  |  9 ++++++++-
 configs/xtrs/ostest/defconfig               |  9 ++++++++-
 configs/xtrs/pashello/defconfig             |  9 ++++++++-
 configs/z16f2800100zcog/ostest/defconfig    |  9 ++++++++-
 configs/z16f2800100zcog/pashello/defconfig  |  9 ++++++++-
 configs/z80sim/nsh/defconfig                |  9 ++++++++-
 configs/z80sim/ostest/defconfig             |  9 ++++++++-
 configs/z80sim/pashello/defconfig           |  9 ++++++++-
 configs/z8encore000zco/ostest/defconfig     |  9 ++++++++-
 configs/z8f64200100kit/ostest/defconfig     |  9 ++++++++-
 sched/os_start.c                            |  2 +-
 39 files changed, 303 insertions(+), 43 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0d00c3f800..2253472545 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -542,4 +542,8 @@
 	  gcc 3.4.5 toolchain (which has very limit SH-1 support to begin with), or perhaps with the
 	  CMON debugger.  At any rate, I have exhausted all of the energy that I am willing to put
 	  into this cool old processor for the time being.
+	* Renamed configuration item CONFIG_PROC_STACK_SIZE as CONFIG_IDLETHREAD_STACKSIZE:  It now
+	  only controls the size of the stack for the IDLE thread.  Added CONFIG_USERMAIN_STACKSIZE:
+	  This is the size of stack used with the user_start() thread is created.  The two stacks
+	  no longer have to be the same.
 
diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html
index 9c8e006afb..84ba8a6ef0 100644
--- a/Documentation/NuttX.html
+++ b/Documentation/NuttX.html
@@ -8,7 +8,7 @@
   <tr align="center" bgcolor="#e4e4e4">
     <td>
       <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
-      <p>Last Updated: November 11, 2008</p>
+      <p>Last Updated: November 13, 2008</p>
     </td>
   </tr>
 </table>
@@ -1185,6 +1185,10 @@ nuttx-0.3.18 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
 	  gcc 3.4.5 toolchain (which has very limit SH-1 support to begin with), or perhaps with the
 	  CMON debugger.  At any rate, I have exhausted all of the energy that I am willing to put
 	  into this cool old processor for the time being.
+	* Renamed configuration item CONFIG_PROC_STACK_SIZE as CONFIG_IDLETHREAD_STACKSIZE:  It now
+	  only controls the size of the stack for the IDLE thread.  Added CONFIG_USERMAIN_STACKSIZE:
+	  This is the size of stack used with the user_start() thread is created.  The two stacks
+	  no longer have to be the same.
 
 pascal-0.1.3 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
 
diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html
index dfee322125..03b40d117c 100644
--- a/Documentation/NuttxPortingGuide.html
+++ b/Documentation/NuttxPortingGuide.html
@@ -1761,7 +1761,15 @@ The system can be re-made subsequently by just typing <code>make</code>.
     <code>CONFIG_STACK_POINTER</code>: The initial stack pointer
   </li>
   <li>
-    <code>CONFIG_IDLETHREAD_STACKSIZE</code>: The size of the initial stack
+    <code>CONFIG_IDLETHREAD_STACKSIZE</code>: The size of the initial stack.
+    This is the thread that (1) performs the inital boot of the system up
+    to the point where user_start() is spawned, and (2) there after is the
+    IDLE thread that executes only when there is no other thread ready to
+    run.
+  </li>
+  <li>
+    <code>CONFIG_USERMAIN_STACKSIZE</code>: The size of the stack to allocate
+    for the main user thread that begins at the user_start() entry point.
   </li>
   <li>
     <code>CONFIG_PTHREAD_STACK_MIN</code>: Minimum pthread stack size
diff --git a/configs/README.txt b/configs/README.txt
index 9f4985aa56..71a1f49e48 100644
--- a/configs/README.txt
+++ b/configs/README.txt
@@ -369,7 +369,13 @@ defconfig -- This is a configuration file similar to the Linux
 		CONFIG_BOOT_FROM_FLASH - Some configurations support XIP
 		  operation from FLASH.
 		CONFIG_STACK_POINTER - The initial stack pointer
-		CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+		CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+		  This is the thread that (1) performs the inital boot of the system up
+		  to the point where user_start() is spawned, and (2) there after is the
+		  IDLE thread that executes only when there is no other thread ready to
+		  run.
+		CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+		  for the main user thread that begins at the user_start() entry point.
 		CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 		CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 		CONFIG_HEAP_BASE - The beginning of the heap
diff --git a/configs/c5471evm/defconfig b/configs/c5471evm/defconfig
index 629f500594..8d1cce2fdb 100644
--- a/configs/c5471evm/defconfig
+++ b/configs/c5471evm/defconfig
@@ -373,7 +373,13 @@ CONFIG_NET_C5471_BASET10=n
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -383,6 +389,7 @@ CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=4096
 CONFIG_HEAP_BASE=
diff --git a/configs/c5471evm/dhcpconfig b/configs/c5471evm/dhcpconfig
index 86a734a812..9f848a8cf8 100644
--- a/configs/c5471evm/dhcpconfig
+++ b/configs/c5471evm/dhcpconfig
@@ -373,7 +373,13 @@ CONFIG_NET_C5471_BASET10=n
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -383,6 +389,7 @@ CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=4096
 CONFIG_HEAP_BASE=
diff --git a/configs/c5471evm/netconfig b/configs/c5471evm/netconfig
index bc684fb6b9..6491e16fa2 100644
--- a/configs/c5471evm/netconfig
+++ b/configs/c5471evm/netconfig
@@ -373,7 +373,13 @@ CONFIG_NET_C5471_BASET10=n
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -383,6 +389,7 @@ CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=4096
 CONFIG_HEAP_BASE=
diff --git a/configs/c5471evm/nshconfig b/configs/c5471evm/nshconfig
index 9ff2dc7676..55c896c45d 100644
--- a/configs/c5471evm/nshconfig
+++ b/configs/c5471evm/nshconfig
@@ -373,7 +373,13 @@ CONFIG_NET_C5471_BASET10=n
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -383,6 +389,7 @@ CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=4096
 CONFIG_HEAP_BASE=
diff --git a/configs/ez80f910200kitg/ostest/defconfig b/configs/ez80f910200kitg/ostest/defconfig
index dd5a72ae00..1580cd5349 100644
--- a/configs/ez80f910200kitg/ostest/defconfig
+++ b/configs/ez80f910200kitg/ostest/defconfig
@@ -345,7 +345,13 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -354,6 +360,7 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_IDLETHREAD_STACKSIZE=256
+CONFIG_USERMAIN_STACKSIZE=256
 CONFIG_PTHREAD_STACK_MIN=128
 CONFIG_PTHREAD_STACK_DEFAULT=256
 CONFIG_HEAP_SIZE=
diff --git a/configs/m68332evb/defconfig b/configs/m68332evb/defconfig
index cfb6220960..8f88cfe569 100644
--- a/configs/m68332evb/defconfig
+++ b/configs/m68332evb/defconfig
@@ -323,7 +323,13 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 #   operation from FLASH.
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -332,6 +338,7 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=4096
 CONFIG_HEAP_BASE=
diff --git a/configs/mcu123-lpc214x/nsh/defconfig b/configs/mcu123-lpc214x/nsh/defconfig
index 4ff5bb089e..7c2a09578a 100644
--- a/configs/mcu123-lpc214x/nsh/defconfig
+++ b/configs/mcu123-lpc214x/nsh/defconfig
@@ -554,7 +554,13 @@ CONFIG_EXAMPLES_NSH_MMCSDMINOR=0
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -564,6 +570,7 @@ CONFIG_BOOT_FROM_FLASH=y
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=2048
 CONFIG_HEAP_BASE=
diff --git a/configs/mcu123-lpc214x/ostest/defconfig b/configs/mcu123-lpc214x/ostest/defconfig
index bc5a8fb3a5..af8d0d84b6 100644
--- a/configs/mcu123-lpc214x/ostest/defconfig
+++ b/configs/mcu123-lpc214x/ostest/defconfig
@@ -549,7 +549,13 @@ CONFIG_EXAMPLES_NSH_MMCSDMINOR=0
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -559,6 +565,7 @@ CONFIG_BOOT_FROM_FLASH=y
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=2048
 CONFIG_HEAP_BASE=
diff --git a/configs/mcu123-lpc214x/usbserial/defconfig b/configs/mcu123-lpc214x/usbserial/defconfig
index 1aacbfb74a..c817da59b7 100644
--- a/configs/mcu123-lpc214x/usbserial/defconfig
+++ b/configs/mcu123-lpc214x/usbserial/defconfig
@@ -566,7 +566,13 @@ CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -576,6 +582,7 @@ CONFIG_BOOT_FROM_FLASH=y
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=2048
 CONFIG_HEAP_BASE=
diff --git a/configs/mcu123-lpc214x/usbstorage/defconfig b/configs/mcu123-lpc214x/usbstorage/defconfig
index 82a1cc5c1f..c95bb2dff9 100644
--- a/configs/mcu123-lpc214x/usbstorage/defconfig
+++ b/configs/mcu123-lpc214x/usbstorage/defconfig
@@ -609,7 +609,13 @@ CONFIG_EXAMPLES_USBSTRG_TRACEINTERRUPTS=n
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -619,6 +625,7 @@ CONFIG_BOOT_FROM_FLASH=y
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=2048
 CONFIG_HEAP_BASE=
diff --git a/configs/ntosd-dm320/nettest/defconfig b/configs/ntosd-dm320/nettest/defconfig
index f6f0b199b9..5a4a760ccd 100644
--- a/configs/ntosd-dm320/nettest/defconfig
+++ b/configs/ntosd-dm320/nettest/defconfig
@@ -485,7 +485,13 @@ CONFIG_DM9X_ETRANS=n
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -495,6 +501,7 @@ CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=4096
 CONFIG_HEAP_BASE=
diff --git a/configs/ntosd-dm320/nsh/defconfig b/configs/ntosd-dm320/nsh/defconfig
index 993539e5c0..40489d75c5 100644
--- a/configs/ntosd-dm320/nsh/defconfig
+++ b/configs/ntosd-dm320/nsh/defconfig
@@ -547,7 +547,13 @@ CONFIG_DM9X_ETRANS=n
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -557,6 +563,7 @@ CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=4096
 CONFIG_HEAP_BASE=
diff --git a/configs/ntosd-dm320/ostest/defconfig b/configs/ntosd-dm320/ostest/defconfig
index c1bbf523ac..7a262f725e 100644
--- a/configs/ntosd-dm320/ostest/defconfig
+++ b/configs/ntosd-dm320/ostest/defconfig
@@ -479,7 +479,13 @@ CONFIG_DM9X_ETRANS=n
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -489,6 +495,7 @@ CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=4096
 CONFIG_HEAP_BASE=
diff --git a/configs/ntosd-dm320/udp/defconfig b/configs/ntosd-dm320/udp/defconfig
index ba014b65ef..75e320c68d 100644
--- a/configs/ntosd-dm320/udp/defconfig
+++ b/configs/ntosd-dm320/udp/defconfig
@@ -493,7 +493,13 @@ CONFIG_DM9X_ETRANS=n
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -503,6 +509,7 @@ CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=4096
 CONFIG_HEAP_BASE=
diff --git a/configs/ntosd-dm320/uip/defconfig b/configs/ntosd-dm320/uip/defconfig
index 1d651edf60..3b74efc44a 100644
--- a/configs/ntosd-dm320/uip/defconfig
+++ b/configs/ntosd-dm320/uip/defconfig
@@ -485,7 +485,13 @@ CONFIG_DM9X_ETRANS=n
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -495,6 +501,7 @@ CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=4096
 CONFIG_HEAP_BASE=
diff --git a/configs/olimex-strp711/ostest/defconfig b/configs/olimex-strp711/ostest/defconfig
index 385468debb..04b3606d72 100644
--- a/configs/olimex-strp711/ostest/defconfig
+++ b/configs/olimex-strp711/ostest/defconfig
@@ -616,7 +616,13 @@ CONFIG_EXAMPLES_NSH_MMCSDMINOR=0
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -626,6 +632,7 @@ CONFIG_BOOT_FROM_FLASH=y
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_USERMAIN_STACKSIZE=2048
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=2048
 CONFIG_HEAP_BASE=
diff --git a/configs/pjrc-8051/defconfig b/configs/pjrc-8051/defconfig
index 9851067d18..eeeb10a9b3 100644
--- a/configs/pjrc-8051/defconfig
+++ b/configs/pjrc-8051/defconfig
@@ -321,7 +321,13 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -330,6 +336,7 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=y
 CONFIG_IDLETHREAD_STACKSIZE=
+CONFIG_USERMAIN_STACKSIZE=
 CONFIG_PTHREAD_STACK_MIN=
 CONFIG_PTHREAD_STACK_DEFAULT=
 CONFIG_HEAP_BASE=
diff --git a/configs/sim/mount/defconfig b/configs/sim/mount/defconfig
index d18ef215c2..0135641a95 100644
--- a/configs/sim/mount/defconfig
+++ b/configs/sim/mount/defconfig
@@ -329,7 +329,13 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -337,7 +343,8 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
 #
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
-CONFIG_IDLETHREAD_STACKSIZE=0x00001000
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=8192
 CONFIG_HEAP_BASE=
diff --git a/configs/sim/nettest/defconfig b/configs/sim/nettest/defconfig
index 2f69402081..9cdd3c9def 100644
--- a/configs/sim/nettest/defconfig
+++ b/configs/sim/nettest/defconfig
@@ -328,7 +328,13 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -336,7 +342,8 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
 #
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
-CONFIG_IDLETHREAD_STACKSIZE=0x00001000
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=8192
 CONFIG_HEAP_BASE=
diff --git a/configs/sim/nsh/defconfig b/configs/sim/nsh/defconfig
index 72ee3a69b0..9ea33d86c7 100644
--- a/configs/sim/nsh/defconfig
+++ b/configs/sim/nsh/defconfig
@@ -372,7 +372,13 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -380,7 +386,8 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
 #
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
-CONFIG_IDLETHREAD_STACKSIZE=0x00001000
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=8192
 CONFIG_HEAP_BASE=
diff --git a/configs/sim/ostest/defconfig b/configs/sim/ostest/defconfig
index 8f2d00bee7..a2f049f45c 100644
--- a/configs/sim/ostest/defconfig
+++ b/configs/sim/ostest/defconfig
@@ -323,7 +323,13 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -331,7 +337,8 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 #
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
-CONFIG_IDLETHREAD_STACKSIZE=0x00001000
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=8192
 CONFIG_HEAP_BASE=
diff --git a/configs/sim/pashello/defconfig b/configs/sim/pashello/defconfig
index f6e491f48c..3adc82c57b 100644
--- a/configs/sim/pashello/defconfig
+++ b/configs/sim/pashello/defconfig
@@ -317,7 +317,13 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -325,7 +331,8 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 #
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
-CONFIG_IDLETHREAD_STACKSIZE=0x00001000
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=8192
 CONFIG_HEAP_BASE=
diff --git a/configs/us7032evb1/nsh/defconfig b/configs/us7032evb1/nsh/defconfig
index 5e174b5003..f2bb020570 100644
--- a/configs/us7032evb1/nsh/defconfig
+++ b/configs/us7032evb1/nsh/defconfig
@@ -545,7 +545,13 @@ CONFIG_EXAMPLES_NSH_MMCSDMINOR=0
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -555,6 +561,7 @@ CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=1024
 CONFIG_HEAP_BASE=
diff --git a/configs/us7032evb1/ostest/defconfig b/configs/us7032evb1/ostest/defconfig
index c713a60f47..b599a8bed9 100644
--- a/configs/us7032evb1/ostest/defconfig
+++ b/configs/us7032evb1/ostest/defconfig
@@ -545,7 +545,13 @@ CONFIG_EXAMPLES_NSH_MMCSDMINOR=0
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer (arm7tdmi only)
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -555,6 +561,7 @@ CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_STACK_POINTER=
 CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=1024
 CONFIG_HEAP_BASE=
diff --git a/configs/xtrs/nsh/defconfig b/configs/xtrs/nsh/defconfig
index f9167cc812..316413f4da 100644
--- a/configs/xtrs/nsh/defconfig
+++ b/configs/xtrs/nsh/defconfig
@@ -360,7 +360,13 @@ CONFIG_EXAMPLES_NSH_FATMOUNTPT=/tmp
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -369,6 +375,7 @@ CONFIG_EXAMPLES_NSH_FATMOUNTPT=/tmp
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=1024
 CONFIG_HEAP_SIZE=
diff --git a/configs/xtrs/ostest/defconfig b/configs/xtrs/ostest/defconfig
index cc52ee44c2..5a5a2d1e7a 100644
--- a/configs/xtrs/ostest/defconfig
+++ b/configs/xtrs/ostest/defconfig
@@ -317,7 +317,13 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -326,6 +332,7 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=1024
 CONFIG_HEAP_SIZE=
diff --git a/configs/xtrs/pashello/defconfig b/configs/xtrs/pashello/defconfig
index 95d718d391..d76598566f 100644
--- a/configs/xtrs/pashello/defconfig
+++ b/configs/xtrs/pashello/defconfig
@@ -317,7 +317,13 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -326,6 +332,7 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=1024
 CONFIG_HEAP_SIZE=
diff --git a/configs/z16f2800100zcog/ostest/defconfig b/configs/z16f2800100zcog/ostest/defconfig
index f70a9ef1fa..00ca3f404d 100644
--- a/configs/z16f2800100zcog/ostest/defconfig
+++ b/configs/z16f2800100zcog/ostest/defconfig
@@ -343,7 +343,13 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -352,6 +358,7 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=4096
 CONFIG_HEAP_SIZE=
diff --git a/configs/z16f2800100zcog/pashello/defconfig b/configs/z16f2800100zcog/pashello/defconfig
index af5d25dae6..c887ff4070 100644
--- a/configs/z16f2800100zcog/pashello/defconfig
+++ b/configs/z16f2800100zcog/pashello/defconfig
@@ -343,7 +343,13 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -352,6 +358,7 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_USERMAIN_STACKSIZE=4096
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=4096
 CONFIG_HEAP_SIZE=
diff --git a/configs/z80sim/nsh/defconfig b/configs/z80sim/nsh/defconfig
index 41707a6db1..160fa8dc46 100644
--- a/configs/z80sim/nsh/defconfig
+++ b/configs/z80sim/nsh/defconfig
@@ -350,7 +350,13 @@ CONFIG_EXAMPLES_NSH_FATMOUNTPT=/tmp
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -359,6 +365,7 @@ CONFIG_EXAMPLES_NSH_FATMOUNTPT=/tmp
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=1024
 CONFIG_HEAP_SIZE=
diff --git a/configs/z80sim/ostest/defconfig b/configs/z80sim/ostest/defconfig
index 432a0a6d84..05c3a27f58 100644
--- a/configs/z80sim/ostest/defconfig
+++ b/configs/z80sim/ostest/defconfig
@@ -307,7 +307,13 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -316,6 +322,7 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=1024
 CONFIG_HEAP_SIZE=
diff --git a/configs/z80sim/pashello/defconfig b/configs/z80sim/pashello/defconfig
index 335924315e..54fcf0d992 100644
--- a/configs/z80sim/pashello/defconfig
+++ b/configs/z80sim/pashello/defconfig
@@ -307,7 +307,13 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -316,6 +322,7 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_IDLETHREAD_STACKSIZE=1024
+CONFIG_USERMAIN_STACKSIZE=1024
 CONFIG_PTHREAD_STACK_MIN=256
 CONFIG_PTHREAD_STACK_DEFAULT=1024
 CONFIG_HEAP_SIZE=
diff --git a/configs/z8encore000zco/ostest/defconfig b/configs/z8encore000zco/ostest/defconfig
index dc8c275337..a1a6447828 100644
--- a/configs/z8encore000zco/ostest/defconfig
+++ b/configs/z8encore000zco/ostest/defconfig
@@ -346,7 +346,13 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -355,6 +361,7 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_IDLETHREAD_STACKSIZE=256
+CONFIG_USERMAIN_STACKSIZE=256
 CONFIG_PTHREAD_STACK_MIN=128
 CONFIG_PTHREAD_STACK_DEFAULT=256
 CONFIG_HEAP_SIZE=
diff --git a/configs/z8f64200100kit/ostest/defconfig b/configs/z8f64200100kit/ostest/defconfig
index 9ed7d973cf..2b9e57ffd2 100644
--- a/configs/z8f64200100kit/ostest/defconfig
+++ b/configs/z8f64200100kit/ostest/defconfig
@@ -346,7 +346,13 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 # CONFIG_CUSTOM_STACK - The up_ implementation will handle
 #   all stack operations outside of the nuttx model.
 # CONFIG_STACK_POINTER - The initial stack pointer
-# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack
+# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
+#  This is the thread that (1) performs the inital boot of the system up
+#  to the point where user_start() is spawned, and (2) there after is the
+#  IDLE thread that executes only when there is no other thread ready to
+#  run.
+# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
+#  for the main user thread that begins at the user_start() entry point.
 # CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
 # CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
 # CONFIG_HEAP_BASE - The beginning of the heap
@@ -355,6 +361,7 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
 CONFIG_BOOT_FROM_FLASH=n
 CONFIG_CUSTOM_STACK=n
 CONFIG_IDLETHREAD_STACKSIZE=256
+CONFIG_USERMAIN_STACKSIZE=256
 CONFIG_PTHREAD_STACK_MIN=128
 CONFIG_PTHREAD_STACK_DEFAULT=256
 CONFIG_HEAP_SIZE=
diff --git a/sched/os_start.c b/sched/os_start.c
index 414cbbe05f..b883424c5e 100644
--- a/sched/os_start.c
+++ b/sched/os_start.c
@@ -430,7 +430,7 @@ void os_start(void)
   sdbg("Starting init thread\n");
 #ifndef CONFIG_CUSTOM_STACK
   init_taskid = task_create("init", SCHED_PRIORITY_DEFAULT,
-                            CONFIG_IDLETHREAD_STACKSIZE,
+                            CONFIG_USERMAIN_STACKSIZE,
                             (main_t)user_start, (const char **)NULL);
 #else
   init_taskid = task_create("init", SCHED_PRIORITY_DEFAULT,
-- 
GitLab