summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2021-10-07 23:10:42 +0000
committerCommit Bot <commit-bot@chromium.org>2021-10-12 18:50:36 +0000
commitb2d5fc19f2b3c46c9fe8abe2bde28223d971dd27 (patch)
tree9d85977932015322d25090d82c6c100b8c552e8f
parentf0c36b07d9efa2f5b12e5de7e794d723e8468e26 (diff)
downloadchrome-ec-b2d5fc19f2b3c46c9fe8abe2bde28223d971dd27.tar.gz
core/cortex-m[0]: Replace calculation with variable for readability
PANIC_DATA_PTR is defined as ((struct panic_data *)CONFIG_PANIC_DATA_BASE) which is CONFIG_RAM_BASE + CONFIG_RAM_SIZE - CONFIG_PANIC_DATA_SIZE Instead of doing that calculation again, just re-use PANIC_DATA_PTR, which more clearly shows the relationship between pdata_ptr and pstack_addr. As indicated by the TEST line, this results in no change to the generated code. BRANCH=none BUG=b:172020503 TEST=./util/compare_build.sh -b all => MATCH Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I52f769b388dd47269b74d70a651868fcd6c339b5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3213285 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--core/cortex-m/panic.c3
-rw-r--r--core/cortex-m0/panic.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/core/cortex-m/panic.c b/core/cortex-m/panic.c
index da6900b1b9..248d27f0b7 100644
--- a/core/cortex-m/panic.c
+++ b/core/cortex-m/panic.c
@@ -25,8 +25,7 @@ static int bus_fault_ignored;
static struct panic_data * const pdata_ptr = PANIC_DATA_PTR;
/* Preceded by stack, rounded down to nearest 64-bit-aligned boundary */
-static const uint32_t pstack_addr = (CONFIG_RAM_BASE + CONFIG_RAM_SIZE
- - sizeof(struct panic_data)) & ~7;
+static const uint32_t pstack_addr = ((uint32_t)pdata_ptr) & ~7;
/**
* Print the name and value of a register
diff --git a/core/cortex-m0/panic.c b/core/cortex-m0/panic.c
index 4fe69fddb1..26447e4b7a 100644
--- a/core/cortex-m0/panic.c
+++ b/core/cortex-m0/panic.c
@@ -24,8 +24,7 @@ static int bus_fault_ignored;
static struct panic_data * const pdata_ptr = PANIC_DATA_PTR;
/* Preceded by stack, rounded down to nearest 64-bit-aligned boundary */
-static const uint32_t pstack_addr = (CONFIG_RAM_BASE + CONFIG_RAM_SIZE
- - sizeof(struct panic_data)) & ~7;
+static const uint32_t pstack_addr = ((uint32_t)pdata_ptr) & ~7;
/**
* Print the name and value of a register