component.mk 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
  10. # This linker script must come before esp32.project.ld
  11. LINKER_SCRIPTS += esp32.extram.bss.ld
  12. endif
  13. #Linker scripts used to link the final application.
  14. #Warning: These linker scripts are only used when the normal app is compiled; the bootloader
  15. #specifies its own scripts.
  16. LINKER_SCRIPTS += $(COMPONENT_BUILD_DIR)/esp32.project.ld esp32.peripherals.ld
  17. #ld_include_panic_highint_hdl is added as an undefined symbol because otherwise the
  18. #linker will ignore panic_highint_hdl.S as it has no other files depending on any
  19. #symbols in it.
  20. COMPONENT_ADD_LDFLAGS += $(COMPONENT_PATH)/libhal.a \
  21. -L$(COMPONENT_PATH)/lib \
  22. $(addprefix -l,$(LIBS)) \
  23. -L $(COMPONENT_PATH)/ld \
  24. -T esp32_out.ld \
  25. -u ld_include_panic_highint_hdl \
  26. $(addprefix -T ,$(LINKER_SCRIPTS)) \
  27. COMPONENT_ADD_LDFRAGMENTS += ld/esp32_fragments.lf linker.lf
  28. ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
  29. COMPONENT_SUBMODULES += lib
  30. # final linking of project ELF depends on all binary libraries, and
  31. # all linker scripts (except esp32_out.ld, as this is code generated here.)
  32. COMPONENT_ADD_LINKER_DEPS := $(ALL_LIB_FILES) \
  33. $(addprefix ld/, $(filter-out $(COMPONENT_BUILD_DIR)/esp32.project.ld, $(LINKER_SCRIPTS))) \
  34. $(COMPONENT_BUILD_DIR)/esp32.project.ld
  35. # Preprocess esp32.ld linker script into esp32_out.ld
  36. #
  37. # The library doesn't really depend on esp32_out.ld, but it
  38. # saves us from having to add the target to a Makefile.projbuild
  39. $(COMPONENT_LIBRARY): esp32_out.ld
  40. esp32_out.ld: $(COMPONENT_PATH)/ld/esp32.ld ../include/sdkconfig.h
  41. $(CC) -I ../include -C -P -x c -E $< -o $@
  42. COMPONENT_EXTRA_CLEAN := esp32_out.ld $(COMPONENT_BUILD_DIR)/esp32.project.ld
  43. # disable stack protection in files which are involved in initialization of that feature
  44. cpu_start.o: CFLAGS := $(filter-out -fstack-protector%, $(CFLAGS))