component.mk 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #
  2. # Component Makefile
  3. #
  4. COMPONENT_SRCDIRS := . hwcrypto
  5. LIBS ?=
  6. ifndef CONFIG_NO_BLOBS
  7. LIBS += core rtc net80211 pp wpa smartconfig coexist wps wpa2 espnow phy
  8. endif
  9. #Linker scripts used to link the final application.
  10. #Warning: These linker scripts are only used when the normal app is compiled; the bootloader
  11. #specifies its own scripts.
  12. LINKER_SCRIPTS += esp32.common.ld esp32.rom.ld esp32.peripherals.ld
  13. #SPI-RAM incompatible functions can be used in when the SPI RAM
  14. #workaround is not enabled.
  15. ifndef CONFIG_SPIRAM_CACHE_WORKAROUND
  16. LINKER_SCRIPTS += esp32.rom.spiram_incompatible_fns.ld
  17. endif
  18. ifdef CONFIG_NEWLIB_NANO_FORMAT
  19. LINKER_SCRIPTS += esp32.rom.nanofmt.ld
  20. endif
  21. ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH
  22. LINKER_SCRIPTS += esp32.rom.spiflash.ld
  23. endif
  24. #ld_include_panic_highint_hdl is added as an undefined symbol because otherwise the
  25. #linker will ignore panic_highint_hdl.S as it has no other files depending on any
  26. #symbols in it.
  27. COMPONENT_ADD_LDFLAGS += $(COMPONENT_PATH)/libhal.a \
  28. -L$(COMPONENT_PATH)/lib \
  29. $(addprefix -l,$(LIBS)) \
  30. -L $(COMPONENT_PATH)/ld \
  31. -T esp32_out.ld \
  32. -u ld_include_panic_highint_hdl \
  33. $(addprefix -T ,$(LINKER_SCRIPTS))
  34. #The cache workaround also needs a c++ standard library recompiled with the workaround.
  35. ifdef CONFIG_SPIRAM_CACHE_WORKAROUND
  36. COMPONENT_ADD_LDFLAGS += $(COMPONENT_PATH)/libstdc++-psram-workaround.a
  37. endif
  38. ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
  39. COMPONENT_SUBMODULES += lib
  40. # final linking of project ELF depends on all binary libraries, and
  41. # all linker scripts (except esp32_out.ld, as this is code generated here.)
  42. COMPONENT_ADD_LINKER_DEPS := $(ALL_LIB_FILES) $(addprefix ld/,$(LINKER_SCRIPTS))
  43. # Preprocess esp32.ld linker script into esp32_out.ld
  44. #
  45. # The library doesn't really depend on esp32_out.ld, but it
  46. # saves us from having to add the target to a Makefile.projbuild
  47. $(COMPONENT_LIBRARY): esp32_out.ld
  48. esp32_out.ld: $(COMPONENT_PATH)/ld/esp32.ld ../include/sdkconfig.h
  49. $(CC) -I ../include -C -P -x c -E $< -o $@
  50. COMPONENT_EXTRA_CLEAN := esp32_out.ld