summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/examples/cpuhog/cpuhog_main.c27
-rw-r--r--nuttx/configs/sam4s-xplained-pro/nsh/defconfig10
-rw-r--r--nuttx/configs/sam4s-xplained-pro/src/sam4s-xplained-pro.h2
-rw-r--r--nuttx/configs/sam4s-xplained-pro/src/sam_boot.c25
-rw-r--r--nuttx/configs/sam4s-xplained-pro/src/sam_nsh.c10
-rw-r--r--nuttx/include/nuttx/arch.h2
6 files changed, 64 insertions, 12 deletions
diff --git a/apps/examples/cpuhog/cpuhog_main.c b/apps/examples/cpuhog/cpuhog_main.c
index 4e5fe3593..486895065 100644
--- a/apps/examples/cpuhog/cpuhog_main.c
+++ b/apps/examples/cpuhog/cpuhog_main.c
@@ -35,6 +35,31 @@
****************************************************************************/
/****************************************************************************
+ * Example usage:
+ *
+ * NuttShell (NSH)
+ * nsh> cpuhog > /dev/ttyS1 &
+ * cpuhog [5:50]
+ * nsh> cpuhog > /dev/ttyS2 &
+ * cpuhog [7:50]
+ * nsh> cpuhog &
+ * cpuhog [8:50]
+ * nsh> cpuhog 2
+ * ps
+ * PID PRI SCHD TYPE NP STATE CPU NAME
+ * 0 0 FIFO TASK READY 0.9% Idle Task()
+ * 1 192 FIFO KTHREAD WAITSIG 0.0% work()
+ * 2 200 FIFO KTHREAD WAITSIG 0.0% wdog()
+ * 3 100 FIFO TASK RUNNING 0.0% init()
+ * 5 50 RR TASK WAITSEM 27.7% cpuhog(20009c70, 20009c80)
+ * 7 50 RR TASK WAITSEM 30.3% cpuhog(20008c00, 20008c10)
+ * 8 50 RR TASK READY 41.7% cpuhog()
+ * nsh>
+ *
+ ****************************************************************************/
+
+
+/****************************************************************************
* Included Files
****************************************************************************/
@@ -158,6 +183,8 @@ int cpuhog_main(int argc, char *argv[])
up_udelay(3000);
}
+
+ fflush(stdout);
}
return 0;
diff --git a/nuttx/configs/sam4s-xplained-pro/nsh/defconfig b/nuttx/configs/sam4s-xplained-pro/nsh/defconfig
index f4ba2b6a8..21c24a4e3 100644
--- a/nuttx/configs/sam4s-xplained-pro/nsh/defconfig
+++ b/nuttx/configs/sam4s-xplained-pro/nsh/defconfig
@@ -125,12 +125,12 @@ CONFIG_ARCH_CORTEXM4=y
# CONFIG_ARCH_CORTEXA8 is not set
CONFIG_ARCH_FAMILY="armv7-m"
CONFIG_ARCH_CHIP="sam34"
-# CONFIG_ARMV7M_USEBASEPRI is not set
+CONFIG_ARMV7M_USEBASEPRI=y
# CONFIG_ARCH_HAVE_FPU is not set
CONFIG_ARCH_HAVE_MPU=y
CONFIG_ARMV7M_MPU=y
CONFIG_ARMV7M_MPU_NREGIONS=8
-# CONFIG_DEBUG_HARDFAULT is not set
+CONFIG_DEBUG_HARDFAULT=y
#
# ARMV7M Configuration Options
@@ -241,8 +241,8 @@ CONFIG_SAM34_EXTNANDSIZE=268435456
# AT91SAM3/4 GPIO Interrupt Configuration
#
CONFIG_SAM34_GPIO_IRQ=y
-CONFIG_SAM34_GPIOA_IRQ=y
-CONFIG_SAM34_GPIOB_IRQ=y
+# CONFIG_SAM34_GPIOA_IRQ is not set
+# CONFIG_SAM34_GPIOB_IRQ is not set
CONFIG_SAM34_GPIOC_IRQ=y
#
@@ -408,7 +408,7 @@ CONFIG_NAME_MAX=32
#
# RTOS hooks
#
-# CONFIG_BOARD_INITIALIZE is not set
+CONFIG_BOARD_INITIALIZE=y
# CONFIG_SCHED_STARTHOOK is not set
# CONFIG_SCHED_ATEXIT is not set
# CONFIG_SCHED_ONEXIT is not set
diff --git a/nuttx/configs/sam4s-xplained-pro/src/sam4s-xplained-pro.h b/nuttx/configs/sam4s-xplained-pro/src/sam4s-xplained-pro.h
index c5efc2c60..88aaae719 100644
--- a/nuttx/configs/sam4s-xplained-pro/src/sam4s-xplained-pro.h
+++ b/nuttx/configs/sam4s-xplained-pro/src/sam4s-xplained-pro.h
@@ -86,7 +86,7 @@
/* We need PIO interrupts on PIOC to support card detect interrupts */
-#if defined(HAVE_HSMCI) && !defined(CONFIG_GPIOC_IRQ)
+#if defined(HAVE_HSMCI) && !defined(CONFIG_SAM34_GPIOC_IRQ)
# warning PIOC interrupts not enabled. No MMC/SD support.
# undef HAVE_HSMCI
#endif
diff --git a/nuttx/configs/sam4s-xplained-pro/src/sam_boot.c b/nuttx/configs/sam4s-xplained-pro/src/sam_boot.c
index 3e4f7128a..8c06ca825 100644
--- a/nuttx/configs/sam4s-xplained-pro/src/sam_boot.c
+++ b/nuttx/configs/sam4s-xplained-pro/src/sam_boot.c
@@ -40,6 +40,7 @@
#include <nuttx/config.h>
#include <debug.h>
+#include <nuttx/watchdog.h>
#include "sam4s-xplained-pro.h"
@@ -73,3 +74,27 @@ void sam_boardinitialize(void)
board_led_initialize();
#endif
}
+
+
+/****************************************************************************
+ * Name: board_initialize
+ *
+ * Description:
+ * If CONFIG_BOARD_INITIALIZE is selected, then an additional
+ * initialization call will be performed in the boot-up sequence to a
+ * function called board_initialize(). board_initialize() will be
+ * called immediately after up_initialize() is called and just before the
+ * initial application is started. This additional initialization phase
+ * may be used, for example, to initialize board-specific device drivers.
+ *
+ ****************************************************************************/
+#ifdef CONFIG_BOARD_INITIALIZE
+void board_initialize(void)
+{
+#if (defined(CONFIG_SAM34_WDT) && !defined(CONFIG_WDT_DISABLE_ON_RESET))
+ /* Enable watchdog timer kicker kernel thread. */
+
+ DEBUGASSERT(up_wdginitialize() >= 0);
+#endif
+}
+#endif /* CONFIG_BOARD_INITIALIZE */
diff --git a/nuttx/configs/sam4s-xplained-pro/src/sam_nsh.c b/nuttx/configs/sam4s-xplained-pro/src/sam_nsh.c
index 9ecd00d6b..bbca0dd81 100644
--- a/nuttx/configs/sam4s-xplained-pro/src/sam_nsh.c
+++ b/nuttx/configs/sam4s-xplained-pro/src/sam_nsh.c
@@ -112,7 +112,7 @@ int nsh_archinitialize(void)
ret = cdcacm_initialize(CONFIG_SAM4S_XPLAINED_PRO_CDCACM_DEVMINOR, NULL);
if (ret < 0)
{
- message("ERROR: Failed to create the CDC/ACM serial device: %d\n", errno);
+ message("ERROR: Failed to create the CDC/ACM serial device: %d (%d)\n", ret, errno);
return ret;
}
#endif
@@ -124,7 +124,7 @@ int nsh_archinitialize(void)
ret = sam_hsmci_initialize();
if (ret < 0)
{
- message("ERROR: sam_hsmci_initialize() failed: %d\n", ret);
+ message("ERROR: sam_hsmci_initialize() failed: %d (%d)\n", ret, errno);
return ret;
}
#endif
@@ -136,7 +136,7 @@ int nsh_archinitialize(void)
ret = mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0)
{
- message("ERROR: Failed to mount the PROC filesystem: %d\n", errno);
+ message("ERROR: Failed to mount the PROC filesystem: %d (%d)\n", ret, errno);
return ret;
}
#endif
@@ -146,7 +146,7 @@ int nsh_archinitialize(void)
ret = mount("/dev/mmcsd0", "/fat", "vfat", 0, NULL);
if (ret < 0)
{
- message("ERROR: Failed to mount the FAT filesystem: %d\n", errno);
+ message("ERROR: Failed to mount the FAT filesystem: %d (%d)\n", ret, errno);
return ret;
}
#endif
@@ -164,7 +164,7 @@ int nsh_archinitialize(void)
ret = usbmonitor_start(0, NULL);
if (ret != OK)
{
- message("nsh_archinitialize: Start USB monitor: %d\n", ret);
+ message("nsh_archinitialize: Start USB monitor: %d (%d)\n", ret, errno);
return ret;
}
#endif
diff --git a/nuttx/include/nuttx/arch.h b/nuttx/include/nuttx/arch.h
index dceee8ab1..d8bb76992 100644
--- a/nuttx/include/nuttx/arch.h
+++ b/nuttx/include/nuttx/arch.h
@@ -158,7 +158,7 @@ void up_initialize(void);
* If CONFIG_BOARD_INITIALIZE is selected, then an additional
* initialization call will be performed in the boot-up sequence to a
* function called board_initialize(). board_initialize() will be
- * called immediately after up_intiialize() is called and just before the
+ * called immediately after up_initialize() is called and just before the
* initial application is started. This additional initialization phase
* may be used, for example, to initialize board-specific device drivers.
*