summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/target/firmware/Makefile5
-rw-r--r--src/target/firmware/Makefile.inc2
-rwxr-xr-xsrc/target/firmware/solve_envs.py41
3 files changed, 47 insertions, 1 deletions
diff --git a/src/target/firmware/Makefile b/src/target/firmware/Makefile
index e8b11142..28344e1f 100644
--- a/src/target/firmware/Makefile
+++ b/src/target/firmware/Makefile
@@ -86,6 +86,11 @@ BOARD_se_j100_ENVIRONMENTS=$(compal_COMMON_ENVIRONMENTS)
# List of all applications (meant to be overridden on command line)
APPLICATIONS?=hello_world compal_dsp_dump layer1 loader chainload rssi
+# Applications specific env requirements
+APP_chainload_ENVIRONMENTS=compalram
+APP_loader_ENVIRONMENTS=compalram highram
+APP_rssi_ENVIRONMENTS=* -compalram
+
# Various objects that are currently linked into all applications
FLASH_OBJS=flash/cfi_flash.o
ABB_OBJS=abb/twl3025.o
diff --git a/src/target/firmware/Makefile.inc b/src/target/firmware/Makefile.inc
index cb2374e0..90498989 100644
--- a/src/target/firmware/Makefile.inc
+++ b/src/target/firmware/Makefile.inc
@@ -134,7 +134,7 @@ $(foreach app,$(APPLICATIONS), \
$(foreach app,$(APPLICATIONS), \
$(foreach brd,$(BOARDS), \
- $(foreach env,$(BOARD_$(brd)_ENVIRONMENTS), \
+ $(foreach env,$(shell ./solve_envs.py "$(BOARD_$(brd)_ENVIRONMENTS)" "$(APP_$(app)_ENVIRONMENTS)"), \
$(eval $(call APPLICATION_BOARD_ENVIRONMENT_template,$(app),$(brd),$(env))))))
diff --git a/src/target/firmware/solve_envs.py b/src/target/firmware/solve_envs.py
new file mode 100755
index 00000000..d6414d69
--- /dev/null
+++ b/src/target/firmware/solve_envs.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+
+import sys
+
+def parse(s):
+ return set([x.strip() for x in s.split() if x.strip()])
+
+
+def solve(board_envs, app_envs):
+ if not app_envs:
+ return board_envs
+
+ envs = set()
+
+ if '*' in app_envs:
+ envs.update(board_envs)
+ app_envs.discard('*')
+
+ for e in app_envs:
+ if e.startswith('-'):
+ envs.discard(e[1:])
+ elif e in board_envs:
+ envs.add(e)
+
+ return envs
+
+
+def main(name, board_envs, app_envs):
+ # Parse args
+ board_envs = parse(board_envs)
+ app_envs = parse(app_envs)
+
+ # Solve
+ envs = solve(board_envs, app_envs)
+
+ # Result
+ print ' '.join(envs)
+
+
+if __name__ == '__main__':
+ main(*sys.argv)