Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pvvx or atc1441, and use buildx for arm64 (m1) #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
docker/tc32_gcc.tar.bz2
SDK/
ATC_MiThermometer/
firmware/
26 changes: 20 additions & 6 deletions 00_bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
#!/bin/bash

if [ ! -d "ATC_MiThermometer" ]; then
read -p "Select flavor of firmware, 'atc1441' or 'pvvx' [atc1441]: " FLAVOR
fi
FLAVOR=${FLAVOR:-atc1441}


echo \#\# First prepare build environment
curl http://shyboy.oss-cn-shenzhen.aliyuncs.com/readonly/tc32_gcc_v2.0.tar.bz2 > docker/tc32_gcc.tar.bz2
docker build ./docker/ -t tc32
if [ ! -f "docker/tc32_gcc.tar.bz2" ]; then
curl http://shyboy.oss-cn-shenzhen.aliyuncs.com/readonly/tc32_gcc_v2.0.tar.bz2 > docker/tc32_gcc.tar.bz2
fi
docker buildx build --platform linux/amd64 ./docker/ -t tc32

if [ ! -d "SDK" ]; then
echo \#\# Now download Telink 825X SDK
git clone --depth=1 https://github.com/Ai-Thinker-Open/Telink_825X_SDK SDK
fi

echo \#\# Now download Telink 825X SDK
git clone --depth=1 https://github.com/Ai-Thinker-Open/Telink_825X_SDK SDK
if [ ! -d "ATC_MiThermometer" ]; then
echo \#\# Download ATC_MiThermometer project
git clone "https://github.com/$FLAVOR/ATC_MiThermometer" ATC_MiThermometer
fi


echo \#\# Download ATC_MiThermometer project
git clone https://github.com/atc1441/ATC_MiThermometer
echo \#\# Done, to change flavor delate folder ATC_MiThermometer and run again
echo \#\# run sh 01_make.sh to build the firmware
23 changes: 22 additions & 1 deletion 01_make.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
#!/bin/bash

docker run --rm -v $PWD:/app -it tc32 -c "cd ATC_MiThermometer/ATC_Thermometer && TEL_PATH=../../SDK make $@"
DEVICE_TYPE="LYWSD03MMC" # LYWSD03MMC, MHO_C401 or CGG1
DOCKER_COMMAND="cd ATC_MiThermometer/ATC_Thermometer && TEL_PATH=../../SDK make"
ATC_MITHERMOMETER_FLAVOR="atc1411"

echo \#\#
echo \#\# Build
echo \#\#
if [ ! -d "ATC_MiThermometer/ATC_Thermometer" ]; then
sed -i '' -E "s/#define DEVICE_TYPE.*\/\//#define DEVICE_TYPE\t\t\tDEVICE_$DEVICE_TYPE \/\//g" ATC_MiThermometer/src/app_config.h
DOCKER_COMMAND="cd ATC_MiThermometer && TEL_PATH=../SDK make"
ATC_MITHERMOMETER_FLAVOR="pvvx"
fi
docker run --rm -v $PWD:/app -it tc32 -c "$DOCKER_COMMAND $@"
echo \#\#
echo \#\# Built $ATC_MITHERMOMETER_FLAVOR ATC_MiThermometer
echo \#\#

mkdir -p firmware
echo \#\#
firmware_out=firmware/ATC_Thermometer_"$ATC_MITHERMOMETER_FLAVOR"_"$DEVICE_TYPE"_"$(date +%s)".bin
cp ATC_MiThermometer/ATC_Thermometer.bin $firmware_out && echo \#\# Here is your awesome firmware: $firmware_out || echo \#\# No file found
echo \#\#
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build environment setup for ATC_MiThermometer

This is a tc32_gcc custom tailored build environment for https://github.com/atc1441/ATC_MiThermometer according to referenced instructions there for linux but in a docker container.
This is a tc32_gcc custom tailored build environment for https://github.com/atc1441/ATC_MiThermometer or https://github.com/pvvx/ATC_MiThermometer according to referenced instructions there for linux but in a docker container.

It shall work on both Linux and macOS with following dependencies installed:
* curl
Expand All @@ -12,7 +12,7 @@ It shall work on both Linux and macOS with following dependencies installed:

* build docker image containing tc32_gcc similar like mentioned in https://github.com/Ai-Thinker-Open/Telink_825X_SDK/blob/master/start_linux.md
* fetches https://github.com/Ai-Thinker-Open/Telink_825X_SDK as SDK
* fetches https://github.com/atc1441/ATC_MiThermometer and patches makefile to be able to run with this build environment using custom SDK location
* fetches https://github.com/atc1441/ATC_MiThermometer or https://github.com/pvvx/ATC_MiThermometer and patches makefile to be able to run with this build environment using custom SDK location

Afterwards you can simply use **01_make.sh** to compile ATC_MiThermometer. If you want you can also add parameter like "**./01_make.sh clean**" to it.

Expand Down