From 4647e7d686026a557a9a84880b92cae6b1d6b7cb Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 20 Dec 2019 14:20:34 +0000 Subject: [PATCH] core+legacy: use nanopb generator from pipenv --- core/SConscript.bootloader | 11 ++++++++--- core/embed/bootloader/nanopb | 1 - core/embed/bootloader/protob/Makefile | 2 +- legacy/firmware/protob/Makefile | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) delete mode 120000 core/embed/bootloader/nanopb diff --git a/core/SConscript.bootloader b/core/SConscript.bootloader index 051b97bcb5..d063677121 100644 --- a/core/SConscript.bootloader +++ b/core/SConscript.bootloader @@ -72,15 +72,18 @@ SOURCE_STMHAL = [ 'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c', ] +SOURCE_NANOPB = [ + 'vendor/nanopb/pb_common.c', + 'vendor/nanopb/pb_decode.c', + 'vendor/nanopb/pb_encode.c', +] + SOURCE_BOOTLOADER = [ 'embed/bootloader/startup.s', 'embed/bootloader/header.S', 'embed/bootloader/bootui.c', 'embed/bootloader/main.c', 'embed/bootloader/messages.c', - 'embed/bootloader/nanopb/pb_common.c', - 'embed/bootloader/nanopb/pb_decode.c', - 'embed/bootloader/nanopb/pb_encode.c', 'embed/bootloader/protob/messages.pb.c', 'embed/bootloader/protob/types.pb.c', ] @@ -148,6 +151,7 @@ env.Replace( 'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Inc', 'vendor/micropython/lib/stm32lib/CMSIS/STM32F4xx/Include', 'vendor/micropython/lib/cmsis/inc', + 'vendor/nanopb', ] + CPPPATH_MOD, CPPDEFINES=[ ('TREZOR_MODEL', '$TREZOR_MODEL'), @@ -172,6 +176,7 @@ env.Replace( obj_program = [] obj_program += env.Object(source=SOURCE_MOD) obj_program += env.Object(source=SOURCE_BOOTLOADER) +obj_program += env.Object(source=SOURCE_NANOPB) obj_program += env.Object(source=SOURCE_STMHAL) obj_program += env.Object(source=SOURCE_TREZORHAL) diff --git a/core/embed/bootloader/nanopb b/core/embed/bootloader/nanopb deleted file mode 120000 index 9d5d160c5d..0000000000 --- a/core/embed/bootloader/nanopb +++ /dev/null @@ -1 +0,0 @@ -../../vendor/nanopb \ No newline at end of file diff --git a/core/embed/bootloader/protob/Makefile b/core/embed/bootloader/protob/Makefile index 0c3c4b26b5..80c57816bd 100644 --- a/core/embed/bootloader/protob/Makefile +++ b/core/embed/bootloader/protob/Makefile @@ -1,7 +1,7 @@ all: messages.pb.c types.pb.c %.pb.c: %.pb %.options - ../../../vendor/nanopb/generator/nanopb_generator.py $< -T + nanopb_generator $< -T %.pb: %.proto protoc -I/usr/include -I. $< -o $@ diff --git a/legacy/firmware/protob/Makefile b/legacy/firmware/protob/Makefile index 26f24773ba..72ce154369 100644 --- a/legacy/firmware/protob/Makefile +++ b/legacy/firmware/protob/Makefile @@ -14,11 +14,11 @@ PYTHON ?= python %.pb.c: %.pb %.options @printf " NANOPB $@\n" - $(Q)$(PYTHON) ../../vendor/nanopb/generator/nanopb_generator.py $< \ + $(Q)nanopb_generator $< \ -L '#include "%s"' \ -T \ -s "mangle_names:M_FLATTEN" - @grep CALLBACK $@ && echo "CALLBACK field found" && rm $@ && exit 1 || : + @grep " CALLBACK, " $@ && echo "CALLBACK field found" && rm $@ && exit 1 || : %.pb: %.proto @printf " PROTOC $@\n"