diff --git a/compile_all.py b/compile_all.py index 09094d6..9c3d544 100755 --- a/compile_all.py +++ b/compile_all.py @@ -62,17 +62,11 @@ def build(algo_dir, template_dir, build_dir): wd = os.getcwd() os.chdir(build_dir) try: - if os.path.isfile('./configure'): - subprocess.check_call(["./configure"]) - stdout_path = 'make.stdout.log' stderr_path = 'make.stderr.log' with open(stdout_path, 'w') as outfile, \ open(stderr_path, 'w') as errfile: - subprocess.check_call(['make'], stdout=outfile, stderr=errfile) - - if os.path.isfile('./cleanup'): - subprocess.check_call(["./cleanup"]) + subprocess.check_call(['./compile'], stdout=outfile, stderr=errfile) finally: sys.stdout.flush() diff --git a/process_zip.sh b/process_zip.sh index a831223..8dc37c3 100755 --- a/process_zip.sh +++ b/process_zip.sh @@ -64,27 +64,7 @@ function run() { mv $cipher/*.log "$TEST_PATH" cp test_vectors/$VARIANT/LWC_AEAD_KAT_*.txt "$TEST_PATH/LWC_AEAD_KAT.txt" || exit 1 - - case $TEMPLATE in - f1-libopencm3) mv $cipher/firmware.{bin,elf} "$TEST_PATH" - ;; - - f7) mv $cipher/build/f7.* "$TEST_PATH" - ;; - - maixduino) mv $cipher/.pio/build/sipeed-maixduino/firmware.* "$TEST_PATH" - ;; - - bluepill) mv $cipher/.pio/build/bluepill_f103c8/firmware.* "$TEST_PATH" - ;; - - uno) mv $cipher/.pio/build/uno/firmware.* "$TEST_PATH" - ;; - - esp32) mv $cipher/.pio/build/esp32dev/firmware.* $cipher/.pio/build/esp32dev/partitions.bin "$TEST_PATH" - ;; - esac - + mv $TMPDIR/$CIPHER_SLUG/*{.elf,.bin,.hex,.map} "$TEST_PATH" curl \ --request 'POST' \ @@ -102,7 +82,7 @@ function run() { done - rm -rf "$TMPDIR" + #rm -rf "$TMPDIR" } if [[ $1 == "run" ]]; then @@ -119,13 +99,13 @@ else TMPDIR=$(mktemp -d -t submission-XXXXXXXXXX) echo "Extracting in $TMPDIR" unzip $ZIP_PATH -d $TMPDIR - for i in templates/{uno,bluepill,esp32,f7,maixduino}; do + for i in templates/{uno,bluepill,f7,longan-nano,esp32,maixduino}; do TEMPLATE="${i##*/}" echo "Template is $TEMPLATE" touch $MAINDIR/locky.lock flock $MAINDIR/locky.lock $0 run $TMPDIR $TEMPLATE $MAINDIR/$TEMPLATE done - rm -rf $TMPDIR + #rm -rf $TMPDIR fi diff --git a/templates/bluepill/Makefile b/templates/bluepill/Makefile deleted file mode 100644 index b1ae053..0000000 --- a/templates/bluepill/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -NISTGCCFLAGS=-std=c99 -Wall -Wextra -Wshadow -fsanitize=address,undefined -O2 -LFLAGS=-lm -all: bluepill_f103c8 - -bluepill_f103c8: .pioenvs/bluepill_f103c8/firmware.hex - -.pioenvs/bluepill_f103c8/firmware.hex: FORCE - platformio run -e bluepill_f103c8 - -FORCE: ; -.PHONY: clean - -clean: - -rm .pioenvs/uno/firmware.hex diff --git a/templates/bluepill/configure b/templates/bluepill/compile similarity index 84% rename from templates/bluepill/configure rename to templates/bluepill/compile index dfa9981..195015c 100755 --- a/templates/bluepill/configure +++ b/templates/bluepill/compile @@ -9,4 +9,5 @@ mv -n *.c *.S src/ mv -n *.dat *.inc *.h include/ sed -i src/encrypt.c -e "s/\(\s\)init(/\1encrypt_init(/g" -exit 0 +platformio run -e bluepill_f103c8 || exit +mv .pio/build/bluepill_f103c8/firmware.* . diff --git a/templates/esp32/configure b/templates/esp32/compile similarity index 84% rename from templates/esp32/configure rename to templates/esp32/compile index 2e69c6b..b5fe767 100755 --- a/templates/esp32/configure +++ b/templates/esp32/compile @@ -8,4 +8,6 @@ done mv -n *.c *.S src/ mv -n *.dat *.inc *.h include/ sed -i src/encrypt.c -e "s/\(\s\)init(/\1_init(/g" -exit 0 + +platformio run -e esp32dev || exit +mv .pio/build/esp32dev/*{.bin,.elf} . diff --git a/templates/f1-libopencm3/cleanup b/templates/f1-libopencm3/compile similarity index 50% rename from templates/f1-libopencm3/cleanup rename to templates/f1-libopencm3/compile index 8c3cbfc..2aad486 100755 --- a/templates/f1-libopencm3/cleanup +++ b/templates/f1-libopencm3/compile @@ -1,3 +1,3 @@ #!/bin/bash -exit 0 +make diff --git a/templates/f1-libopencm3/configure b/templates/f1-libopencm3/configure deleted file mode 100755 index 8c3cbfc..0000000 --- a/templates/f1-libopencm3/configure +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -exit 0 diff --git a/templates/f7/cleanup b/templates/f7/cleanup deleted file mode 100755 index a83f262..0000000 --- a/templates/f7/cleanup +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -rm -rf ./Drivers/ -rm build/*.o -rm build/*.d -rm build/*.lst diff --git a/templates/f7/configure b/templates/f7/compile similarity index 57% rename from templates/f7/configure rename to templates/f7/compile index d19e1a2..52b69fa 100755 --- a/templates/f7/configure +++ b/templates/f7/compile @@ -5,4 +5,17 @@ mv -n *.dat *.inc *.h Inc/ [ -f src/encrypt.c ] && sed -i src/encrypt.c -e "s/\(\s\)init(/\1_init(/g" mkdir -p /tmp/f7/Drivers ln -s /tmp/f7/Drivers Drivers -exit 0 + +make +EXIT_CODE=$? + +mv build/f7.bin . +mv build/f7.hex . +mv build/f7.elf . + +rm ./Drivers +rm -rf ./build/ + +exit EXIT_CODE + + diff --git a/templates/longan-nano/Makefile b/templates/longan-nano/Makefile deleted file mode 100644 index 41fc3b6..0000000 --- a/templates/longan-nano/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -NISTGCCFLAGS=-std=c99 -Wall -Wextra -Wshadow -fsanitize=address,undefined -O2 -LFLAGS=-lm -PIO_ENV = sipeed-longan-nano-lite -all: ${PIO_ENV} - -${PIO_ENV}: .pioenvs/${PIO_ENV}/firmware.elf - -.pioenvs/${PIO_ENV}/firmware.elf: FORCE - platformio run -e ${PIO_ENV} - -FORCE: ; -.PHONY: clean - -clean: - -rm .pioenvs/${PIO_ENV}/firmware.elf diff --git a/templates/longan-nano/cleanup b/templates/longan-nano/cleanup deleted file mode 100755 index 4db6720..0000000 --- a/templates/longan-nano/cleanup +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -mv .pio/build/sipeed-longan-nano-lite/firmware.* . -exit 0 diff --git a/templates/longan-nano/configure b/templates/longan-nano/compile similarity index 84% rename from templates/longan-nano/configure rename to templates/longan-nano/compile index dfa9981..3b00919 100755 --- a/templates/longan-nano/configure +++ b/templates/longan-nano/compile @@ -9,4 +9,5 @@ mv -n *.c *.S src/ mv -n *.dat *.inc *.h include/ sed -i src/encrypt.c -e "s/\(\s\)init(/\1encrypt_init(/g" -exit 0 +platformio run -e sipeed-longan-nano-lite || exit +mv .pio/build/sipeed-longan-nano-lite/firmware.* . diff --git a/templates/maixduino/Makefile b/templates/maixduino/Makefile deleted file mode 100644 index 777637a..0000000 --- a/templates/maixduino/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -LFLAGS=-lm -all: sipeed-maixduino - -sipeed-maixduino: .pioenvs/sipeed-maixduino/firmware.bin - -.pioenvs/sipeed-maixduino/firmware.bin: FORCE - platformio run -e sipeed-maixduino - -FORCE: ; -.PHONY: clean - -clean: - -rm .pioenvs/sipeed-maixduino/firmware.bin diff --git a/templates/maixduino/configure b/templates/maixduino/compile similarity index 84% rename from templates/maixduino/configure rename to templates/maixduino/compile index 2e69c6b..7417239 100755 --- a/templates/maixduino/configure +++ b/templates/maixduino/compile @@ -8,4 +8,6 @@ done mv -n *.c *.S src/ mv -n *.dat *.inc *.h include/ sed -i src/encrypt.c -e "s/\(\s\)init(/\1_init(/g" -exit 0 + +platformio run -e sipeed-maixduino || exit +mv .pio/build/sipeed-maixduino/*.* . diff --git a/templates/uno/Makefile b/templates/uno/Makefile deleted file mode 100644 index a971f16..0000000 --- a/templates/uno/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -NISTGCCFLAGS=-std=c99 -Wall -Wextra -Wshadow -fsanitize=address,undefined -O2 -LFLAGS=-lm -all: uno - -uno: .pioenvs/uno/firmware.hex - -.pioenvs/uno/firmware.hex: FORCE - platformio run -e uno - -FORCE: ; -.PHONY: clean - -clean: - -rm .pioenvs/uno/firmware.hex diff --git a/templates/uno/configure b/templates/uno/compile similarity index 84% rename from templates/uno/configure rename to templates/uno/compile index 2e69c6b..7a1d71e 100755 --- a/templates/uno/configure +++ b/templates/uno/compile @@ -8,4 +8,6 @@ done mv -n *.c *.S src/ mv -n *.dat *.inc *.h include/ sed -i src/encrypt.c -e "s/\(\s\)init(/\1_init(/g" -exit 0 + +platformio run -e uno || exit +mv .pio/build/uno/firmware.* . diff --git a/test-scheduler.py b/test-scheduler.py index e8480fe..8e657a8 100644 --- a/test-scheduler.py +++ b/test-scheduler.py @@ -325,6 +325,7 @@ def get_results_json(job_id): if __name__ == '__main__': runners.append(Runner('maixduino', 'Maixduino')) + runners.append(Runner('longan-nano', 'Longan Nano')) runners.append(Runner('f7', 'NUCLEO-F746ZG')) runners.append(Runner('uno', 'Arduino Uno')) runners.append(Runner('esp32', 'ESP32'))