summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-10 13:56:01 -0700
committerCommit Bot <commit-bot@chromium.org>2021-03-11 06:07:13 +0000
commit9070a18e72f867e987a87f819f7db8b017e767f1 (patch)
treec93b1d68d50c9b72b6a49f12397dd7589446906e /docs
parented5f46d3a7d931f6f2aed9ccfc2edbb4f0fb6576 (diff)
downloadchrome-ec-9070a18e72f867e987a87f819f7db8b017e767f1.tar.gz
zephyr: Add a step-by-step guide
Add a guide to make it easier for people to add a new Kconfig. BUG=b:181253613 BRANCH=none TEST=none Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I2714c02f3541a07c18cfa1d4a40e6b75fb2aa4fa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2749762 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'docs')
-rw-r--r--docs/zephyr_shim.md42
1 files changed, 42 insertions, 0 deletions
diff --git a/docs/zephyr_shim.md b/docs/zephyr_shim.md
index c33a983a4a..019ad1013d 100644
--- a/docs/zephyr_shim.md
+++ b/docs/zephyr_shim.md
@@ -326,6 +326,48 @@ Zephyr's build system (including shimmed code) uses CMake instead of
`Makefiles`, and your code will not be compiled for Zephyr unless you
list the files in `zephyr/CMakeLists.txt`.
+## Step-by-step guide to adding a Kconfig
+
+Follow these steps:
+
+1. Make sure you have read the above Configuration section
+
+2. Add your config to one of zephyr/Kconfig* files. Note the PLATFORM_EC_ prefix
+ and try to put it near related things:
+
+ ```kconfig
+ config PLATFORM_EC_CHARGER_BQ25720
+ bool "TI BQ25720 charger"
+ help
+ The TI BQ25720 is a blah blah (describe summary from datasheet,
+ at least 3 lines so take 10 minutes to write something truly useful)
+ ```
+
+ Consider a `depends on PLATFORM_EC_...` line if it depends on an existing
+ feature.
+
+3. Add to zephyr/shim/include/config_chip.h (put it at the bottom):
+
+ ```kconfig
+ #undef CONFIG_CHARGER_BQ25720
+ #ifdef CONFIG_PLATFORM_EC_CHARGER_BQ25720
+ #define CONFIG_CHARGER_BQ25720
+ #endif
+ ```
+
+4. Add the source file to zephyr/CMakeLists.txt if it is not already there. For
+ ordering check the comments in that file:
+
+ `zephyr_sources_ifdef(CONFIG_PLATFORM_EC_CHARGER_BQ25720
+ "${PLATFORM_EC}/driver/charger/bq25720.c")`
+
+5. Run a build on a board that enables the new CONFIG (in config.h) to make sure
+ there are no problems.
+
+6. If it doesn't work, please email zephyr-task-force@ or file a bug and assign
+ it to sjg@, cc zephyr-task-force@ (please include CL link and the error
+ output).
+
## Unit Tests
Unit tests, implemented using the Ztest framework, can be found in