diff --git a/components/bt/component.mk b/components/bt/component.mk index 7d5019f242..12d98e6ff2 100644 --- a/components/bt/component.mk +++ b/components/bt/component.mk @@ -16,6 +16,7 @@ COMPONENT_ADD_LDFLAGS := -lbt -L $(COMPONENT_PATH)/controller/lib/esp32 \ COMPONENT_ADD_LINKER_DEPS := $(patsubst %,$(COMPONENT_PATH)/controller/lib/esp32/lib%.a,$(LIBS)) COMPONENT_SUBMODULES += controller/lib +COMPONENT_ADD_LDFRAGMENTS += linker.lf # TODO: annotate fallthroughs in Bluedroid code with comments diff --git a/components/bt/linker.lf b/components/bt/linker.lf index e8cbc14628..f699264869 100644 --- a/components/bt/linker.lf +++ b/components/bt/linker.lf @@ -1,5 +1,40 @@ +[sections:bss_common] +entries: + .bss+ + COMMON + +[scheme:bt_start_end] +entries: + bss_common -> dram0_bss + data -> dram0_data + +# For the following fragments, order matters for +# 'align(4, post) emit(sym)', which generates: +# +# _sym_start +# ... +# . = ALIGN(4) +# _sym_end + [mapping:bt] archive: libbt.a entries: + * (bt_start_end); + bss_common -> dram0_bss align(4, post) emit(bt_bss), + data -> dram0_data align(4, post) emit(bt_data) if ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY = y: * (extram_bss) + +[mapping:btdm] +archive: libbtdm_app.a +entries: + * (bt_start_end); + bss_common -> dram0_bss align(4, post) emit(btdm_bss), + data -> dram0_data align(4, post) emit(btdm_data) + +[mapping:nimble] +archive: libnimble.a +entries: + * (bt_start_end); + bss_common -> dram0_bss align(4, post) emit(nimble_bss), + data -> dram0_data align(4, post) emit(nimble_data) diff --git a/components/esp32/ld/esp32.project.ld.in b/components/esp32/ld/esp32.project.ld.in index 2051976b34..3cd0d7e8f4 100644 --- a/components/esp32/ld/esp32.project.ld.in +++ b/components/esp32/ld/esp32.project.ld.in @@ -172,18 +172,6 @@ SECTIONS .dram0.data : { _data_start = ABSOLUTE(.); - _bt_data_start = ABSOLUTE(.); - *libbt.a:(.data .data.*) - . = ALIGN (4); - _bt_data_end = ABSOLUTE(.); - _btdm_data_start = ABSOLUTE(.); - *libbtdm_app.a:(.data .data.*) - . = ALIGN (4); - _btdm_data_end = ABSOLUTE(.); - _nimble_data_start = ABSOLUTE(.); - *libnimble.a:(.data .data.*) - . = ALIGN (4); - _nimble_data_end = ABSOLUTE(.); *(.gnu.linkonce.d.*) *(.data1) *(.sdata) @@ -234,18 +222,6 @@ SECTIONS { . = ALIGN (8); _bss_start = ABSOLUTE(.); - _bt_bss_start = ABSOLUTE(.); - *libbt.a:(.bss .bss.* COMMON) - . = ALIGN (4); - _bt_bss_end = ABSOLUTE(.); - _btdm_bss_start = ABSOLUTE(.); - *libbtdm_app.a:(.bss .bss.* COMMON) - . = ALIGN (4); - _btdm_bss_end = ABSOLUTE(.); - _nimble_bss_start = ABSOLUTE(.); - *libnimble.a:(.bss .bss.* COMMON) - . = ALIGN (4); - _nimble_bss_end = ABSOLUTE(.); mapping[dram0_bss] diff --git a/components/esp32c3/ld/esp32c3.project.ld.in b/components/esp32c3/ld/esp32c3.project.ld.in index 012deb1a68..de18365153 100644 --- a/components/esp32c3/ld/esp32c3.project.ld.in +++ b/components/esp32c3/ld/esp32c3.project.ld.in @@ -150,18 +150,6 @@ SECTIONS .dram0.data : { _data_start = ABSOLUTE(.); - _bt_data_start = ABSOLUTE(.); - *libbt.a:(.data .data.*) - . = ALIGN (4); - _bt_data_end = ABSOLUTE(.); - _btdm_data_start = ABSOLUTE(.); - *libbtdm_app.a:(.data .data.*) - . = ALIGN (4); - _btdm_data_end = ABSOLUTE(.); - _nimble_data_start = ABSOLUTE(.); - *libnimble.a:(.data .data.*) - . = ALIGN (4); - _nimble_data_end = ABSOLUTE(.); *(.gnu.linkonce.d.*) *(.data1) __global_pointer$ = . + 0x800; @@ -203,18 +191,6 @@ SECTIONS { . = ALIGN (8); _bss_start = ABSOLUTE(.); - _bt_bss_start = ABSOLUTE(.); - *libbt.a:(.bss .bss.* COMMON) - . = ALIGN (4); - _bt_bss_end = ABSOLUTE(.); - _btdm_bss_start = ABSOLUTE(.); - *libbtdm_app.a:(.bss .bss.* COMMON) - . = ALIGN (4); - _btdm_bss_end = ABSOLUTE(.); - _nimble_bss_start = ABSOLUTE(.); - *libnimble.a:(.bss .bss.* COMMON) - . = ALIGN (4); - _nimble_bss_end = ABSOLUTE(.); mapping[dram0_bss] diff --git a/components/esp32s3/ld/esp32s3.project.ld.in b/components/esp32s3/ld/esp32s3.project.ld.in index a1729c9eb8..38c58180b9 100644 --- a/components/esp32s3/ld/esp32s3.project.ld.in +++ b/components/esp32s3/ld/esp32s3.project.ld.in @@ -181,18 +181,6 @@ SECTIONS .dram0.data : { _data_start = ABSOLUTE(.); - _bt_data_start = ABSOLUTE(.); - *libbt.a:(.data .data.*) - . = ALIGN (4); - _bt_data_end = ABSOLUTE(.); - _btdm_data_start = ABSOLUTE(.); - *libbtdm_app.a:(.data .data.*) - . = ALIGN (4); - _btdm_data_end = ABSOLUTE(.); - _nimble_data_start = ABSOLUTE(.); - *libnimble.a:(.data .data.*) - . = ALIGN (4); - _nimble_data_end = ABSOLUTE(.); *(.gnu.linkonce.d.*) *(.data1) *(.sdata) @@ -234,18 +222,6 @@ SECTIONS . = ALIGN (8); _bss_start = ABSOLUTE(.); *(.ext_ram.bss*) - _bt_bss_start = ABSOLUTE(.); - *libbt.a:(.bss .bss.* COMMON) - . = ALIGN (4); - _bt_bss_end = ABSOLUTE(.); - _btdm_bss_start = ABSOLUTE(.); - *libbtdm_app.a:(.bss .bss.* COMMON) - . = ALIGN (4); - _btdm_bss_end = ABSOLUTE(.); - _nimble_bss_start = ABSOLUTE(.); - *libnimble.a:(.bss .bss.* COMMON) - . = ALIGN (4); - _nimble_bss_end = ABSOLUTE(.); mapping[dram0_bss]