Skip to content

Instantly share code, notes, and snippets.

@nraynaud
Last active November 10, 2024 22:55
Show Gist options
  • Save nraynaud/6fdc08807bd81d7ea4b6bcf3391bfbfd to your computer and use it in GitHub Desktop.
Save nraynaud/6fdc08807bd81d7ea4b6bcf3391bfbfd to your computer and use it in GitHub Desktop.
build Zstack with docker
# SPDX-License-Identifier: MIT
#
# Copyright (C) 2024 Olliver Schinagl <[email protected]>
ARG UBUNTU_VERSION="22.04"
ARG TARGET_ARCH="library"
FROM index.docker.io/${TARGET_ARCH}/ubuntu:${UBUNTU_VERSION}
ENV HOME="/build"
ARG SLF2_COMPONENTS="PF_WCONN"
ENV SLF2_COMPONENTS="${SLF2_COMPONENTS}"
ARG SLF2_SDK="/sdk/cc13xx_cc26xx_sdk/"
ENV SLF2_SDK="${SLF2_SDK}"
ARG CCS_VERSION="12.6.0"
ARG CCS_RELEASE="00008"
ADD "https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-J1VdearkvK/${CCS_VERSION}/CCS${CCS_VERSION}.${CCS_RELEASE}_linux-x64.tar.gz" "/tmp/ccs_install/"
ENV CCS_VERSION=${CCS_VERSION}.${CCS_RELEASE}
RUN apt-get update && apt-get install --yes \
'tini' \
'build-essential' \
'cmake' \
'git' \
'libc6-i386' \
'libgconf-2-4' \
'libncurses5' \
'libtinfo5' \
'libusb-0.1-4' \
'python3' \
'unzip' \
&& \
rm -f -r '/var/cache/apt' && \
rm -f -r '/var/lib/apt' && \
echo 'Extracting CCS ...' && \
tar -xvf "/tmp/ccs_install/CCS${CCS_VERSION:?}_linux-x64.tar.gz" -C '/tmp/ccs_install' && \
echo 'Installing CCS ...' && \
"/tmp/ccs_install/CCS${CCS_VERSION}_linux-x64/ccs_setup_${CCS_VERSION}.run" \
--enable-components "${SLF2_COMPONENTS:?}" \
--mode unattended \
--prefix '/opt/ti/' \
&& \
echo 'Wrapping things up' && \
rm -f -r '/tmp/ccs_install' && \
ln -f -s \
'/opt/ti/xdctools_'*'_core' \
'/opt/ti/xdctools_core' \
&& \
ln -f -s \
'/opt/ti/ccs/utils/sysconfig_'* \
'/opt/ti/ccs/utils/sysconfig' \
&& \
ln -f -s \
'/opt/ti/ccs/tools/compiler/ti-cgt-armllvm_'* \
'/opt/ti/ccs/tools/compiler/ti-cgt-armllvm' \
&& \
echo 'Installation complete'
ENV PATH="/opt/ti/ccs/eclipse:/opt/ti/ccs/utils/sysconfig/:${PATH}"
ENV XDC_INSTALL_DIR="/opt/ti/xdctools_core"
ENV SYSCONFIG_TOOL="sysconfig_cli.sh"
ENV CMAKE="cmake"
ENV PYTHON="python3"
ENV TICLANG_ARMCOMPILER="/opt/ti/ccs/tools/compiler/ti-cgt-armllvm"
COPY "container-entrypoint.sh" "/init"
ENTRYPOINT [ "/usr/bin/tini", "--", "/init" ]
# entire script runs in coordinator/Z-Stack_3.x.0
alias zstack='docker run --rm --tty --volume "./:/src" --volume "$PWD/../../simplelink_f2_examples_sdk:/sdk" --volume "./workspace:/build/workspace" --workdir "/build/workspace" "z-stack:dev"'
git submodule add https://github.com/TexasInstruments/simplelink-zstack-examples ../../simplelink_f2_examples_sdk
(cd ../../simplelink_f2_examples_sdk && git submodule add https://github.com/TexasInstruments/cc13xx_cc26xx_sdk.git cc13xx_cc26xx_sdk)
git submodule update --init --recursive
(cd ../../simplelink_f2_examples_sdk/cc13xx_cc26xx_sdk && git apply --ignore-space-change -v --include='source/*' ../../coordinator/Z-Stack_3.x.0/*.patch)
docker build \
--file '../../Containerfile' \
--rm \
--tag 'z-stack:dev' \
'../../'
zstack make --directory='/sdk/cc13xx_cc26xx_sdk' --jobs=$(($(nproc) - 1)) build-ticlang
# https://software-dl.ti.com/ccs/esd/documents/ccs_projects-command-line.html
zstack -noSplash -data '/build/workspace' -application com.ti.ccstudio.apps.projectImport -ccs.copyIntoWorkspace \
-ccs.location /sdk/examples/rtos/CC1352P_2_LAUNCHXL/zstack/znp/tirtos7/ticlang/znp_CC1352P_2_LAUNCHXL_tirtos7_ticlang.projectspec \
-ccs.location /sdk/examples/rtos/CC26X2R1_LAUNCHXL/zstack/znp/tirtos7/ticlang/znp_CC26X2R1_LAUNCHXL_tirtos7_ticlang.projectspec \
-ccs.copyIntoWorkspace -ccs.location /sdk/examples/rtos/LP_CC1352P7_4/zstack/znp/tirtos7/ticlang/znp_LP_CC1352P7_4_tirtos7_ticlang.projectspec \
-ccs.copyIntoWorkspace -ccs.location /sdk/examples/rtos/LP_CC2652R7/zstack/znp/tirtos7/ticlang/znp_LP_CC2652R7_tirtos7_ticlang.projectspec \
-ccs.copyIntoWorkspace -ccs.location /sdk/examples/rtos/LP_CC2652RB/zstack/znp/tirtos7/ticlang/znp_LP_CC2652RB_tirtos7_ticlang.projectspec
# edit/save all the znp.syscfg by hand
# then :
git apply -v --directory=coordinator/Z-Stack_3.x.0 --include='coordinator/Z-Stack_3.x.0/workspace/*' --check --ignore-space-change firmware.patch
# build all
zstack -noSplash -data '/build/workspace' -application com.ti.ccstudio.apps.projectBuild -ccs.workspace -ccs.buildType full
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment