component.mk 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #
  2. # Component Makefile
  3. #
  4. COMPONENT_SRCDIRS := .
  5. #Linker scripts used to link the final application.
  6. #Warning: These linker scripts are only used when the normal app is compiled; the bootloader
  7. #specifies its own scripts.
  8. LINKER_SCRIPTS += $(COMPONENT_BUILD_DIR)/esp32.project.ld esp32.peripherals.ld
  9. #ld_include_panic_highint_hdl is added as an undefined symbol because otherwise the
  10. #linker will ignore panic_highint_hdl.S as it has no other files depending on any
  11. #symbols in it.
  12. COMPONENT_ADD_LDFLAGS += -L $(COMPONENT_PATH)/ld \
  13. -T esp32_out.ld \
  14. -u ld_include_panic_highint_hdl \
  15. $(addprefix -T ,$(LINKER_SCRIPTS)) \
  16. COMPONENT_ADD_LDFRAGMENTS += ld/esp32_fragments.lf linker.lf
  17. # final linking of project ELF depends on all binary libraries, and
  18. # all linker scripts (except esp32_out.ld, as this is code generated here.)
  19. COMPONENT_ADD_LINKER_DEPS := $(addprefix ld/, $(filter-out $(COMPONENT_BUILD_DIR)/esp32.project.ld, $(LINKER_SCRIPTS))) \
  20. $(COMPONENT_BUILD_DIR)/esp32.project.ld
  21. # Preprocess esp32.ld linker script into esp32_out.ld
  22. #
  23. # The library doesn't really depend on esp32_out.ld, but it
  24. # saves us from having to add the target to a Makefile.projbuild
  25. $(COMPONENT_LIBRARY): esp32_out.ld
  26. esp32_out.ld: $(COMPONENT_PATH)/ld/esp32.ld ../include/sdkconfig.h
  27. $(CC) -I ../include -C -P -x c -E $< -o $@
  28. COMPONENT_EXTRA_CLEAN := esp32_out.ld $(COMPONENT_BUILD_DIR)/esp32.project.ld