Guest User

Dockerfile

a guest
Jan 31st, 2022
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. FROM ubuntu:20.04
  2.  
  3. RUN ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
  4. # Download tools and prerequisites
  5. RUN apt-get update && \
  6. apt-get install -y curl git unzip bzip2 build-essential gcc-multilib srecord pkg-config python3 libusb-1.0.0 python-is-python3 && \
  7. apt-get clean all
  8.  
  9. # Download and install ARM toolchain matching the SDK
  10. RUN curl -SL https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 > /tmp/gcc-arm-none-eabi-9-2019-q4-major-linux.tar.bz2 && \
  11. tar xvjf /tmp/gcc-arm-none-eabi-9-2019-q4-major-linux.tar.bz2 -C /usr/local/ && \
  12. rm /tmp/gcc-arm-none-eabi-9-2019-q4-major-linux.tar.bz2
  13.  
  14. # Download NRF5 SDK v16.0.0 and extract nRF5 SDK to/nrf5/sdk/v16.0
  15. RUN curl -SL http://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v16.x.x/nRF5_SDK_16.0.0_98a08e2.zip > /tmp/SDK_16.0.0.zip && \
  16. mkdir -p /nrf5/sdk/v16.0 && \
  17. unzip -q /tmp/SDK_16.0.0.zip -d /nrf5/sdk/v16.0 && \
  18. rm /tmp/SDK_16.0.0.zip
  19.  
  20. # Patch around what is likely to be an oversight in Nordic's SDK
  21. # https://devzone.nordicsemi.com/f/nordic-q-a/68352/gcc-toolchain-version-for-sdk-17-0-2-on-posix
  22. RUN \
  23. echo "GNU_INSTALL_ROOT ?= /usr/local/gcc-arm-none-eabi-9-2019-q4-major/bin/" > /nrf5/sdk/v16.0/components/toolchain/gcc/Makefile.posix && \
  24. echo "GNU_VERSION ?= 9.2.1" >> /nrf5/sdk/v16.0/components/toolchain/gcc/Makefile.posix && \
  25. echo "GNU_PREFIX ?= arm-none-eabi" >> /nrf5/sdk/v16.0/components/toolchain/gcc/Makefile.posix
  26.  
  27. # Add micro-ecc to SDK and build it
  28. RUN curl -SL https://github.com/kmackay/micro-ecc/archive/v1.0.zip > /tmp/micro-ecc_v1.0.zip && \
  29. unzip -q /tmp/micro-ecc_v1.0.zip -d /nrf5/sdk/v16.0/external/micro-ecc && \
  30. mv /nrf5/sdk/v16.0/external/micro-ecc/micro-ecc-1.0 /nrf5/sdk/v16.0/external/micro-ecc/micro-ecc && \
  31. make -C /nrf5/sdk/v16.0/external/micro-ecc/nrf51_armgcc/armgcc && \
  32. make -C /nrf5/sdk/v16.0/external/micro-ecc/nrf51_iar/armgcc && \
  33. make -C /nrf5/sdk/v16.0/external/micro-ecc/nrf51_keil/armgcc && \
  34. make -C /nrf5/sdk/v16.0/external/micro-ecc/nrf52hf_armgcc/armgcc && \
  35. make -C /nrf5/sdk/v16.0/external/micro-ecc/nrf52hf_iar/armgcc && \
  36. make -C /nrf5/sdk/v16.0/external/micro-ecc/nrf52hf_keil/armgcc && \
  37. make -C /nrf5/sdk/v16.0/external/micro-ecc/nrf52nf_armgcc/armgcc && \
  38. make -C /nrf5/sdk/v16.0/external/micro-ecc/nrf52nf_iar/armgcc && \
  39. make -C /nrf5/sdk/v16.0/external/micro-ecc/nrf52nf_keil/armgcc && \
  40. rm /tmp/micro-ecc_v1.0.zip
  41.  
  42. # JLink and debug setup
  43. COPY JLink_Linux_V760f_x86_64.deb /tmp/
  44. RUN apt install -y /tmp/JLink_Linux_V760f_x86_64.deb && \
  45. apt install -y libncurses5
  46.  
  47. # Install nRF Tools (makes it easy to build a DFU package)
  48. RUN apt-get update && apt-get install -y python3-pip && \
  49. pip install nrfutil
  50.  
  51. # Install nRF programming tools
  52. RUN curl -SL https://www.nordicsemi.com/-/media/Software-and-other-downloads/Desktop-software/nRF-command-line-tools/sw/Versions-10-x-x/10-15-2/nrf-command-line-tools_10.15.2_amd64.deb > /tmp/nrf-cli.deb && \
  53. dpkg -i /tmp/nrf-cli.deb
  54.  
  55. # The environment variables
  56. ENV GCC_PATH /usr/local/gcc-arm-none-eabi-9-2019-q4-major
  57. ENV NRF_PATH /nrf5/sdk
Advertisement
Add Comment
Please, Sign In to add comment