diff --git a/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_GCC_ARM/LPC1768.ld b/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_GCC_ARM/LPC1768.ld index 2faa2e0f449..cf4492d079c 100644 --- a/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_GCC_ARM/LPC1768.ld +++ b/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_GCC_ARM/LPC1768.ld @@ -159,7 +159,7 @@ SECTIONS * values to stack symbols later */ .stack_dummy (NOLOAD): { - *(.stack) + . += STACK_SIZE; } > RAM /* Set stack top to end of RAM, and stack limit move down by diff --git a/tools/cmake/mbed_set_linker_script.cmake b/tools/cmake/mbed_set_linker_script.cmake index 8c48e0bd2ca..4170a60870f 100644 --- a/tools/cmake/mbed_set_linker_script.cmake +++ b/tools/cmake/mbed_set_linker_script.cmake @@ -95,9 +95,10 @@ function(mbed_setup_linker_script mbed_os_target mbed_baremetal_target target_de # add linker script only for tests if(MBED_IS_STANDALONE) target_link_options(${TARGET} - INTERFACE - "-T" "${LINKER_SCRIPT_PATH}" - ) + INTERFACE + "-T" "${LINKER_SCRIPT_PATH}" + ) + set_property(TARGET ${TARGET} APPEND PROPERTY INTERFACE_LINK_DEPENDS ${LINKER_SCRIPT_PATH}) endif() endforeach() @@ -150,5 +151,6 @@ function(mbed_set_custom_linker_script target new_linker_script_path) PRIVATE "-T" "${CUSTOM_LINKER_SCRIPT_PATH}" ) + set_property(TARGET ${target} APPEND PROPERTY LINK_DEPENDS ${CUSTOM_LINKER_SCRIPT_PATH}) endfunction(mbed_set_custom_linker_script) diff --git a/tools/cmake/mbed_target_functions.cmake b/tools/cmake/mbed_target_functions.cmake index f5dcbec1a3f..6f6f1c8e9c5 100644 --- a/tools/cmake/mbed_target_functions.cmake +++ b/tools/cmake/mbed_target_functions.cmake @@ -128,19 +128,14 @@ function(mbed_set_post_build target) get_target_property(POST_BUILD_TARGET_LINK_LIBRARIES ${target} LINK_LIBRARIES) if("mbed-os" IN_LIST POST_BUILD_TARGET_LINK_LIBRARIES) get_target_property(LINKER_SCRIPT_PATH mbed-os LINKER_SCRIPT_PATH) - target_link_options(${target} - PRIVATE - "-T" "${LINKER_SCRIPT_PATH}" - ) elseif("mbed-baremetal" IN_LIST POST_BUILD_TARGET_LINK_LIBRARIES) get_target_property(LINKER_SCRIPT_PATH mbed-baremetal LINKER_SCRIPT_PATH) - target_link_options(${target} - PRIVATE - "-T" "${LINKER_SCRIPT_PATH}" - ) else() message(FATAL_ERROR "Target ${target} used with mbed_set_post_build() but does not link to mbed-os or mbed-baremetal!") endif() + + target_link_options(${target} PRIVATE "-T" "${LINKER_SCRIPT_PATH}") + set_property(TARGET ${target} APPEND PROPERTY LINK_DEPENDS ${LINKER_SCRIPT_PATH}) else() message(STATUS "${target} uses custom linker script ${ARGV1}") mbed_set_custom_linker_script(${target} ${ARGV1}) diff --git a/tools/python/memap/memap.py b/tools/python/memap/memap.py index af781051223..100db9d5bb7 100644 --- a/tools/python/memap/memap.py +++ b/tools/python/memap/memap.py @@ -63,7 +63,6 @@ from prettytable import PrettyTable, HEADER from jinja2 import FileSystemLoader, StrictUndefined from jinja2.environment import Environment -from future.utils import with_metaclass # Be sure that the tools directory is in the search path @@ -127,7 +126,7 @@ def _add_symbol_to_memory_banks(self, symbol_name: str, symbol_start_addr: int, for banks in self.memory_banks.values(): for bank_info in banks: if bank_info.contains_addr(symbol_start_addr): - if bank_info.contains_addr(end_addr): + if bank_info.contains_addr(end_addr - 1): # end_addr is the first address past the end of the symbol so we subtract 1 here # Symbol fully inside this memory bank bank_info.used_size += size @@ -146,7 +145,7 @@ def add_symbol(self, symbol_name: str, object_name: str, start_addr: int, size: """ Adds information about a symbol (e.g. a function or global variable) to the data structures. Positional arguments: - symbol_name - Descriptive name of the symbol, e.g. ".text.some_function" + symbol_name - Descriptive name of the symbol, e.g. ".text.some_function" or "*fill*" object_name - name of the object file containing the symbol start addr - start address of symbol size - the size of the symbol being added @@ -234,7 +233,9 @@ class _GccParser(_Parser): # Gets the input section name from the line, if it exists. # Input section names are always indented 1 space. - RE_INPUT_SECTION_NAME = re.compile(r'^ (\.\w+\.?\w*\.?\w*)') # Note: This allows up to 3 dots... hopefully that's enough... + # Note: This allows up to 3 dots... hopefully that's enough... + # It can also capture "*fill*" instead of something that looks like a section name. + RE_INPUT_SECTION_NAME = re.compile(r'^ ((?:\.\w+\.?\w*\.?\w*)|(?:\*fill\*))') ALL_SECTIONS = ( _Parser.SECTIONS @@ -844,7 +845,7 @@ def parse(self, mapfile: str, toolchain: str, memory_banks_json_path: str | None def main(): """Entry Point""" - version = '0.4.0' + version = '1.0.0' # Parser handling parser = ArgumentParser(