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

Fix issue with app.overlay getting ignored #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
15 changes: 14 additions & 1 deletion scripts/lfc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,21 @@ def do_add_parser(self, parser_adder):

parser.add_argument('app', help='Name of main LF file')
parser.add_argument('--build', nargs='?', const=" ", help='Invoke `west build` after code-generation')
parser.add_argument('--board', help='Board selection, which is passed to `west build` if invoked')
parser.add_argument('--lfc', help='Path to LFC binary')

return parser # gets stored as self.parser

def do_run(self, args, unknown_args):

if args.build and not args.board:
print("ERROR: build option selected but no board was passed")
exit(1)

# Verify that the project is laid out correctly
if "src" not in args.app:
print("ERROR: LF app must be inside a `src` folder")
exit(1)


# Find the path to where lfc will put the sources
Expand Down Expand Up @@ -61,9 +67,16 @@ def do_run(self, args, unknown_args):
exit(1)
shutil.copyfile(src, dst)

# 3. Add board/<board>.overlay and app.overlay to the DTC_OVERLAY_FILE
# variable, so west picks them both up
#
# Note: The ordering here matters
# (see https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/build/dts/howtos.html#set-devicetree-overlays)
cmake_args = f"-DDTC_OVERLAY_FILE=\"app.overlay boards/{args.board}.overlay\""

# Invoke west in the `src-gen` directory. Pass in
if args.build:
westCmd = f"west build {srcGenPath} {args.build}"
westCmd = f"west build {srcGenPath} {args.build} -b {args.board} -- {cmake_args}"
print(f"Executing west command: `{westCmd}`")
res = subprocess.Popen(westCmd, shell=True)
ret = res.wait()
Expand Down