Skip to content

Commit

Permalink
FLASH_DISCRIM causing every target to always full rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
CapnBry committed Jan 26, 2024
1 parent fbfd839 commit 2cabe3b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ python/__pycache__/
*.pyc
super_defines.txt
include/WebContent.h
include/flashdiscrim.h
.DS_Store
6 changes: 3 additions & 3 deletions src/lib/OPTIONS/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ firmware_options_t firmwareOptions;
bool options_init()
{
firmwareOptions = flashedOptions;
#if defined(TARGET_STM32) && defined(FLASH_DISCRIM)
// This is defined by the build_flags.py and used by STM32 (ESP gets it from json)
// It is always defined even though intellisense doesn't pick it up
#if defined(PLATFORM_STM32)
#include "flashdiscrim.h"
// This is created by the build_flags.py and used by STM32 (ESP gets it from json)
flash_discriminator = FLASH_DISCRIM;
#endif
return true;
Expand Down
11 changes: 7 additions & 4 deletions src/python/build_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,17 @@ def get_git_sha():
def get_version():
return string_to_ascii(env.get('GIT_VERSION'))

json_flags['flash-discriminator'] = randint(1,2**32-1)
json_flags['wifi-on-interval'] = -1

process_flags("user_defines.txt")
process_flags("super_defines.txt") # allow secret super_defines to override user_defines
version_to_env()
build_flags.append("-DLATEST_COMMIT=" + get_git_sha())
build_flags.append("-DLATEST_VERSION=" + get_version())
build_flags.append("-DTARGET_NAME=" + re.sub("_VIA_.*", "", target_name))
build_flags.append("-DFLASH_DISCRIM=" + str(json_flags['flash-discriminator']))
condense_flags()

json_flags['flash-discriminator'] = randint(1,2**32-1)
json_flags['wifi-on-interval'] = -1

if '-DRADIO_SX127X=1' in build_flags:
# disallow setting 2400s for 900
if fnmatch.filter(build_flags, '*-DRegulatory_Domain_ISM_2400') or \
Expand Down Expand Up @@ -205,3 +204,7 @@ def get_version():
stm = env.get('PIOPLATFORM', '') in ['ststm32']
if stm:
env['UPLOAD_PROTOCOL'] = 'custom'
# -DFLASH_DISCRIM=xxxx can't be passed on the command line or it will every file to
# always be rebuilt, so put it in a header that options.cpp can include
print(f"#define FLASH_DISCRIM {json_flags['flash-discriminator']}",
file=open("include/flashdiscrim.h", "w"))

0 comments on commit 2cabe3b

Please sign in to comment.