|
| 1 | +FROM ubuntu:latest AS upstream |
| 2 | + |
| 3 | +ARG DEBIAN_FRONTEND=noninteractive |
| 4 | + |
| 5 | +# Get curl, git and unzip |
| 6 | +RUN apt-get update \ |
| 7 | + && apt-get install -y curl git unzip \ |
| 8 | + && apt-get clean \ |
| 9 | + && rm -rf /var/lib/apt/lists/* |
| 10 | + |
| 11 | +# Setup Arduino CLI |
| 12 | +#RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/usr/local/bin sh |
| 13 | +RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh |
| 14 | + |
| 15 | +# Start config file |
| 16 | +RUN arduino-cli config init --additional-urls https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/main/package_sparkfun_apollo3_index.json |
| 17 | + |
| 18 | +# Update core index |
| 19 | +RUN arduino-cli core update-index |
| 20 | + |
| 21 | +# Update library index |
| 22 | +RUN arduino-cli lib update-index |
| 23 | + |
| 24 | +# Install core |
| 25 | +RUN arduino-cli core install "Sparkfun:[email protected]" |
| 26 | + |
| 27 | +# Get known libraries |
| 28 | +# RUN arduino-cli lib install "SparkFun Qwiic Power Switch Arduino Library" |
| 29 | +RUN arduino-cli lib install "SdFat"@2.2.2 |
| 30 | +RUN arduino-cli lib install "SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library"@1.3.0 |
| 31 | +RUN arduino-cli lib install "SparkFun I2C Mux Arduino Library"@1.0.3 |
| 32 | +RUN arduino-cli lib install "SparkFun CCS811 Arduino Library"@2.0.3 |
| 33 | +RUN arduino-cli lib install "SparkFun VL53L1X 4m Laser Distance Sensor"@1.2.12 |
| 34 | +RUN arduino-cli lib install "SparkFun BME280"@2.0.11 |
| 35 | +RUN arduino-cli lib install "SparkFun LPS25HB Pressure Sensor Library"@1.1.1 |
| 36 | +RUN arduino-cli lib install "SparkFun VEML6075 Arduino Library"@1.1.5 |
| 37 | +RUN arduino-cli lib install "SparkFun PHT MS8607 Arduino Library"@1.0.5 |
| 38 | +RUN arduino-cli lib install "SparkFun MCP9600 Thermocouple Library"@1.0.5 |
| 39 | +RUN arduino-cli lib install "SparkFun SGP30 Arduino Library"@1.0.5 |
| 40 | +RUN arduino-cli lib install "SparkFun VCNL4040 Proximity Sensor Library"@1.0.4 |
| 41 | +RUN arduino-cli lib install "SparkFun MS5637 Barometric Pressure Library"@1.0.2 |
| 42 | +RUN arduino-cli lib install "SparkFun High Precision Temperature Sensor TMP117 Qwiic"@1.2.5 |
| 43 | +RUN arduino-cli lib install "SparkFun u-blox GNSS Arduino Library"@2.2.26 |
| 44 | +RUN arduino-cli lib install "SparkFun 6DoF ISM330DHCX"@1.0.6 |
| 45 | +RUN arduino-cli lib install "SparkFun Qwiic Scale NAU7802 Arduino Library"@1.0.6 |
| 46 | +RUN arduino-cli lib install "SparkFun SCD30 Arduino Library"@1.0.20 |
| 47 | +RUN arduino-cli lib install "SparkFun Qwiic Humidity AHT20"@1.0.3 |
| 48 | +RUN arduino-cli lib install "SparkFun SHTC3 Humidity and Temperature Sensor Library"@1.1.4 |
| 49 | +RUN arduino-cli lib install "SparkFun ADS122C04 ADC Arduino Library"@1.0.4 |
| 50 | +RUN arduino-cli lib install "SparkFun MicroPressure Library"@1.0.1 |
| 51 | +RUN arduino-cli lib install "SparkFun Particle Sensor Panasonic SN-GCJA5"@1.0.1 |
| 52 | +RUN arduino-cli lib install "SparkFun SGP40 Arduino Library"@1.0.4 |
| 53 | +RUN arduino-cli lib install "SparkFun Qwiic Button and Qwiic Switch Library"@2.0.6 |
| 54 | +RUN arduino-cli lib install "SparkFun Bio Sensor Hub Library"@1.0.6 |
| 55 | +RUN arduino-cli lib install "SparkFun MMC5983MA Magnetometer Arduino Library"@1.1.4 |
| 56 | +RUN arduino-cli lib install "SparkFun ADS1015 Arduino Library"@2.3.2 |
| 57 | +RUN arduino-cli lib install "SparkFun KX13X Arduino Library"@2.0.4 |
| 58 | +RUN arduino-cli lib install "SparkFun SDP3x Arduino Library"@1.0.4 |
| 59 | +RUN arduino-cli lib install "SparkFun LPS28DFW Arduino Library"@1.0.0 |
| 60 | +RUN arduino-cli lib install "SparkFun VEML7700 Arduino Library"@1.0.0 |
| 61 | +RUN arduino-cli lib install "SparkFun TMP102 Breakout"@1.1.2 |
| 62 | + |
| 63 | +# Enable external libs |
| 64 | +RUN arduino-cli config set library.enable_unsafe_install true |
| 65 | + |
| 66 | +# Add BlueRobotics_MS5837_Library from git |
| 67 | +RUN arduino-cli lib install --git-url https://github.com/bluerobotics/BlueRobotics_MS5837_Library.git |
| 68 | + |
| 69 | +# Deploy |
| 70 | +FROM upstream AS deployment |
| 71 | + |
| 72 | +# Add the source files |
| 73 | +ADD . . |
| 74 | + |
| 75 | +# Patch Apollo Core |
| 76 | +RUN cd ./Extras \ |
| 77 | + && unzip UartPower3.zip \ |
| 78 | + && cp HardwareSerial.h /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-extend/HardwareSerial.h \ |
| 79 | + && cp HardwareSerial.cpp /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-implement/HardwareSerial.cpp \ |
| 80 | + && cp UnbufferedSerial.h /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/mbed-os/drivers/UnbufferedSerial.h \ |
| 81 | + && cp serial_api.c /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/mbed-os/targets/TARGET_Ambiq_Micro/TARGET_Apollo3/device/serial_api.c \ |
| 82 | + && cp libmbed-os.a /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/variants/SFE_ARTEMIS_ATP/mbed/libmbed-os.a \ |
| 83 | + && cp SPI.cpp /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/libraries/SPI/src/SPI.cpp |
| 84 | + |
| 85 | +# Enable DMP on ICM 20948 |
| 86 | +RUN sed -i 's|//#define ICM|#define ICM|g' /root/Arduino/libraries/SparkFun_9DoF_IMU_Breakout_-_ICM_20948_-_Arduino_Library/src/util/ICM_20948_C.h |
| 87 | + |
| 88 | +# Enable debug symbols |
| 89 | +# echo "compiler.c.extra_flags=-MMD -g3" >> /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/platform.local.txt |
| 90 | +# echo "compiler.cxx.extra_flags=-MMD -g3" >> /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/platform.local.txt |
| 91 | + |
| 92 | +# Disable Power Loss Protection |
| 93 | +RUN cd ./OpenLog_Artemis \ |
| 94 | + && sed -i 's|#define noPowerLossProtection|//#define noPowerLossProtection|g' OpenLog_Artemis.ino |
| 95 | + |
| 96 | +# X04 Hardware |
| 97 | +RUN cd ./OpenLog_Artemis \ |
| 98 | + && sed -i 's|#define HARDWARE_VERSION_MAJOR 1|#define HARDWARE_VERSION_MAJOR 0|g' OpenLog_Artemis.ino \ |
| 99 | + && sed -i 's|#define HARDWARE_VERSION_MINOR 0|#define HARDWARE_VERSION_MINOR 4|g' OpenLog_Artemis.ino |
| 100 | + |
| 101 | +# Compile |
| 102 | +RUN cd ./OpenLog_Artemis \ |
| 103 | + && arduino-cli compile -v -e -b SparkFun:apollo3:sfe_artemis_atp OpenLog_Artemis.ino |
| 104 | + |
| 105 | +# Copy the compile output. List the files |
| 106 | +FROM deployment AS output |
| 107 | +COPY --from=deployment ./OpenLog_Artemis/build/SparkFun.apollo3.sfe_artemis_atp / |
| 108 | +CMD echo $(ls /*.*) |
0 commit comments