Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proto: fix compilation with nanopb #38

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions messages/common.options
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FirmwareUpdateData.image_block max_size: 39
Log.log max_length: 50
MemfaultEvent.chunk max_size: 50
orb.FirmwareUpdateData.image_block max_size: 39
orb.Log.log max_length: 50
orb.MemfaultEvent.chunk max_size: 50
24 changes: 12 additions & 12 deletions messages/main.options
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
GNSSData.nmea max_length: 82
GNSSDataPartial.nmea_part max_length: 50
UserCenterLEDsSequence.rgb_uncompressed max_size: 192
UserCenterLEDsSequence.argb32_uncompressed max_size: 256
UserRingLEDsSequence.rgb_uncompressed max_size: 672
UserRingLEDsSequence.argb32_uncompressed max_size: 396
DistributorLEDsSequence.rgb_uncompressed max_size: 15
DistributorLEDsSequence.argb32_uncompressed max_size: 20
ConeLEDsSequence.rgb_uncompressed max_size: 192
ConeLEDsSequence.argb32_uncompressed max_size: 256
IREyeCameraFocusSweepLensValues max_size: 600
BatteryInfoHwFw.mcu_id max_size: 12
orb.main.GNSSData.nmea max_length: 82
orb.main.GNSSDataPartial.nmea_part max_length: 50
orb.main.UserCenterLEDsSequence.rgb_uncompressed max_size: 192
orb.main.UserCenterLEDsSequence.argb32_uncompressed max_size: 256
orb.main.UserRingLEDsSequence.rgb_uncompressed max_size: 672
orb.main.UserRingLEDsSequence.argb32_uncompressed max_size: 396
orb.main.DistributorLEDsSequence.rgb_uncompressed max_size: 15
orb.main.DistributorLEDsSequence.argb32_uncompressed max_size: 20
orb.main.ConeLEDsSequence.rgb_uncompressed max_size: 192
orb.main.ConeLEDsSequence.argb32_uncompressed max_size: 256
orb.main.IREyeCameraFocusSweepLensValues max_size: 600
orb.main.BatteryInfoHwFw.mcu_id max_size: 12
4 changes: 1 addition & 3 deletions messages/orb.proto
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
syntax = "proto3";

// This file is the root of the entire package heirarchy.
// This file is the root of the entire package hierarchy.
package orb;

import "main.proto";
import "sec.proto";
import "common.proto";

// Any change in version number should be made only if:
// - at least one new field is mandatory for the message to be correctly
Expand All @@ -31,4 +30,3 @@ message McuMessage
sec.SecToJetson sec_to_jetson_message = 5;
}
}

2 changes: 1 addition & 1 deletion messages/sec.options
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SERequest.data max_size: 512
orb.sec.SERequest.data max_size: 512
8 changes: 4 additions & 4 deletions messages/sec.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ message SecToJetson
orb.Ack ack = 1;
orb.Versions versions = 2;
orb.Log log = 3;
sec.private.SEResponse se_response = 4;
sec.private.Tamper tampered = 5;
orb.sec.private.SEResponse se_response = 4;
orb.sec.private.Tamper tampered = 5;
orb.BatteryStatus battery_status = 7;
orb.FatalError fatal_error = 8;
sec.private.TamperRaw tamper_raw = 9;
sec.private.TamperStates tamper_states = 10;
orb.sec.private.TamperRaw tamper_raw = 9;
orb.sec.private.TamperStates tamper_states = 10;
orb.Temperature temperature = 11;
orb.MemfaultEvent memfault_event = 12;
orb.HardwareDiagnostic hardware_diag = 13;
Expand Down
25 changes: 10 additions & 15 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,18 @@ if (CONFIG_ORB_MCU_MESSAGING_LIB)
set(NANOPB_OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}/../messages/")

set(SRC_FILES)
if (CONFIG_BOARD_PEARL_SECURITY OR CONFIG_BOARD_DIAMOND_SECURITY)
# look for mcu_messaging_sec_priv.proto in private first, then in private_stub
set(PRIV_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../messages/private)
if (NOT EXISTS ${PRIV_INCLUDE_DIR}/mcu_messaging_sec_priv.proto)
set(PRIV_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../messages/private_stub)
if (NOT EXISTS ${PRIV_INCLUDE_DIR}/mcu_messaging_sec_priv.proto)
message(FATAL_ERROR "mcu_messaging_sec_priv.proto not found in private or private_stub")
endif ()
# look for sec_priv.proto in private first, then in private_stub
set(PRIV_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../messages/private)
if (NOT EXISTS ${PRIV_INCLUDE_DIR}/sec_priv.proto)
set(PRIV_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../messages/private_stub)
if (NOT EXISTS ${PRIV_INCLUDE_DIR}/sec_priv.proto)
message(FATAL_ERROR "sec_priv.proto not found in private or private_stub")
endif ()
# mcu_messaging_sec_priv.proto must be first in the list
list(APPEND PROTO_FILES ${PRIV_INCLUDE_DIR}/mcu_messaging_sec_priv.proto ../messages/mcu_messaging_sec.proto ../messages/mcu_messaging_common.proto)
list(APPEND SRC_FILES ${CMAKE_CURRENT_BINARY_DIR}/mcu_messaging_sec.pb.c ${CMAKE_CURRENT_BINARY_DIR}/mcu_messaging_common.pb.c ${CMAKE_CURRENT_BINARY_DIR}/mcu_messaging_sec_priv.pb.c)
list(APPEND NANOPB_OPTIONS "-I${PRIV_INCLUDE_DIR}")
else ()
list(APPEND PROTO_FILES ../messages/mcu_messaging_main.proto ../messages/mcu_messaging_common.proto)
list(APPEND SRC_FILES ${CMAKE_CURRENT_BINARY_DIR}/mcu_messaging_main.pb.c ${CMAKE_CURRENT_BINARY_DIR}/mcu_messaging_common.pb.c)
endif ()
# sec_priv.proto must be first in the list
list(APPEND PROTO_FILES ../messages/orb.proto ../messages/main.proto ../messages/sec.proto ../messages/common.proto ${PRIV_INCLUDE_DIR}/sec_priv.proto)
list(APPEND SRC_FILES ${CMAKE_CURRENT_BINARY_DIR}/main.pb.c ${CMAKE_CURRENT_BINARY_DIR}/sec.pb.c ${CMAKE_CURRENT_BINARY_DIR}/common.pb.c ${CMAKE_CURRENT_BINARY_DIR}/sec_priv.pb.c)
list(APPEND NANOPB_OPTIONS "-I${PRIV_INCLUDE_DIR}")

# use provided function to generate C files
# it will create a custom command that is launched if ${proto_sources} are dependencies
Expand Down
Loading