summaryrefslogtreecommitdiff
path: root/zephyr/linker
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2021-02-09 13:05:51 -0700
committerCommit Bot <commit-bot@chromium.org>2021-02-10 21:59:33 +0000
commitd6b4ab27daa1e95bcc8939a59e3407ba2574a48b (patch)
treec2e3b280d954b5556d4e6f4be5f3e738241ed7bd /zephyr/linker
parentbd0a091787d9b3cb57ff88dd37b9895ed5c72f03 (diff)
downloadchrome-ec-d6b4ab27daa1e95bcc8939a59e3407ba2574a48b.tar.gz
zephyr: fix version console command
Fixes the data seen by the version console command. Since the version data structure is suppose to be at the same offset from the start of the image, running `version` in the ec terminal previously did not yield any values for the RW image (the .rodata.ver section was at a different offset for RW vs RO). - Add a new fixed-sections.ld file that adds the .fixed section. - Include it into all our builds at the start of the sections. - Add a new macro in common.h to allow us to specify that a section should be at a fixed location (FIXED_SECTION). - Use that macro to put the version information in that location. Sample output: 21-02-09 12:59:45.531 version 21-02-09 12:59:46.638 Chip: chromeos emu 21-02-09 12:59:46.642 Board: 1 21-02-09 12:59:46.647 RO: _v2.0.7390+2d340147c 21-02-09 12:59:46.672 RW: _v2.0.7390+2d340147c 21-02-09 12:59:46.675 Build: _v2.0.7390+2d340147c 21-02-09 12:59:46.680 2021-02-09 12:58:26 BRANCH=none BUG=b:164421798 TEST=build volteer, flash, run `version` command. TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Id19a07d16b5e307d81e8a411b933d9e9a674eb27 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2685339 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'zephyr/linker')
-rw-r--r--zephyr/linker/CMakeLists.txt6
-rw-r--r--zephyr/linker/fixed-sections.ld8
2 files changed, 14 insertions, 0 deletions
diff --git a/zephyr/linker/CMakeLists.txt b/zephyr/linker/CMakeLists.txt
new file mode 100644
index 0000000000..4d8b26f631
--- /dev/null
+++ b/zephyr/linker/CMakeLists.txt
@@ -0,0 +1,6 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Add the fixed sections to the output image.
+zephyr_linker_sources(ROM_START SORT_KEY 1 fixed-sections.ld)
diff --git a/zephyr/linker/fixed-sections.ld b/zephyr/linker/fixed-sections.ld
new file mode 100644
index 0000000000..5046823713
--- /dev/null
+++ b/zephyr/linker/fixed-sections.ld
@@ -0,0 +1,8 @@
+/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#if defined(CONFIG_PLATFORM_EC) && !defined(CONFIG_ARCH_POSIX)
+*(.fixed.*)
+#endif