Tools: ardupilotwaf: move setting of ROMFS flags for all boards to `embed_ROMFS_files` method

This commit is contained in:
Iampete1 2024-05-11 16:39:45 +01:00 committed by Peter Barker
parent 0bb51a31ea
commit 773fa73e75
1 changed files with 8 additions and 15 deletions

View File

@ -542,6 +542,14 @@ class Board:
if not embed.create_embedded_h(header, ctx.env.ROMFS_FILES, ctx.env.ROMFS_UNCOMPRESSED): if not embed.create_embedded_h(header, ctx.env.ROMFS_FILES, ctx.env.ROMFS_UNCOMPRESSED):
ctx.fatal("Failed to created ap_romfs_embedded.h") ctx.fatal("Failed to created ap_romfs_embedded.h")
ctx.env.CXXFLAGS += ['-DHAL_HAVE_AP_ROMFS_EMBEDDED_H']
# Allow lua to load from ROMFS if any lua files are added
for file in ctx.env.ROMFS_FILES:
if file[0].startswith("scripts") and file[0].endswith(".lua"):
ctx.env.CXXFLAGS += ['-DHAL_HAVE_AP_ROMFS_EMBEDDED_LUA']
break
Board = BoardMeta('Board', Board.__bases__, dict(Board.__dict__)) Board = BoardMeta('Board', Board.__bases__, dict(Board.__dict__))
def add_dynamic_boards_chibios(): def add_dynamic_boards_chibios():
@ -777,14 +785,6 @@ class sitl(Board):
if fnmatch.fnmatch(f, "*.lua"): if fnmatch.fnmatch(f, "*.lua"):
env.ROMFS_FILES += [('scripts/'+f,'ROMFS/scripts/'+f)] env.ROMFS_FILES += [('scripts/'+f,'ROMFS/scripts/'+f)]
if len(env.ROMFS_FILES) > 0:
# Allow lua to load from ROMFS if any lua files are added
for file in env.ROMFS_FILES:
if file[0].startswith("scripts") and file[0].endswith(".lua"):
env.CXXFLAGS += ['-DHAL_HAVE_AP_ROMFS_EMBEDDED_LUA']
break
env.CXXFLAGS += ['-DHAL_HAVE_AP_ROMFS_EMBEDDED_H']
if cfg.options.sitl_rgbled: if cfg.options.sitl_rgbled:
env.CXXFLAGS += ['-DWITH_SITL_RGBLED'] env.CXXFLAGS += ['-DWITH_SITL_RGBLED']
@ -1357,13 +1357,6 @@ class linux(Board):
env.DEFINES.update( env.DEFINES.update(
HAL_PARAM_DEFAULTS_PATH='"@ROMFS/defaults.parm"', HAL_PARAM_DEFAULTS_PATH='"@ROMFS/defaults.parm"',
) )
if len(env.ROMFS_FILES) > 0:
# Allow lua to load from ROMFS if any lua files are added
for file in env.ROMFS_FILES:
if file[0].startswith("scripts") and file[0].endswith(".lua"):
env.CXXFLAGS += ['-DHAL_HAVE_AP_ROMFS_EMBEDDED_LUA']
break
env.CXXFLAGS += ['-DHAL_HAVE_AP_ROMFS_EMBEDDED_H']
def build(self, bld): def build(self, bld):
super(linux, self).build(bld) super(linux, self).build(bld)