component.mk 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #
  2. # Component Makefile
  3. #
  4. COMPONENT_SRCDIRS := .
  5. ifdef CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
  6. # This linker script must come before esp32.project.ld
  7. LINKER_SCRIPTS += esp32.extram.bss.ld
  8. endif
  9. ifndef CONFIG_COMPILER_CXX_RTTI
  10. # This linker script must come before esp32.project.ld
  11. LINKER_SCRIPTS += esp32.discard-rtti.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 += -L $(COMPONENT_PATH)/ld \
  21. -T esp32_out.ld \
  22. -u ld_include_panic_highint_hdl \
  23. $(addprefix -T ,$(LINKER_SCRIPTS)) \
  24. COMPONENT_ADD_LDFRAGMENTS += ld/esp32_fragments.lf linker.lf
  25. # final linking of project ELF depends on all binary libraries, and
  26. # all linker scripts (except esp32_out.ld, as this is code generated here.)
  27. COMPONENT_ADD_LINKER_DEPS := $(addprefix ld/, $(filter-out $(COMPONENT_BUILD_DIR)/esp32.project.ld, $(LINKER_SCRIPTS))) \
  28. $(COMPONENT_BUILD_DIR)/esp32.project.ld
  29. # Preprocess esp32.ld linker script into esp32_out.ld
  30. #
  31. # The library doesn't really depend on esp32_out.ld, but it
  32. # saves us from having to add the target to a Makefile.projbuild
  33. $(COMPONENT_LIBRARY): esp32_out.ld
  34. esp32_out.ld: $(COMPONENT_PATH)/ld/esp32.ld ../include/sdkconfig.h
  35. $(CC) -I ../include -C -P -x c -E $< -o $@
  36. COMPONENT_EXTRA_CLEAN := esp32_out.ld $(COMPONENT_BUILD_DIR)/esp32.project.ld
  37. # disable stack protection in files which are involved in initialization of that feature
  38. cpu_start.o: CFLAGS := $(filter-out -fstack-protector%, $(CFLAGS))