summaryrefslogtreecommitdiff
path: root/scripts/sysgen
diff options
context:
space:
mode:
authorJithu Joseph <jithu.joseph@intel.com>2016-03-04 14:44:25 -0800
committerGerrit Code Review <gerrit@zephyrproject.org>2016-03-10 23:19:59 +0000
commit9e45411a59282d95d13ec8bd23766a2740daad15 (patch)
tree419573c97fe0e8c61dae2bb8f7a8275add2b068d /scripts/sysgen
parent77087102294fd6820f6a679a11b030099d0c6553 (diff)
memory_pool_heap: malloc/free access over a heap memory pool
Specifying HEAP_SIZE keyword in an app's MDEF file, results in creating a new memory pool, which can be accessed using the task_malloc() and task_free() APIs, which have the usual malloc/free like semantics. Expected format in MDEF file HEAP_SIZE <value> Change-Id: I0569cffeecf8a2c23c20c7b359256123ece91982 Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Diffstat (limited to 'scripts/sysgen')
-rwxr-xr-xscripts/sysgen18
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/sysgen b/scripts/sysgen
index 2abdcb260..9e8ee4d31 100755
--- a/scripts/sysgen
+++ b/scripts/sysgen
@@ -34,6 +34,8 @@ import subprocess
# global variables describing system
+MIN_HEAP = 64
+heap_pos_in_pool_list = -1
num_kargs = 0
num_timers = 0
num_prios = 0
@@ -118,6 +120,8 @@ def mdef_parse():
global num_kargs
global num_timers
global num_prios
+ global MIN_HEAP
+ global heap_pos_in_pool_list
# read file contents in a single shot
with open(sys.argv[1], 'r') as infile:
@@ -210,10 +214,19 @@ def mdef_parse():
int(words[4])))
continue
+ if (words[0] == "HEAP_SIZE"):
+ if (len(words) != 2):
+ error_arg_count(line)
+ heap_size = int(words[1])
+ heap_pos_in_pool_list = len(pool_list)
+ pool_list.append(("_HEAP_MEM_POOL", MIN_HEAP, heap_size, 1))
+ continue
+
sysgen_error("unrecognized keyword %s on following line\n%s" %
(words[0], line))
+
#
# GENERATE kernel_main.c FILE
#
@@ -598,6 +611,7 @@ def kernel_main_c_maps():
def kernel_main_c_pools():
""" Generate memory pool variables """
+ global heap_pos_in_pool_list
total_pools = len(pool_list)
@@ -608,6 +622,10 @@ def kernel_main_c_pools():
if (total_pools == 0):
kernel_main_c_out("\nstruct pool_struct * _k_mem_pool_list = NULL;\n")
return
+ # Heap pool if present can be indexed using the below variable
+ if (heap_pos_in_pool_list != -1):
+ kernel_main_c_out("\nconst kmemory_pool_t _heap_mem_pool_id = %d;\n" \
+ %(heap_pos_in_pool_list))
# start accumulating memory pool descriptor info