diff --git a/core/SConscript.bootloader b/core/SConscript.bootloader index 051b97bcb..d06367712 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 9d5d160c5..000000000 --- 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 0c3c4b26b..80c57816b 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 26f24773b..72ce15436 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"