• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. _module-pw_kernel-cheat-sheet:
2
3===========
4Cheat Sheet
5===========
6.. pigweed-module-subpage::
7   :name: pw_kernel
8
9.. _module-pw_kernel-build:
10
11-------------
12rust_analyzer
13-------------
14
15Generating rust-project.json
16============================
17
18For a given ``$CONFIG`` in:
19
20* k_host
21* k_qemu_mps2_an505
22* k_rp2350
23
24.. code-block:: shell
25
26   bazelisk run @rules_rust//tools/rust_analyzer:gen_rust_project -- --config $CONFIG //pw_kernel/...
27
28
29Errors and warnings in VSCode
30=============================
31
32Add this to Pigweed's ``.vscode/settings.json``.  Note that it only builds the
33kernel targets to limit the amount of time that it takes to run.  Substitute
34``$CONFIG`` for the config chosen above.
35
36.. code-block:: json
37
38   "rust-analyzer.check.overrideCommand": [
39     "bazelisk",
40     "build",
41     "--config=$CONFIG",
42     "--@rules_rust//:error_format=json",
43     "//pw_kernel/..."
44   ],
45
46--------------
47Build and Test
48--------------
49
50Host
51====
52
53Test
54----
55
56.. code-block:: shell
57
58   bazelisk test --config k_host //pw_kernel/...
59
60QEMU
61====
62
63Test
64----
65
66.. code-block:: shell
67
68   bazelisk test --config k_qemu_mps2_an505 //pw_kernel/...
69
70Run
71---
72
73^A-x to exit qemu
74
75.. code-block:: shell
76
77   bazelisk run --config k_qemu_mps2_an505 //pw_kernel/entry:kernel
78
79RP2350 Target Board
80===================
81
82Build
83-----
84
85.. code-block:: shell
86
87   bazelisk build --config k_rp2350 //pw_kernel/entry:kernel
88
89Flash
90-----
91
92.. code-block:: shell
93
94   probe-rs download --chip rp2350 bazel-bin/pw_kernel/entry/kernel && probe-rs reset
95