Skip to content

Commit

Permalink
update components/platforms/alink/component.mk components/spi_devices…
Browse files Browse the repository at this point in the history
…/epaper/epaper.c components/spi_devices/xpt2046/include/iot_xpt2046.h examples/hmi/lvgl_coffee/main/app_main.cpp examples/smart_device/ examples/touch_pad_evb/Makefile

add CMakeList.txt of components
add CMake build for example(aws_iot_demo,check_pedestrian_flow,empty_project,esp32_azure_iot_kit,eth2wifi,hmi,lowpower_evb,oled_screen_module,touch_pad_evb)
add cmake support for ulp co-processor
add CMake build CI
update lvgl ugfx CMake
update example README.md
update solution README.md
add CMakeLists.txt for unit-test-app
update .gitlab-ci.yml
  • Loading branch information
InfiniteYuan committed Apr 10, 2019
1 parent fb277af commit 15a43f8
Show file tree
Hide file tree
Showing 192 changed files with 3,054 additions and 120 deletions.
22 changes: 12 additions & 10 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@

stages:
- build

before_script:
- export PATH="/opt/xtensa-esp32-elf/bin:$PATH"
- export PATH="/opt/esp32ulp-elf-binutils/bin:$PATH"
- export PATH="$CI_PROJECT_DIR/submodule/esp-idf/tools:$PATH"
- python -m pip install --user -r $IDF_PATH/requirements.txt
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- git submodule update --init --recursive
- git submodule update -f --init --recursive

variables:
IDF_PATH: "$CI_PROJECT_DIR/submodule/esp-idf"
Expand All @@ -25,30 +26,30 @@ build:
script:
- cd examples/check_pedestrian_flow
- make defconfig
- make -j8
- idf.py build
- cd ../eth2wifi
- make defconfig
- make -j8
- idf.py build
- cd ../oled_screen_module
- make defconfig
- make -j8
- idf.py build
- cd ../smart_device/alink_smart_device_demo
- make defconfig
- make -j8
- idf.py build
- cd ..
- cd ../empty_project
- make defconfig
- make -j8
- idf.py build
- cd ../hmi/ugfx_example
- make defconfig
- make -j8
- idf.py build
- cd ../lvgl_example
- make defconfig
- make -j8
- idf.py build
- cd ../
- cd ../touch_pad_evb
- make defconfig
- make -j8
- idf.py build
- cd ../ulp_examples/ulp_watering_device
- make defconfig
- make -j8
Expand All @@ -68,3 +69,4 @@ build:
- make defconfig
- make IOT_TEST_ALL=1 -j8


8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

# Overwrite the IDF_PATH to the esp-idf path in submodule.
set(ENV{IDF_PATH} "$ENV{IOT_SOLUTION_PATH}/submodule/esp-idf/")

include($ENV{IOT_SOLUTION_PATH}/components/CMakeLists.txt)
232 changes: 220 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@

---

## <h2 id="preparation">Preparation</h2>
## <h2 id="preparation">Preparation(Make)</h2>

* To clone this repository by

