From 715517b1a0c2c5215f87fc17d34bb72263094583 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Thu, 30 Jan 2020 13:24:07 +0900 Subject: [PATCH] examples: hello: Show CPU index when running in SMP mode Signed-off-by: Masayuki Ishikawa --- 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 953597aa2..a533eff35 100644 --- a/examples/hello/hello_main.c +++ b/examples/hello/hello_main.c @@ -40,6 +40,10 @@ #include #include +#ifdef CONFIG_SMP +# include +#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; }