component.mk 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 mesh
  8. endif
  9. ifdef CONFIG_FREERTOS_UNICORE
  10. COMPONENT_OBJEXCLUDE := ipc.o
  11. endif
  12. ifdef CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
  13. # This linker script must come before esp32.project.ld
  14. LINKER_SCRIPTS += esp32.extram.bss.ld
  15. endif
  16. #Linker scripts used to link the final application.
  17. #Warning: These linker scripts are only used when the normal app is compiled; the bootloader
  18. #specifies its own scripts.
  19. LINKER_SCRIPTS += $(COMPONENT_BUILD_DIR)/esp32.project.ld esp32.rom.ld esp32.peripherals.ld
  20. #Force pure functions from libgcc.a to be linked from ROM
  21. LINKER_SCRIPTS += esp32.rom.libgcc.ld
  22. #SPI-RAM incompatible functions can be used in when the SPI RAM
  23. #workaround is not enabled.
  24. ifndef CONFIG_SPIRAM_CACHE_WORKAROUND
  25. LINKER_SCRIPTS += esp32.rom.spiram_incompatible_fns.ld
  26. endif
  27. ifdef CONFIG_NEWLIB_NANO_FORMAT
  28. LINKER_SCRIPTS += esp32.rom.nanofmt.ld
  29. endif
  30. ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH
  31. LINKER_SCRIPTS += esp32.rom.spiflash.ld
  32. endif
  33. #ld_include_panic_highint_hdl is added as an undefined symbol because otherwise the
  34. #linker will ignore panic_highint_hdl.S as it has no other files depending on any
  35. #symbols in it.
  36. COMPONENT_ADD_LDFLAGS += $(COMPONENT_PATH)/libhal.a \
  37. -L$(COMPONENT_PATH)/lib \
  38. $(addprefix -l,$(LIBS)) \
  39. -L $(COMPONENT_PATH)/ld \
  40. -T esp32_out.ld \
  41. -u ld_include_panic_highint_hdl \
  42. $(addprefix -T ,$(LINKER_SCRIPTS)) \
  43. COMPONENT_ADD_LDFRAGMENTS += ld/esp32_fragments.lf linker.lf
  44. ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
  45. COMPONENT_SUBMODULES += lib
  46. # final linking of project ELF depends on all binary libraries, and
  47. # all linker scripts (except esp32_out.ld, as this is code generated here.)
  48. COMPONENT_ADD_LINKER_DEPS := $(ALL_LIB_FILES) \
  49. $(addprefix ld/, $(filter-out $(COMPONENT_BUILD_DIR)/esp32.project.ld, $(LINKER_SCRIPTS))) \
  50. $(COMPONENT_BUILD_DIR)/esp32.project.ld
  51. # Preprocess esp32.ld linker script into esp32_out.ld
  52. #
  53. # The library doesn't really depend on esp32_out.ld, but it
  54. # saves us from having to add the target to a Makefile.projbuild
  55. $(COMPONENT_LIBRARY): esp32_out.ld
  56. esp32_out.ld: $(COMPONENT_PATH)/ld/esp32.ld ../include/sdkconfig.h
  57. $(CC) -I ../include -C -P -x c -E $< -o $@
  58. COMPONENT_EXTRA_CLEAN := esp32_out.ld $(COMPONENT_BUILD_DIR)/esp32.project.ld
  59. # disable stack protection in files which are involved in initialization of that feature
  60. stack_check.o: CFLAGS := $(filter-out -fstack-protector%, $(CFLAGS))
  61. cpu_start.o: CFLAGS := $(filter-out -fstack-protector%, $(CFLAGS))