From ed25ae2df50aa7c043f982d99ccefb6f5c6ef221 Mon Sep 17 00:00:00 2001 From: Christoph Honal Date: Mon, 4 Apr 2022 02:31:18 +0200 Subject: [PATCH] Update scripts to support P8a --- README.md | 8 ++++---- scripts/.gitignore | 3 ++- scripts/build_all.sh | 20 ++++++++++++++++++-- scripts/build_infinitime.sh | 2 +- scripts/build_infinitime_dev.sh | 10 +++++----- 5 files changed, 30 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 4c7f57f..7f6f0a8 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# InfiniTime on P8b +# InfiniTime on P8 -This repository contains some slightly adjusted versions of the Infinitime application, bootloader and reloader (based on wasp-os), to run on the P8b smartwatch. +This repository contains some slightly adjusted versions of the Infinitime application, bootloader and reloader (based on wasp-os), to run on the P8a and P8b smartwatch. ### P8a vs P8b The (at least the one I have) P8b uses a different SPI flash chip. The bootloader is configured to accept either chip. -In addition, the touch driver is a bit different. The P8b touch driver cannot wake up from sleep mode, so instead the accelerometer is used to detect taps and double taps to wake up. The touch driver configuration set in the factory may also vary. A compile time variable is provided. +In addition, the touch driver is a bit different. The P8 touch driver cannot wake up from sleep mode, so instead the accelerometer is used to detect taps and double taps to wake up. The touch driver configuration set in the factory may also vary. A compile time variable is provided. See the file `HardwareVariants.md` for more info. ## Download Binaries @@ -30,7 +30,7 @@ Run `scripts/init.sh` to set up the repositories, do not clone this repo with al Use the scripts in `scripts/`, run `build_all.sh p8` to build all the firmware for the P8 watch. The Wasp reloader factory package will package the builds of mcuboot and the Infinitime minimal recovery loader. -All scripts accept either `pinetime` or `p8` (this means P8b) as the first argument (Default: `pinetime`). This argument configures the target hardware platform. +All scripts accept either `pinetime`, `p8`, `p8a` or `p8b` as the first argument (Default: `pinetime`). This argument configures the target hardware platform. You can change the compile time parameters in `build_infinitime.sh` if your smartwatch has a different hardware configuration. diff --git a/scripts/.gitignore b/scripts/.gitignore index 07489e9..3e38f02 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -1 +1,2 @@ -factory_image.hex \ No newline at end of file +factory_image.hex +binaries/ \ No newline at end of file diff --git a/scripts/build_all.sh b/scripts/build_all.sh index cbdc32b..58b1aaa 100755 --- a/scripts/build_all.sh +++ b/scripts/build_all.sh @@ -4,6 +4,22 @@ TARGET=${1:-pinetime} echo "Using target $TARGET" cd "${0%/*}" -./build_mcuboot.sh $TARGET +source ./infinitime_version.sh + +TARGETINT=$TARGET +if [ "$TARGETINT" = "p8a" ] || [ "$TARGETINT" = "p8b" ]; then + TARGETINT="p8" +fi; + +./build_mcuboot.sh $TARGETINT ./build_infinitime.sh $TARGET -./build_wasp.sh $TARGET \ No newline at end of file +./build_wasp.sh $TARGETINT + +echo "Copying $TARGET binaries" + +rm -rf ./binaries/$TARGET +mkdir -p ./binaries/$TARGET +cp ../InfiniTime/build/src/pinetime-mcuboot-app-dfu-$INFINITIME_VERSION.zip ./binaries/$TARGET/ +cp ../wasp-os/build-$TARGETINT/reloader-factory.zip ./binaries/$TARGET/ +cp ../wasp-os/build-$TARGETINT/bootloader-daflasher.zip ./binaries/$TARGET/ +cp ../wasp-os/build-$TARGETINT/bootloader.hex ./binaries/$TARGET/ diff --git a/scripts/build_infinitime.sh b/scripts/build_infinitime.sh index b8cd8ea..7eea9fa 100755 --- a/scripts/build_infinitime.sh +++ b/scripts/build_infinitime.sh @@ -11,7 +11,7 @@ cd build COMMON_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DARM_NONE_EABI_TOOLCHAIN_PATH=/usr -DNRF5_SDK_PATH=/opt/nrf5-sdk -DUSE_JLINK=1 -DNRFJPROG=/usr/bin/nrfjprog -DBUILD_DFU=1" if [ "$TARGET" = "pinetime" ]; then cmake -DTARGET_DEVICE=PINETIME -DLF_CLK=XTAL -DDRIVER_ACC=BMA421 $COMMON_OPTIONS .. -elif [ "$TARGET" = "p8" ]; then +elif [ "$TARGET" = "p8" ] || [ "$TARGET" = "p8b" ]; then cmake -DTARGET_DEVICE=P8 -DLF_CLK=RC -DDRIVER_ACC=SC7A20 $COMMON_OPTIONS .. elif [ "$TARGET" = "p8a" ]; then cmake -DTARGET_DEVICE=P8 -DLF_CLK=XTAL -DDRIVER_ACC=BMA421 $COMMON_OPTIONS .. diff --git a/scripts/build_infinitime_dev.sh b/scripts/build_infinitime_dev.sh index 5cdd0fc..d2fb050 100755 --- a/scripts/build_infinitime_dev.sh +++ b/scripts/build_infinitime_dev.sh @@ -8,13 +8,13 @@ cd ../InfiniTime mkdir -p build cd build -COMMON_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DARM_NONE_EABI_TOOLCHAIN_PATH=/usr -DNRF5_SDK_PATH=/opt/nrf5-sdk -DUSE_JLINK=1 -DNRFJPROG=/usr/bin/nrfjprog -DBUILD_DFU=1" +COMMON_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DARM_NONE_EABI_TOOLCHAIN_PATH=/usr -DNRF5_SDK_PATH=/opt/nrf5-sdk -DUSE_JLINK=1 -DNRFJPROG=/usr/bin/nrfjprog -DBUILD_DFU=1" if [ "$TARGET" = "pinetime" ]; then - cmake -DDRIVER_TOUCH=DYNAMIC -DTARGET_DEVICE=PINETIME -DLF_CLK=XTAL -DDRIVER_ACC=BMA421 $COMMON_OPTIONS .. -elif [ "$TARGET" = "p8" ]; then - cmake -DDRIVER_TOUCH=REPORT -DTARGET_DEVICE=P8 -DLF_CLK=RC -DDRIVER_ACC=SC7A20 $COMMON_OPTIONS .. + cmake -DDRIVER_TOUCH=DYNAMIC -DDRIVER_ACC_EVENTS=OFF -DTARGET_DEVICE=PINETIME -DLF_CLK=XTAL -DDRIVER_ACC=BMA421 $COMMON_OPTIONS .. +elif [ "$TARGET" = "p8" ] || [ "$TARGET" = "p8b" ]; then + cmake -DDRIVER_TOUCH=REPORT -DDRIVER_ACC_EVENTS=ON -DTARGET_DEVICE=P8 -DLF_CLK=RC -DDRIVER_ACC=SC7A20 $COMMON_OPTIONS .. elif [ "$TARGET" = "p8a" ]; then - cmake -DDRIVER_TOUCH=GESTURE -DTARGET_DEVICE=P8 -DLF_CLK=XTAL -DDRIVER_ACC=BMA421 $COMMON_OPTIONS .. + cmake -DDRIVER_TOUCH=GESTURE -DDRIVER_ACC_EVENTS=ON -DTARGET_DEVICE=P8 -DLF_CLK=XTAL -DDRIVER_ACC=BMA421 $COMMON_OPTIONS .. fi make -j$(nproc) pinetime-app \ No newline at end of file