You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2020/01/30 08:23:21 UTC
[incubator-nuttx-apps] branch master updated: examples: hello: Show
CPU index when running in SMP mode
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 715517b examples: hello: Show CPU index when running in SMP mode
715517b is described below
commit 715517b1a0c2c5215f87fc17d34bb72263094583
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Thu Jan 30 13:24:07 2020 +0900
examples: hello: Show CPU index when running in SMP mode
Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
examples/hello/hello_main.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/examples/hello/hello_main.c b/examples/hello/hello_main.c
index 953597a..a533eff 100644
--- a/examples/hello/hello_main.c
+++ b/examples/hello/hello_main.c
@@ -40,6 +40,10 @@
#include <nuttx/config.h>
#include <stdio.h>
+#ifdef CONFIG_SMP
+# include <nuttx/arch.h>
+#endif
+
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -50,6 +54,12 @@
int main(int argc, FAR char *argv[])
{
+#ifdef CONFIG_SMP
+ uint32_t cpu = up_cpu_index();
+
+ printf("Hello, World from CPU%d !!\n", cpu);
+#else
printf("Hello, World!!\n");
+#endif
return 0;
}