check_link_map: fix check for app memory

This script was assuming that all XIP data copied sections
were contiguous. However with application memory partitioning
enabled, this is not the case; in between the kernel data sections
and the app data sections will be the kernel's BSS and noinit.

As a quick fix, reset the last section compared if we encounter
the kernel's BSS section.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
diff --git a/scripts/check_link_map.py b/scripts/check_link_map.py
index dcc45ce..897afa0 100755
--- a/scripts/check_link_map.py
+++ b/scripts/check_link_map.py
@@ -25,7 +25,7 @@
 section_re = re.compile('(?x)'                    # (allow whitespace)
                         '^([a-zA-Z0-9_\.]+) \s+'  # name
                         ' (0x[0-9a-f]+)     \s+'  # addr
-                        ' (0x[0-9a-f]+)     \s+') # size
+                        ' (0x[0-9a-f]+)\s*')      # size
 
 load_addr_re = re.compile('load address (0x[0-9a-f]+)')
 
@@ -45,6 +45,13 @@
         vma = int(match.group(2), 16)
         size = int(match.group(3), 16)
 
+        if (sec == "bss"):
+            # Make sure we don't compare the last section of kernel data
+            # with the first section of application data, the kernel's bss
+            # and noinit are in between.
+            last_sec = None
+            continue
+
         lmatch = load_addr_re.search(line.rstrip())
         if lmatch:
             lma = int(lmatch.group(1), 16)