component.mk 2.3 KB

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