Commit 5fb979ea by Enrico Pozzobon

unified compilation logic in a single file

parent 6662f90b
...@@ -62,17 +62,11 @@ def build(algo_dir, template_dir, build_dir): ...@@ -62,17 +62,11 @@ def build(algo_dir, template_dir, build_dir):
wd = os.getcwd() wd = os.getcwd()
os.chdir(build_dir) os.chdir(build_dir)
try: try:
if os.path.isfile('./configure'):
subprocess.check_call(["./configure"])
stdout_path = 'make.stdout.log' stdout_path = 'make.stdout.log'
stderr_path = 'make.stderr.log' stderr_path = 'make.stderr.log'
with open(stdout_path, 'w') as outfile, \ with open(stdout_path, 'w') as outfile, \
open(stderr_path, 'w') as errfile: open(stderr_path, 'w') as errfile:
subprocess.check_call(['make'], stdout=outfile, stderr=errfile) subprocess.check_call(['./compile'], stdout=outfile, stderr=errfile)
if os.path.isfile('./cleanup'):
subprocess.check_call(["./cleanup"])
finally: finally:
sys.stdout.flush() sys.stdout.flush()
......
...@@ -64,27 +64,7 @@ function run() { ...@@ -64,27 +64,7 @@ function run() {
mv $cipher/*.log "$TEST_PATH" mv $cipher/*.log "$TEST_PATH"
cp test_vectors/$VARIANT/LWC_AEAD_KAT_*.txt "$TEST_PATH/LWC_AEAD_KAT.txt" || exit 1 cp test_vectors/$VARIANT/LWC_AEAD_KAT_*.txt "$TEST_PATH/LWC_AEAD_KAT.txt" || exit 1
mv $TMPDIR/$CIPHER_SLUG/*{.elf,.bin,.hex,.map} "$TEST_PATH"
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
curl \ curl \
--request 'POST' \ --request 'POST' \
...@@ -102,7 +82,7 @@ function run() { ...@@ -102,7 +82,7 @@ function run() {
done done
rm -rf "$TMPDIR" #rm -rf "$TMPDIR"
} }
if [[ $1 == "run" ]]; then if [[ $1 == "run" ]]; then
...@@ -119,13 +99,13 @@ else ...@@ -119,13 +99,13 @@ else
TMPDIR=$(mktemp -d -t submission-XXXXXXXXXX) TMPDIR=$(mktemp -d -t submission-XXXXXXXXXX)
echo "Extracting in $TMPDIR" echo "Extracting in $TMPDIR"
unzip $ZIP_PATH -d $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##*/}" TEMPLATE="${i##*/}"
echo "Template is $TEMPLATE" echo "Template is $TEMPLATE"
touch $MAINDIR/locky.lock touch $MAINDIR/locky.lock
flock $MAINDIR/locky.lock $0 run $TMPDIR $TEMPLATE $MAINDIR/$TEMPLATE flock $MAINDIR/locky.lock $0 run $TMPDIR $TEMPLATE $MAINDIR/$TEMPLATE
done done
rm -rf $TMPDIR #rm -rf $TMPDIR
fi fi
......
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
...@@ -9,4 +9,5 @@ mv -n *.c *.S src/ ...@@ -9,4 +9,5 @@ mv -n *.c *.S src/
mv -n *.dat *.inc *.h include/ mv -n *.dat *.inc *.h include/
sed -i src/encrypt.c -e "s/\(\s\)init(/\1encrypt_init(/g" 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.* .
...@@ -8,4 +8,6 @@ done ...@@ -8,4 +8,6 @@ done
mv -n *.c *.S src/ mv -n *.c *.S src/
mv -n *.dat *.inc *.h include/ mv -n *.dat *.inc *.h include/
sed -i src/encrypt.c -e "s/\(\s\)init(/\1_init(/g" 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} .
#!/bin/bash
rm -rf ./Drivers/
rm build/*.o
rm build/*.d
rm build/*.lst
...@@ -5,4 +5,17 @@ mv -n *.dat *.inc *.h Inc/ ...@@ -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" [ -f src/encrypt.c ] && sed -i src/encrypt.c -e "s/\(\s\)init(/\1_init(/g"
mkdir -p /tmp/f7/Drivers mkdir -p /tmp/f7/Drivers
ln -s /tmp/f7/Drivers 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
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
#!/bin/bash
mv .pio/build/sipeed-longan-nano-lite/firmware.* .
exit 0
...@@ -9,4 +9,5 @@ mv -n *.c *.S src/ ...@@ -9,4 +9,5 @@ mv -n *.c *.S src/
mv -n *.dat *.inc *.h include/ mv -n *.dat *.inc *.h include/
sed -i src/encrypt.c -e "s/\(\s\)init(/\1encrypt_init(/g" 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.* .
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
...@@ -8,4 +8,6 @@ done ...@@ -8,4 +8,6 @@ done
mv -n *.c *.S src/ mv -n *.c *.S src/
mv -n *.dat *.inc *.h include/ mv -n *.dat *.inc *.h include/
sed -i src/encrypt.c -e "s/\(\s\)init(/\1_init(/g" 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/*.* .
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
...@@ -8,4 +8,6 @@ done ...@@ -8,4 +8,6 @@ done
mv -n *.c *.S src/ mv -n *.c *.S src/
mv -n *.dat *.inc *.h include/ mv -n *.dat *.inc *.h include/
sed -i src/encrypt.c -e "s/\(\s\)init(/\1_init(/g" sed -i src/encrypt.c -e "s/\(\s\)init(/\1_init(/g"
exit 0
platformio run -e uno || exit
mv .pio/build/uno/firmware.* .
...@@ -325,6 +325,7 @@ def get_results_json(job_id): ...@@ -325,6 +325,7 @@ def get_results_json(job_id):
if __name__ == '__main__': if __name__ == '__main__':
runners.append(Runner('maixduino', 'Maixduino')) runners.append(Runner('maixduino', 'Maixduino'))
runners.append(Runner('longan-nano', 'Longan Nano'))
runners.append(Runner('f7', 'NUCLEO-F746ZG')) runners.append(Runner('f7', 'NUCLEO-F746ZG'))
runners.append(Runner('uno', 'Arduino Uno')) runners.append(Runner('uno', 'Arduino Uno'))
runners.append(Runner('esp32', 'ESP32')) runners.append(Runner('esp32', 'ESP32'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment