From 08cca6b9f8d7d3253868be758deef9280fc949c5 Mon Sep 17 00:00:00 2001
From: NIIBE Yutaka <gniibe@fsij.org>
Date: Mon, 11 Jul 2016 17:21:32 +0900
Subject: stackaddr/size change

---
 example-fsm-55/debian-logo.c   | 20 ++++++++++----------
 example-fsm-55/hh.c            | 20 ++++++++++----------
 example-fsm-55/hiroshi-ayumi.c | 24 ++++++++++++------------
 3 files changed, 32 insertions(+), 32 deletions(-)

(limited to 'example-fsm-55')

diff --git a/example-fsm-55/debian-logo.c b/example-fsm-55/debian-logo.c
index e96fb75..de7ca5c 100644
--- a/example-fsm-55/debian-logo.c
+++ b/example-fsm-55/debian-logo.c
@@ -166,14 +166,14 @@ button (void *arg)
 #define PRIO_LED 3
 #define PRIO_BUTTON 2
 
-extern uint8_t __process1_stack_base__, __process1_stack_size__;
-extern uint8_t __process2_stack_base__, __process2_stack_size__;
+extern uint8_t __process1_stack_base__[], __process1_stack_size__[];
+extern uint8_t __process2_stack_base__[], __process2_stack_size__[];
 
-const uint32_t __stackaddr_led = (uint32_t)&__process1_stack_base__;
-const size_t __stacksize_led = (size_t)&__process1_stack_size__;
+#define STACK_ADDR_LED ((uint32_t)__process1_stack_base__)
+#define STACK_SIZE_LED ((uint32_t)__process1_stack_size__)
 
-const uint32_t __stackaddr_button = (uint32_t)&__process2_stack_base__;
-const size_t __stacksize_button = (size_t)&__process2_stack_size__;
+#define STACK_ADDR_BUTTON ((uint32_t)__process2_stack_base__)
+#define STACK_SIZE_BUTTON ((uint32_t)__process2_stack_size__)
 
 #define DATA55(x0,x1,x2,x3,x4) (x0<<20)|(x1<<15)|(x2<<10)|(x3<< 5)|(x4<< 0)
 #define SIZE55(img) (sizeof (img) / sizeof (uint32_t))
@@ -382,10 +382,10 @@ main (int argc, const char *argv[])
   chopstx_cond_init (&cnd0);
   chopstx_cond_init (&cnd1);
 
-  led_thd = chopstx_create (PRIO_LED, __stackaddr_led,
-			    __stacksize_led, led, NULL);
-  button_thd = chopstx_create (PRIO_BUTTON, __stackaddr_button,
-			       __stacksize_button, button, NULL);
+  led_thd = chopstx_create (PRIO_LED, STACK_ADDR_LED,
+			    STACK_SIZE_LED, led, NULL);
+  button_thd = chopstx_create (PRIO_BUTTON, STACK_ADDR_BUTTON,
+			       STACK_SIZE_BUTTON, button, NULL);
 
   chopstx_usec_wait (200*1000);
 
diff --git a/example-fsm-55/hh.c b/example-fsm-55/hh.c
index 8575383..fc8ad92 100644
--- a/example-fsm-55/hh.c
+++ b/example-fsm-55/hh.c
@@ -166,14 +166,14 @@ button (void *arg)
 #define PRIO_LED 3
 #define PRIO_BUTTON 2
 
-extern uint8_t __process1_stack_base__, __process1_stack_size__;
-extern uint8_t __process2_stack_base__, __process2_stack_size__;
+extern uint8_t __process1_stack_base__[], __process1_stack_size__[];
+extern uint8_t __process2_stack_base__[], __process2_stack_size__[];
 
-const uint32_t __stackaddr_led = (uint32_t)&__process1_stack_base__;
-const size_t __stacksize_led = (size_t)&__process1_stack_size__;
+#define STACK_ADDR_LED ((uint32_t)__process1_stack_base__)
+#define STACK_SIZE_LED ((uint32_t)__process1_stack_size__)
 
-const uint32_t __stackaddr_button = (uint32_t)&__process2_stack_base__;
-const size_t __stacksize_button = (size_t)&__process2_stack_size__;
+#define STACK_ADDR_BUTTON ((uint32_t)__process2_stack_base__)
+#define STACK_SIZE_BUTTON ((uint32_t)__process2_stack_size__)
 
 #define DATA55(x0,x1,x2,x3,x4) (x0<<20)|(x1<<15)|(x2<<10)|(x3<< 5)|(x4<< 0)
 #define SIZE55(img) (sizeof (img) / sizeof (uint32_t))
