extapps.scons 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. Import("ENV")
  2. from fbt.appmanifest import FlipperAppType
  3. appenv = ENV.Clone(tools=["fbt_extapps"])
  4. appenv.Replace(
  5. LINKER_SCRIPT="application-ext",
  6. STRIPFLAGS=[
  7. "--strip-debug",
  8. "--strip-unneeded",
  9. "-d",
  10. "-g",
  11. "-S",
  12. ],
  13. )
  14. appenv.AppendUnique(
  15. CCFLAGS=[
  16. "-Os",
  17. "-ggdb3",
  18. "-mword-relocations",
  19. "-mlong-calls",
  20. "-fno-common",
  21. "-nostdlib",
  22. "-fvisibility=hidden",
  23. ],
  24. LINKFLAGS=[
  25. "-r",
  26. "-s",
  27. # "-Bsymbolic",
  28. "-nostartfiles",
  29. "-mlong-calls",
  30. "-fno-common",
  31. "-nostdlib",
  32. "-Wl,--gc-sections",
  33. "-Wl,--no-export-dynamic",
  34. "-fvisibility=hidden",
  35. "-Wl,-e${APP_ENTRY}",
  36. ],
  37. )
  38. extapps = []
  39. for apptype in (FlipperAppType.PLUGIN, FlipperAppType.EXTERNAL):
  40. for app in appenv["APPBUILD"].get_apps_of_type(apptype):
  41. extapps.append(appenv.BuildAppElf(app))
  42. # Ugly access to global option
  43. if extra_app_list := GetOption("extra_ext_apps"):
  44. for extra_app in extra_app_list.split(","):
  45. extapps.append(appenv.BuildAppElf(appenv["APPMGR"].get(extra_app)))
  46. Alias(appenv["FIRMWARE_BUILD_CFG"] + "_extapps", extapps)
  47. Return("extapps")