Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions tools/cmake/mbed_set_linker_script.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
11 changes: 3 additions & 8 deletions tools/cmake/mbed_target_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
11 changes: 6 additions & 5 deletions tools/python/memap/memap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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 calture "*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
Expand Down Expand Up @@ -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(
Expand Down
Loading