Skip to content

Commit

Permalink
Build updated base image - OSS mode and new FVP models 11.22.39
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasHertel80 committed Nov 13, 2023
1 parent 010b351 commit f376edc
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

.DS_Store
*.o
2 changes: 1 addition & 1 deletion docker_base/armgcc_install.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
wget https://artifacts.keil.arm.com/arm-none-eabi-gcc/12.3.1/arm-gnu-toolchain-x86_64-arm-none-eabi.tar.bz2 -nv
tar -xf arm-gnu-toolchain-x86_64-arm-none-eabi.tar.bz2 -C /home/arm_mlops_docker
chown -R arm_mlops_docker /home/arm_mlops_docker/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/
chown -R arm_mlops_docker `/home/arm_mlops_docker/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/`
2 changes: 1 addition & 1 deletion docker_base/armllvm_install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
wget https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-16.0.0/LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64.tar.gz -nv
tar -xf LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64.tar.gz -C /home/arm_mlops_docker
apt install -y libtinfo5
echo 'export PATH="$PATH:/home/arm_mlops_docker/LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64/bin"' >> /home/arm_mlops_docker/.bashrc
#echo 'export "/home/arm_mlops_docker/LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64/bin:$PATH"' >> /home/arm_mlops_docker/.bashrc
chown -R arm_mlops_docker /home/arm_mlops_docker/LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64
8 changes: 4 additions & 4 deletions docker_base/avh-fvp_install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
wget https://artifacts.keil.arm.com/avh/11.21.15/avh-fvp-cortex-m-linux-amd64.tar.bz2 -nv
mkdir /home/arm_mlops_docker/avh-fvp-11.21.15
tar -xvf avh-fvp-cortex-m-linux-amd64.tar.bz2 -C /home/arm_mlops_docker/avh-fvp-11.21.15
chmod 0755 /home/arm_mlops_docker/avh-fvp-11.21.15 -R
wget https://artifacts.keil.arm.com/avh/11.22.39/avh-fvp-linux-amd64.tar.gz -nv
mkdir /home/arm_mlops_docker/avh-fvp-11.22.39
tar -xvf avh-fvp-linux-amd64.tar.gz -C /home/arm_mlops_docker/avh-fvp-11.22.39
chmod 0755 /home/arm_mlops_docker/avh-fvp-11.22.39 -R
8 changes: 4 additions & 4 deletions docker_base/cmsistoolbox_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ echo 'export CMSIS_PACK_ROOT=/home/arm_mlops_docker/packs' >> /home/arm_mlops_do
echo 'export CMSIS_COMPILER_ROOT=/home/arm_mlops_docker/cmsis-toolbox-linux-amd64/etc' >> /home/arm_mlops_docker/.bashrc
echo 'export PATH=/home/arm_mlops_docker/cmake/bin:$PATH' >> /home/arm_mlops_docker/.bashrc
echo 'export PATH=/home/arm_mlops_docker/cmsis-toolbox-linux-amd64/bin:$PATH' >> /home/arm_mlops_docker/.bashrc
echo 'export AC6_TOOLCHAIN_6_20_1=/home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin' >> /etc/environment
echo 'export CMSIS_PACK_ROOT=/home/arm_mlops_docker/packs' >> /etc/environment
echo 'export CMSIS_COMPILER_ROOT=/home/arm_mlops_docker/cmsis-toolbox-linux-amd64/etc' >> /etc/environment
echo 'export PATH=/home/arm_mlops_docker/cmsis-toolbox-linux-amd64/bin:/home/arm_mlops_docker/cmake/bin:/home/arm_mlops_docker/ninja:/home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin:$PATH' >> /etc/environment
echo 'AC6_TOOLCHAIN_6_20_1="/home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin"' >> /etc/environment
echo 'CMSIS_PACK_ROOT="/home/arm_mlops_docker/packs"' >> /etc/environment
echo 'CMSIS_COMPILER_ROOT="/home/arm_mlops_docker/cmsis-toolbox-linux-amd64/etc"' >> /etc/environment
echo 'PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin//home/arm_mlops_docker/cmsis-toolbox-linux-amd64/bin:/home/arm_mlops_docker/cmake/bin:/home/arm_mlops_docker/ninja:/home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin"' >> /etc/environment
export AC6_TOOLCHAIN_6_20_1=/home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin
export CMSIS_PACK_ROOT=/home/arm_mlops_docker/packs
export CMSIS_COMPILER_ROOT=/home/arm_mlops_docker/cmsis-toolbox-linux-amd64/etc
Expand Down
8 changes: 6 additions & 2 deletions docker_licensed/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE} as base

ADD arm_mlops_docker_license /arm_mlops_docker_license
RUN su -l arm_mlops_docker -c "/home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin/armlm import --file /arm_mlops_docker_license"
ADD arm_mlops_docker_license* /arm_mlops_docker_license*
RUN if [ -f /arm_mlops_docker_license ]; then \
su -l arm_mlops_docker -c "/home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin/armlm import --file /arm_mlops_docker_license"; \
else \
su -l arm_mlops_docker -c "/home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin/armlm activate -product KEMDK-COM0 -server https://mdk-preview.keil.arm.com"; \
fi

