1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-26 00:08:10 +00:00

core+legacy: use nanopb generator from pipenv

This commit is contained in:
Pavol Rusnak 2019-12-20 14:20:34 +00:00
parent 5bf8eca350
commit 4647e7d686
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 11 additions and 7 deletions

View File

@ -72,15 +72,18 @@ SOURCE_STMHAL = [
'vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c', '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 = [ SOURCE_BOOTLOADER = [
'embed/bootloader/startup.s', 'embed/bootloader/startup.s',
'embed/bootloader/header.S', 'embed/bootloader/header.S',
'embed/bootloader/bootui.c', 'embed/bootloader/bootui.c',
'embed/bootloader/main.c', 'embed/bootloader/main.c',
'embed/bootloader/messages.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/messages.pb.c',
'embed/bootloader/protob/types.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/STM32F4xx_HAL_Driver/Inc',
'vendor/micropython/lib/stm32lib/CMSIS/STM32F4xx/Include', 'vendor/micropython/lib/stm32lib/CMSIS/STM32F4xx/Include',
'vendor/micropython/lib/cmsis/inc', 'vendor/micropython/lib/cmsis/inc',
'vendor/nanopb',
] + CPPPATH_MOD, ] + CPPPATH_MOD,
CPPDEFINES=[ CPPDEFINES=[
('TREZOR_MODEL', '$TREZOR_MODEL'), ('TREZOR_MODEL', '$TREZOR_MODEL'),
@ -172,6 +176,7 @@ env.Replace(
obj_program = [] obj_program = []
obj_program += env.Object(source=SOURCE_MOD) obj_program += env.Object(source=SOURCE_MOD)
obj_program += env.Object(source=SOURCE_BOOTLOADER) 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_STMHAL)
obj_program += env.Object(source=SOURCE_TREZORHAL) obj_program += env.Object(source=SOURCE_TREZORHAL)

View File

@ -1 +0,0 @@
../../vendor/nanopb

View File

@ -1,7 +1,7 @@
all: messages.pb.c types.pb.c all: messages.pb.c types.pb.c
%.pb.c: %.pb %.options %.pb.c: %.pb %.options
../../../vendor/nanopb/generator/nanopb_generator.py $< -T nanopb_generator $< -T
%.pb: %.proto %.pb: %.proto
protoc -I/usr/include -I. $< -o $@ protoc -I/usr/include -I. $< -o $@

View File

@ -14,11 +14,11 @@ PYTHON ?= python
%.pb.c: %.pb %.options %.pb.c: %.pb %.options
@printf " NANOPB $@\n" @printf " NANOPB $@\n"
$(Q)$(PYTHON) ../../vendor/nanopb/generator/nanopb_generator.py $< \ $(Q)nanopb_generator $< \
-L '#include "%s"' \ -L '#include "%s"' \
-T \ -T \
-s "mangle_names:M_FLATTEN" -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 %.pb: %.proto
@printf " PROTOC $@\n" @printf " PROTOC $@\n"