@@ -370,10 +370,10 @@ main (int argc, const char *argv[])
   chopstx_cond_init (&cnd0);
   chopstx_cond_init (&cnd1);
 
-  led_thd = chopstx_create (PRIO_LED, __stackaddr_led,
-			    __stacksize_led, led, NULL);
-  button_thd = chopstx_create (PRIO_BUTTON, __stackaddr_button,
-			       __stacksize_button, button, NULL);
+  led_thd = chopstx_create (PRIO_LED, STACK_ADDR_LED,
+			    STACK_SIZE_LED, led, NULL);
+  button_thd = chopstx_create (PRIO_BUTTON, STACK_ADDR_BUTTON,
+			       STACK_SIZE_BUTTON, button, NULL);
 
   chopstx_usec_wait (200*1000);
 
diff --git a/example-fsm-55/hiroshi-ayumi.c b/example-fsm-55/hiroshi-ayumi.c
index d465208..c300316 100644
--- a/example-fsm-55/hiroshi-ayumi.c
+++ b/example-fsm-55/hiroshi-ayumi.c
@@ -88,10 +88,10 @@ led_enable_column (uint8_t col)
 
 #define PRIO_LED 3
 
-extern uint8_t __process1_stack_base__, __process1_stack_size__;
+extern uint8_t __process1_stack_base__[], __process1_stack_size__[];
 
-const uint32_t stackaddr_led = (uint32_t)&__process1_stack_base__;
-const size_t stacksize_led = (size_t)&__process1_stack_size__;
+#define STACK_ADDR_LED ((uint32_t)__process1_stack_base__)
+#define STACK_SIZE_LED ((uint32_t)__process1_stack_size__)
 
 static void *
 led (void *arg)
@@ -119,10 +119,10 @@ led (void *arg)
 
 
 #define PRIO_SPK 4
-extern uint8_t __process2_stack_base__, __process2_stack_size__;
+extern uint8_t __process2_stack_base__[], __process2_stack_size__[];
 
-const uint32_t stackaddr_spk = (uint32_t)&__process2_stack_base__;
-const size_t stacksize_spk = (size_t)&__process2_stack_size__;
+#define STACK_ADDR_SPK ((uint32_t)__process2_stack_base__)
+#define STACK_SIZE_SPK ((uint32_t)__process2_stack_size__)
 
 static chopstx_mutex_t spk_mtx;
 static chopstx_cond_t spk_cnd;
@@ -193,10 +193,10 @@ spk (void *arg)
 
 
 #define PRIO_MUSIC 2
-extern uint8_t __process3_stack_base__, __process3_stack_size__;
+extern uint8_t __process3_stack_base__[], __process3_stack_size__[];
 
-const uint32_t stackaddr_music = (uint32_t)&__process3_stack_base__;
-const size_t stacksize_music = (size_t)&__process3_stack_size__;
+#define STACK_ADDR_MUSIC ((uint32_t)__process3_stack_base__)
+#define STACK_SIZE_MUSIC ((uint32_t)__process3_stack_size__)
 
 #define C 0
 #define D 1
@@ -254,7 +254,7 @@ music (void *arg)
   chopstx_cond_init (&spk_cnd);
   chopstx_cond_init (&spk_cnd_no_tone);
 
-  chopstx_create (PRIO_SPK, stackaddr_spk, stacksize_spk, spk, NULL);
+  chopstx_create (PRIO_SPK, STACK_ADDR_SPK, STACK_SIZE_SPK, spk, NULL);
 
   while (1)
     {
@@ -350,8 +350,8 @@ main (int argc, const char *argv[])
   chopstx_mutex_init (&mtx);
   chopstx_cond_init (&cnd);
 
-  chopstx_create (PRIO_LED, stackaddr_led, stacksize_led, led, NULL);
-  chopstx_create (PRIO_MUSIC, stackaddr_music, stacksize_music, music, NULL);
+  chopstx_create (PRIO_LED, STACK_ADDR_LED, STACK_SIZE_LED, led, NULL);
+  chopstx_create (PRIO_MUSIC, STACK_ADDR_MUSIC, STACK_SIZE_MUSIC, music, NULL);
 
   chopstx_usec_wait (200*1000);
 
-- 
cgit v1.2.3