summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Grandi <agrandi@google.com>2022-08-26 20:18:47 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-09-12 21:23:20 +0000
commit801af54b125fced75596f37592b31f76a45f1d29 (patch)
treeff089f18ee07ca1fafaaeac2c06ac409d19ee212
parent3b2b654318c1375a3aa9031db087ea3845628a5d (diff)
downloadchrome-ec-801af54b125fced75596f37592b31f76a45f1d29.tar.gz
docs/ide-support.md: Update instructions for clangd
The native Makefiles can now generate a compile_commands.json for clangd. Update and simplify instructions by removing the dependencies on bear and the Python script that translates the paths outside the chroot. BUG=b:236389226,b:176500425 TEST=none BRANCH=none Cq-Depend: chromium:3826375 Signed-off-by: Andrea Grandi <agrandi@google.com> Change-Id: I2f2f654c175e3ad5e076c621b02a7ec28cea88f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3859872 Reviewed-by: Craig Hesling <hesling@chromium.org> Reviewed-by: Bobby Casey <bobbycasey@google.com>
-rw-r--r--docs/ide-support.md51
1 files changed, 29 insertions, 22 deletions
diff --git a/docs/ide-support.md b/docs/ide-support.md
index 55ce33117c..1a8abda422 100644
--- a/docs/ide-support.md
+++ b/docs/ide-support.md
@@ -70,6 +70,10 @@ ChromeOS source files.
Support for `platform/ec` is not available out of the box (yet), but can be
manually enabled following these steps.
+### Prerequisites
+
+Install CrOS IDE following the [quickstart guide]
+
<!-- mdformat off(b/139308852) -->
*** note
NOTE: CrOS IDE uses the VSCode extension `clangd` for code completion and
@@ -78,37 +82,40 @@ navigation. The installation of CrOS IDE disables the built-in
***
<!-- mdformat on -->
-### Prerequisites
+### Configure EC Board
-1. Install CrOS IDE following the [quickstart guide]
-1. Install `bear`, a utility to generate the compilation database
+1. Enter the EC repository:
- ```
- (chroot) $ sudo emerge bear
+ ```bash
+ (chroot) $ cd ~/chromiumos/src/platform/ec
```
-[quickstart guide]: https://chromium.googlesource.com/chromiumos/chromite/+/main/ide_tooling/docs/quickstart.md
+1. Create a `compile_commands.json` for the all EC boards:
-### Configure EC Board
+ ```bash
+ (chroot) $ make all-ide-compile-cmds -j
+ ```
-1. Build the image and create new compile_commands.json using `bear`
+1. Select a particular board:
- ```
- (chroot) $ cd ~/chromiumos/src/platform/ec
- export BOARD=bloonchipper
- make clean BOARD=${BOARD}
- bear make -j BOARD=${BOARD}
- mv compile_commands.json compile_commands_inside_chroot.json
+ ```bash
+ (chroot) $ export BOARD=bloonchipper
```
-1. Generate the new compile_commands.json (use the absolute path outside chroot
- as first argument)
+1. Copy the new `compile_commands.json` in the root of the EC repository:
```bash
- (chroot) $ cd ~/chromiumos/chromite/ide_tooling/scripts
- python compdb_no_chroot.py ${EXTERNAL_TRUNK_PATH} \
- < ~/chromiumos/src/platform/ec/compile_commands_inside_chroot.json \
- > ~/chromiumos/src/platform/ec/compile_commands.json
+ cp build/${BOARD}/RW/compile_commands.json .
```
- The command will overwrite the file `compile_commands.json`, if it already
- exists.
+
+Note: a single `compile_commands.json` can only cover one specific build
+configuration. Only the `compile_commands.json`placed in the root of the EC
+repository is considered active. When the build configuration changes (e.g. user
+wants to use a different board), repeat steps 3 and 4 to replace the active
+`compile_commands.json` file.
+
+To create a `compile_commands.json` for a specific EC board:
+
+```bash
+(chroot) $ make BOARD=${BOARD} ide-compile-cmds
+```