extapps.scons 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. "-Xlinker",
  37. "-Map=${TARGET}.map",
  38. ],
  39. )
  40. extapps = []
  41. for apptype in (FlipperAppType.PLUGIN, FlipperAppType.EXTERNAL):
  42. for app in appenv["APPBUILD"].get_apps_of_type(apptype):
  43. extapps.append(appenv.BuildAppElf(app))
  44. # Ugly access to global option
  45. if extra_app_list := GetOption("extra_ext_apps"):
  46. for extra_app in extra_app_list.split(","):
  47. extapps.append(appenv.BuildAppElf(appenv["APPMGR"].get(extra_app)))
  48. Alias(appenv["FIRMWARE_BUILD_CFG"] + "_extapps", extapps)
  49. Return("extapps")