component.mk 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #
  2. # Component Makefile
  3. #
  4. #ifdef IS_BOOTLOADER_BUILD
  5. CFLAGS += -DBOOTLOADER_BUILD
  6. #endif
  7. COMPONENT_SRCDIRS := . hwcrypto
  8. LIBS := core rtc
  9. ifdef CONFIG_PHY_ENABLED # BT || WIFI
  10. LIBS += phy coexist
  11. endif
  12. ifdef CONFIG_WIFI_ENABLED
  13. LIBS += net80211 pp wpa smartconfig coexist wps wpa2
  14. endif
  15. LINKER_SCRIPTS += esp32.common.ld esp32.rom.ld esp32.peripherals.ld
  16. ifeq ("$(CONFIG_NEWLIB_NANO_FORMAT)","y")
  17. LINKER_SCRIPTS += esp32.rom.nanofmt.ld
  18. endif
  19. ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH
  20. LINKER_SCRIPTS += esp32.rom.spiflash.ld
  21. endif
  22. #ld_include_panic_highint_hdl is added as an undefined symbol because otherwise the
  23. #linker will ignore panic_highint_hdl.S as it has no other files depending on any
  24. #symbols in it.
  25. COMPONENT_ADD_LDFLAGS += $(COMPONENT_PATH)/libhal.a \
  26. -L$(COMPONENT_PATH)/lib \
  27. $(addprefix -l,$(LIBS)) \
  28. -L $(COMPONENT_PATH)/ld \
  29. -T esp32_out.ld \
  30. -u ld_include_panic_highint_hdl \
  31. $(addprefix -T ,$(LINKER_SCRIPTS))
  32. ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
  33. COMPONENT_SUBMODULES += lib
  34. # final linking of project ELF depends on all binary libraries, and
  35. # all linker scripts (except esp32_out.ld, as this is code generated here.)
  36. COMPONENT_ADD_LINKER_DEPS := $(ALL_LIB_FILES) $(addprefix ld/,$(LINKER_SCRIPTS))
  37. # Preprocess esp32.ld linker script into esp32_out.ld
  38. #
  39. # The library doesn't really depend on esp32_out.ld, but it
  40. # saves us from having to add the target to a Makefile.projbuild
  41. $(COMPONENT_LIBRARY): esp32_out.ld
  42. esp32_out.ld: $(COMPONENT_PATH)/ld/esp32.ld ../include/sdkconfig.h
  43. $(CC) -I ../include -C -P -x c -E $< -o $@
  44. COMPONENT_EXTRA_CLEAN := esp32_out.ld