Expand All @@ -215,12 +215,42 @@
* You can refer to the Makefile in example if you want to build your own application.
* To run the example project, please refer to:
* [example](#example)
* [unit-test](#unit-test)
* [example](#example-make)
* [unit-test](#unit-test-make)
---
## Build system and dependency
## <h2 id="preparation">Preparation(CMake)</h2>
* Add to PATH the path to the tools directory inside the IDF_PATH directory.[Add IDF_PATH & idf.py PATH to User Profile(CMake)](https://docs.espressif.com/projects/esp-idf/en/latest/get-started-cmake/add-idf_path-to-profile.html)
* To clone this repository by
```
git clone --recursive https://github.com/espressif/esp-iot-solution
```
* To initialize the submodules
```
git submodule update --init --recursive
```
* Set IOT_SOLUTION_PATH, for example:
```
export IOT_SOLUTION_PATH=~/esp/esp-iot-solution
```
* esp-iot-solution project will over `write` the `IDF_PATH` to the submodule in makefile by default
* You can refer to the Makefile in example if you want to build your own application.
* To run the example project, please refer to:
* [example](#example-cmake)
* [unit-test](#unit-test-cmake)
---
## Build system and dependency (Make)
* We can regard IoT solution project as a platform that contains different device drivers and features
* `Add-on project`: If you want to use those drivers and build your project base on the framework, you need to include the IoT components into your project.
Expand Down Expand Up @@ -263,6 +293,75 @@
---
## Build system and dependency (CMake)
* We can regard IoT solution project as a platform that contains different device drivers and features
* `Add-on project`: If you want to use those drivers and build your project base on the framework, you need to include the IoT components into your project.
```
# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
#If IOT_SOLUTION_PATH is not defined, use relative path as default value
set(IOT_SOLUTION_PATH "$ENV{IOT_SOLUTION_PATH}")
if(NOT IOT_SOLUTION_PATH)
# Documentation says you should set IOT_SOLUTION_PATH in your environment, but we
# can infer it relative to PROJECT_PATH directory if it's not set.
get_filename_component(IOT_SOLUTION_PATH "${PROJECT_PATH}/../.." ABSOLUTE)
endif()
file(TO_CMAKE_PATH "${IOT_SOLUTION_PATH}" IOT_SOLUTION_PATH)
set(ENV{IOT_SOLUTION_PATH} ${IOT_SOLUTION_PATH})
include($ENV{IOT_SOLUTION_PATH}/CMakeLists.txt)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(empty-project)
```
As we can see, in the Makefile of your project, you need to include the Makefile under $(IOT_SOLUTION_PATH) directory so that the build system can involve all the components and drivers you need.
`Note: In this way, the build system will replace the IDF_PATH with the directory of idf repository in submodule during the build process.`
If you don't want the replacement to happen(which means to use the ESP_IDF value from your system environment), you can modify as the following Makefile does:
```
# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
#If IOT_SOLUTION_PATH is not defined, use relative path as default value
set(IOT_SOLUTION_PATH "$ENV{IOT_SOLUTION_PATH}")
if(NOT IOT_SOLUTION_PATH)
# Documentation says you should set IOT_SOLUTION_PATH in your environment, but we
# can infer it relative to PROJECT_PATH directory if it's not set.
get_filename_component(IOT_SOLUTION_PATH "${PROJECT_PATH}/../.." ABSOLUTE)
endif()
file(TO_CMAKE_PATH "${IOT_SOLUTION_PATH}" IOT_SOLUTION_PATH)
set(ENV{IOT_SOLUTION_PATH} ${IOT_SOLUTION_PATH})
include($ENV{IOT_SOLUTION_PATH}/CMakeLists.txt)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(empty-project)
```
* `Stand-alone component`: if you just want to pick one of the component and put it into your existing project, you just need to copy the single component to your project components directory. But you can also append the component list in your project Makefile like this:
```
set(EXTRA_COMPONENT_DIRS "${EXTRA_COMPONENT_DIRS} ${IOT_SOLUTION_PATH}/components/the_one_you_want_to_use")
```
* `Components control`: Usually we don't need all the device drivers to be compiled into our project, we can choose the necessary ones in menuconfig:
```
idf.py menuconfig --> IoT Solution settings --> IoT Components Management
```
Those components that are not enabled, will not be compiled into the project, which alos means, you need to enable the components you would like to use.
---
## Framework
* `components`
Expand All @@ -287,14 +386,17 @@
├── components
├── documents
├── examples
│ └── aws_iot_demo
│ └── check_pedestrian_flow
│ └── empty_project
│ └── esp32_azure_iot_kit
│ └── eth2wifi
│ └── hmi
│ └── lowpower_evb
│ └── oled_screen_module
│ └── smart_device
│ └── touch_pad_evb
│ └── ulp_rtc_gpio
│ └── ulp_watering_device
│ └── ulp_examples
├── submodule
│ └── esp-idf
└── tools
Expand All @@ -303,7 +405,7 @@
---
## Usage
## Usage (Make)
* This code is based on esp-idf project.
* This repository contains esp-idf code as submodule.
Expand All @@ -326,7 +428,30 @@ Exit miniterm by typing Ctrl-].
---
## <h2 id="unit-test">Unit-test</h2>
## Usage (CMake)
* This code is based on esp-idf project.
* This repository contains esp-idf code as submodule.
* To clone this repository by **git clone --recurisve https://github.com/espressif/esp-iot-solution.git**
* Change to the directory of examples (such as examples/smart_device) in esp-iot-solution, run `idf.py menuconfig` to configure the project.
* Compiling the Project by `idf.py build`
> ... will compile app, bootloader and generate a partition table based on the config.
* Flashing the Project
* Flash the binaries by `idf.py flash`
> This will flash the entire project (app, bootloader and partition table) to a new chip. The settings for serial port flashing can be configured with `idf.py menuconfig`.
> You don't need to run `idf.py all` before running `idf.py flash`, `idf.py flash` will automatically rebuild anything which needs it.
* Viewing Serial Output by `idf.py monitor` target will use the already-installed [miniterm](http://pyserial.readthedocs.io/en/latest/tools.html#module-serial.tools.miniterm) (a part of pyserial) to display serial output from the ESP32 on the terminal console.
Exit miniterm by typing Ctrl-].
* To flash and monitor output in one pass, you can run: `idf.py flash monitor`
* You can use unit-test in esp-iot-solution to test all the components.
---
## <h2 id="unit-test">Unit-test (Make)</h2>
[back to top](#preparation)
Expand Down Expand Up @@ -370,7 +495,51 @@ Exit miniterm by typing Ctrl-].
---
## <h2 id="example">Example</h2>
## <h2 id="unit-test">Unit-test (CMake)</h2>
[back to top](#preparation)
### To use uint-test, follow these steps:
* Change to the directory of unit-test-app
```
cd YOUR_IOT_SOLUTION_PATH/tools/unit-test-app
```
* Use the default sdkconfig and compile unit-test-app by `make IOT_TEST_ALL=1 -j8`
```
make defconfig
make IOT_TEST_ALL=1
```
* Flash the images by `make flash`
```
make IOT_TEST_ALL=1 flash
```
* Reset the chip and see the uart log using an uart tool such as minicom
* All kinds of components will be shown by uart
```
Here's the test menu, pick your combo:
(1) "Sensor BH1750 test" [bh1750][iot][sensor]
(2) "Button test" [button][iot]
(3) "Button cpp test" [button_cpp][iot]
(4) "Dac audio test" [dac_audio][iot][audio]
(5) "Debug cmd test" [debug][iot]
(6) "Deep sleep gpio test" [deep_sleep][rtc_gpio][current][iot]
(7) "Deep sleep touch test" [deep_sleep][touch][current][iot]
......
```
* You need to send the index of the unit you want to test by uart. Test code of the unit you select will be run
---
## <h2 id="example">Example (Make)</h2>
[back to top](#preparation)
Expand All @@ -394,12 +563,51 @@ Exit miniterm by typing Ctrl-].
---
## <h2 id="empty_project">Empty project</h2>
## <h2 id="example">Example (CMake)</h2>
[back to top](#preparation)
### To run the Examples projects, follow the steps below:
* Change the directory to example
* choose one example project you want to run, we take smart_device here.
* Change the directory to the example project under example directory, take smart_device example as example here:
```
cd YOUR_IOT_SOLUTION_PATH/example/smart_device/alink_smart_device_demo
```
* Run `idf.py menuconfig` to set the project parameters in
```
idf.py menuconfig --> IoT Example - smart_device
```
* Run `idf.py` to compile the project, or `idf.py flash` to compile and flash the module.
---
## <h2 id="empty_project">Empty project (Make)</h2>
[back to top](#preparation)
* You can start your own appliction code base on the empty_project.
* By default, you just need to run `make` under the example/empty_project directory. The makefile will set all the path by default.
* Meanwhile, you can copy the example project to anywhere you want, in this case, you will have to set the `IOT_SOLUTION_PATH` so that the build system shall know where to find the code and link the files.
* Set iot path:(replace 'YOUR_PATH' below), you can also add `IOT_SOLUTION_PATH ` to your environment PATH
```
export IOT_SOLUTION_PATH = "YOUR_PATH/esp-iot-solution"
```
---
## <h2 id="empty_project">Empty project (CMake)</h2>
[back to top](#preparation)
* You can start your own appliction code base on the empty-project.
* By default, you just need to run `make` under the example/smart_device directory. The makefile will set all the path by default.
* You can start your own appliction code base on the empty_project.
* By default, you just need to run `idf.py build` under the example/empty_project directory. The makefile will set all the path by default.
* Meanwhile, you can copy the example project to anywhere you want, in this case, you will have to set the `IOT_SOLUTION_PATH` so that the build system shall know where to find the code and link the files.
* Set iot path:(replace 'YOUR_PATH' below), you can also add `IOT_SOLUTION_PATH ` to your environment PATH
Expand Down
19 changes: 19 additions & 0 deletions components/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

set(IOT_COMPONENT_DIRS ${IOT_COMPONENT_DIRS}
$ENV{IOT_SOLUTION_PATH}/components
$ENV{IOT_SOLUTION_PATH}/components/features
$ENV{IOT_SOLUTION_PATH}/components/general
$ENV{IOT_SOLUTION_PATH}/components/wifi
$ENV{IOT_SOLUTION_PATH}/components/spi_devices
$ENV{IOT_SOLUTION_PATH}/components/i2c_devices
$ENV{IOT_SOLUTION_PATH}/components/i2c_devices/sensor
$ENV{IOT_SOLUTION_PATH}/components/i2c_devices/others
$ENV{IOT_SOLUTION_PATH}/components/network
$ENV{IOT_SOLUTION_PATH}/components/platforms
$ENV{IOT_SOLUTION_PATH}/components/motor/stepper
$ENV{IOT_SOLUTION_PATH}/components/motor/servo
$ENV{IOT_SOLUTION_PATH}/components/framework
$ENV{IOT_SOLUTION_PATH}/components/i2s_devices
$ENV{IOT_SOLUTION_PATH}/components/hmi )

set(EXTRA_COMPONENT_DIRS "${EXTRA_COMPONENT_DIRS} ${IOT_COMPONENT_DIRS}")
2 changes: 2 additions & 0 deletions components/__config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

register_config_only_component()
Loading

0 comments on commit 15a43f8

Please sign in to comment.