FROM base
2 changes: 1 addition & 1 deletion local_build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ To locally build the container onto a desktop machine:
- Build an image based on the base image, adding the license. This needs to be rebuild whenever the license expires: \
``` docker build -t arm-mlops-docker-licensed:latest -f ./docker_licensed/Dockerfile ./docker_licensed --build-arg BASE_IMAGE=arm-mlops-docker-base --platform=linux/amd64 ```
- Run an instance of the image: \
``` docker run -d --name local_arm_mlops_container -u root -v .:/workspace --platform=linux/amd64 arm-mlops-docker-licensed:latest ```
``` docker run -d --name local_arm_mlops_container -u root -v .:/workspace --platform=linux/amd64 arm-mlops-docker-licensed:latest sleep infinity ```
- Test if the Arm Compiler can be executed and displays your license: \
```docker exec local_arm_mlops_container su -l arm_mlops_docker -c "/home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin/armclang --version"```
43 changes: 43 additions & 0 deletions local_build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# Check if the license code is provided as an argument
LICENSE_CODE=${1:-}

# Make sure Docker engine is installed
if ! command -v docker &> /dev/null
then
echo "Docker is not installed. Please install Docker and try again."
exit 1
fi

# Check if Docker daemon is running
DOCKER_INFO=$(docker info 2>&1)
if [[ $DOCKER_INFO == *"Cannot connect to the Docker daemon"* ]]; then
echo "Docker is not running. Please start Docker and try again."
exit 1
fi

# Build the base image
docker build -t arm-mlops-docker-base:latest -f ../docker_base/Dockerfile ../docker_base --platform=linux/amd64

# Run an instance of the image in a container
docker run -d --name build_container -u root -v ../:/workspace --platform=linux/amd64 arm-mlops-docker-base:latest sleep infinity

# If the license code is provided, export it and copy to build folder
if [[ -n "$LICENSE_CODE" ]]; then
docker exec build_container /home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin/armlm activate --code $LICENSE_CODE --as-user arm_mlops_docker --to-file /workspace/arm_mlops_docker_license
cp ../arm_mlops_docker_license ../docker_licensed/arm_mlops_docker_license
fi

# Build an image based on the base image, adding the license. This needs to be rebuild whenever the license expires
docker build -t arm-mlops-docker-licensed:latest -f ../docker_licensed/Dockerfile ../docker_licensed --build-arg BASE_IMAGE=arm-mlops-docker-base --platform=linux/amd64

# Run an instance of the image
docker run -d --name local_arm_mlops_container -u root -v $(readlink -f ../):/workspace --platform=linux/amd64 arm-mlops-docker-licensed:latest sleep infinity

# Test if the Arm Compiler can be executed and displays your license
docker exec local_arm_mlops_container su -l arm_mlops_docker -c "/home/arm_mlops_docker/ArmCompilerforEmbedded6.20/bin/armclang --version"

# Test if a Arm Virtual Hardware FVP can be executed
docker exec local_arm_mlops_container su -l arm_mlops_docker -c "/home/arm_mlops_docker/avh-fvp-11.22.39/avh-linux-x86/bin/FVP_MPS2_Cortex-M33 --version"

8 changes: 8 additions & 0 deletions local_build/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Test if a project can be compiled and executed
docker exec local_arm_mlops_container wget -P /home/arm_mlops_docker https://github.com/ARM-software/CMSIS_6/releases/download/dev%2Fv6.0.0-dev35/ARM.CMSIS.6.0.0-dev35+geb1d42a.pack -nv
docker exec local_arm_mlops_container su -l arm_mlops_docker -c "/home/arm_mlops_docker/cmsis-toolbox-linux-amd64/bin/cpackget add ARM.CMSIS.6.0.0-dev35+geb1d42a.pack --agree-embedded-license"
docker exec local_arm_mlops_container wget -P /home/arm_mlops_docker https://github.com/ARM-software/Cortex_DFP/releases/download/dev%2Fv1.0.0-dev15/ARM.Cortex_DFP.1.0.0-dev15+gf6802e4.pack -nv
docker exec local_arm_mlops_container su -l arm_mlops_docker -c "/home/arm_mlops_docker/cmsis-toolbox-linux-amd64/bin/cpackget add ARM.Cortex_DFP.1.0.0-dev15+gf6802e4.pack --agree-embedded-license"

docker exec local_arm_mlops_container su - arm_mlops_docker -c "/home/arm_mlops_docker/cmsis-toolbox-linux-amd64/bin/cbuild /workspace/mlek-kws/MLOps.csolution.yml --packs --context +CM4 --toolchain AC6"
docker exec local_arm_mlops_container su - arm_mlops_docker -c "LD_LIBRARY_PATH=/home/arm_mlops_docker/avh-fvp-11.21.15/avh-fvp-cortex-m-linux-amd64/bin/ /home/arm_mlops_docker/avh-fvp-11.22.39/avh-linux-x86/bin/FVP_MPS2_Cortex-M4 -f /workspace/TFLmicrospeech/Target/CM4/fvp_config.txt /workspace/mlek-kws/out/ML_Test/CM4/size/ML_Test.axf --simlimit 12"

0 comments on commit f376edc

Please sign in to comment.