fbt: added support for FBT_NO_SYNC environment variable to skip submodule update at start (#1363)

This commit is contained in:
hedger 2022-07-04 20:38:18 +03:00 committed by GitHub
parent 6b6ea44802
commit 43fd2e4433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 225 deletions

View File

@ -1,33 +0,0 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.5 */
#include "gpio.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
PB_BIND(PB_Gpio_SetPinMode, PB_Gpio_SetPinMode, AUTO)
PB_BIND(PB_Gpio_SetInputPull, PB_Gpio_SetInputPull, AUTO)
PB_BIND(PB_Gpio_GetPinMode, PB_Gpio_GetPinMode, AUTO)
PB_BIND(PB_Gpio_GetPinModeResponse, PB_Gpio_GetPinModeResponse, AUTO)
PB_BIND(PB_Gpio_ReadPin, PB_Gpio_ReadPin, AUTO)
PB_BIND(PB_Gpio_ReadPinResponse, PB_Gpio_ReadPinResponse, AUTO)
PB_BIND(PB_Gpio_WritePin, PB_Gpio_WritePin, AUTO)

View File

@ -1,183 +0,0 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.5 */
#ifndef PB_PB_GPIO_GPIO_PB_H_INCLUDED
#define PB_PB_GPIO_GPIO_PB_H_INCLUDED
#include <pb.h>
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Enum definitions */
typedef enum _PB_Gpio_GpioPin {
PB_Gpio_GpioPin_PC0 = 0,
PB_Gpio_GpioPin_PC1 = 1,
PB_Gpio_GpioPin_PC3 = 2,
PB_Gpio_GpioPin_PB2 = 3,
PB_Gpio_GpioPin_PB3 = 4,
PB_Gpio_GpioPin_PA4 = 5,
PB_Gpio_GpioPin_PA6 = 6,
PB_Gpio_GpioPin_PA7 = 7
} PB_Gpio_GpioPin;
typedef enum _PB_Gpio_GpioPinMode {
PB_Gpio_GpioPinMode_OUTPUT = 0,
PB_Gpio_GpioPinMode_INPUT = 1
} PB_Gpio_GpioPinMode;
typedef enum _PB_Gpio_GpioInputPull {
PB_Gpio_GpioInputPull_NO = 0,
PB_Gpio_GpioInputPull_UP = 1,
PB_Gpio_GpioInputPull_DOWN = 2
} PB_Gpio_GpioInputPull;
/* Struct definitions */
typedef struct _PB_Gpio_GetPinMode {
PB_Gpio_GpioPin pin;
} PB_Gpio_GetPinMode;
typedef struct _PB_Gpio_GetPinModeResponse {
PB_Gpio_GpioPinMode mode;
} PB_Gpio_GetPinModeResponse;
typedef struct _PB_Gpio_ReadPin {
PB_Gpio_GpioPin pin;
} PB_Gpio_ReadPin;
typedef struct _PB_Gpio_ReadPinResponse {
uint32_t value;
} PB_Gpio_ReadPinResponse;
typedef struct _PB_Gpio_SetInputPull {
PB_Gpio_GpioPin pin;
PB_Gpio_GpioInputPull pull_mode;
} PB_Gpio_SetInputPull;
typedef struct _PB_Gpio_SetPinMode {
PB_Gpio_GpioPin pin;
PB_Gpio_GpioPinMode mode;
} PB_Gpio_SetPinMode;
typedef struct _PB_Gpio_WritePin {
PB_Gpio_GpioPin pin;
uint32_t value;
} PB_Gpio_WritePin;
/* Helper constants for enums */
#define _PB_Gpio_GpioPin_MIN PB_Gpio_GpioPin_PC0
#define _PB_Gpio_GpioPin_MAX PB_Gpio_GpioPin_PA7
#define _PB_Gpio_GpioPin_ARRAYSIZE ((PB_Gpio_GpioPin)(PB_Gpio_GpioPin_PA7+1))
#define _PB_Gpio_GpioPinMode_MIN PB_Gpio_GpioPinMode_OUTPUT
#define _PB_Gpio_GpioPinMode_MAX PB_Gpio_GpioPinMode_INPUT
#define _PB_Gpio_GpioPinMode_ARRAYSIZE ((PB_Gpio_GpioPinMode)(PB_Gpio_GpioPinMode_INPUT+1))
#define _PB_Gpio_GpioInputPull_MIN PB_Gpio_GpioInputPull_NO
#define _PB_Gpio_GpioInputPull_MAX PB_Gpio_GpioInputPull_DOWN
#define _PB_Gpio_GpioInputPull_ARRAYSIZE ((PB_Gpio_GpioInputPull)(PB_Gpio_GpioInputPull_DOWN+1))
#ifdef __cplusplus
extern "C" {
#endif
/* Initializer values for message structs */
#define PB_Gpio_SetPinMode_init_default {_PB_Gpio_GpioPin_MIN, _PB_Gpio_GpioPinMode_MIN}
#define PB_Gpio_SetInputPull_init_default {_PB_Gpio_GpioPin_MIN, _PB_Gpio_GpioInputPull_MIN}
#define PB_Gpio_GetPinMode_init_default {_PB_Gpio_GpioPin_MIN}
#define PB_Gpio_GetPinModeResponse_init_default {_PB_Gpio_GpioPinMode_MIN}
#define PB_Gpio_ReadPin_init_default {_PB_Gpio_GpioPin_MIN}
#define PB_Gpio_ReadPinResponse_init_default {0}
#define PB_Gpio_WritePin_init_default {_PB_Gpio_GpioPin_MIN, 0}
#define PB_Gpio_SetPinMode_init_zero {_PB_Gpio_GpioPin_MIN, _PB_Gpio_GpioPinMode_MIN}
#define PB_Gpio_SetInputPull_init_zero {_PB_Gpio_GpioPin_MIN, _PB_Gpio_GpioInputPull_MIN}
#define PB_Gpio_GetPinMode_init_zero {_PB_Gpio_GpioPin_MIN}
#define PB_Gpio_GetPinModeResponse_init_zero {_PB_Gpio_GpioPinMode_MIN}
#define PB_Gpio_ReadPin_init_zero {_PB_Gpio_GpioPin_MIN}
#define PB_Gpio_ReadPinResponse_init_zero {0}
#define PB_Gpio_WritePin_init_zero {_PB_Gpio_GpioPin_MIN, 0}
/* Field tags (for use in manual encoding/decoding) */
#define PB_Gpio_GetPinMode_pin_tag 1
#define PB_Gpio_GetPinModeResponse_mode_tag 1
#define PB_Gpio_ReadPin_pin_tag 1
#define PB_Gpio_ReadPinResponse_value_tag 2
#define PB_Gpio_SetInputPull_pin_tag 1
#define PB_Gpio_SetInputPull_pull_mode_tag 2
#define PB_Gpio_SetPinMode_pin_tag 1
#define PB_Gpio_SetPinMode_mode_tag 2
#define PB_Gpio_WritePin_pin_tag 1
#define PB_Gpio_WritePin_value_tag 2
/* Struct field encoding specification for nanopb */
#define PB_Gpio_SetPinMode_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UENUM, pin, 1) \
X(a, STATIC, SINGULAR, UENUM, mode, 2)
#define PB_Gpio_SetPinMode_CALLBACK NULL
#define PB_Gpio_SetPinMode_DEFAULT NULL
#define PB_Gpio_SetInputPull_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UENUM, pin, 1) \
X(a, STATIC, SINGULAR, UENUM, pull_mode, 2)
#define PB_Gpio_SetInputPull_CALLBACK NULL
#define PB_Gpio_SetInputPull_DEFAULT NULL
#define PB_Gpio_GetPinMode_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UENUM, pin, 1)
#define PB_Gpio_GetPinMode_CALLBACK NULL
#define PB_Gpio_GetPinMode_DEFAULT NULL
#define PB_Gpio_GetPinModeResponse_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UENUM, mode, 1)
#define PB_Gpio_GetPinModeResponse_CALLBACK NULL
#define PB_Gpio_GetPinModeResponse_DEFAULT NULL
#define PB_Gpio_ReadPin_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UENUM, pin, 1)
#define PB_Gpio_ReadPin_CALLBACK NULL
#define PB_Gpio_ReadPin_DEFAULT NULL
#define PB_Gpio_ReadPinResponse_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, value, 2)
#define PB_Gpio_ReadPinResponse_CALLBACK NULL
#define PB_Gpio_ReadPinResponse_DEFAULT NULL
#define PB_Gpio_WritePin_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UENUM, pin, 1) \
X(a, STATIC, SINGULAR, UINT32, value, 2)
#define PB_Gpio_WritePin_CALLBACK NULL
#define PB_Gpio_WritePin_DEFAULT NULL
extern const pb_msgdesc_t PB_Gpio_SetPinMode_msg;
extern const pb_msgdesc_t PB_Gpio_SetInputPull_msg;
extern const pb_msgdesc_t PB_Gpio_GetPinMode_msg;
extern const pb_msgdesc_t PB_Gpio_GetPinModeResponse_msg;
extern const pb_msgdesc_t PB_Gpio_ReadPin_msg;
extern const pb_msgdesc_t PB_Gpio_ReadPinResponse_msg;
extern const pb_msgdesc_t PB_Gpio_WritePin_msg;
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
#define PB_Gpio_SetPinMode_fields &PB_Gpio_SetPinMode_msg
#define PB_Gpio_SetInputPull_fields &PB_Gpio_SetInputPull_msg
#define PB_Gpio_GetPinMode_fields &PB_Gpio_GetPinMode_msg
#define PB_Gpio_GetPinModeResponse_fields &PB_Gpio_GetPinModeResponse_msg
#define PB_Gpio_ReadPin_fields &PB_Gpio_ReadPin_msg
#define PB_Gpio_ReadPinResponse_fields &PB_Gpio_ReadPinResponse_msg
#define PB_Gpio_WritePin_fields &PB_Gpio_WritePin_msg
/* Maximum encoded size of messages (where known) */
#define PB_Gpio_GetPinModeResponse_size 2
#define PB_Gpio_GetPinMode_size 2
#define PB_Gpio_ReadPinResponse_size 6
#define PB_Gpio_ReadPin_size 2
#define PB_Gpio_SetInputPull_size 4
#define PB_Gpio_SetPinMode_size 4
#define PB_Gpio_WritePin_size 8
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -10,7 +10,10 @@ Make sure that `gcc-arm-none-eabi` toolchain & OpenOCD executables are in system
## NB
FBT constructs all referenced environments & their targets' dependency trees on startup. So, to keep startup time as low as possible, we're hiding construction of certain targets behind command-line options.
* `fbt` constructs all referenced environments & their targets' dependency trees on startup. So, to keep startup time as low as possible, we're hiding construction of certain targets behind command-line options.
* `fbt` always performs `git submodule update --init` on start, unless you set `FBT_NO_SYNC=1` in environment:
* On Windows, that's `set "FBT_NO_SYNC=1"` in the shell you're running `fbt` from
* On \*nix, it's `$ FBT_NO_SYNC=1 ./fbt ...`
## Invoking FBT

13
fbt
View File

@ -5,12 +5,13 @@ set -e
SCRIPTDIR="$( dirname -- "$0"; )";
SCONS_EP=${SCRIPTDIR}/lib/scons/scripts/scons.py
if [[ -d .git ]]; then
git submodule update --init
else # Not in a git repo
echo Not in a git repo, please clone with git clone --recursive
# Return error code 1 to indicate failure
exit 1
if [[ -z "${FBT_NO_SYNC:-}" ]] ; then
if [[ -d .git ]]; then
git submodule update --init
else
echo Not in a git repo, please clone with git clone --recursive
exit 1
fi
fi
SCONS_DEFAULT_FLAGS="-Q --warn=target-not-built"

View File

@ -2,8 +2,13 @@
set SCONS_EP=%~dp0\lib\scons\scripts\scons.py
if exist ".git" (
git submodule update --init
if [%FBT_NO_SYNC%] == [] (
if exist ".git" (
git submodule update --init
) else (
echo Not in a git repo, please clone with git clone --recursive
exit /b 1
)
)
set "SCONS_DEFAULT_FLAGS=-Q --warn=target-not-built"