feat(tools): Move sample_project from examples to tools

Extended example readme.md by further development options.
pull/14184/merge
Marek Fiala 2024-09-13 10:18:20 +02:00
rodzic 5a5c004691
commit 6ec1e9107f
10 zmienionych plików z 19 dodań i 51 usunięć

Wyświetl plik

@ -96,6 +96,18 @@ The `IDF_PATH` environment variable is the only thing that connects the example
If you're looking for a more bare-bones project to start from, try [esp-idf-template](https://github.com/espressif/esp-idf-template).
## Further Development
For further steps on how to develop a project, see the following:
- Managing the project:
- [IDF Frontend](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html#start-a-new-project) document
- ESP-IDF Getting Started video ([YouTube](https://youtu.be/J8zc8mMNKtc?t=340), [bilibili](https://www.bilibili.com/video/BV1114y1r7du/?t=336))
- [Overview](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#example-project) of an example project
- [Build System](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/build-system.html) document
- Writing code:
- Write your own code following the [API references](https://docs.espressif.com/projects/esp-idf/en/stable/api-reference/index.html)
## Contributing Examples
If you have a new example you think we'd like, please consider sending it to us as a Pull Request.

Wyświetl plik

@ -1,44 +0,0 @@
# _Sample project_
(For general overview of examples and their usage, see the `README.md` file in the upper level 'examples' directory.)
> [!NOTE]
> After you click any link to [ESP-IDF Programming Guide](https://docs.espressif.com/projects/esp-idf/en/latest/index.html), go to the top of the sidebar, then make sure you have the appropriate **Espressif chip** (target) and **ESP-IDF version** selected in the dropdown menus.
This is the example of a simplest buildable project. It is also used by the command `idf.py create-project` which copies these files to the path specified by the user and sets the project name.
This sample projects contains:
```sh
├── CMakeLists.txt # Build configuration declaring entire project
├── main
│   ├── CMakeLists.txt # File that registers the main component
│   └── main.c # Source file for the main component
└── README.md # File you are currently browsing
```
If you want to develop a project for the legacy build system based on Make that requires `Makefile` and `component.mk` files, see [esp-idf-template](https://github.com/espressif/esp-idf-template).
## Usage
For brief instructions on how to configure, build, and flash the project, see [Examples README](https://github.com/espressif/esp-idf/blob/master/examples/README.md#using-examples) > Using Examples.
## Further Development
For further steps on how to develop the project, see the following:
- Managing the project:
- [IDF Frontend](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html#start-a-new-project) document
- ESP-IDF Getting Started video ([YouTube](https://youtu.be/J8zc8mMNKtc?t=340), [bilibili](https://www.bilibili.com/video/BV1114y1r7du/?t=336))
- [Overview](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#example-project) of an example project
- [Build System](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/build-system.html) document
- Writing code:
- Find appropriate bits of code in [application examples](https://github.com/espressif/esp-idf/tree/master/examples)
- Write your own code following the [API references](https://docs.espressif.com/projects/esp-idf/en/stable/api-reference/index.html)
## Documentation
If you want to contribute this project as an ESP-IDF application example, please write this README based on the [example README template](https://github.com/espressif/esp-idf/blob/master/docs/TEMPLATE_EXAMPLE_README.md).

Wyświetl plik

@ -427,9 +427,9 @@ if __name__ == '__main__':
check_dirs = {IDF_PATH}
_exclude_dirs = [os.path.join(IDF_PATH, 'tools', 'unit-test-app'),
os.path.join(IDF_PATH, 'tools', 'test_build_system', 'build_test_app'),
os.path.join(IDF_PATH, 'examples', 'get-started', 'sample_project')]
os.path.join(IDF_PATH, 'tools', 'templates', 'sample_project')]
else:
_exclude_dirs = [os.path.join(IDF_PATH, 'examples', 'get-started', 'sample_project')]
_exclude_dirs = [os.path.join(IDF_PATH, 'tools', 'templates', 'sample_project')]
extra_default_build_targets_list: List[str] = []
bypass_check_test_targets_list: List[str] = []

Wyświetl plik

@ -242,3 +242,4 @@ ignore:
- components/protocomm/python/
- components/wifi_provisioning/proto-c/
- components/wifi_provisioning/python/
- tools/templates/

Wyświetl plik

@ -995,7 +995,6 @@ examples/ethernet/basic/main/ethernet_example_main.c
examples/ethernet/enc28j60/components/eth_enc28j60/enc28j60.h
examples/ethernet/enc28j60/main/enc28j60_example_main.c
examples/get-started/blink/main/blink_example_main.c
examples/get-started/sample_project/main/main.c
examples/mesh/internal_communication/main/include/mesh_light.h
examples/mesh/internal_communication/main/mesh_light.c
examples/mesh/internal_communication/main/mesh_main.c
@ -1146,8 +1145,6 @@ tools/ble/lib_gatt.py
tools/catch/catch.hpp
tools/ldgen/samples/template.ld
tools/ldgen/test/data/linker_script.ld
tools/templates/sample_component/include/main.h
tools/templates/sample_component/main.c
tools/test_apps/build_system/embed_test/main/test_main.c
tools/test_apps/build_system/ldgen_test/main/src1.c
tools/test_apps/build_system/ldgen_test/main/src2.c

Wyświetl plik

@ -32,6 +32,9 @@ tools/eclipse-code-style.xml
tools/format.sh
tools/mocks/**/*
tools/set-submodules-to-github.sh
tools/templates/sample_project/main/main.c
tools/templates/sample_project/CMakeLists.txt
tools/templates/sample_project/main/CMakeLists.txt
tools/templates/sample_component/CMakeLists.txt
tools/templates/sample_component/include/main.h
tools/templates/sample_component/main.c

Wyświetl plik

@ -40,7 +40,7 @@ def is_empty_and_create(path: str, action: str) -> None:
def create_project(target_path: str, name: str) -> None:
copytree(
os.path.join(os.environ['IDF_PATH'], 'examples', 'get-started', 'sample_project'),
os.path.join(os.environ['IDF_PATH'], 'tools', 'templates', 'sample_project'),
target_path,
copy_function=copy,
dirs_exist_ok=True,
@ -49,7 +49,6 @@ def create_project(target_path: str, name: str) -> None:
os.rename(os.path.join(main_folder, 'main.c'), os.path.join(main_folder, '.'.join((name, 'c'))))
replace_in_file(os.path.join(main_folder, 'CMakeLists.txt'), 'main', name)
replace_in_file(os.path.join(target_path, 'CMakeLists.txt'), 'main', name)
os.remove(os.path.join(target_path, 'README.md'))
def create_component(target_path: str, name: str) -> None: