kernel: app_smem: allowing pinning memory partitions

This allows memory partitions to be put into the pinned
section so they are available during boot. For example,
the stack guard (in libc partition) is needed during boot
but before the paging mechanism is initialized. Without
pinning it in physical memory, it would fault in early
boot process.

A new cmake property app_smem,pinned_partitions is
introduced so that additional partitions can be pinned
if needed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
diff --git a/scripts/gen_kobject_list.py b/scripts/gen_kobject_list.py
index 93f2ed8..b9b0ca1 100755
--- a/scripts/gen_kobject_list.py
+++ b/scripts/gen_kobject_list.py
@@ -514,6 +514,14 @@
 
     app_smem_start = syms["_app_smem_start"]
     app_smem_end = syms["_app_smem_end"]
+
+    if "CONFIG_LINKER_USE_PINNED_SECTION" in syms and "_app_smem_pinned_start" in syms:
+        app_smem_pinned_start = syms["_app_smem_pinned_start"]
+        app_smem_pinned_end = syms["_app_smem_pinned_end"]
+    else:
+        app_smem_pinned_start = app_smem_start
+        app_smem_pinned_end = app_smem_end
+
     user_stack_start = syms["z_user_stacks_start"]
     user_stack_end = syms["z_user_stacks_end"]
 
@@ -630,7 +638,9 @@
             continue
 
         _, user_ram_allowed, _ = kobjects[ko.type_obj.name]
-        if not user_ram_allowed and app_smem_start <= addr < app_smem_end:
+        if (not user_ram_allowed and
+            ((app_smem_start <= addr < app_smem_end)
+             or (app_smem_pinned_start <= addr < app_smem_pinned_end))):
             debug("object '%s' found in invalid location %s"
                   % (ko.type_obj.name, hex(addr)))
             continue