Skip to content

Commit

Permalink
Update build docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
f34rdotcom committed Dec 30, 2022
1 parent a206d6e commit 9ca78ed
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ Changes:
### Change log
- [ ] SM FTPD: Does not build with stsdk.
- [ ] SM CORE: Testing modules build. All built even mqtt? Ok... I did not expect that. Needs testing.
- [X] SM CORE: Update README.md docs on building project including stsdk and platformio.
- [X] SM CORE: Add fixes for stsdk code that I have been sitting on. Mostly just CDECL stuff.
- [X] SM CORE: Fix CMakeList.txt to fetch SimpleIni from github and include it for stsdk building.
- [X] SM CORE: Travis build platform io project test.
- [X] SM CORE: Travis build platformio project test.
- [X] SM CORE: Fix sdkconfig.defaults was missing critical bits. Better organized now and "should" build same exact same firmware as in release.
- [X] SM CORE: Fix missing compile flag ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH
- [X] SM TWILIO: Improve error handling and response data validation.
Expand Down
43 changes: 32 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* 5.8.1. [Configuration for FTP server](#configuration-for-ftp-server)
* 6. [Building firmware](#building-firmware)
* 6.1. [PlatformIO](#platformio)
* 6.1.1. [TODO: Setup notes](#todo:-setup-notes)
* 6.1.1. [TODO: Setup notes](#platformio-setup-notes)
* 6.2. [SmartThings device SDK build environment](#smartthings-device-sdk-build-environment)
* 6.2.1. [Setup build environment](#setup-build-environment)
* 6.2.2. [Configure the project](#configure-the-project)
Expand Down Expand Up @@ -734,31 +734,52 @@ Examples:

## 6. <a name='building-firmware'></a>Building firmware
### 6.1. <a name='platformio'></a>PlatformIO
#### 6.1.1. <a name='todo:-setup-notes'></a>TODO: Setup notes
#### 6.1.1. <a name='platformio-setup-notes'></a>Open the project and use the platformio UI inside of vscode to build and flash. Select esp32dev or esp32-poe-iso tree and select Build to compile.
### 6.2. <a name='smartthings-device-sdk-build-environment'></a>SmartThings device SDK build environment
#### 6.2.1. <a name='setup-build-environment'></a>Setup build environment
- Follow the instructions in the [SmartThings SDK for Direct connected devices for C](https://github.com/SmartThingsCommunity/st-device-sdk-c-ref) project for setting up a build environment. Confirm you can build the switch_example before continuing.
- Select the esp32 build environment. Branch v1.4 seems to be the current active branch and uses espidf v4.0.1-317-g50b3e2c81.
- Based on the instructions in the [SmartThings SDK for Direct connected devices for C](https://github.com/SmartThingsCommunity/st-device-sdk-c-ref) for setting up a build environment and [This community post](https://community.smartthings.com/t/how-to-build-direct-connected-devices/204055) to build the code inside of the stsdk c-ref build environment.
```
# Make the root esp folder.
cd ~
mkdir esp
# Install the xtensa esp32 compiler
cd ~/esp
git clone https://github.com/SmartThingsCommunity/st-device-sdk-c-ref.git -b release/v1.4
cd st-device-sdk-c-ref
./setup.py esp32
```
wget https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
tar -xvf xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
- Place the contents of this his project in ```st-device-sdk-c-ref/apps/esp32/```
# Get and install esp-idf toolchain v4.3.2
cd ~/esp
git clone -b v4.3.2 --recursive https://github.com/espressif/esp-idf.git
cd ~/esp/esp-idf
./install.sh
#### 6.2.2. <a name='configure-the-project'></a>Configure the project
# Install st-device-sdk-c-ref master branch currently v1.7.5.
cd ~/esp
git clone https://github.com/SmartThingsCommunity/st-device-sdk-c-ref.git
cd st-device-sdk-c-ref
python setup.py esp32
## At the end will be prompted to set the environment for building by sourcing the exports.sh file created during setup of stsdk c-ref.
. ./export.sh
# Link our external AlarmDecoder-IoT project into the apps folder for st-device-sdk-c-ref.
ln -s ~/Code/AlarmDecoder-IoT ~/esp/st-device-sdk-c-ref/apps/esp32
```

#### 6.2.2. <a name='configure-the-project'></a>Configure the project
Run menu config and enable/disable components. Each module will consume code space and memory so test with the ```top``` command to be sure resources are not being exausted.
```
./build.sh esp32 AlarmDecoder-IoT menuconfig
cd ~/esp/st-device-sdk-c-ref
./build.py esp32 AlarmDecoder-IoT menuconfig
```

#### 6.2.3. <a name='build,-flash,-and-run'></a>Build, Flash, and Run

Build the project and flash it to the board, then run monitor tool to view serial output:

```
cd ~/esp/st-device-sdk-c-ref
./build.sh esp32 AlarmDecoder-IoT build flash monitor -p /dev/ttyUSB0
```

Expand Down

1 comment on commit 9ca78ed

@f34rdotcom
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to enable ST. Does not build if enabled. Back to the start...

Please sign in to comment.