component.mk 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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.common.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 += esp32.common.ld esp32.rom.ld esp32.peripherals.ld
  17. #Force pure functions from libgcc.a to be linked from ROM
  18. LINKER_SCRIPTS += esp32.rom.libgcc.ld
  19. #SPI-RAM incompatible functions can be used in when the SPI RAM
  20. #workaround is not enabled.
  21. ifndef CONFIG_SPIRAM_CACHE_WORKAROUND
  22. LINKER_SCRIPTS += esp32.rom.spiram_incompatible_fns.ld
  23. endif
  24. ifdef CONFIG_NEWLIB_NANO_FORMAT
  25. LINKER_SCRIPTS += esp32.rom.nanofmt.ld
  26. endif
  27. ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH
  28. LINKER_SCRIPTS += esp32.rom.spiflash.ld
  29. endif
  30. #ld_include_panic_highint_hdl is added as an undefined symbol because otherwise the
  31. #linker will ignore panic_highint_hdl.S as it has no other files depending on any
  32. #symbols in it.
  33. COMPONENT_ADD_LDFLAGS += $(COMPONENT_PATH)/libhal.a \
  34. -L$(COMPONENT_PATH)/lib \
  35. $(addprefix -l,$(LIBS)) \
  36. -L $(COMPONENT_PATH)/ld \
  37. -T esp32_out.ld \
  38. -u ld_include_panic_highint_hdl \
  39. $(addprefix -T ,$(LINKER_SCRIPTS))
  40. ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
  41. COMPONENT_SUBMODULES += lib
  42. # final linking of project ELF depends on all binary libraries, and
  43. # all linker scripts (except esp32_out.ld, as this is code generated here.)
  44. COMPONENT_ADD_LINKER_DEPS := $(ALL_LIB_FILES) $(addprefix ld/,$(LINKER_SCRIPTS))
  45. # Preprocess esp32.ld linker script into esp32_out.ld
  46. #
  47. # The library doesn't really depend on esp32_out.ld, but it
  48. # saves us from having to add the target to a Makefile.projbuild
  49. $(COMPONENT_LIBRARY): esp32_out.ld
  50. esp32_out.ld: $(COMPONENT_PATH)/ld/esp32.ld ../include/sdkconfig.h
  51. $(CC) -I ../include -C -P -x c -E $< -o $@
  52. COMPONENT_EXTRA_CLEAN := esp32_out.ld
  53. # disable stack protection in files which are involved in initialization of that feature
  54. stack_check.o: CFLAGS := $(filter-out -fstack-protector%, $(CFLAGS))
  55. cpu_start.o: CFLAGS := $(filter-out -fstack-protector%, $(CFLAGS))