From eff9f12b9b9e9051ce0097d3340ad52a455f908d Mon Sep 17 00:00:00 2001 From: Timothy Rule Date: Tue, 7 Sep 2021 10:09:25 +0200 Subject: [PATCH 1/5] Remove meta information from register schema file names. --- schemas/register/{register_interface__can.fbs => can.fbs} | 0 .../register/{register_interface__ethernet.fbs => ethernet.fbs} | 0 schemas/register/{register_interface__flexray.fbs => flexray.fbs} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename schemas/register/{register_interface__can.fbs => can.fbs} (100%) rename schemas/register/{register_interface__ethernet.fbs => ethernet.fbs} (100%) rename schemas/register/{register_interface__flexray.fbs => flexray.fbs} (100%) diff --git a/schemas/register/register_interface__can.fbs b/schemas/register/can.fbs similarity index 100% rename from schemas/register/register_interface__can.fbs rename to schemas/register/can.fbs diff --git a/schemas/register/register_interface__ethernet.fbs b/schemas/register/ethernet.fbs similarity index 100% rename from schemas/register/register_interface__ethernet.fbs rename to schemas/register/ethernet.fbs diff --git a/schemas/register/register_interface__flexray.fbs b/schemas/register/flexray.fbs similarity index 100% rename from schemas/register/register_interface__flexray.fbs rename to schemas/register/flexray.fbs From 9942b23c61966a99c8f25b275dbbf0f52a55aaa2 Mon Sep 17 00:00:00 2001 From: Timothy Rule Date: Tue, 7 Sep 2021 11:40:01 +0200 Subject: [PATCH 2/5] Updates for code and documentation style. --- schemas/register/can.fbs | 90 +++++++++++++++++++++-------------- schemas/register/ethernet.fbs | 57 ++++++++++++++-------- schemas/register/flexray.fbs | 44 ++++++++++------- 3 files changed, 118 insertions(+), 73 deletions(-) diff --git a/schemas/register/can.fbs b/schemas/register/can.fbs index d228f1c..603cab7 100644 --- a/schemas/register/can.fbs +++ b/schemas/register/can.fbs @@ -1,48 +1,65 @@ //*************************************************************************** // Copyright (c) 2021 for information on the respective copyright owner -// see the NOTICE file and/or the repository https://github.com/boschglobal/automotive-bus-schema +// see the NOTICE file and/or the following repository: +// https://github.com/boschglobal/automotive-bus-schema // // SPDX-License-Identifier: Apache-2.0 //*************************************************************************** -// -// IDL for Automotive Bus - Register Interface - CAN -// -// MIME type : application/x-automotive-bus; interface=register; type=CAN; -// Flatbuffers file identifier : RICA -namespace AutomotiveBus.RegisterInterface.CAN; +/** + IDL for Automotive Bus - Register Interface - CAN + ================================================= + + MIME Type : application/x-automotive-bus; interface=register; type=CAN; + Flatbuffers file identifier : RICA +*/ -// L2 CAN Bus Model -// ================ +namespace AutomotiveBus.RegisterInterface.CAN; -// L2 Bus Status. -enum BusState:byte { BusOff = 0, Idle = 1, Sync = 2 } +/** + L2 CAN Bus Model + ================ +*/ +enum BusState:byte { + // L2 Bus Status. + BusOff = 0, + Idle = 1, + Sync = 2 +} table CanStatus { sync:BusState; } - -// L3 CAN Bus Model -// ================ - -// Holds data from clock system call. Used for timestamps and simulation time. +/** + L3 CAN Bus Model + ================ +*/ struct TimeSpec { + // Holds data from clock system call. Used for timestamps and simulation time. sec:long; nsec:long; } +enum BufferDirection:byte { + // Direction (of a CAN Buffer), None is disabled. + None = 0, + Tx = 1, + Rx = 2 +} +enum BufferStatus:byte { + // Status of a CAN Buffer. + None = 0, + TxDone = 1, + RxDone = 2, + TxError = 11, + RxError = 12 +} -// Direction (of a CAN Buffer), None is disabled. -enum BufferDirection:byte { None = 0, Tx = 1, Rx = 2 } - -// Status of a CAN Buffer. -enum BufferStatus:byte { None = 0, TxDone = 1, RxDone = 2, TxError = 11, RxError = 12 } - -// Link Protocol Data Unit (L-PDU). table LinkProtocolDataUnit { + // Link Protocol Data Unit (L-PDU). frame_id:long; // CAN Message ID. // Tx - Frame ID // Rx - Filtering schema @@ -51,9 +68,9 @@ table LinkProtocolDataUnit { length:ubyte; // Length of payload content (not the size of the payload vector). } -// CAN Buffer, representation of a single CAN Tx/Rx Buffer. -// Structs are fixed, no schema versioning, so can be precise to a chipset, then use Union to add to RegisterFile. Perhaps? table CanBuffer { + // CAN Buffer, representation of a single CAN Tx/Rx Buffer. + // // Buffer/Register index:ubyte (key); // Buffer Index, maps to a Register File position (0..n). direction:BufferDirection = None; // None, Tx, Rx @@ -72,16 +89,20 @@ table CanBuffer { } -// CAN Register File -// ================= +/** + CAN Register File + ================= -// Different CAN Transceivers will have different number of Buffers in their -// Register File. The "index" of each Buffer should be initialized (depending on -// the mode of operation, a partial Register File might be sent, in which case -// the buffer.index would be needed to marshal data to correct locations). - -// Register Mode. -enum BufferMode:byte { Register = 0, Fifo = 1 } + Different CAN Transceivers will have different number of Buffers in their + Register File. The "index" of each Buffer should be initialized (depending on + the mode of operation, a partial Register File might be sent, in which case + the buffer.index would be needed to marshal data to correct locations). +*/ +enum BufferMode:byte { + // Indicate how the buffers are operating. + Register = 0, + Fifo = 1 +} table RegisterFile { status:CanStatus; // L2 Bus Status. @@ -106,7 +127,6 @@ table RegisterFile { } - root_type RegisterFile; file_identifier "RICA"; file_extension "can"; diff --git a/schemas/register/ethernet.fbs b/schemas/register/ethernet.fbs index a1c6977..f54c807 100644 --- a/schemas/register/ethernet.fbs +++ b/schemas/register/ethernet.fbs @@ -1,41 +1,58 @@ //*************************************************************************** // Copyright (c) 2021 for information on the respective copyright owner -// see the NOTICE file and/or the repository https://github.com/boschglobal/automotive-bus-schema +// see the NOTICE file and/or the following repository: +// https://github.com/boschglobal/automotive-bus-schema // // SPDX-License-Identifier: Apache-2.0 //*************************************************************************** -// -// IDL for Automotive Bus - Register Interface - Ethernet -// -// MIME type : application/x-automotive-bus; interface=register; type=Ethernet; -// Flatbuffers file identifier : RIEN -namespace AutomotiveBus.RegisterInterface.Ethernet; +/** + IDL for Automotive Bus - Register Interface - Ethernet + ====================================================== + MIME Type : application/x-automotive-bus; interface=register; type=Ethernet; + Flatbuffers file identifier : RIEN +*/ -// Ethernet Bus Model -// ==================== -enum BusSync:byte { NoSync = 0, Sync = 1} +namespace AutomotiveBus.RegisterInterface.Ethernet; + +/** + Ethernet Bus Model + ================== +*/ +enum BusSync:byte { + NoSync = 0, + Sync = 1 +} table EthernetStatus { sync:BusSync; } -// Holds data from clock system call. Used for timestamps and simulation time. struct TimeSpec { + // Holds data from clock system call. Used for timestamps and simulation time. sec:long; nsec:long; } -// Direction (of an Ethernet Buffer), None is disabled. -enum BufferDirection:byte { None = 0, Tx = 1, Rx = 2 } +enum BufferDirection:byte { + // Direction (of an Ethernet Buffer), None is disabled. + None = 0, + Tx = 1, + Rx = 2 +} -// Status of an Ethernet Buffer. -enum BufferStatus:byte { None = 0, TxDone = 1, RxDone = 2, TxError = 11, RxError = 12 } +enum BufferStatus:byte { + // Status of an Ethernet Buffer. + None = 0, + TxDone = 1, + RxDone = 2, + TxError = 11, + RxError = 12 +} -// Ethernet Frame table EthernetFrame { dest_mac:[ubyte]; // Destination MAC address, 6 bytes src_mac:[ubyte]; // Source MAC address, 6 bytes @@ -45,7 +62,6 @@ table EthernetFrame { length:ushort; // Length of data payload. } -// Ethernet Buffer table EthernetBuffer { index:ubyte; direction:BufferDirection = None; @@ -61,9 +77,10 @@ table EthernetBuffer { } -// Ethernet Register File -// ====================== - +/** + Ethernet Register File + ====================== +*/ table RegisterFile { status:EthernetStatus; // L1/2 Bus Status. buffer:[EthernetBuffer]; // Buffers for Ethernet Messages. diff --git a/schemas/register/flexray.fbs b/schemas/register/flexray.fbs index a9d120c..1a8a316 100644 --- a/schemas/register/flexray.fbs +++ b/schemas/register/flexray.fbs @@ -1,33 +1,41 @@ //*************************************************************************** // Copyright (c) 2021 for information on the respective copyright owner -// see the NOTICE file and/or the repository https://github.com/boschglobal/automotive-bus-schema +// see the NOTICE file and/or the following repository: +// https://github.com/boschglobal/automotive-bus-schema // // SPDX-License-Identifier: Apache-2.0 //*************************************************************************** -// -// IDL for Automotive Bus - Register Interface - FlexRay -// -// MIME type : application/x-automotive-bus; interface=register; type=FlexRay; -// Flatbuffers file identifier : RIFR -namespace AutomotiveBus.RegisterInterface.FlexRay; +/** + IDL for Automotive Bus - Register Interface - FlexRay + ===================================================== + MIME Type : application/x-automotive-bus; interface=register; type=FlexRay; + Flatbuffers file identifier : RIFR +*/ -// L2 FlexRay Bus Model -// ==================== -enum BusSync:byte { NoSync = 0, Sync = 1} +namespace AutomotiveBus.RegisterInterface.FlexRay; + +/** + L2 FlexRay Bus Model + ==================== +*/ +enum BusSync:byte { + NoSync = 0, + Sync = 1 +} table FlexrayStatus { sync:BusSync; } - -// L3 CAN Bus Model -// ================ - +/** + L3 FlexRay Bus Model + ==================== +*/ table FlexrayBuffer { index:ubyte; frame_id:ushort; @@ -37,10 +45,10 @@ table FlexrayBuffer { } - -// FlexRay Register File -// ===================== - +/** + FlexRay Register File + ===================== +*/ table RegisterFile { status:FlexrayStatus; // L2 Bus Status. buffer:[FlexrayBuffer]; // L3 Buffers for FlexRay Messages. From a15d98469ce5d62e23bc48348f0153ed3a7f318f Mon Sep 17 00:00:00 2001 From: Timothy Rule Date: Tue, 7 Sep 2021 11:40:37 +0200 Subject: [PATCH 3/5] Add signal interface schemas. --- schemas/signal/flatbuffers/channel.fbs | 99 +++++++++++++++++++++ schemas/signal/flatbuffers/encoder.fbs | 100 ++++++++++++++++++++++ schemas/signal/flatbuffers/parameter.fbs | 65 ++++++++++++++ schemas/signal/msgpack/data_payloads.yaml | 51 +++++++++++ 4 files changed, 315 insertions(+) create mode 100644 schemas/signal/flatbuffers/channel.fbs create mode 100644 schemas/signal/flatbuffers/encoder.fbs create mode 100644 schemas/signal/flatbuffers/parameter.fbs create mode 100644 schemas/signal/msgpack/data_payloads.yaml diff --git a/schemas/signal/flatbuffers/channel.fbs b/schemas/signal/flatbuffers/channel.fbs new file mode 100644 index 0000000..237245e --- /dev/null +++ b/schemas/signal/flatbuffers/channel.fbs @@ -0,0 +1,99 @@ +//*************************************************************************** +// Copyright (c) 2021 for information on the respective copyright owner +// see the NOTICE file and/or the following repository: +// https://github.com/boschglobal/automotive-bus-schema +// +// SPDX-License-Identifier: Apache-2.0 +//*************************************************************************** + + +/** + IDL for Automotive Bus - Signal Interface - Channel + =================================================== + + Channel Messages. + + Signals are sent in channels. Each channel represents a kind of Signal (e.g. + Physical or Simulation signals). + + Signal data is encoded with related MsgPack schema SignalData. See schema + file 'schemas/signal/msgpack/data_payloads.yaml' for details. + + MIME Type : application/x-automotive-bus; interface=signal; type=channel; + Flatbuffers file identifier : SICH +*/ + + +include "parameter.fbs"; + + +namespace AutomotiveBus.SignalInterface.Channel; + + +/** + Signal Indexing. + */ +table SignalLookup { + signal_uid:uint; // UID of a signal, if not provided the UID will + // be generated using the blake2b hash algorithm + // (to 4 bytes) over the signal name. + name:string; // Name of the Signal. + alias:[string]; // Signals can also have aliases (i.e. more than one name). +} +table SignalIndex { + indexes:[SignalLookup]; +} + + + +/** + Signal Messages. + + MsgPack encoded Signal Data: + Data = [ + [0..N], // (uint) Signal UID + [0..N], // (number) Signal Value - can be ommited for SignalRead. + ] + Signal Values can be encoded with any MsgPack numeric type (e.g. Integer + or Float). + */ +table SignalWrite { + data:[ubyte]; // MsgPack encoded Signal Data. + immediate:bool; // When set this Write will be immediatly processed. + // This supports Unit Testing. +} +table SignalRead { + data:[ubyte]; // MsgPack encoded Signal Data. +} +table SignalValue { + data:[ubyte]; // MsgPack encoded Signal Data. +} + + + +/** + Message Construction. + */ +union MessageType { + // From channel.fbs (this file) + SignalWrite:SignalWrite, + SignalRead:SignalRead, + SignalValue:SignalValue, + SignalIndex:SignalIndex, + // From parameter.fbs + ParameterValue:AutomotiveBus.SignalInterface.Parameter.ParameterValue, +} +table ChannelMessage { + // Message metadata. + model_uid:uint; // Identifes a Model within a Simulation Environment. + // Value 0 is reserved for control messages. + message:MessageType; // The message being transmitted. + control_code:uint; // Code to "authenticate" a control message. + + // Response info, requested by setting token. + token:int; // Client supplied token for linking Response to original Message. + rc:int; // Result of the message processing, 0 indicates success. + response:string; // A message which might explain the failure reason. +} +root_type ChannelMessage; +file_identifier "SICH"; // Signal Interface CHannel diff --git a/schemas/signal/flatbuffers/encoder.fbs b/schemas/signal/flatbuffers/encoder.fbs new file mode 100644 index 0000000..ece5e0c --- /dev/null +++ b/schemas/signal/flatbuffers/encoder.fbs @@ -0,0 +1,100 @@ +//*************************************************************************** +// Copyright (c) 2021 for information on the respective copyright owner +// see the NOTICE file and/or the following repository: +// https://github.com/boschglobal/automotive-bus-schema +// +// SPDX-License-Identifier: Apache-2.0 +//*************************************************************************** + + +/** + IDL for Automotive Bus - Signal Interface - Encoder + =================================================== + + Encoder Messages. + + MIME Type : application/x-automotive-bus; interface=signal; type=encoder; + Flatbuffers file identifier : SIEN +*/ + + +namespace AutomotiveBus.SignalInterface.Encoder; + + +/** + Encoder : K-Matrix + ================== + + The following Messages describe the K-Matrix encoding. +*/ +table KmatrixRawEncoding { + min:ulong; // Minimum expected raw value. + max:ulong; // Maximum expected raw value. + length:ubyte; // Length in bits of the raw value. +} + +table KmatrixPhysicalEncoding { + // A physical value is calculated with this encoding as follows: + // physical value = (raw value * _scale_) + _offset_: + // + // The range of a physical value can be limited by _min_ and _max_. + min:float; // Indicates the minimum value. + max:float; // Indicate the maximum value. + unit:string; // Information only. + offset:float; // Physical Value = Raw Value * scale (applied first). + scale:float; // Physical Value = Raw Value + offset (applied second). +} + +table KmatrixLogicalEncoding { + value:ulong; // Raw value. + name:string; // Logical value/meaning. +} + +table KmatrixSignalEncoding { + // A K-Matrix signal encoding represents a conversion from a raw signal + // value (unsigned integer) to either a (in order or priority): + // - logical signal value (unsigned integer) representing a state + // - physical signal value (float) + raw:KmatrixRawEncoding; + physical:KmatrixPhysicalEncoding; + logical:[KmatrixLogicalEncoding]; +} + +table KmatrixSignal { + name:string; // Name of the Signal. If not provided, use the UID. + uid:uint; // UID of a signal, if not provided the UID will + // be generated using the blake2b hash algorithm + // (to 4 bytes) and interpreted as a uint. + encoding:KmatrixSignalEncoding; // The signal encoding. +} + +table KmatrixEncoder { + signals:[KmatrixSignal]; +} + + + +/** + Encoder Messages + ================ + + These messages define a generic Signal Encoder which will reference a + specific Signal Encoding. +*/ +union MessageType { + KmatrixEncoder:KmatrixEncoder, +} +table EncoderMessage { + // Message metadata. + model_uid:uint; // Identifes a Model within a Simulation Environment. + // Value 0 is reserved for control messages. + message:MessageType; // The message being transmitted. + control_code:uint; // Code to "authenticate" a control message. + + // Response info, requested by setting token. + token:int; // Client supplied token for linking Response to original Message. + rc:int; // Result of the message processing, 0 indicates success. + response:string; // A message which might explain the failure reason. +} +root_type EncoderMessage; +file_identifier "SIEN"; // Signal Interface ENcoder diff --git a/schemas/signal/flatbuffers/parameter.fbs b/schemas/signal/flatbuffers/parameter.fbs new file mode 100644 index 0000000..ce3fb54 --- /dev/null +++ b/schemas/signal/flatbuffers/parameter.fbs @@ -0,0 +1,65 @@ +//*************************************************************************** +// Copyright (c) 2021 for information on the respective copyright owner +// see the NOTICE file and/or the following repository: +// https://github.com/boschglobal/automotive-bus-schema +// +// SPDX-License-Identifier: Apache-2.0 +//*************************************************************************** + + +/** + IDL for Automotive Bus - Signal Interface - Parameter + ===================================================== + + Parameter Messages. + + Parameter data is encoded with related MsgPack schema ParameterData. See + schema file 'schemas/signal/msgpack/data_payloads.yaml' for details. + + MIME Type : application/x-automotive-bus; interface=signal; type=parameter; + Flatbuffers file identifier : SIPA +*/ + + +namespace AutomotiveBus.SignalInterface.Parameter; + + +/** + Parameter Messages + ================== + + MsgPack encoded Parameter Data: + Data = { + Parameter Name: Parameter Value, // (string): (number) + } + Parameter Values can be encoded with any MsgPack numeric + type (i.e. Integer or Float). +*/ +table ParameterWrite { // Configuration_Client -> SimBus + data:[ubyte]; // MsgPack encoded Parameter Data. +} +table ParameterValue { // SimBus -> Configuration_Client + data:[ubyte]; // MsgPack encoded Parameter Data. +} + + +/** + Message Construction. +*/ +union MessageType { + ParameterWrite:ParameterWrite, +} +table ParameterMessage { + // Message metadata. + model_uid:uint; // Identifes a Model within a Simulation Environment. + // Value 0 is reserved for control messages. + message:MessageType; // The message being transmitted. + control_code:uint; // Code to "authenticate" a control message. + + // Response info, requested by setting token. + token:int; // Client supplied token for linking Response to original Message. + rc:int; // Result of the message processing, 0 indicates success. + response:string; // A message which might explain the failure reason. +} +root_type ParameterMessage; +file_identifier "SIPA"; // Signal Interface PArameter diff --git a/schemas/signal/msgpack/data_payloads.yaml b/schemas/signal/msgpack/data_payloads.yaml new file mode 100644 index 0000000..e107e97 --- /dev/null +++ b/schemas/signal/msgpack/data_payloads.yaml @@ -0,0 +1,51 @@ +#*************************************************************************** +# Copyright (c) 2021 for information on the respective copyright owner +# see the NOTICE file and/or the following repository: +# https://github.com/boschglobal/automotive-bus-schema +# +# SPDX-License-Identifier: Apache-2.0 +#*************************************************************************** + +--- +openapi: 3.0.0 +info: + title: Automotive Bus Signal Interface Data Payloads. + description: Schemas for MsgPack encoded payloads. + contact: + url: https://github.com/boschglobal/automotive-bus-schema + license: + name: Apache-2.0 + url: https://github.com/boschglobal/automotive-bus-schema/blob/main/LICENSE + version: 1.0 +components: + schemas: + SignalData: + description: MsgPack encoded Signal Data. Number of elements in each nested array should be identical. + example: Data = [[0..N],[0..N]] + type: array + minItems: 1 + maxItems: 2 + items: + type: array + required: true + items: + description: Signal UID + type: integer + format: int32 + minimum: 0 + type: array + items: + description: Signal Value - can be omitted for SignalRead. + anyOf: + - type: integer + - type: number + ParameterData: + description: MsgPack encoded Parameter Data. + type: object + additionalProperties: + anyOf: + - type: integer + - type: number + example: + foo: 42.24 + bar: 42 From de02ffeb9a0c99056dff078239d4255ea8a14d2c Mon Sep 17 00:00:00 2001 From: Timothy Rule Date: Tue, 7 Sep 2021 11:56:59 +0200 Subject: [PATCH 4/5] Add docker builder images. --- docker/flatc-builder/Dockerfile | 111 +++++++++++++++++++++++++++++++ docker/python-builder/Dockerfile | 49 ++++++++++++++ docker/python-builder/pip.conf | 2 + 3 files changed, 162 insertions(+) create mode 100644 docker/flatc-builder/Dockerfile create mode 100644 docker/python-builder/Dockerfile create mode 100644 docker/python-builder/pip.conf diff --git a/docker/flatc-builder/Dockerfile b/docker/flatc-builder/Dockerfile new file mode 100644 index 0000000..a249afc --- /dev/null +++ b/docker/flatc-builder/Dockerfile @@ -0,0 +1,111 @@ +FROM debian:buster-slim AS builder + + +# ========================= +# Builder image +# ========================= +# Partly derived from the following Dockerfile : +# https://github.com/neomantra/docker-flatbuffers/blob/master/Dockerfile + + +# Setup basic GCC and CMAKE toolchains +# ==================================== +RUN apt-get -y update; \ + apt-get -y upgrade; \ + apt-get -y install --no-install-recommends \ + binutils \ + build-essential \ + ca-certificates \ + cmake \ + extra-cmake-modules \ + curl \ + g++ \ + git \ + less \ + make \ + && \ + apt-get clean; \ + rm -rf /var/lib/apt/lists/* + + +# FlatBuffer Build +# ================ +# https://github.com/google/flatbuffers/archive/refs/tags/v1.12.0.tar.gz +ARG FLATBUFFERS_ARCHIVE_BASE_URL="https://github.com/google/flatbuffers/archive/refs/tags" +ARG FLATBUFFERS_ARCHIVE_TAG="v1.12.0" +ARG FLATBUFFERS_BUILD_TYPE="Release" +ARG FLATBUFFERS_USE_CLANG="false" + +RUN curl -fSL "${FLATBUFFERS_ARCHIVE_BASE_URL}/${FLATBUFFERS_ARCHIVE_TAG}.tar.gz" -o flatbuffers.tar.gz \ + && tar xzf flatbuffers.tar.gz \ + && cd flatbuffers-* \ + && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=${FLATBUFFERS_BUILD_TYPE} . \ + && make \ + && make test \ + && make install \ + && cp src/idl_parser.cpp src/idl_gen_text.cpp /usr/local/include/flatbuffers + + +# Flatcc Build +# ============ +# https://github.com/dvidelabs/flatcc/archive/refs/tags/v0.6.0.tar.gz +ARG FLATCC_ARCHIVE_BASE_URL="https://github.com/dvidelabs/flatcc/archive/refs/tags" +ARG FLATCC_ARCHIVE_TAG="v0.6.0" + +RUN curl -fSL "${FLATCC_ARCHIVE_BASE_URL}/${FLATCC_ARCHIVE_TAG}.tar.gz" -o flatcc.tar.gz \ + && tar xzf flatcc.tar.gz \ + && mv flatcc-* flatcc \ + && cd flatcc \ + && env $( if [ "${FLATBUFFERS_USE_CLANG}" = "true" ] ; then echo "CC=/usr/bin/clang CXX=/usr/bin/clang++ " ; fi) \ + ./scripts/initbuild.sh make \ + && env $( if [ "${FLATBUFFERS_USE_CLANG}" = "true" ] ; then echo "CC=/usr/bin/clang CXX=/usr/bin/clang++ " ; fi) \ + ./scripts/build.sh + + + +# ========================= +# Construct the final image +# ========================= +FROM debian:buster-slim + + +# Setup basic tools +# ================= +RUN apt-get -y update; \ + apt-get -y upgrade; \ + apt-get -y install --no-install-recommends \ + build-essential \ + curl \ + git \ + make \ + zip \ + && \ + apt-get clean; \ + rm -rf /var/lib/apt/lists/* + + +# Flatbuffers (flatc) +# =================== +COPY --from=builder /usr/local/bin/flatc /usr/local/bin/flatc +COPY --from=builder /usr/local/include/flatbuffers /usr/local/include/flatbuffers +COPY --from=builder /usr/local/lib/libflatbuffers.a /usr/local/lib/libflatbuffers.a +COPY --from=builder /usr/local/lib/cmake/flatbuffers /usr/local/lib/cmake/flatbuffers + + +# Flatcc (flatcc) +# =============== +COPY --from=builder /flatcc/bin/flatcc /usr/local/bin/flatcc +COPY --from=builder /flatcc/include/flatcc /usr/local/include/flatcc +COPY --from=builder /flatcc/lib/*.a /usr/local/lib/ + + +# Source Code (flatcc) +# ==================== +COPY --from=builder /flatcc.tar.gz flatcc.tar.gz +RUN tar xzf flatcc.tar.gz \ + && mkdir -p /usr/local/src \ + && mv flatcc-* /usr/local/src/flatcc \ + && rm flatcc.tar.gz + + +# CMD ["/bin/bash", "-c", "tail /dev/null -f"] diff --git a/docker/python-builder/Dockerfile b/docker/python-builder/Dockerfile new file mode 100644 index 0000000..6eb23a4 --- /dev/null +++ b/docker/python-builder/Dockerfile @@ -0,0 +1,49 @@ +FROM python:3.8.10-slim + + +# Setup basic tools +# ================= +RUN apt-get -y update; \ + apt-get -y upgrade; \ + apt-get -y install --no-install-recommends \ + build-essential \ + ca-certificates \ + cargo \ + curl \ + gcc \ + git \ + less \ + make \ + python3-dev \ + zip \ + && \ + apt-get clean; \ + rm -rf /var/lib/apt/lists/* + + +# Python VENV +# =========== +RUN python -m venv /opt/venv +ENV PATH="/opt/venv/bin:$PATH" + + +# Python Libraries +# ================ +RUN pip install --upgrade pip; pip install \ + flatbuffers==1.12 \ + msgpack \ + numpy \ + pip-licenses \ + pytest \ + twine \ + wheel \ + && \ + pip list; pip-licenses + + +# Global PIP config +# ================= +COPY pip.conf /etc/pip.conf + + +# CMD ["/bin/bash", "-c", "tail /dev/null -f"] diff --git a/docker/python-builder/pip.conf b/docker/python-builder/pip.conf new file mode 100644 index 0000000..1ce2513 --- /dev/null +++ b/docker/python-builder/pip.conf @@ -0,0 +1,2 @@ +[global] +disable-pip-version-check = True From 1e37116022bd1d672eb32f45c7b2d9d495391159 Mon Sep 17 00:00:00 2001 From: Timothy Rule Date: Tue, 7 Sep 2021 12:15:47 +0200 Subject: [PATCH 5/5] Doc updates for mimetypes and other metadata. --- README.md | 5 ++- doc/network_model_flexray.md | 31 ---------------- doc/{network_model_can.md => register/can.md} | 37 ++++++++++--------- .../ethernet.md} | 16 ++++---- doc/register/flexray.md | 32 ++++++++++++++++ 5 files changed, 63 insertions(+), 58 deletions(-) delete mode 100644 doc/network_model_flexray.md rename doc/{network_model_can.md => register/can.md} (78%) rename doc/{network_model_ethernet.md => register/ethernet.md} (61%) create mode 100644 doc/register/flexray.md diff --git a/README.md b/README.md index 848f4dc..18f9957 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,15 @@ ## Introduction This is a collection of schemas in the Google FlatBuffers IDL for describing automotive network communications within a virtualized simulation environment. - Currently buffer representations of CAN, FlexRay, Ethernet and Encoded Signals at the level of a Communication Matrix definition are provided. + +Currently buffer representations of CAN, FlexRay, Ethernet and Encoded Signals at the level of a Communication Matrix definition are provided. + ## Project structure ``` L- docs Documentation L- schemas Schemas of the Standard +L- docker Supporting build environments ``` diff --git a/doc/network_model_flexray.md b/doc/network_model_flexray.md deleted file mode 100644 index 0f77c20..0000000 --- a/doc/network_model_flexray.md +++ /dev/null @@ -1,31 +0,0 @@ - - - -## Network Model FlexRay - -Model | Network Model FlexRay -:---|:--- -  | [Schema File](../schemas/network_model_flexray.fbs) -MIME Type | application/x-open-simulation-interface-network-model; type=FlexRay; -Data Stream | 4 byte Message Length followed by FlatBuffers Message. Repeating. -FlatBuffers File Identifier | NMFR -Abbreviations | NM FlexRay, NMFR - - -### Modeled BUS Features - -#### Static/Dynamic Parts - - -#### Slot Chasing (Events) - - -#### FlexRay Startup - - -#### L2 Status diff --git a/doc/network_model_can.md b/doc/register/can.md similarity index 78% rename from doc/network_model_can.md rename to doc/register/can.md index 207aea4..fb4bd6b 100644 --- a/doc/network_model_can.md +++ b/doc/register/can.md @@ -6,25 +6,26 @@ --> -## Network Model CAN +# Automotive Bus Register Interface CAN -Model | Network Model CAN +## Overview + +Schema | Register Interface CAN :---|:--- -  | [Schema File](../schemas/network_model_can.fbs) -MIME Type | application/x-open-simulation-interface-network-model; type=CAN; +  | [Schema File](../../schemas/register/can.fbs) +MIME Type | application/x-automotive-bus; interface=register; type=CAN; Data Stream | 4 byte Message Length followed by FlatBuffers Message. Repeating. -FlatBuffers File Identifier | NMCA -Abbreviations | NM CAN, NMC, NMCA +FlatBuffers File Identifier | RICA -### Modeled BUS Features +## Modeled BUS Features -#### Tx/Rx FIFO(Buffer) Operation +### Tx/Rx FIFO(Buffer) Operation The size and configuration of FIFO/Buffer is set when connecting to a Virtual BUS. Typically this is a limited resource and FIFO/Buffers are assigned to one of the Tx/Rx functions. -##### TX FIFO with Priority +#### TX FIFO with Priority * TX Queue with maximum size. * Messages are sent according to Message ID. @@ -36,7 +37,7 @@ The size and configuration of FIFO/Buffer is set when connecting to a Virtual BU - number of unused FIFO/Buffers -##### TX FIFO +#### TX FIFO * TX Queue with maximum size. * Messages are sent in order of enqueue (i.e. circular buffer). @@ -50,7 +51,7 @@ The size and configuration of FIFO/Buffer is set when connecting to a Virtual BU - number of unused FIFO/Buffers -##### RX FIFO +#### RX FIFO * RX Queue with maximum size. * Queue is cleared when ECU requests BUS Pull. ECU must handle all messages. @@ -63,22 +64,22 @@ The size and configuration of FIFO/Buffer is set when connecting to a Virtual BU -#### TEC +### TEC -#### REC +### REC -#### Active Error Frame +### Active Error Frame -#### Passive Error Frame +### Passive Error Frame -#### Overload +### Overload -#### Frame Request +### Frame Request -#### L2 Status +### L2 Status diff --git a/doc/network_model_ethernet.md b/doc/register/ethernet.md similarity index 61% rename from doc/network_model_ethernet.md rename to doc/register/ethernet.md index 2a45cb1..5be779f 100644 --- a/doc/network_model_ethernet.md +++ b/doc/register/ethernet.md @@ -5,21 +5,21 @@ SPDX-License-Identifier: Apache-2.0 --> +# Automotive Bus Register Interface Ethernet -## Network Model Ethernet +## Overview -Model | Network Model Ethernet +Schema | Register Interface Ethernet :---|:--- -  | [Schema File](../schemas/network_model_ethernet.fbs) -MIME Type | application/x-open-simulation-interface-network-model; type=Ethernet; +  | [Schema File](../../schemas/register/ethernet.fbs) +MIME Type | application/x-automotive-bus; interface=register; type=Ethernet; Data Stream | 4 byte Message Length followed by FlatBuffers Message. Repeating. -FlatBuffers File Identifier | NMEN -Abbreviations | NM Ethernet, NMEN +FlatBuffers File Identifier | RIEN -### Modeled BUS Features +## Modeled BUS Features -#### Ethernet Frame +### Ethernet Frame Ethernet Frame | 68 - 1522 bytes --|-- diff --git a/doc/register/flexray.md b/doc/register/flexray.md new file mode 100644 index 0000000..71ba5b1 --- /dev/null +++ b/doc/register/flexray.md @@ -0,0 +1,32 @@ + + + +# Automotive Bus Register Interface FlexRay + +## Overview + +Schema | Register Interface FlexRay +:---|:--- +  | [Schema File](../../schemas/register/flexray.fbs) +MIME Type | application/x-automotive-bus; interface=register; type=FlexRay; +Data Stream | 4 byte Message Length followed by FlatBuffers Message. Repeating. +FlatBuffers File Identifier | RIFR + + +## Modeled BUS Features + +### Static/Dynamic Parts + + +### Slot Chasing (Events) + + +### FlexRay Startup + + +### L2 Status