2015-04-10 16:44:37 -07:00
|
|
|
#! /usr/bin/env python
|
|
|
|
#
|
2015-06-19 09:52:04 -04:00
|
|
|
# sysgen - System Generator
|
2015-04-10 16:44:37 -07:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# Copyright (c) 2015, Wind River Systems, Inc.
|
|
|
|
#
|
2015-10-06 11:00:37 -05:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
2015-04-10 16:44:37 -07:00
|
|
|
#
|
2015-10-06 11:00:37 -05:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2015-04-10 16:44:37 -07:00
|
|
|
#
|
2015-10-06 11:00:37 -05:00
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2015-04-10 16:44:37 -07:00
|
|
|
#
|
|
|
|
|
2015-04-15 15:27:49 -04:00
|
|
|
# Arguments:
|
2015-06-05 16:24:46 -04:00
|
|
|
# - name of MDEF file
|
2015-04-15 15:27:49 -04:00
|
|
|
# - name of directory for output files (optional)
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
# Generates:
|
|
|
|
# - kernel_main.c file
|
2015-05-14 09:24:35 -04:00
|
|
|
# - kernel_main.h file (local copy)
|
2015-06-19 10:46:53 -04:00
|
|
|
# - micro_private_types.h file (local copy)
|
2015-10-21 07:24:39 -04:00
|
|
|
# - sysgen.h file
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
2015-05-12 09:28:55 -04:00
|
|
|
import subprocess
|
2016-06-07 15:58:43 -04:00
|
|
|
import argparse
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-15 15:27:49 -04:00
|
|
|
# global variables describing system
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2016-03-04 14:44:25 -08:00
|
|
|
MIN_HEAP = 64
|
|
|
|
heap_pos_in_pool_list = -1
|
2015-04-15 13:42:48 -04:00
|
|
|
num_kargs = 0
|
|
|
|
num_timers = 0
|
2015-04-24 16:34:53 -04:00
|
|
|
num_prios = 0
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
task_list = []
|
|
|
|
event_list = []
|
|
|
|
mutex_list = []
|
|
|
|
sema_list = []
|
|
|
|
fifo_list = []
|
|
|
|
pipe_list = []
|
|
|
|
mbx_list = []
|
|
|
|
map_list = []
|
|
|
|
pool_list = []
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
group_dictionary = {}
|
|
|
|
group_key_list = []
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-15 15:27:49 -04:00
|
|
|
# global variables used during generation of output files
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-15 15:36:02 -04:00
|
|
|
do_not_edit_warning = \
|
|
|
|
"\n\n\n/* THIS FILE IS AUTOGENERATED -- DO NOT MODIFY! */\n\n\n"
|
|
|
|
|
|
|
|
copyright = \
|
|
|
|
"/*\n" + \
|
|
|
|
" * Copyright (c) 2015 Wind River Systems, Inc.\n" + \
|
|
|
|
" *\n" + \
|
2015-10-06 11:00:37 -05:00
|
|
|
" * Licensed under the Apache License, Version 2.0 (the \"License\");\n" + \
|
|
|
|
" * you may not use this file except in compliance with the License.\n" + \
|
|
|
|
" * You may obtain a copy of the License at\n" + \
|
2015-04-15 15:36:02 -04:00
|
|
|
" *\n" + \
|
2015-10-06 11:00:37 -05:00
|
|
|
" * http://www.apache.org/licenses/LICENSE-2.0\n" + \
|
2015-04-15 15:36:02 -04:00
|
|
|
" *\n" + \
|
2015-10-06 11:00:37 -05:00
|
|
|
" * Unless required by applicable law or agreed to in writing, software\n" + \
|
|
|
|
" * distributed under the License is distributed on an \"AS IS\" BASIS,\n" + \
|
|
|
|
" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" + \
|
|
|
|
" * See the License for the specific language governing permissions and\n" + \
|
|
|
|
" * limitations under the License.\n" + \
|
2015-04-15 15:36:02 -04:00
|
|
|
" */\n"
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-15 15:42:15 -04:00
|
|
|
output_dir = ""
|
2016-06-07 15:58:43 -04:00
|
|
|
input_mdef_file = ""
|
2016-06-07 16:04:24 -04:00
|
|
|
kernel_type = 'micro'
|
2015-04-15 15:42:15 -04:00
|
|
|
|
2016-06-07 15:58:43 -04:00
|
|
|
def get_cmdline_args():
|
2015-04-15 15:42:15 -04:00
|
|
|
""" Handle optional output directory argument """
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2016-06-07 15:58:43 -04:00
|
|
|
global input_mdef_file
|
2015-04-15 15:42:15 -04:00
|
|
|
global output_dir
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
global kernel_type
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2016-06-07 15:58:43 -04:00
|
|
|
output_dir_help='output directory for kernel_main.*, sysgen.h, etc'
|
|
|
|
input_mdef_file_help='input MDEF file'
|
2016-06-07 16:04:24 -04:00
|
|
|
kernel_type_help="'micro' or 'unified'"
|
2016-06-07 15:58:43 -04:00
|
|
|
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
|
|
|
|
parser.add_argument('-i', '--input-mdef-file', action='store',
|
|
|
|
required=True, help=input_mdef_file_help)
|
|
|
|
parser.add_argument('-o', '--output-dir', action='store',
|
|
|
|
help=output_dir_help)
|
2016-06-07 16:04:24 -04:00
|
|
|
parser.add_argument('-k', '--kernel-type', action='store',
|
|
|
|
help=kernel_type_help)
|
2016-06-07 15:58:43 -04:00
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
input_mdef_file = args.input_mdef_file
|
|
|
|
|
|
|
|
if (args.output_dir != None):
|
|
|
|
output_dir = args.output_dir
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2016-06-07 16:04:24 -04:00
|
|
|
if (args.kernel_type != None):
|
|
|
|
kernel_type = args.kernel_type
|
|
|
|
|
2015-04-15 15:36:02 -04:00
|
|
|
def write_file(filename, contents):
|
|
|
|
""" Create file using specified name and contents """
|
|
|
|
|
|
|
|
f = open(filename, 'w') # overwrites file if it already exists
|
|
|
|
f.write(contents)
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
2015-04-16 12:02:34 -04:00
|
|
|
#
|
|
|
|
# ERROR HANDLING
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
def sysgen_error(msg):
|
2015-06-16 11:13:26 +02:00
|
|
|
print("\n*** sysgen error: " + msg + "\n")
|
2015-04-16 12:02:34 -04:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
2015-04-17 09:41:28 -04:00
|
|
|
def error_arg_count(line):
|
|
|
|
sysgen_error("invalid number of arguments on following line\n" + line)
|
|
|
|
|
|
|
|
|
2015-04-15 15:27:49 -04:00
|
|
|
#
|
|
|
|
# CREATE INTERNAL REPRESENTATION OF SYSTEM
|
|
|
|
#
|
|
|
|
|
|
|
|
|
2015-06-05 16:24:46 -04:00
|
|
|
def mdef_parse():
|
|
|
|
""" Parse MDEF file """
|
2015-04-15 13:42:48 -04:00
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
global num_kargs
|
|
|
|
global num_timers
|
2015-04-24 16:34:53 -04:00
|
|
|
global num_prios
|
2016-03-04 14:44:25 -08:00
|
|
|
global MIN_HEAP
|
|
|
|
global heap_pos_in_pool_list
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-15 15:27:49 -04:00
|
|
|
# read file contents in a single shot
|
2016-06-07 15:58:43 -04:00
|
|
|
with open(input_mdef_file, 'r') as infile:
|
2015-04-10 16:44:37 -07:00
|
|
|
data = infile.read()
|
|
|
|
|
|
|
|
# create list of the lines, breaking at line boundaries
|
|
|
|
my_list = data.splitlines()
|
|
|
|
|
|
|
|
# process each line
|
|
|
|
for line in my_list:
|
|
|
|
words = line.split()
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (len(words) == 0):
|
|
|
|
continue # ignore blank line
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (words[0][0] == "%"):
|
|
|
|
continue # ignore comment line
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (words[0] == "CONFIG"):
|
2015-04-24 16:34:53 -04:00
|
|
|
if (len(words) != 4):
|
2015-04-17 09:41:28 -04:00
|
|
|
error_arg_count(line)
|
2015-04-10 16:44:37 -07:00
|
|
|
num_kargs = int(words[1])
|
|
|
|
num_timers = int(words[2])
|
2015-04-24 16:34:53 -04:00
|
|
|
num_prios = int(words[3])
|
2015-04-10 16:44:37 -07:00
|
|
|
continue
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (words[0] == "TASK"):
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
if (len(words) != 6):
|
|
|
|
error_arg_count(line)
|
|
|
|
task_list.append((words[1], int(words[2]), words[3],
|
|
|
|
int(words[4]), words[5]))
|
|
|
|
continue
|
|
|
|
elif (kernel_type == 'unified'):
|
|
|
|
if len(words) < 6 and len(words) > 10:
|
|
|
|
error_arg_count(line)
|
|
|
|
|
|
|
|
p1 = 0
|
|
|
|
p2 = 0
|
|
|
|
p3 = 0
|
|
|
|
|
|
|
|
if len(words) >= 7:
|
|
|
|
p1 = words[6]
|
|
|
|
if len(words) >= 8:
|
|
|
|
p2 = words[7]
|
|
|
|
if len(words) == 9:
|
|
|
|
p3 = words[8]
|
|
|
|
|
|
|
|
abort = 0
|
|
|
|
if len(words) == 10:
|
|
|
|
abort = words[9]
|
|
|
|
|
|
|
|
task_list.append((words[1], int(words[2]), words[3],
|
|
|
|
int(words[4]), words[5], p1, p2, p3, abort))
|
|
|
|
continue
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (words[0] == "TASKGROUP"):
|
2015-04-17 09:41:28 -04:00
|
|
|
if (len(words) != 2):
|
|
|
|
error_arg_count(line)
|
2015-04-15 13:42:48 -04:00
|
|
|
if words[1] in group_dictionary:
|
2015-04-10 16:44:37 -07:00
|
|
|
continue # ignore re-definition of a task group
|
|
|
|
group_bitmask = 1 << len(group_dictionary)
|
|
|
|
group_dictionary[words[1]] = group_bitmask
|
2015-04-15 13:42:48 -04:00
|
|
|
group_key_list.append(words[1])
|
2015-04-10 16:44:37 -07:00
|
|
|
continue
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (words[0] == "EVENT"):
|
2015-04-17 09:41:28 -04:00
|
|
|
if (len(words) != 3):
|
|
|
|
error_arg_count(line)
|
2015-04-15 13:42:48 -04:00
|
|
|
event_list.append((words[1], words[2]))
|
2015-04-10 16:44:37 -07:00
|
|
|
continue
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (words[0] == "SEMA"):
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
if (kernel_type == "micro"):
|
|
|
|
if (len(words) != 2):
|
|
|
|
error_arg_count(line)
|
|
|
|
sema_list.append((words[1],))
|
|
|
|
continue
|
|
|
|
elif (kernel_type == "unified"):
|
|
|
|
if len(words) < 2 and len(words) > 4:
|
|
|
|
error_arg_count(line)
|
|
|
|
if len(words) == 2:
|
|
|
|
sema_list.append((words[1], 0, 0xffffffff))
|
|
|
|
elif len(words) == 3:
|
|
|
|
sema_list.append((words[1], int(words[2]), 0xffffffff))
|
|
|
|
else:
|
|
|
|
sema_list.append((words[1], int(words[2]), int(words[3])))
|
|
|
|
continue
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (words[0] == "MUTEX"):
|
2015-04-17 09:41:28 -04:00
|
|
|
if (len(words) != 2):
|
|
|
|
error_arg_count(line)
|
2015-04-15 13:42:48 -04:00
|
|
|
mutex_list.append((words[1],))
|
2015-04-10 16:44:37 -07:00
|
|
|
continue
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (words[0] == "FIFO"):
|
2015-04-17 09:41:28 -04:00
|
|
|
if (len(words) != 4):
|
|
|
|
error_arg_count(line)
|
2015-04-15 13:42:48 -04:00
|
|
|
fifo_list.append((words[1], int(words[2]), int(words[3])))
|
2015-04-10 16:44:37 -07:00
|
|
|
continue
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (words[0] == "PIPE"):
|
2015-04-17 09:41:28 -04:00
|
|
|
if (len(words) != 3):
|
|
|
|
error_arg_count(line)
|
2015-04-15 13:42:48 -04:00
|
|
|
pipe_list.append((words[1], int(words[2])))
|
2015-04-10 16:44:37 -07:00
|
|
|
continue
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (words[0] == "MAILBOX"):
|
2015-04-17 09:41:28 -04:00
|
|
|
if (len(words) != 2):
|
|
|
|
error_arg_count(line)
|
2015-04-15 13:42:48 -04:00
|
|
|
mbx_list.append((words[1],))
|
2015-04-10 16:44:37 -07:00
|
|
|
continue
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (words[0] == "MAP"):
|
2015-04-17 09:41:28 -04:00
|
|
|
if (len(words) != 4):
|
|
|
|
error_arg_count(line)
|
2015-04-15 13:42:48 -04:00
|
|
|
map_list.append((words[1], int(words[2]), int(words[3])))
|
2015-04-10 16:44:37 -07:00
|
|
|
continue
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (words[0] == "POOL"):
|
2015-04-17 09:41:28 -04:00
|
|
|
if (len(words) != 5):
|
|
|
|
error_arg_count(line)
|
2015-04-15 13:42:48 -04:00
|
|
|
pool_list.append((words[1], int(words[2]), int(words[3]),
|
|
|
|
int(words[4])))
|
2015-04-10 16:44:37 -07:00
|
|
|
continue
|
|
|
|
|
2016-03-04 14:44:25 -08:00
|
|
|
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
|
|
|
|
|
2015-04-16 12:02:34 -04:00
|
|
|
sysgen_error("unrecognized keyword %s on following line\n%s" %
|
|
|
|
(words[0], line))
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-15 15:27:49 -04:00
|
|
|
|
2016-03-04 14:44:25 -08:00
|
|
|
|
2015-04-15 15:27:49 -04:00
|
|
|
#
|
|
|
|
# GENERATE kernel_main.c FILE
|
|
|
|
#
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-15 15:36:02 -04:00
|
|
|
kernel_main_c_data = ""
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
kernel_main_c_filename_str = \
|
2015-09-29 13:41:42 -04:00
|
|
|
"/* kernel_main.c - microkernel objects */\n\n"
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
|
2015-04-15 16:13:59 -04:00
|
|
|
def kernel_main_c_out(string):
|
|
|
|
""" Append a string to kernel_main.c """
|
|
|
|
|
|
|
|
global kernel_main_c_data
|
|
|
|
kernel_main_c_data += string
|
|
|
|
|
|
|
|
|
2015-04-15 16:48:21 -04:00
|
|
|
def kernel_main_c_header():
|
|
|
|
""" Generate initial portion of kernel_main.c """
|
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
kernel_main_c_out(
|
|
|
|
kernel_main_c_filename_str +
|
|
|
|
copyright +
|
|
|
|
do_not_edit_warning +
|
|
|
|
"\n" +
|
|
|
|
"#include <sysgen.h>\n" +
|
|
|
|
"#include <misc/debug/object_tracing_common.h>\n" +
|
|
|
|
"#include <micro_private_types.h>\n" +
|
|
|
|
"#include <kernel_main.h>\n" +
|
|
|
|
"#include <toolchain.h>\n" +
|
|
|
|
"#include <sections.h>\n")
|
|
|
|
else:
|
|
|
|
kernel_main_c_out(
|
|
|
|
kernel_main_c_filename_str +
|
|
|
|
copyright +
|
|
|
|
do_not_edit_warning +
|
|
|
|
"\n" +
|
|
|
|
"#include <sysgen.h>\n" +
|
|
|
|
"#include <misc/debug/object_tracing_common.h>\n" +
|
|
|
|
"#include <kernel.h>\n" +
|
|
|
|
"#include <toolchain.h>\n" +
|
|
|
|
"#include <sections.h>\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
|
|
|
|
def kernel_main_c_kargs():
|
2015-04-15 13:42:48 -04:00
|
|
|
""" Generate command packet variables """
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
# command packets
|
|
|
|
|
|
|
|
kernel_main_c_out("\n" +
|
2015-05-08 17:13:01 -05:00
|
|
|
"struct k_args _k_server_command_packets[%s] =\n" % (num_kargs) +
|
2015-04-10 16:44:37 -07:00
|
|
|
"{\n" +
|
2015-07-25 15:31:09 -07:00
|
|
|
" {NULL, NULL, 0, 0, _K_SVC_UNDEFINED},\n")
|
2015-04-15 13:42:48 -04:00
|
|
|
for i in range(1, num_kargs - 1):
|
2015-04-10 16:44:37 -07:00
|
|
|
kernel_main_c_out(
|
2015-05-14 16:00:21 -04:00
|
|
|
" {&_k_server_command_packets[%d], " % (i - 1) +
|
2015-07-25 15:31:09 -07:00
|
|
|
"NULL, 0, 0, _K_SVC_UNDEFINED},\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
kernel_main_c_out(
|
2015-05-14 16:00:21 -04:00
|
|
|
" {&_k_server_command_packets[%d], " % (num_kargs - 2) +
|
2015-07-25 15:31:09 -07:00
|
|
|
"NULL, 0, 0, _K_SVC_UNDEFINED}\n" +
|
2015-04-15 16:13:59 -04:00
|
|
|
"};\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
# linked list of free command packets
|
|
|
|
|
|
|
|
kernel_main_c_out("\n" +
|
2015-04-27 10:28:29 -05:00
|
|
|
"struct nano_lifo _k_server_command_packet_free = " +
|
2015-05-04 22:05:39 -04:00
|
|
|
"{{NULL, &_k_server_command_packet_free.wait_q.head}, " +
|
2015-05-08 17:13:01 -05:00
|
|
|
"(void *) &_k_server_command_packets[%d]};\n" % (num_kargs - 1))
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
|
|
|
|
def kernel_main_c_timers():
|
2015-04-15 13:42:48 -04:00
|
|
|
""" Generate timer system variables """
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-20 16:16:16 -04:00
|
|
|
if (num_timers == 0):
|
|
|
|
return
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
# timer descriptors
|
|
|
|
|
|
|
|
kernel_main_c_out("\n" +
|
2015-05-11 15:25:03 -04:00
|
|
|
"struct k_timer _k_timer_blocks[%d] =\n" % (num_timers) +
|
2015-04-10 16:44:37 -07:00
|
|
|
"{\n" +
|
2015-04-15 16:13:59 -04:00
|
|
|
" {NULL, NULL, 0, 0, (struct k_args *)0xffffffff},\n")
|
2015-04-15 13:42:48 -04:00
|
|
|
for i in range(1, num_timers - 1):
|
2015-04-10 16:44:37 -07:00
|
|
|
kernel_main_c_out(
|
2015-05-14 16:00:21 -04:00
|
|
|
" {&_k_timer_blocks[%d], " % (i - 1) +
|
|
|
|
"NULL, 0, 0, (struct k_args *)0xffffffff},\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
kernel_main_c_out(
|
2015-05-14 16:00:21 -04:00
|
|
|
" {&_k_timer_blocks[%d], " % (num_timers - 2) +
|
|
|
|
"NULL, 0, 0, (struct k_args *)0xffffffff}\n" +
|
2015-04-15 16:13:59 -04:00
|
|
|
"};\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
# linked list of free timers
|
|
|
|
|
|
|
|
kernel_main_c_out("\n" +
|
2015-04-27 10:28:29 -05:00
|
|
|
"struct nano_lifo _k_timer_free = " +
|
2015-05-04 22:05:39 -04:00
|
|
|
"{{NULL, &_k_timer_free.wait_q.head}, " +
|
2015-05-12 10:14:55 -04:00
|
|
|
"(void *) &_k_timer_blocks[%d]};\n" % (num_timers - 1))
|
2015-04-10 16:44:37 -07:00
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
def get_group_bitmask(group_str):
|
2015-04-10 16:44:37 -07:00
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
# create bitmask of group(s) task belongs to
|
|
|
|
group_bitmask = 0
|
|
|
|
group_set = group_str[1:len(group_str) - 1] # drop [] surrounding groups
|
|
|
|
if (group_set != ""):
|
|
|
|
group_list = group_set.split(',')
|
|
|
|
for group in group_list:
|
|
|
|
group_bitmask |= group_dictionary[group]
|
|
|
|
|
|
|
|
return group_bitmask
|
|
|
|
|
|
|
|
def is_float(x):
|
|
|
|
try:
|
|
|
|
float(x)
|
|
|
|
return True
|
|
|
|
except ValueError:
|
|
|
|
return False
|
|
|
|
|
|
|
|
def is_int(x):
|
|
|
|
try:
|
|
|
|
int(x)
|
|
|
|
return True
|
|
|
|
except ValueError:
|
|
|
|
return False
|
|
|
|
|
|
|
|
def is_number(x):
|
|
|
|
return is_float(x) or is_int(x)
|
|
|
|
|
|
|
|
def kernel_main_c_tasks_unified():
|
|
|
|
global num_prios
|
|
|
|
|
|
|
|
kernel_main_c_out("\n")
|
|
|
|
|
|
|
|
# declare task entry points
|
|
|
|
|
|
|
|
kernel_main_c_out("\n")
|
|
|
|
for task in task_list:
|
|
|
|
kernel_main_c_out("EXTERN_C void %s(void *, void *, void *);\n" %
|
|
|
|
task[2])
|
|
|
|
|
|
|
|
|
|
|
|
# thread_init objects
|
|
|
|
|
|
|
|
kernel_main_c_out("\n")
|
|
|
|
|
|
|
|
for task in task_list:
|
|
|
|
name = task[0]
|
|
|
|
prio = task[1]
|
|
|
|
entry = task[2]
|
|
|
|
stack_size = task[3]
|
|
|
|
|
|
|
|
groups = get_group_bitmask(task[4])
|
|
|
|
|
|
|
|
params = (task[5], task[6], task[7])
|
|
|
|
for param in params:
|
|
|
|
if not is_number(param):
|
|
|
|
kernel_main_c_out("extern void *%s;\n" % (param));
|
|
|
|
|
|
|
|
abort = task[8]
|
|
|
|
if abort != 0 and abort != 'NULL':
|
|
|
|
kernel_main_c_out("EXTERN_C void %s(void);\n" % abort)
|
|
|
|
|
|
|
|
kernel_main_c_out(
|
2016-10-11 12:06:25 -04:00
|
|
|
"_MDEF_THREAD_DEFINE(%s, %u, %s, %s, %s, %s, %s, %d, 0x%x);\n" %
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
(name, int(stack_size), entry,
|
|
|
|
params[0], params[1], params[2],
|
|
|
|
abort, int(prio), int(groups)))
|
|
|
|
|
|
|
|
|
|
|
|
def kernel_main_c_tasks_micro():
|
2015-04-15 13:42:48 -04:00
|
|
|
|
2015-04-24 16:34:53 -04:00
|
|
|
global num_prios
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
# task stack areas
|
|
|
|
|
2015-04-15 16:13:59 -04:00
|
|
|
kernel_main_c_out("\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
for task in task_list:
|
2015-05-22 13:22:56 -04:00
|
|
|
kernel_main_c_out("char __noinit __stack __%s_stack[%d];\n" %
|
2015-04-15 16:13:59 -04:00
|
|
|
(task[0], task[3]))
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-05-22 11:37:03 -04:00
|
|
|
kernel_main_c_out("extern char main_task_stack[CONFIG_MAIN_STACK_SIZE];\n")
|
|
|
|
|
2015-05-14 14:34:05 -04:00
|
|
|
# declare task entry points
|
|
|
|
|
|
|
|
kernel_main_c_out("\n")
|
|
|
|
for task in task_list:
|
2016-01-13 13:02:56 -05:00
|
|
|
kernel_main_c_out("EXTERN_C void %s(void);\n" % task[2])
|
2015-05-14 14:34:05 -04:00
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
# task descriptors (including one for idle task)
|
2015-07-23 17:17:40 -07:00
|
|
|
#
|
|
|
|
# compiler puts these objects into the section as if
|
|
|
|
# it is a stack. hence the need to reverse the list.
|
|
|
|
# this is to preseve the order defined in MDEF file.
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-07-23 17:17:40 -07:00
|
|
|
kernel_main_c_out("\n")
|
|
|
|
for task in reversed(task_list):
|
|
|
|
name = task[0]
|
2015-04-10 16:44:37 -07:00
|
|
|
prio = task[1]
|
|
|
|
entry = task[2]
|
|
|
|
size = task[3]
|
2015-07-23 17:17:40 -07:00
|
|
|
obj_name = "_k_task_obj_%s" % (name)
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
stack = "__" + task[0] + "_stack"
|
|
|
|
|
|
|
|
# create bitmask of group(s) task belongs to
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
group_bitmask = get_group_bitmask(task[4])
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
# invert bitmask to convert SYS indication to non-SYS indication
|
|
|
|
#
|
|
|
|
# NOTE: There actually is no SYS group; instead, there is a non-SYS
|
|
|
|
# group that all tasks belong to unless they specify the 'SYS' name.
|
|
|
|
# This approach allows the kernel to easily suspend all non-SYS tasks
|
|
|
|
# during debugging, while minimizing the number of task entries that
|
|
|
|
# have to explicitly indicate their SYS/non-SYS status.
|
|
|
|
group_bitmask ^= group_dictionary['SYS']
|
|
|
|
|
|
|
|
kernel_main_c_out(
|
2015-08-17 16:27:31 -04:00
|
|
|
"struct k_task %s " % (obj_name)+
|
2015-10-08 10:21:57 -04:00
|
|
|
"__in_section(_k_task_list, public, task) =\n" +
|
2015-07-23 17:17:40 -07:00
|
|
|
" {NULL, NULL, %d, (ktask_t)&%s,\n" % (prio, obj_name) +
|
|
|
|
" 0x00000001, %#010x,\n" % (group_bitmask) +
|
|
|
|
" %s, %s, %d,\n" % (entry, stack, size) +
|
2015-09-16 09:35:22 -07:00
|
|
|
" (taskabortfunction)NULL, NULL};\n" +
|
|
|
|
"ktask_t _k_task_ptr_%s " % (name) +
|
2015-10-08 10:21:57 -04:00
|
|
|
" __in_section(_k_task_ptr, public, task) = " +
|
2015-09-16 09:35:22 -07:00
|
|
|
" (ktask_t)&%s;\n" % (obj_name))
|
2015-07-23 17:17:40 -07:00
|
|
|
|
|
|
|
kernel_main_c_out(
|
2015-08-17 16:27:31 -04:00
|
|
|
"struct k_task _k_task_idle " +
|
2015-10-08 10:21:57 -04:00
|
|
|
"__in_section(_k_task_list, idle, task) =\n" +
|
2015-07-23 17:17:40 -07:00
|
|
|
" {NULL, NULL, %d, 0x00000000,\n" % (num_prios - 1) +
|
|
|
|
" 0x00000000, 0x00000000,\n" +
|
|
|
|
" (taskstartfunction)NULL, main_task_stack,\n"
|
|
|
|
" CONFIG_MAIN_STACK_SIZE,\n" +
|
2015-09-16 09:35:22 -07:00
|
|
|
" (taskabortfunction)NULL, NULL};\n" +
|
|
|
|
"ktask_t _k_task_ptr_idle " +
|
2015-10-08 10:21:57 -04:00
|
|
|
" __in_section(_k_task_ptr, idle, task) = " +
|
2015-09-16 09:35:22 -07:00
|
|
|
" (ktask_t)&_k_task_idle;\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
# currently scheduled task (idle task)
|
|
|
|
|
|
|
|
kernel_main_c_out("\n" +
|
2015-08-17 16:27:31 -04:00
|
|
|
"struct k_task * _k_current_task = &_k_task_idle;\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
def kernel_main_c_tasks():
|
|
|
|
""" Generate task variables """
|
|
|
|
|
|
|
|
if kernel_type == 'micro':
|
|
|
|
kernel_main_c_tasks_micro()
|
|
|
|
else:
|
|
|
|
kernel_main_c_tasks_unified()
|
|
|
|
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
def kernel_main_c_priorities():
|
2015-04-15 13:42:48 -04:00
|
|
|
""" Generate task scheduling variables """
|
|
|
|
|
2015-04-24 16:34:53 -04:00
|
|
|
global num_prios
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
total_tasks = len(task_list) + 1
|
|
|
|
|
|
|
|
# priority queue descriptors (lowest priority queue contains idle task)
|
|
|
|
|
|
|
|
kernel_main_c_out("\n" +
|
2015-04-27 10:28:21 -05:00
|
|
|
"struct k_tqhd _k_task_priority_list[%d] =\n" % (num_prios) +
|
2015-04-15 16:13:59 -04:00
|
|
|
"{\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
for i in range(1, num_prios):
|
2015-04-15 13:42:48 -04:00
|
|
|
kernel_main_c_out(
|
2015-08-17 16:27:31 -04:00
|
|
|
" {NULL, (struct k_task *)&_k_task_priority_list[%d]},\n" %
|
2015-04-28 09:08:31 -04:00
|
|
|
(i - 1))
|
2015-04-10 16:44:37 -07:00
|
|
|
kernel_main_c_out(
|
2015-07-23 17:17:40 -07:00
|
|
|
" {&_k_task_idle, &_k_task_idle}\n" +
|
2015-04-15 16:13:59 -04:00
|
|
|
"};\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
# active priority queue (idle task's queue)
|
|
|
|
|
|
|
|
kernel_main_c_out("\n" +
|
2015-04-28 09:08:31 -04:00
|
|
|
"struct k_tqhd * K_Prio = &_k_task_priority_list[%d];\n" %
|
|
|
|
(num_prios - 1))
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-24 16:34:53 -04:00
|
|
|
# priority queue bit map (indicates which priority queues are non-empty;
|
|
|
|
# initially only the idle task's queue has a runnable task)
|
|
|
|
|
2015-06-16 11:13:26 +02:00
|
|
|
num_bit_maps = ((num_prios + 31) // 32)
|
2015-04-24 16:34:53 -04:00
|
|
|
|
|
|
|
kernel_main_c_out("\n" +
|
|
|
|
"uint32_t _k_task_priority_bitmap[%d] = {" % (num_bit_maps))
|
|
|
|
for i in range(1, num_bit_maps):
|
|
|
|
kernel_main_c_out("0, ")
|
|
|
|
kernel_main_c_out("(1u << %d)};\n" % ((num_prios - 1) & 0x1f))
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
def kernel_main_c_events():
|
2015-04-15 13:42:48 -04:00
|
|
|
""" Generate event variables """
|
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
event_type = 'int'
|
|
|
|
else:
|
|
|
|
event_type = 'struct k_event *'
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
# event descriptors
|
|
|
|
|
2015-10-21 11:04:58 -07:00
|
|
|
# pre-defined event for timer
|
2015-04-20 16:16:16 -04:00
|
|
|
if (num_timers > 0):
|
2015-10-21 11:04:58 -07:00
|
|
|
kernel_main_c_out("DEFINE_EVENT(TICK_EVENT, _k_ticker);\n")
|
2015-04-20 16:16:16 -04:00
|
|
|
else:
|
2015-10-21 11:04:58 -07:00
|
|
|
kernel_main_c_out("DEFINE_EVENT(TICK_EVENT, NULL);\n")
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
# project-specific events
|
|
|
|
for event in event_list:
|
2016-05-03 13:45:55 -07:00
|
|
|
|
|
|
|
# if there is a handler function, it needs to be declared
|
|
|
|
# before setting up the object via DEFINE_EVENT()
|
|
|
|
#
|
|
|
|
# in other words, no declaration if handler is NULL or 0
|
|
|
|
handler = event[1].strip().lower()
|
|
|
|
if handler != "null" and handler != "0":
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
kernel_main_c_out("extern int %s(%s event);\n" %
|
|
|
|
(event[1], event_type))
|
2016-05-03 13:45:55 -07:00
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
kernel_main_c_out("DEFINE_EVENT(%s, %s);\n" % (event[0], event[1]))
|
|
|
|
else:
|
|
|
|
kernel_main_c_out("K_EVENT_DEFINE(_k_event_obj_%s, %s);\n" %
|
|
|
|
(event[0], event[1]))
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
def kernel_main_c_mutexes():
|
2015-04-15 13:42:48 -04:00
|
|
|
""" Generate mutex variables """
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
total_mutexes = len(mutex_list)
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (total_mutexes == 0):
|
2015-04-10 16:44:37 -07:00
|
|
|
return
|
|
|
|
|
|
|
|
# mutex descriptors
|
|
|
|
|
2015-04-15 16:13:59 -04:00
|
|
|
kernel_main_c_out("\n")
|
2015-06-22 16:22:13 -04:00
|
|
|
for mutex in mutex_list:
|
|
|
|
name = mutex[0]
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
kernel_main_c_out("struct _k_mutex_struct _k_mutex_obj_%s = " %
|
|
|
|
(name) + "__MUTEX_DEFAULT;\n")
|
|
|
|
else:
|
|
|
|
kernel_main_c_out("K_MUTEX_DEFINE(_k_mutex_obj_%s);\n" % (name))
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
|
|
|
|
def kernel_main_c_semas():
|
2015-04-15 13:42:48 -04:00
|
|
|
""" Generate semaphore variables """
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
total_semas = len(sema_list)
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (total_semas == 0):
|
2015-04-10 16:44:37 -07:00
|
|
|
return
|
|
|
|
|
|
|
|
# semaphore descriptors
|
|
|
|
|
2015-07-14 16:15:54 -07:00
|
|
|
kernel_main_c_out("\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
for semaphore in sema_list:
|
2015-07-14 16:15:54 -07:00
|
|
|
name = semaphore[0]
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
kernel_main_c_out("struct _k_sem_struct _k_sem_obj_%s = " %
|
|
|
|
(name) + "__K_SEMAPHORE_DEFAULT;\n")
|
|
|
|
else:
|
|
|
|
initial_count = semaphore[1]
|
|
|
|
limit = semaphore[2]
|
|
|
|
kernel_main_c_out("K_SEM_DEFINE(_k_sem_obj_%s, %s, %s);\n" %
|
|
|
|
(name, initial_count, limit))
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
|
|
|
|
def kernel_main_c_fifos():
|
2015-04-15 13:42:48 -04:00
|
|
|
""" Generate FIFO variables """
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
total_fifos = len(fifo_list)
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (total_fifos == 0):
|
2015-04-10 16:44:37 -07:00
|
|
|
return
|
|
|
|
|
2015-04-15 16:13:59 -04:00
|
|
|
kernel_main_c_out("\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
# FIFO buffers and descriptors
|
2015-04-10 16:44:37 -07:00
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
for fifo in fifo_list:
|
|
|
|
name = fifo[0]
|
|
|
|
depth = fifo[1]
|
|
|
|
width = fifo[2]
|
|
|
|
buffer = "__" + name + "_buffer"
|
|
|
|
kernel_main_c_out("char __noinit %s[%d];\n" %
|
|
|
|
(buffer, depth * width))
|
|
|
|
kernel_main_c_out(
|
|
|
|
"struct _k_fifo_struct _k_fifo_obj_%s = " % (name) +
|
|
|
|
"__K_FIFO_DEFAULT(%d, %d, %s);\n" % (depth, width, buffer))
|
|
|
|
else:
|
|
|
|
# message queue objects
|
2015-04-10 16:44:37 -07:00
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
for fifo in fifo_list:
|
|
|
|
name = fifo[0]
|
|
|
|
depth = fifo[1]
|
|
|
|
width = fifo[2]
|
2016-10-02 17:31:41 +03:00
|
|
|
kernel_main_c_out("K_MSGQ_DEFINE(_k_fifo_obj_%s, %s, %s);\n" %
|
|
|
|
(name, depth, width))
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
|
|
|
|
def kernel_main_c_pipes():
|
2015-04-15 13:42:48 -04:00
|
|
|
""" Generate pipe variables """
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
total_pipes = len(pipe_list)
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (total_pipes == 0):
|
2015-04-10 16:44:37 -07:00
|
|
|
return
|
|
|
|
|
|
|
|
# pipe buffers
|
|
|
|
|
2015-04-15 16:13:59 -04:00
|
|
|
kernel_main_c_out("\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
for pipe in pipe_list:
|
|
|
|
kernel_main_c_out(
|
|
|
|
"char __noinit __%s_buffer[%d];\n" % (pipe[0], pipe[1]))
|
2015-04-10 16:44:37 -07:00
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
# pipe descriptors
|
2015-04-10 16:44:37 -07:00
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
for pipe in pipe_list:
|
|
|
|
name = pipe[0]
|
|
|
|
size = pipe[1]
|
|
|
|
buffer = "__" + pipe[0] + "_buffer"
|
|
|
|
kernel_main_c_out("struct _k_pipe_struct _k_pipe_obj_%s = "
|
|
|
|
% (name) +
|
|
|
|
" __K_PIPE_INITIALIZER(%d, %s);\n" % (size, buffer) +
|
|
|
|
"kpipe_t _k_pipe_ptr_%s " % (name) +
|
|
|
|
" __in_section(_k_pipe_ptr, public, pipe) =\n" +
|
|
|
|
" (kpipe_t)&_k_pipe_obj_%s;\n" % (name))
|
|
|
|
|
|
|
|
else:
|
|
|
|
# pipe objects
|
|
|
|
|
|
|
|
for pipe in pipe_list:
|
2016-10-02 17:31:41 +03:00
|
|
|
name = pipe[0]
|
|
|
|
size = pipe[1]
|
2016-10-14 14:44:57 -04:00
|
|
|
kernel_main_c_out("K_PIPE_DEFINE(_k_pipe_obj_%s, %d, 4);\n" %
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
(name, size))
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
|
|
|
|
def kernel_main_c_mailboxes():
|
2015-04-15 13:42:48 -04:00
|
|
|
""" Generate mailbox variables """
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
total_mbxs = len(mbx_list)
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (total_mbxs == 0):
|
2015-04-10 16:44:37 -07:00
|
|
|
return
|
|
|
|
|
2015-07-17 12:28:06 -07:00
|
|
|
kernel_main_c_out("\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
# mailbox descriptors
|
|
|
|
|
|
|
|
for mbx in mbx_list:
|
|
|
|
name = mbx[0]
|
|
|
|
kernel_main_c_out(
|
|
|
|
"struct _k_mbox_struct _k_mbox_obj_%s = " % (name) +
|
|
|
|
"__K_MAILBOX_DEFAULT;\n")
|
|
|
|
else:
|
|
|
|
# mailbox objects
|
|
|
|
|
|
|
|
for mbx in mbx_list:
|
2016-10-02 17:31:41 +03:00
|
|
|
name = mbx[0]
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
kernel_main_c_out("K_MBOX_DEFINE(_k_mbox_obj_%s);\n" % (name))
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
def kernel_main_c_maps():
|
2015-04-15 13:42:48 -04:00
|
|
|
""" Generate memory map variables """
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
total_maps = len(map_list)
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
if (total_maps == 0):
|
2015-04-10 16:44:37 -07:00
|
|
|
return
|
|
|
|
|
2015-04-15 16:13:59 -04:00
|
|
|
kernel_main_c_out("\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
# memory map buffers and descriptors
|
|
|
|
|
2016-10-02 17:31:41 +03:00
|
|
|
for map in map_list:
|
|
|
|
name = map[0]
|
|
|
|
blocks = map[1]
|
|
|
|
block_size = map[2]
|
|
|
|
kernel_main_c_out("char __noinit __MAP_%s_buffer[%d];\n" %
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
(map[0], blocks * block_size))
|
2016-10-02 17:31:41 +03:00
|
|
|
kernel_main_c_out(
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
"struct _k_mem_map_struct _k_mem_map_obj_%s = " % (name) +
|
|
|
|
"__K_MEM_MAP_INITIALIZER(%d, %d, __MAP_%s_buffer);\n" %
|
|
|
|
(blocks, block_size, map[0]))
|
2016-10-02 17:31:41 +03:00
|
|
|
kernel_main_c_out(
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
"kmemory_map_t _k_mem_map_ptr_%s " % (name) +
|
|
|
|
" __in_section(_k_mem_map_ptr, public, mem_map) =\n" +
|
|
|
|
" (kmemory_map_t)&_k_mem_map_obj_%s;\n" % (name))
|
|
|
|
else:
|
|
|
|
# memory map objects
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2016-10-02 17:31:41 +03:00
|
|
|
for map in map_list:
|
|
|
|
name = map[0]
|
|
|
|
blocks = map[1]
|
|
|
|
block_size = map[2]
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
kernel_main_c_out("K_MEM_MAP_DEFINE(_k_mem_map_obj_%s, %s, %s);\n" %
|
|
|
|
(name, blocks, block_size))
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
|
|
|
|
def kernel_main_c_pools():
|
2015-04-15 13:42:48 -04:00
|
|
|
""" Generate memory pool variables """
|
2016-03-04 14:44:25 -08:00
|
|
|
global heap_pos_in_pool_list
|
2015-04-15 13:42:48 -04:00
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
total_pools = len(pool_list)
|
|
|
|
|
|
|
|
# pool global variables
|
|
|
|
|
2015-04-27 10:28:26 -05:00
|
|
|
kernel_main_c_out("\nint _k_mem_pool_count = %d;\n" % (total_pools))
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2016-09-01 18:14:17 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
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
|
|
|
|
|
|
|
|
pool_descriptors = "\nstruct pool_struct _k_mem_pool_list[%d] =\n{\n" % \
|
|
|
|
(total_pools)
|
|
|
|
ident = 0x00010000
|
|
|
|
|
|
|
|
for pool in pool_list:
|
|
|
|
|
|
|
|
kernel_main_c_out("\n")
|
|
|
|
|
|
|
|
# create local variables relating to current pool
|
|
|
|
|
|
|
|
min_block_size = pool[1]
|
|
|
|
max_block_size = pool[2]
|
|
|
|
num_maximal_blocks = pool[3]
|
|
|
|
total_memory = max_block_size * num_maximal_blocks
|
|
|
|
buffer = "__" + pool[0] + "_buffer"
|
|
|
|
frag_table = "block_sets_%#010x" % ident
|
|
|
|
|
|
|
|
# determine block sizes used by pool (including actual minimum size)
|
|
|
|
|
|
|
|
block_size_list = [max_block_size]
|
|
|
|
while (ident != 0): # loop forever
|
|
|
|
min_block_size_actual = block_size_list[len(block_size_list) - 1]
|
|
|
|
min_block_size_proposed = min_block_size_actual / 4
|
|
|
|
if (min_block_size_proposed < min_block_size):
|
|
|
|
break
|
|
|
|
block_size_list.append(min_block_size_proposed)
|
|
|
|
frag_levels = len(block_size_list)
|
|
|
|
|
|
|
|
# determine size of quad-block arrays,
|
|
|
|
# from the largest block size to the smallest block size
|
|
|
|
# - each array must be big enough to track the status of
|
|
|
|
# the entire memory pool buffer
|
|
|
|
# - each array entry tracks the status of 4 consecutive blocks
|
|
|
|
# - need to do rounding up with array for largest block size
|
|
|
|
# in case the # of largest size blocks isn't a multiple of 4
|
|
|
|
# (i.e. it's final array entry may be partly unused)
|
|
|
|
|
|
|
|
quad_block_sizes = [(num_maximal_blocks + 3) / 4]
|
|
|
|
quad_block_size_to_use = num_maximal_blocks
|
|
|
|
for index in range(1, frag_levels):
|
|
|
|
quad_block_sizes.append(quad_block_size_to_use)
|
|
|
|
quad_block_size_to_use *= 4
|
|
|
|
|
|
|
|
# generate array of quad-blocks for each block set
|
|
|
|
|
|
|
|
for index in range(0, frag_levels):
|
|
|
|
kernel_main_c_out(
|
|
|
|
"struct pool_quad_block quad_blocks_%#010x_%d[%d];\n" %
|
|
|
|
(ident, index, quad_block_sizes[index]))
|
|
|
|
|
|
|
|
# generate array of block sets for memory pool
|
|
|
|
|
|
|
|
kernel_main_c_out("\nstruct pool_block_set %s[%d] =\n{\n" %
|
|
|
|
(frag_table, frag_levels))
|
|
|
|
for index in range(0, frag_levels):
|
|
|
|
kernel_main_c_out(" { %d, %d, quad_blocks_%#010x_%d},\n" %
|
|
|
|
(block_size_list[index], quad_block_sizes[index],
|
|
|
|
ident, index))
|
|
|
|
kernel_main_c_out("};\n")
|
|
|
|
|
|
|
|
# generate memory pool buffer
|
|
|
|
|
|
|
|
kernel_main_c_out("\nchar __noinit %s[%d];\n" % (buffer, total_memory))
|
|
|
|
|
|
|
|
# append memory pool descriptor info
|
|
|
|
|
|
|
|
pool_descriptors += " {%d, %d, %d, %d, NULL, %s, %s},\n" % \
|
|
|
|
(max_block_size, min_block_size_actual,
|
|
|
|
num_maximal_blocks, frag_levels, frag_table, buffer)
|
|
|
|
|
|
|
|
ident += 1
|
|
|
|
|
|
|
|
# generate memory pool descriptor info
|
|
|
|
|
|
|
|
pool_descriptors += "};\n"
|
|
|
|
elif kernel_type == 'unified':
|
|
|
|
pool_descriptors = ""
|
|
|
|
for pool in pool_list:
|
|
|
|
kernel_main_c_out("\n")
|
|
|
|
min_block_size = pool[1]
|
|
|
|
max_block_size = pool[2]
|
|
|
|
num_maximal_blocks = pool[3]
|
2016-10-06 16:27:01 -04:00
|
|
|
pool_descriptors += "K_MEM_POOL_DEFINE(_k_mem_pool_obj_%s, %d, %d, %d, 4);\n" % \
|
2016-09-01 18:14:17 -04:00
|
|
|
(pool[0], min_block_size, max_block_size,
|
|
|
|
num_maximal_blocks)
|
2015-04-10 16:44:37 -07:00
|
|
|
kernel_main_c_out(pool_descriptors)
|
|
|
|
|
|
|
|
|
|
|
|
def kernel_main_c_node_init():
|
2015-04-15 13:42:48 -04:00
|
|
|
""" Generate node initialization routine """
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
kernel_main_c_out("\n" +
|
2015-09-01 10:43:43 -04:00
|
|
|
"void _k_init_dynamic(void)\n{\n")
|
2015-07-28 11:18:35 -07:00
|
|
|
kernel_main_c_out(" _k_pipe_init();\n")
|
microkernel: introduce support for private memory maps
This enable defining memory maps in source code in addition to
defining in MDEF files. This introduces the macro
DEFINE_MEM_MAP(mem_map_name, ...). The memory maps created this
way are the same, in functionality, as those defined in MDEF
files. They can be manipulated by the standard microkernel
memory map APIs.
Define the memory map using:
DEFINE_MEM_MAP(mem_map1, blocks, block_size);
and "mem_map1" can be used, for example:
task_mem_map_alloc(mem_map1, ...);
or,
task_mem_map_free(mem_map1, ...);
etc.
To use the memory map defined in another source file, simply add:
extern const kmemory_map_t mem_map1;
to the desired C or header file.
Change-Id: I9c551b90f9d0a95f961fd8ec1c5278c2ea44312d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2015-08-04 10:15:43 -07:00
|
|
|
kernel_main_c_out(" _k_mem_map_init();\n")
|
2015-04-15 13:42:48 -04:00
|
|
|
if (len(pool_list) > 0):
|
2015-06-11 09:46:38 -04:00
|
|
|
kernel_main_c_out(" _k_mem_pool_init();\n")
|
2015-10-11 13:11:10 -05:00
|
|
|
|
|
|
|
kernel_main_c_out("#ifdef CONFIG_DEBUG_TRACING_KERNEL_OBJECTS\n")
|
|
|
|
# mutex object ids
|
|
|
|
for mutex in mutex_list:
|
|
|
|
name = mutex[0]
|
2016-02-17 14:56:57 -06:00
|
|
|
kernel_main_c_out("\tSYS_TRACING_OBJ_INIT(micro_mutex, " +
|
|
|
|
"&_k_mutex_obj_%s);\n" % (name))
|
2015-10-11 13:11:10 -05:00
|
|
|
# semaphore object ids
|
|
|
|
for semaphore in sema_list:
|
|
|
|
name = semaphore[0]
|
2016-02-17 14:56:57 -06:00
|
|
|
kernel_main_c_out("\tSYS_TRACING_OBJ_INIT(micro_sem, " +
|
|
|
|
"&_k_sem_obj_%s);\n" % (name))
|
2015-10-11 13:11:10 -05:00
|
|
|
# fifo object ids
|
|
|
|
for fifo in fifo_list:
|
|
|
|
name = fifo[0]
|
2016-02-17 14:56:57 -06:00
|
|
|
kernel_main_c_out("\tSYS_TRACING_OBJ_INIT(micro_fifo, " +
|
|
|
|
"&_k_fifo_obj_%s);\n" % (name))
|
2015-10-11 13:11:10 -05:00
|
|
|
# mailbox object ids
|
|
|
|
for mbx in mbx_list:
|
|
|
|
name = mbx[0]
|
2016-02-17 14:56:57 -06:00
|
|
|
kernel_main_c_out("\tSYS_TRACING_OBJ_INIT(micro_mbox, " +
|
|
|
|
"&_k_mbox_obj_%s);\n" % (name))
|
2015-10-11 13:11:10 -05:00
|
|
|
# pipe object id
|
|
|
|
for pipe in pipe_list:
|
|
|
|
name = pipe[0];
|
2016-02-17 14:56:57 -06:00
|
|
|
kernel_main_c_out("\tSYS_TRACING_OBJ_INIT(micro_pipe, " +
|
|
|
|
"&_k_pipe_obj_%s);\n" % (name))
|
2015-10-11 13:11:10 -05:00
|
|
|
# memory map object id
|
|
|
|
for map in map_list:
|
|
|
|
name = map[0];
|
2016-02-17 14:56:57 -06:00
|
|
|
kernel_main_c_out("\tSYS_TRACING_OBJ_INIT(micro_mem_map, " +
|
|
|
|
"&_k_mem_map_obj_%s);\n" % (name))
|
2015-10-11 13:11:10 -05:00
|
|
|
# memory pool object id
|
|
|
|
pool_count = 0;
|
|
|
|
total_pools = len(pool_list);
|
|
|
|
while (pool_count < total_pools):
|
2016-02-17 14:56:57 -06:00
|
|
|
kernel_main_c_out("\tSYS_TRACING_OBJ_INIT(micro_mem_pool, " +
|
|
|
|
"&(_k_mem_pool_list[%d]));\n" % (pool_count))
|
2015-10-11 13:11:10 -05:00
|
|
|
pool_count = pool_count + 1;
|
2016-03-04 09:42:23 -06:00
|
|
|
|
|
|
|
# event map object id
|
|
|
|
for event in event_list:
|
|
|
|
# no need to expose the irq task events
|
|
|
|
if not (event[0].startswith("_TaskIrqEvt")):
|
|
|
|
name = event[0];
|
|
|
|
kernel_main_c_out("\tSYS_TRACING_OBJ_INIT(micro_event, " +
|
|
|
|
"&_k_event_obj_%s);\n" % (name))
|
|
|
|
|
2015-10-11 13:11:10 -05:00
|
|
|
kernel_main_c_out("#endif\n")
|
|
|
|
|
2015-04-15 16:13:59 -04:00
|
|
|
kernel_main_c_out("}\n")
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
|
|
|
|
def kernel_main_c_generate():
|
2015-04-15 13:42:48 -04:00
|
|
|
""" Generate kernel_main.c file """
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
global kernel_main_c_data
|
|
|
|
|
2015-04-15 16:48:21 -04:00
|
|
|
kernel_main_c_header()
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
kernel_main_c_mutexes()
|
|
|
|
kernel_main_c_semas()
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
kernel_main_c_events()
|
|
|
|
kernel_main_c_maps()
|
2015-04-10 16:44:37 -07:00
|
|
|
kernel_main_c_fifos()
|
|
|
|
kernel_main_c_mailboxes()
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
kernel_main_c_tasks()
|
|
|
|
kernel_main_c_pipes()
|
2016-09-01 18:14:17 -04:00
|
|
|
kernel_main_c_pools()
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
|
|
|
|
if kernel_type == 'micro':
|
|
|
|
kernel_main_c_kargs()
|
|
|
|
kernel_main_c_timers()
|
|
|
|
kernel_main_c_node_init()
|
|
|
|
kernel_main_c_priorities()
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
write_file(output_dir + 'kernel_main.c', kernel_main_c_data)
|
|
|
|
|
2015-04-15 15:27:49 -04:00
|
|
|
|
2015-05-12 09:28:55 -04:00
|
|
|
#
|
|
|
|
# GENERATE kernel_main.h FILE
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
def kernel_main_h_generate():
|
|
|
|
""" Generate kernel_main.h file """
|
|
|
|
|
|
|
|
global output_dir
|
|
|
|
|
|
|
|
subprocess.check_call([
|
|
|
|
"cp",
|
|
|
|
"-f",
|
2015-06-05 22:46:00 -04:00
|
|
|
os.environ["ZEPHYR_BASE"] +
|
2015-05-12 09:28:55 -04:00
|
|
|
"/kernel/microkernel/include/kernel_main.h",
|
|
|
|
output_dir])
|
|
|
|
|
|
|
|
|
2015-05-14 09:24:35 -04:00
|
|
|
#
|
2015-06-19 10:46:53 -04:00
|
|
|
# GENERATE micro_private_types.h FILE
|
2015-05-14 09:24:35 -04:00
|
|
|
#
|
|
|
|
|
|
|
|
|
2015-06-19 10:46:53 -04:00
|
|
|
def micro_private_types_h_generate():
|
|
|
|
""" Generate micro_private_types.h file """
|
2015-05-14 09:24:35 -04:00
|
|
|
|
|
|
|
global output_dir
|
|
|
|
|
|
|
|
subprocess.check_call([
|
|
|
|
"cp",
|
|
|
|
"-f",
|
2015-06-05 22:46:00 -04:00
|
|
|
os.environ["ZEPHYR_BASE"] +
|
2015-06-19 10:46:53 -04:00
|
|
|
"/kernel/microkernel/include/micro_private_types.h",
|
2015-05-14 09:24:35 -04:00
|
|
|
output_dir])
|
|
|
|
|
|
|
|
|
2015-04-15 15:27:49 -04:00
|
|
|
#
|
2015-10-21 07:24:39 -04:00
|
|
|
# GENERATE sysgen.h FILE
|
2015-04-15 15:27:49 -04:00
|
|
|
#
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_data = ""
|
2015-04-15 15:36:02 -04:00
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_filename_str = \
|
|
|
|
"/* sysgen.h - system generated microkernel definitions */\n\n"
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_include_guard = "_SYSGEN__H_"
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_header_include_guard_str = \
|
|
|
|
"#ifndef " + sysgen_h_include_guard + "\n" \
|
|
|
|
"#define " + sysgen_h_include_guard + "\n\n"
|
2015-04-15 13:42:48 -04:00
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
def generate_sysgen_h_header():
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
global sysgen_h_data
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
|
|
|
|
if kernel_type == 'micro':
|
|
|
|
kernel_api_file = "#include <microkernel.h>\n"
|
|
|
|
else:
|
|
|
|
kernel_api_file = "#include <kernel.h>\n"
|
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_data += \
|
|
|
|
sysgen_h_filename_str + \
|
2015-04-15 13:42:48 -04:00
|
|
|
copyright + \
|
|
|
|
do_not_edit_warning + \
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
kernel_api_file + \
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_header_include_guard_str + \
|
2015-05-14 15:05:49 -04:00
|
|
|
"\n"
|
2015-04-15 13:42:48 -04:00
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
def generate_taskgroup_line(taskgroup, group_id):
|
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
global sysgen_h_data
|
|
|
|
sysgen_h_data += \
|
2015-04-15 13:42:48 -04:00
|
|
|
"#define " + taskgroup + " 0x%8.8x\n" % group_id
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
def generate_sysgen_h_taskgroups():
|
2015-05-14 15:05:49 -04:00
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
global sysgen_h_data
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
for group in group_key_list:
|
|
|
|
generate_taskgroup_line(group, group_dictionary[group])
|
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_data += "\n"
|
2015-04-15 13:42:48 -04:00
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
def generate_obj_id_line(name, obj_id):
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
return "#define " + name + " 0x0001%4.4x\n" % obj_id
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
def generate_obj_id_lines(obj_types):
|
|
|
|
|
2015-04-15 13:42:48 -04:00
|
|
|
data = ""
|
|
|
|
for obj_type in obj_types:
|
|
|
|
for obj in obj_type[0]:
|
|
|
|
data += generate_obj_id_line(str(obj[0]), obj_type[1])
|
|
|
|
obj_type[1] += 1
|
|
|
|
if obj_type[1] > 0:
|
|
|
|
data += "\n"
|
|
|
|
|
|
|
|
return data
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
def generate_sysgen_h_obj_ids():
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
global sysgen_h_data
|
2015-04-15 13:42:48 -04:00
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
mutex_struct = '_k_mutex_struct'
|
|
|
|
mutex_type = 'kmutex_t'
|
|
|
|
sem_struct = '_k_sem_struct'
|
|
|
|
sem_type = 'ksem_t'
|
2016-10-02 17:31:41 +03:00
|
|
|
pipe_struct = '_k_pipe_struct'
|
|
|
|
pipe_type = 'kpipe_t'
|
|
|
|
map_struct = '_k_mem_map_struct'
|
|
|
|
map_type = 'kmemory_map_t'
|
|
|
|
fifo_struct = '_k_fifo_struct'
|
|
|
|
fifo_type = 'kfifo_t'
|
|
|
|
mbox_struct = '_k_mbox_struct'
|
|
|
|
mbox_type = 'kmbox_t'
|
|
|
|
event_type = 'kevent_t'
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
# add missing object types
|
|
|
|
else:
|
|
|
|
mutex_struct = 'k_mutex'
|
|
|
|
mutex_type = 'struct k_mutex *'
|
|
|
|
sem_struct = 'k_sem'
|
|
|
|
sem_type = 'struct k_sem *'
|
2016-10-02 17:31:41 +03:00
|
|
|
pipe_struct = 'k_pipe'
|
|
|
|
pipe_type = 'struct k_pipe *'
|
|
|
|
map_struct = 'k_mem_map'
|
|
|
|
map_type = 'struct k_mem_map *'
|
|
|
|
fifo_struct = 'k_msgq'
|
|
|
|
fifo_type = 'struct k_msgq *'
|
|
|
|
mbox_struct = 'k_mbox'
|
|
|
|
mbox_type = 'struct k_mbox *'
|
|
|
|
event_type = 'struct k_event *'
|
|
|
|
mem_pool_type = 'struct k_mem_pool'
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
# add missing object types
|
|
|
|
|
2015-06-22 16:22:13 -04:00
|
|
|
# mutex object ids
|
|
|
|
|
2015-10-21 14:02:07 -07:00
|
|
|
sysgen_h_data += "\n"
|
2015-06-22 16:22:13 -04:00
|
|
|
for mutex in mutex_list:
|
|
|
|
name = mutex[0]
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_data += \
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
"extern struct %s _k_mutex_obj_%s;\n" % (mutex_struct, name)
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_data += \
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
"#define %s ((%s)&_k_mutex_obj_%s)\n\n" % (name, mutex_type, name)
|
2015-06-22 16:22:13 -04:00
|
|
|
|
2015-07-14 16:15:54 -07:00
|
|
|
# semaphore object ids
|
|
|
|
|
2015-10-21 14:02:07 -07:00
|
|
|
sysgen_h_data += "\n"
|
2015-07-14 16:15:54 -07:00
|
|
|
for semaphore in sema_list:
|
|
|
|
name = semaphore[0]
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_data += \
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
"extern struct %s _k_sem_obj_%s;\n" % (sem_struct, name)
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_data += \
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
"#define %s ((%s)&_k_sem_obj_%s)\n\n" % (name, sem_type, name)
|
2015-07-14 16:15:54 -07:00
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
# fifo (aka message queue) object ids
|
2015-07-16 14:03:02 -07:00
|
|
|
|
2015-10-21 14:02:07 -07:00
|
|
|
sysgen_h_data += "\n"
|
2015-07-16 14:03:02 -07:00
|
|
|
for fifo in fifo_list:
|
|
|
|
name = fifo[0]
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_data += \
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
"extern struct %s _k_fifo_obj_%s;\n" % (fifo_struct, name)
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_data += \
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
"#define %s ((%s)&_k_fifo_obj_%s)\n\n" % (name, fifo_type, name)
|
2015-07-16 14:03:02 -07:00
|
|
|
|
2015-07-17 12:28:06 -07:00
|
|
|
# mailbox object ids
|
|
|
|
|
2015-10-21 14:02:07 -07:00
|
|
|
sysgen_h_data += "\n"
|
2015-07-17 12:28:06 -07:00
|
|
|
for mbx in mbx_list:
|
|
|
|
name = mbx[0]
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_data += \
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
"extern struct %s _k_mbox_obj_%s;\n" % (mbox_struct, name)
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_data += \
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
"#define %s ((%s)&_k_mbox_obj_%s)\n\n" % (name, mbox_type, name)
|
2015-07-17 12:28:06 -07:00
|
|
|
|
2015-07-27 14:43:45 -07:00
|
|
|
# pipe object id
|
|
|
|
|
2015-10-21 14:02:07 -07:00
|
|
|
sysgen_h_data += "\n"
|
2015-07-27 14:43:45 -07:00
|
|
|
for pipe in pipe_list:
|
|
|
|
name = pipe[0];
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_data += \
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
"extern struct %s _k_pipe_obj_%s;\n" % (pipe_struct, name)
|
|
|
|
sysgen_h_data += \
|
|
|
|
"#define %s ((%s)&_k_pipe_obj_%s)\n\n" % (name, pipe_type, name)
|
2015-07-27 14:43:45 -07:00
|
|
|
|
2015-08-03 17:13:51 -07:00
|
|
|
# memory map object id
|
|
|
|
|
2015-10-21 14:02:07 -07:00
|
|
|
sysgen_h_data += "\n"
|
2015-08-03 17:13:51 -07:00
|
|
|
for map in map_list:
|
|
|
|
name = map[0];
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_data += \
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
"extern struct %s _k_mem_map_obj_%s;\n" % (map_struct, name)
|
|
|
|
sysgen_h_data += \
|
|
|
|
"#define %s ((%s)&_k_mem_map_obj_%s)\n" % (name, map_type, name)
|
2015-08-03 17:13:51 -07:00
|
|
|
|
2015-07-21 11:02:59 -07:00
|
|
|
# task object id
|
|
|
|
|
2015-10-21 14:02:07 -07:00
|
|
|
sysgen_h_data += "\n"
|
2015-07-21 11:02:59 -07:00
|
|
|
for task in task_list:
|
|
|
|
name = task[0];
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
sysgen_h_data += \
|
|
|
|
"extern struct k_task _k_task_obj_%s;\n" % (name) + \
|
|
|
|
"#define %s ((ktask_t)&_k_task_obj_%s)\n" % (name, name)
|
|
|
|
elif (kernel_type == 'unified'):
|
|
|
|
sysgen_h_data += \
|
|
|
|
"extern char _k_thread_obj_%s[];\n" % (name) + \
|
|
|
|
"#define %s ((k_tid_t)_k_thread_obj_%s)\n" % (name, name)
|
2015-07-21 11:02:59 -07:00
|
|
|
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
# event object ids
|
2015-10-21 11:04:58 -07:00
|
|
|
|
|
|
|
sysgen_h_data += "\n"
|
|
|
|
for event in event_list:
|
|
|
|
# no need to expose the irq task events
|
|
|
|
if not (event[0].startswith("_TaskIrqEvt")):
|
|
|
|
name = event[0];
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
sysgen_h_data += "extern const %s %s;\n" % (event_type, name)
|
|
|
|
elif (kernel_type == 'unified'):
|
|
|
|
sysgen_h_data += \
|
|
|
|
"extern struct k_event _k_event_obj_%s;\n" % (name)
|
|
|
|
sysgen_h_data += \
|
|
|
|
"#define %s (&_k_event_obj_%s)\n\n" % (name, name)
|
2015-07-21 11:02:59 -07:00
|
|
|
|
2016-09-01 18:14:17 -04:00
|
|
|
# memory pool object ids
|
2015-06-22 16:22:13 -04:00
|
|
|
|
2016-09-01 18:14:17 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
obj_types = [
|
|
|
|
[pool_list, 0],
|
|
|
|
]
|
|
|
|
sysgen_h_data += generate_obj_id_lines(obj_types)
|
|
|
|
elif (kernel_type == 'unified'):
|
|
|
|
for mem_pool in pool_list:
|
|
|
|
name = mem_pool[0];
|
|
|
|
sysgen_h_data += \
|
|
|
|
"extern %s _k_mem_pool_obj_%s;\n" % (mem_pool_type, name)
|
|
|
|
sysgen_h_data += \
|
|
|
|
"#define %s ((%s *)&_k_mem_pool_obj_%s)\n" % (name, mem_pool_type, name)
|
|
|
|
|
|
|
|
# all other object ids
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_footer_include_guard_str = \
|
|
|
|
"\n#endif /* " + sysgen_h_include_guard + " */\n"
|
2015-04-15 13:42:48 -04:00
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
def generate_sysgen_h_footer():
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
global sysgen_h_data
|
|
|
|
sysgen_h_data += \
|
|
|
|
sysgen_h_footer_include_guard_str
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
def sysgen_h_generate():
|
|
|
|
""" Generate sysgen.h file """
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
generate_sysgen_h_header()
|
|
|
|
generate_sysgen_h_taskgroups()
|
|
|
|
generate_sysgen_h_obj_ids()
|
|
|
|
generate_sysgen_h_footer()
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-10-21 07:24:39 -04:00
|
|
|
write_file(output_dir + 'sysgen.h', sysgen_h_data)
|
2015-04-10 16:44:37 -07:00
|
|
|
|
2015-04-15 15:27:49 -04:00
|
|
|
|
|
|
|
#
|
|
|
|
# SYSTEM GENERATOR MAINLINE
|
|
|
|
#
|
|
|
|
|
2016-06-07 15:58:43 -04:00
|
|
|
get_cmdline_args()
|
2015-06-05 16:24:46 -04:00
|
|
|
mdef_parse()
|
2015-04-10 16:44:37 -07:00
|
|
|
kernel_main_c_generate()
|
unified: initial unified kernel implementation
Summary of what this includes:
initialization:
Copy from nano_init.c, with the following changes:
- the main thread is the continuation of the init thread, but an idle
thread is created as well
- _main() initializes threads in groups and starts the EXE group
- the ready queues are initialized
- the main thread is marked as non-essential once the system init is
done
- a weak main() symbol is provided if the application does not provide a
main() function
scheduler:
Not an exhaustive list, but basically provide primitives for:
- adding/removing a thread to/from a wait queue
- adding/removing a thread to/from the ready queue
- marking thread as ready
- locking/unlocking the scheduler
- instead of locking interrupts
- getting/setting thread priority
- checking what state (coop/preempt) a thread is currenlty running in
- rescheduling threads
- finding what thread is the next to run
- yielding/sleeping/aborting sleep
- finding the current thread
threads:
- Add operationns on threads, such as creating and starting them.
standardized handling of kernel object return codes:
- Kernel objects now cause _Swap() to return the following values:
0 => operation successful
-EAGAIN => operation timed out
-Exxxxx => operation failed for another reason
- The thread's swap_data field can be used to return any additional
information required to complete the operation, such as the actual
result of a successful operation.
timeouts:
- same as nano timeouts, renamed to simply 'timeouts'
- the kernel is still tick-based, but objects take timeout values in
ms for forward compatibility with a tickless kernel.
semaphores:
- Port of the nanokernel semaphores, which have the same basic behaviour
as the microkernel ones. Semaphore groups are not yet implemented.
- These semaphores are enhanced in that they accept an initial count and a
count limit. This allows configuring them as binary semaphores, and also
provisioning them without having to "give" the semaphore multiple times
before using them.
mutexes:
- Straight port of the microkernel mutexes. An init function is added to
allow defining them at runtime.
pipes:
- straight port
timers:
- amalgamation of nano and micro timers, with all functionalities
intact.
events:
- re-implementation, using semaphores and workqueues.
mailboxes:
- straight port
message queues:
- straight port of microkernel FIFOs
memory maps:
- straight port
workqueues:
- Basically, have all APIs follow the k_ naming rule, and use the _timeout
subsystem from the unified kernel directory, and not the _nano_timeout
one.
stacks:
- Port of the nanokernel stacks. They can now have multiple threads
pending on them and threads can wait with a timeout.
LIFOs:
- Straight port of the nanokernel LIFOs.
FIFOs:
- Straight port of the nanokernel FIFOs.
Work by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Peter Mitsis <peter.mitsis@windriver.com>
Allan Stephens <allan.stephens@windriver.com>
Benjamin Walsh <benjamin.walsh@windriver.com>
Change-Id: Id3cadb3694484ab2ca467889cfb029be3cd3a7d6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-02 18:55:39 -04:00
|
|
|
if kernel_type == 'micro':
|
|
|
|
kernel_main_h_generate()
|
|
|
|
micro_private_types_h_generate()
|
2015-10-21 07:24:39 -04:00
|
|
|
sysgen_h_generate()
|