def METHOD_NAME(self, mem_size):
    """
    Define system memory ranges. This depends on the physical
    memory map provided by the realview platform and by the memory
    size provided by the user (mem_size argument).
    The method is iterating over all platform ranges until they cover
    the entire user's memory requirements.
    """
    mem_ranges = []
    for mem_range in self.platform._mem_regions:
        size_in_range = min(mem_size, mem_range.size())
        mem_ranges.append(
            AddrRange(start=mem_range.start, size=size_in_range)
        )
        mem_size -= size_in_range
        if mem_size == 0:
            return mem_ranges
    raise ValueError("memory size too big for platform capabilities")