component.mk 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. ifdef IS_BOOTLOADER_BUILD
  2. ifndef CONFIG_IDF_ENV_FPGA
  3. COMPONENT_CONFIG_ONLY := 1
  4. else
  5. COMPONENT_SRCDIRS := .
  6. COMPONENT_OBJS += fpga_overrides.o
  7. endif
  8. else
  9. SOC_NAME := $(IDF_TARGET)
  10. COMPONENT_SRCDIRS := .
  11. COMPONENT_ADD_INCLUDEDIRS := include port/public_compat
  12. COMPONENT_PRIV_INCLUDEDIRS := port/include port
  13. COMPONENT_ADD_LDFRAGMENTS += linker.lf app.lf
  14. COMPONENT_DEPENDS := esp_phy
  15. ifndef CONFIG_IDF_ENV_FPGA
  16. COMPONENT_OBJEXCLUDE += fpga_overrides.o
  17. endif
  18. # Force linking UBSAN hooks. If UBSAN is not enabled, the hooks will ultimately be removed
  19. # due to -ffunction-sections -Wl,--gc-sections options.
  20. COMPONENT_ADD_LDFLAGS += -u __ubsan_include
  21. include $(COMPONENT_PATH)/port/soc/$(SOC_NAME)/component.mk
  22. # disable stack protection in files which are involved in initialization of that feature
  23. startup.o stack_check.o: CFLAGS := $(filter-out -fstack-protector%, $(CFLAGS))
  24. ld_input := $(COMPONENT_PATH)/ld/esp32/memory.ld.in
  25. ld_output := $(COMPONENT_BUILD_DIR)/ld/memory.ld
  26. sections_ld := $(COMPONENT_BUILD_DIR)/ld/sections.ld
  27. #Linker scripts used to link the final application.
  28. #Warning: These linker scripts are only used when the normal app is compiled; the bootloader
  29. #specifies its own scripts.
  30. LINKER_SCRIPTS += $(ld_output) $(sections_ld)
  31. #ld_include_panic_highint_hdl is added as an undefined symbol because otherwise the
  32. #linker will ignore panic_highint_hdl.S as it has no other files depending on any
  33. #symbols in it.
  34. COMPONENT_ADD_LDFLAGS += -u ld_include_panic_highint_hdl \
  35. $(addprefix -T ,$(LINKER_SCRIPTS)) \
  36. # Preprocess memory.ld.in linker script into memory.ld
  37. #
  38. # The library doesn't really depend on memory.ld, but it
  39. # saves us from having to add the target to a Makefile.projbuild
  40. $(COMPONENT_LIBRARY): $(ld_output)
  41. $(ld_output): $(ld_input) ../include/sdkconfig.h
  42. mkdir -p $(COMPONENT_BUILD_DIR)/ld
  43. $(CC) -I ../include -I $(COMPONENT_PATH)/ld -C -P -x c -E $< -o $@
  44. COMPONENT_EXTRA_CLEAN := $(ld_output) $(sections_ld)
  45. endif