Skip to content

Commit 6ada812

Browse files
committed
Merge branch 'feature/support_make_size_family_cmd' into 'master'
esp8266: supports "make size" and its family function See merge request sdk/ESP8266_RTOS_SDK!1033
2 parents 73e3a7d + 301d857 commit 6ada812

36 files changed

+8567
-325
lines changed

components/esp8266/CMakeLists.txt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ else()
4747
set(include_dirs "include" "include/driver")
4848

4949
set(priv_requires "wpa_supplicant" "log" "spi_flash" "tcpip_adapter" "esp_ringbuf" "bootloader_support" "nvs_flash" "util")
50+
set(fragments linker.lf ld/esp8266_fragments.lf)
5051

5152
idf_component_register(SRCS "${srcs}"
5253
INCLUDE_DIRS "${include_dirs}"
5354
REQUIRES "${requires}"
5455
PRIV_REQUIRES "${priv_requires}"
56+
LDFRAGMENTS "${fragments}"
5557
REQUIRED_IDF_TARGETS esp8266)
5658

5759
target_link_libraries(${COMPONENT_LIB} PUBLIC "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib" "-lstdc++")
@@ -73,7 +75,9 @@ else()
7375
endforeach()
7476
endif()
7577
target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/esp8266_out.ld")
76-
target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/esp8266_common_out.ld")
78+
79+
target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/ld/esp8266.project.ld.in"
80+
PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp8266.project.ld")
7781

7882
target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp8266.rom.ld")
7983
target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp8266.peripherals.ld")
@@ -93,13 +97,7 @@ else()
9397
MAIN_DEPENDENCY ${LD_DIR}/esp8266.ld ${SDKCONFIG_H}
9498
COMMENT "Generating memory map linker script..."
9599
VERBATIM)
96-
add_custom_command(
97-
OUTPUT esp8266_common_out.ld
98-
COMMAND "${CMAKE_C_COMPILER}" -C -P -x c -E -o esp8266_common_out.ld -I ${CONFIG_DIR} ${LD_DIR}/esp8266.common.ld
99-
MAIN_DEPENDENCY ${LD_DIR}/esp8266.common.ld ${SDKCONFIG_H}
100-
COMMENT "Generating section linker script..."
101-
VERBATIM)
102-
add_custom_target(esp8266_linker_script DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/esp8266_out.ld" "${CMAKE_CURRENT_BINARY_DIR}/esp8266_common_out.ld")
100+
add_custom_target(esp8266_linker_script DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/esp8266_out.ld")
103101
add_dependencies(${COMPONENT_LIB} esp8266_linker_script)
104102

105103
if(CONFIG_ESP8266_PHY_INIT_DATA_IN_PARTITION)

components/esp8266/Makefile.projbuild

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ endif # CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION
6464

6565
endif
6666

67+
LINKER_SCRIPT_TEMPLATE := $(COMPONENT_PATH)/ld/esp8266.project.ld.in
68+
LINKER_SCRIPT_OUTPUT_DIR := $(abspath $(BUILD_DIR_BASE)/esp8266)
69+
70+
# Target to generate linker script generator from fragments presented by each of
71+
# the components
72+
$(eval $(call ldgen_process_template,$(LINKER_SCRIPT_TEMPLATE),$(LINKER_SCRIPT_OUTPUT_DIR)/esp8266.project.ld))
73+
6774
# global CFLAGS for ESP8266
6875
CFLAGS += -DICACHE_FLASH
6976

components/esp8266/component.mk

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ endif
2525
#specifies its own scripts.
2626
LINKER_SCRIPTS += esp8266.rom.ld esp8266.peripherals.ld
2727

28+
COMPONENT_ADD_LDFRAGMENTS += ld/esp8266_fragments.lf linker.lf
29+
2830
COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/lib \
2931
$(addprefix -l,$(LIBS)) \
3032
-L $(COMPONENT_PATH)/ld \
3133
-T esp8266_out.ld \
32-
-T esp8266_common_out.ld \
34+
-T $(COMPONENT_BUILD_DIR)/esp8266.project.ld \
3335
-Wl,--no-check-sections \
3436
-u call_user_start \
3537
$(addprefix -T ,$(LINKER_SCRIPTS))
@@ -38,20 +40,18 @@ ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
3840

3941
# final linking of project ELF depends on all binary libraries, and
4042
# all linker scripts
41-
COMPONENT_ADD_LINKER_DEPS := $(ALL_LIB_FILES) $(addprefix ld/,$(LINKER_SCRIPTS))
43+
COMPONENT_ADD_LINKER_DEPS := $(ALL_LIB_FILES) $(addprefix ld/, $(filter-out $(COMPONENT_BUILD_DIR)/esp8266.project.ld, $(LINKER_SCRIPTS))) \
44+
$(COMPONENT_BUILD_DIR)/esp8266.project.ld
4245

4346
# Preprocess esp8266.ld linker script into esp8266_out.ld
4447
#
4548
# The library doesn't really depend on esp8266_out.ld, but it
4649
# saves us from having to add the target to a Makefile.projbuild
47-
$(COMPONENT_LIBRARY): esp8266_out.ld esp8266_common_out.ld
50+
$(COMPONENT_LIBRARY): esp8266_out.ld
4851

4952
esp8266_out.ld: $(COMPONENT_PATH)/ld/esp8266.ld ../include/sdkconfig.h
5053
$(CC) $(CFLAGS) -I ../include -C -P -x c -E $< -o $@
5154

52-
esp8266_common_out.ld: $(COMPONENT_PATH)/ld/esp8266.common.ld ../include/sdkconfig.h
53-
$(CC) -I ../include -C -P -x c -E $< -o $@
54-
55-
COMPONENT_EXTRA_CLEAN := esp8266_out.ld
55+
COMPONENT_EXTRA_CLEAN := esp8266_out.ld $(COMPONENT_BUILD_DIR)/esp8266.project.ld
5656

5757
endif

components/esp8266/include/esp8266/eagle_soc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
#define IRAM_SIZE (48 * 1024)
182182

183183
#define FLASH_BASE (0x40200000)
184-
#define FLASH_SIZE (1 * 1024 * 1024)
184+
#define FLASH_SIZE (2 * 1024 * 1024)
185185

186186
#define RTC_SYS_BASE (0x60001000)
187187
#define RTC_SYS_SIZE (0x200)

components/esp8266/ld/esp8266.common.ld

Lines changed: 0 additions & 258 deletions
This file was deleted.

0 commit comments

Comments
 (0)