Skip to content

Commit

Permalink
add platform to build directory (#8945)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrdadh authored Sep 7, 2021
1 parent 4f1d6ab commit a3e96c0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 50 deletions.
5 changes: 3 additions & 2 deletions apps/microtvm/reference-vm/arduino/provision_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ set -ex
# NOTE: TVM is presumed to be mounted already by Vagrantfile.
cd "${TVM_HOME}"

apps/microtvm/reference-vm/rebuild-tvm.sh
platform="arduino"
apps/microtvm/reference-vm/rebuild-tvm.sh ${platform}

# Build poetry
cd apps/microtvm/reference-vm/arduino
Expand All @@ -43,6 +44,6 @@ echo "------------------------------[ TVM Message ]-----------------------------
poetry lock -vvv
poetry install

echo "export TVM_LIBRARY_PATH=\"$TVM_HOME\"/build-microtvm" >>~/.profile
echo "export TVM_LIBRARY_PATH=\"$TVM_HOME\"/build-microtvm-${platform}" >>~/.profile
echo "VENV_PATH=\$((cd \"$TVM_HOME\"/apps/microtvm/reference-vm/arduino && poetry env list --full-path) | sed -E 's/^(.*)[[:space:]]\(Activated\)\$/\1/g')" >>~/.profile
echo "source \$VENV_PATH/bin/activate" >>~/.profile
13 changes: 12 additions & 1 deletion apps/microtvm/reference-vm/rebuild-tvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,20 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# "Usage ./apps/microtvm/reference-vm/rebuild-tvm.sh <PLATFORM>"
#

set -e

if [ "$#" -lt 1 -o "$1" == "--help" ]; then
echo "Usage ./apps/microtvm/reference-vm/rebuild-tvm.sh <PLATFORM>"
exit -1
fi

platform=$1
shift 1

# Get number of cores for build
if [ -n "${TVM_CI_NUM_CORES}" ]; then
num_cores=${TVM_CI_NUM_CORES}
Expand All @@ -28,7 +39,7 @@ fi

cd "$(dirname $0)"
cd "$(git rev-parse --show-toplevel)"
BUILD_DIR=build-microtvm
BUILD_DIR="build-microtvm-${platform}"

if [ ! -e "${BUILD_DIR}" ]; then
mkdir "${BUILD_DIR}"
Expand Down
5 changes: 3 additions & 2 deletions apps/microtvm/reference-vm/zephyr/provision_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ set -ex
# NOTE: TVM is presumed to be mounted already by Vagrantfile.
cd "${TVM_HOME}"

apps/microtvm/reference-vm/rebuild-tvm.sh
platform="zephyr"
apps/microtvm/reference-vm/rebuild-tvm.sh ${platform}

# Build poetry
cd apps/microtvm/reference-vm/zephyr
Expand All @@ -44,7 +45,7 @@ poetry lock -vvv
poetry install
poetry run pip3 install -r ${ZEPHYR_BASE}/scripts/requirements.txt

echo "export TVM_LIBRARY_PATH=\"$TVM_HOME\"/build-microtvm" >>~/.profile
echo "export TVM_LIBRARY_PATH=\"$TVM_HOME\"/build-microtvm-${platform}" >>~/.profile
echo "VENV_PATH=\$((cd \"$TVM_HOME\"/apps/microtvm/reference-vm/zephyr && poetry env list --full-path) | sed -E 's/^(.*)[[:space:]]\(Activated\)\$/\1/g')" >>~/.profile
echo "source \$VENV_PATH/bin/activate" >>~/.profile
echo "export PATH=\"\${PATH}:\${HOME}/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin\"" >>~/.profile
43 changes: 0 additions & 43 deletions apps/microtvm/reference-vm/zephyr/rebuild-tvm.sh

This file was deleted.

4 changes: 2 additions & 2 deletions tutorials/micro/micro_reference_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@
Rebuilding TVM inside the Reference VM
--------------------------------------
After the first boot, you'll need to ensure you keep the build, in ``$TVM_HOME/build-microtvm``,
After the first boot, you'll need to ensure you keep the build, in ``$TVM_HOME/build-microtvm-zephyr``,
up-to-date when you modify the C++ runtime or checkout a different revision. You can either
re-provision the machine (``vagrant provision`` in the same directory you ran ``vagrant up`` before)
or manually rebuild TVM yourself.
Remember: the TVM ``.so`` built inside the VM is different from the one you may use on your host
machine. This is why it's built inside the special directory ``build-microtvm``.
machine. This is why it's built inside the special directory ``build-microtvm-zephyr``.
Logging in to the VM
--------------------
Expand Down

0 comments on commit a3e96c0

Please sign in to comment.