Statistics
| Branch: | Tag: | Revision:

amiro-os / patches / 0001-ARM-fix-rounding-issue-with-WORKING_AREA-stack-size.patch @ 58fe0e0b

History | View | Annotate | Download (1.572 KB)

1
From 8dc86a6495b16e656d5fff4d55b4b6f78e3b3c82 Mon Sep 17 00:00:00 2001
2
From: Robert ABEL <rabel@cit-ec.uni-bielefeld.de>
3
Date: Fri, 4 Jul 2014 16:51:30 +0200
4
Subject: [PATCH] ARM: fix rounding issue with WORKING_AREA stack size
5

    
6
Signed-off-by: Robert ABEL <rabel@cit-ec.uni-bielefeld.de>
7
---
8
 os/ports/GCC/ARMCMx/chcore_v6m.h | 2 +-
9
 os/ports/GCC/ARMCMx/chcore_v7m.h | 2 +-
10
 2 files changed, 2 insertions(+), 2 deletions(-)
11

    
12
diff --git a/os/ports/GCC/ARMCMx/chcore_v6m.h b/os/ports/GCC/ARMCMx/chcore_v6m.h
13
index be1381e..2937be9 100644
14
--- a/os/ports/GCC/ARMCMx/chcore_v6m.h
15
+++ b/os/ports/GCC/ARMCMx/chcore_v6m.h
16
@@ -238,7 +238,7 @@ struct context {
17
  * @details This macro is used to allocate a static thread working area
18
  *          aligned as both position and size.
19
  */
20
-#define WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)]
21
+#define WORKING_AREA(s, n) stkalign_t s[(THD_WA_SIZE(n) + sizeof(stkalign_t) - 1) / sizeof(stkalign_t)]
22
 
23
 /**
24
  * @brief   IRQ prologue code.
25
diff --git a/os/ports/GCC/ARMCMx/chcore_v7m.h b/os/ports/GCC/ARMCMx/chcore_v7m.h
26
index 3706a92..5cb8867 100644
27
--- a/os/ports/GCC/ARMCMx/chcore_v7m.h
28
+++ b/os/ports/GCC/ARMCMx/chcore_v7m.h
29
@@ -338,7 +338,7 @@ struct context {
30
  * @details This macro is used to allocate a static thread working area
31
  *          aligned as both position and size.
32
  */
33
-#define WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)]
34
+#define WORKING_AREA(s, n) stkalign_t s[(THD_WA_SIZE(n) + sizeof(stkalign_t) - 1) / sizeof(stkalign_t)]
35
 
36
 /**
37
  * @brief   IRQ prologue code.
38
-- 
39
1.8.4.msysgit.0
40