瀏覽代碼

KBF-13 add setup docs

Bence Balint 3 年之前
父節點
當前提交
abeee38f37
共有 2 個文件被更改,包括 66 次插入0 次删除
  1. 65 0
      README.md
  2. 1 0
      test_app/.idea/misc.xml

+ 65 - 0
README.md

@@ -0,0 +1,65 @@
+# Kraxor's Boilerplate Framework
+
+A collection of useful things in the form of an `esp-idf` component.
+
+## Using as a component
+
+To use `kbf` as an `esp-idf` component, clone it into the `components` subdirectory of your project:
+
+```shell
+cd /path/to/project/components
+git clone https://git.kraxor.net/kraxor/kbf.git
+cd kbf
+git submodule update --init
+```
+
+Then you can `REQUIRE` it in `idf_component_register` in your app's `CMakeLists.txt`:
+
+```cmake
+idf_component_register(
+        SRCS "app_main.cpp"
+        REQUIRES "kbf"
+        INCLUDE_DIRS "."
+)
+
+```
+
+## Checkout as standalone project
+
+For a standalone checkout, in order for the test application to compile, the parent directory of the project root (`test_app/../..`) is included in `EXTRA_COMPONENT_DIRS`.
+This is fine when used as a component, but will cause issues if this directory contains other projects that are not `esp-idf` components.
+
+Therefore, if you want to setup `kbf` as a standalone project, it is recommended to clone the project into a subdirectory:
+
+```shell
+mkdir ~/src/kbf
+cd ~/src/kbf 
+git clone https://git.kraxor.net/kraxor/kbf.git
+cd kbf  # ~/src/kbf/kbf/
+git submodule init && git submodule update
+```
+
+## CLion setup
+
+The smoothest way is to open the `test_app` as a project, e.g. following the above example:
+
+```shell
+clion ~/src/kbf/kbf/test_app
+```
+
+Next, you need to setup `cmake`.
+In `File / Settings / Build, Execution, Deployment / CMake`, add the following to `CMake options`:
+
+```shell
+-DIDF_PATH=/path/to/esp-idf
+```
+
+Then you need to add `IDF_PATH` again, this time as an environment variable,
+along with the `PATH` variable updated by `/path/to/esp-idf/export.sh`.
+In my case, it looks like this:
+
+```
+IDF_PATH=/home/kraxor/src/esp-idf;PATH=/home/kraxor/src/kbf/esp-idf/components/esptool_py/esptool:/home/kraxor/src/esp-idf/components/espcoredump:/home/kraxor/src/esp-idf/components/partition_table:/home/kraxor/src/esp-idf/components/app_update:/home/kraxor/.espressif/python_env/idf4.4_py3.8_env/bin:/home/kraxor/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin:/home/kraxor/.espressif/tools/xtensa-esp32s2-elf/esp-2020r3-8.4.0/xtensa-esp32s2-elf/bin:/home/kraxor/.espressif/tools/xtensa-esp32s3-elf/esp-2020r3-8.4.0/xtensa-esp32s3-elf/bin:/home/kraxor/.espressif/tools/riscv32-esp-elf/1.24.0.123_64eb9ff-8.4.0/riscv32-esp-elf/bin:/home/kraxor/.espressif/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin:/home/kraxor/.espressif/tools/esp32s2ulp-elf/2.28.51-esp-20191205/esp32s2ulp-elf-binutils/bin:/home/kraxor/.espressif/tools/openocd-esp32/v0.10.0-esp32-20200709/openocd-esp32/bin:/home/kraxor/src/esp-idf/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
+```
+
+After this, CLion should be able to parse `test_app/CMakeLists.txt` and add the parent directory (i.e. `kbf` root) and `esp-idf` to the project.

+ 1 - 0
test_app/.idea/misc.xml

@@ -4,6 +4,7 @@
   <component name="CidrRootsConfiguration">
     <libraryRoots>
       <file path="$USER_HOME$/esp/esp-idf" />
+      <file path="$PROJECT_DIR$/../../../esp-idf" />
       <file path="$PROJECT_DIR$/../lib" />
     </libraryRoots>
     <excludeRoots>