component.mk 1.8 KB

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