From dd07b4779f87a26fc1ba9807a47407d112683c9d Mon Sep 17 00:00:00 2001 From: Allan Stephens Date: Fri, 11 Nov 2016 16:24:04 -0500 Subject: [PATCH] kernel: Eliminate use of KERNEL_V2 configuration option The unified kernel is now the only supported kernel, so this option is unnessary. Eliminating this option also enables the removal of some legacy code that is no longer required. Change-Id: Ibfc339d643c8de16a2ed2009c9b468848b8b4972 Signed-off-by: Allan Stephens --- arch/arm/core/swap.S | 2 - kernel/Kconfig | 18 ------ kernel/configs/unified.config | 1 - kernel/unified/Kconfig | 1 - tests/legacy/benchmark/app_kernel/README.txt | 1 - .../legacy/benchmark/app_kernel/src/Makefile | 6 -- .../legacy/benchmark/app_kernel/src/config.h | 3 - .../legacy/benchmark/app_kernel/src/master.c | 3 - .../legacy/benchmark/app_kernel/src/master.h | 5 -- tests/legacy/benchmark/app_kernel/src/nop_b.c | 49 ---------------- .../microkernel/src/microkernel_footprint.c | 58 ------------------- .../nanokernel/src/nanokernel_footprint.c | 29 ---------- .../legacy/kernel/test_context/src/context.c | 5 -- tests/legacy/kernel/test_lifo/src/lifo.c | 15 ----- tests/legacy/kernel/test_mail/src/mail.c | 7 --- .../microkernel/src/object_monitor.c | 55 +----------------- .../nanokernel/src/object_monitor.c | 20 ------- .../kernel/test_sema/microkernel/src/sema.c | 19 ------ .../kernel/test_timer/microkernel/src/timer.c | 8 --- 19 files changed, 1 insertion(+), 304 deletions(-) delete mode 100644 tests/legacy/benchmark/app_kernel/src/nop_b.c diff --git a/arch/arm/core/swap.S b/arch/arm/core/swap.S index da75884716f..9b14408d2af 100644 --- a/arch/arm/core/swap.S +++ b/arch/arm/core/swap.S @@ -317,11 +317,9 @@ SECTION_FUNC(TEXT, _Swap) ldr r2, =_SCS_ICSR_PENDSV str r2, [r1, #0] -#ifdef CONFIG_KERNEL_V2 /* load -EAGAIN as the default return value */ ldr r0, =_k_neg_eagain ldr r0, [r0] -#endif /* Unlock interrupts to allow PendSV, since it's running at prio 0xff * diff --git a/kernel/Kconfig b/kernel/Kconfig index e97057b1efa..d0e46aee29b 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -16,11 +16,6 @@ # limitations under the License. # -config KERNEL_V2 - bool - prompt "Unified Kernel" - default n - choice prompt "Kernel Type" default MICROKERNEL @@ -226,17 +221,7 @@ endmenu endmenu -if !KERNEL_V2 -source "kernel/nanokernel/Kconfig" -endif - -if KERNEL_V2 source "kernel/unified/Kconfig" -endif - -if MICROKERNEL && !KERNEL_V2 -source "kernel/microkernel/Kconfig" -endif menu "Power Management" config SYS_POWER_MANAGEMENT @@ -296,8 +281,6 @@ config TICKLESS_IDLE bool prompt "Tickless idle" default y - depends on MICROKERNEL || KERNEL_V2 || \ - NANOKERNEL_TICKLESS_IDLE_SUPPORTED help This option suppresses periodic system clock interrupts whenever the kernel becomes idle. This permits the system to remain in a power @@ -325,7 +308,6 @@ endmenu config MDEF bool prompt "Use MDEF files for statically configured kernel objects" - depends on KERNEL_V2 || MICROKERNEL default y help Using an MDEF file can help the startup time of the application since diff --git a/kernel/configs/unified.config b/kernel/configs/unified.config index 42889d56652..3b33c804bfc 100644 --- a/kernel/configs/unified.config +++ b/kernel/configs/unified.config @@ -1,3 +1,2 @@ -CONFIG_KERNEL_V2=y CONFIG_MICROKERNEL=y CONFIG_INIT_STACKS=y diff --git a/kernel/unified/Kconfig b/kernel/unified/Kconfig index 2837aa68b5d..22596f3c15d 100644 --- a/kernel/unified/Kconfig +++ b/kernel/unified/Kconfig @@ -22,7 +22,6 @@ config KERNEL_V2_DEBUG bool prompt "Kernel V2 debug help" default n - depends on KERNEL_V2 select INIT_STACKS config NUM_COOP_PRIORITIES diff --git a/tests/legacy/benchmark/app_kernel/README.txt b/tests/legacy/benchmark/app_kernel/README.txt index cda93d0ef23..07fd0e1fcd3 100644 --- a/tests/legacy/benchmark/app_kernel/README.txt +++ b/tests/legacy/benchmark/app_kernel/README.txt @@ -34,7 +34,6 @@ Sample Output: |-----------------------------------------------------------------------------| | S I M P L E S E R V I C E M E A S U R E M E N T S | nsec | |-----------------------------------------------------------------------------| -| kernel service request overhead | NNNNN| |-----------------------------------------------------------------------------| | enqueue 1 byte msg in FIFO | NNNNNN| | dequeue 1 byte msg in FIFO | NNNNNN| diff --git a/tests/legacy/benchmark/app_kernel/src/Makefile b/tests/legacy/benchmark/app_kernel/src/Makefile index e344b1c5a86..8439f46bc04 100644 --- a/tests/legacy/benchmark/app_kernel/src/Makefile +++ b/tests/legacy/benchmark/app_kernel/src/Makefile @@ -6,9 +6,3 @@ obj-y := fifo_b.o mailbox_b.o master.o mempool_b.o \ pipe_r.o sema_r.o event_b.o \ fifo_r.o mailbox_r.o memmap_b.o mutex_b.o \ pipe_b.o receiver.o sema_b.o - -# TODO once we drop legacy support, remove completely -ifeq ($(CONFIG_KERNEL_V2),) -obj-y += nop_b.o -endif - diff --git a/tests/legacy/benchmark/app_kernel/src/config.h b/tests/legacy/benchmark/app_kernel/src/config.h index a543a1720ab..96dd041cccf 100644 --- a/tests/legacy/benchmark/app_kernel/src/config.h +++ b/tests/legacy/benchmark/app_kernel/src/config.h @@ -22,9 +22,6 @@ /* Max size of a message string */ #define MAX_MSG 256 -/* flag for performing the kernel call benchmark */ -#define MICROKERNEL_CALL_BENCH - /* flag for performing the Mailbox benchmark */ #define MAILBOX_BENCH diff --git a/tests/legacy/benchmark/app_kernel/src/master.c b/tests/legacy/benchmark/app_kernel/src/master.c index 6edd3b2655c..48f38835f1f 100644 --- a/tests/legacy/benchmark/app_kernel/src/master.c +++ b/tests/legacy/benchmark/app_kernel/src/master.c @@ -115,9 +115,6 @@ void BenchTask(void) output_file); PRINT_STRING(dashline, output_file); task_start(RECVTASK); -#ifndef CONFIG_KERNEL_V2 - call_test(); -#endif queue_test(); sema_test(); mutex_test(); diff --git a/tests/legacy/benchmark/app_kernel/src/master.h b/tests/legacy/benchmark/app_kernel/src/master.h index 2859e7987f0..6238ae3542d 100644 --- a/tests/legacy/benchmark/app_kernel/src/master.h +++ b/tests/legacy/benchmark/app_kernel/src/master.h @@ -70,11 +70,6 @@ extern char sline[]; extern void dummy_test(void); /* other external functions */ -#ifdef MICROKERNEL_CALL_BENCH -extern void call_test(void); -#else -#define call_test dummy_test -#endif #ifdef MAILBOX_BENCH extern void mailbox_test(void); diff --git a/tests/legacy/benchmark/app_kernel/src/nop_b.c b/tests/legacy/benchmark/app_kernel/src/nop_b.c deleted file mode 100644 index 3bee948f9a1..00000000000 --- a/tests/legacy/benchmark/app_kernel/src/nop_b.c +++ /dev/null @@ -1,49 +0,0 @@ -/* nop_b.c */ - -/* - * Copyright (c) 1997-2010,2013-2014 Wind River Systems, Inc. - * - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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. - */ - -#include "master.h" - -#ifdef MICROKERNEL_CALL_BENCH - -/* utilize non-public microkernel API for test purposes */ - -extern void _task_nop(void); - -/** - * - * @brief Kernel entry timing test - * - * @return N/A - */ -void call_test(void) -{ - uint32_t et; /* Elapsed Time */ - int i; - - et = BENCH_START(); - for (i = 0; i < NR_OF_NOP_RUNS; i++) { - _task_nop(); - } - et = TIME_STAMP_DELTA_GET(et); - check_result(); - - PRINT_F(output_file, FORMAT, "kernel service request overhead", - SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_NOP_RUNS)); -} - -#endif /* MICROKERNEL_CALL_BENCH */ diff --git a/tests/legacy/benchmark/footprint/microkernel/src/microkernel_footprint.c b/tests/legacy/benchmark/footprint/microkernel/src/microkernel_footprint.c index 80270d52b28..ed91e9d2018 100644 --- a/tests/legacy/benchmark/footprint/microkernel/src/microkernel_footprint.c +++ b/tests/legacy/benchmark/footprint/microkernel/src/microkernel_footprint.c @@ -44,63 +44,6 @@ typedef void* (*pfunc) (void*); volatile int i = 0; /* counter used by foreground task */ -#ifndef CONFIG_KERNEL_V2 - -/* legacy microkernel */ - -/* pointer array ensures specified functions are linked into the image */ -static pfunc func_array[] = { - /* event functions */ - (pfunc)task_event_send, - (pfunc)task_event_recv, - /* mutex functions */ - (pfunc)task_mutex_lock, - (pfunc)_task_mutex_unlock, - /* FIFO functions */ - (pfunc)task_fifo_put, - (pfunc)task_fifo_get, - (pfunc)_task_fifo_ioctl, - /* memory map functions */ - (pfunc)task_mem_map_used_get, - (pfunc)task_mem_map_alloc, - (pfunc)_task_mem_map_free, -#ifdef TEST_max - /* semaphore functions */ - (pfunc)isr_sem_give, - (pfunc)task_sem_give, - (pfunc)task_sem_group_give, - (pfunc)task_sem_count_get, - (pfunc)task_sem_reset, - (pfunc)task_sem_group_reset, - (pfunc)task_sem_take, - (pfunc)task_sem_group_take, - /* pipe functions */ - (pfunc)task_pipe_put, - (pfunc)task_pipe_get, - (pfunc)_task_pipe_block_put, - /* mailbox functions */ - (pfunc)task_mbox_put, - (pfunc)task_mbox_get, - (pfunc)_task_mbox_block_put, - (pfunc)_task_mbox_data_get, - (pfunc)task_mbox_data_block_get, - /* memory pool functions */ - (pfunc)task_mem_pool_alloc, - (pfunc)task_mem_pool_free, - (pfunc)task_mem_pool_defragment, - /* task functions */ - (pfunc)_task_ioctl, - (pfunc)_task_group_ioctl, - (pfunc)task_abort_handler_set, - (pfunc)task_entry_set, - (pfunc)task_priority_set, - (pfunc)task_sleep, - (pfunc)task_yield, -#endif /* TEST_max */ -}; - -#else - static pfunc func_array[] = { /* mutexes */ (pfunc)k_mutex_init, @@ -220,7 +163,6 @@ static pfunc func_array[] = { (pfunc)k_thread_custom_data_get, #endif }; -#endif /** * diff --git a/tests/legacy/benchmark/footprint/nanokernel/src/nanokernel_footprint.c b/tests/legacy/benchmark/footprint/nanokernel/src/nanokernel_footprint.c index 8952f230675..52a73162f73 100644 --- a/tests/legacy/benchmark/footprint/nanokernel/src/nanokernel_footprint.c +++ b/tests/legacy/benchmark/footprint/nanokernel/src/nanokernel_footprint.c @@ -47,34 +47,6 @@ typedef void* (*pfunc) (void*); /* stack used by fiber */ static char __stack pStack[FIBER_STACK_SIZE]; -#ifndef CONFIG_KERNEL_V2 - -/* pointer array ensures specified functions are linked into the image */ -volatile pfunc func_array[] = { - /* nano timer functions */ - (pfunc)nano_timer_init, - (pfunc)nano_fiber_timer_start, - (pfunc)nano_fiber_timer_test, - /* nano semaphore functions */ - (pfunc)nano_sem_init, - (pfunc)nano_fiber_sem_take, - (pfunc)nano_fiber_sem_give, -#ifdef TEST_max - /* nano LIFO functions */ - (pfunc)nano_lifo_init, - (pfunc)nano_fiber_lifo_put, - (pfunc)nano_fiber_lifo_get, - /* nano stack functions */ - (pfunc)nano_stack_init, - (pfunc)nano_fiber_stack_push, - (pfunc)nano_fiber_stack_pop, - /* nano FIFO functions */ - (pfunc)nano_fifo_init, - (pfunc)nano_fiber_fifo_put, - (pfunc)nano_fiber_fifo_get, -#endif /* TEST_max */ - }; -#else static pfunc func_array[] = { /* timers */ (pfunc)k_timer_init, @@ -114,7 +86,6 @@ static pfunc func_array[] = { (pfunc)k_fifo_get, #endif }; -#endif /** * diff --git a/tests/legacy/kernel/test_context/src/context.c b/tests/legacy/kernel/test_context/src/context.c index 17a92d5a884..1dbba066dc1 100644 --- a/tests/legacy/kernel/test_context/src/context.c +++ b/tests/legacy/kernel/test_context/src/context.c @@ -423,12 +423,7 @@ static int test_nano_fiber(nano_thread_id_t task_thread_id) * * @return N/A */ -#ifdef CONFIG_KERNEL_V2 #define fiber_priority_set(fiber, new_prio) task_priority_set(fiber, new_prio) -#else -#define fiber_priority_set(thread, new_prio) \ - do { (thread)->prio = (new_prio); } while ((0)) -#endif static void fiber_helper(int arg1, int arg2) { diff --git a/tests/legacy/kernel/test_lifo/src/lifo.c b/tests/legacy/kernel/test_lifo/src/lifo.c index f2c18889e61..0fa67587397 100644 --- a/tests/legacy/kernel/test_lifo/src/lifo.c +++ b/tests/legacy/kernel/test_lifo/src/lifo.c @@ -324,7 +324,6 @@ int taskLifoWaitTest(void) void *data; /* ptr to data retrieved from LIFO */ int i; -#ifdef CONFIG_KERNEL_V2 /* * the first item sent by the fiber is given directly to the waiting * task, which then ceases waiting (but doesn't get to execute yet); @@ -333,20 +332,6 @@ int taskLifoWaitTest(void) */ int expected_item[3] = { 3, 1, 2 }; -#else - /* - * all 3 items sent by the fiber are queued internally by the LIFO, - * while the task is busy waiting; when the task finally gets to run - * it retrieves all of the items in LIFO order - * - * note that the items would be received in a different order - * if a fiber was waiting on the FIFO!; in this case, the first - * item would be given directly to the fiber, and only the two - * remaining items would be queued internally by the LIFO - */ - - int expected_item[3] = { 1, 2, 3 }; -#endif /* Wait on in case fiber's print message blocked */ nano_fiber_sem_take(&taskWaitSem, TICKS_UNLIMITED); diff --git a/tests/legacy/kernel/test_mail/src/mail.c b/tests/legacy/kernel/test_mail/src/mail.c index 7943fccddc6..6e360202f63 100644 --- a/tests/legacy/kernel/test_mail/src/mail.c +++ b/tests/legacy/kernel/test_mail/src/mail.c @@ -52,15 +52,8 @@ #define MSG_INFO1 1234 /* Message info test value */ #define MSG_INFO2 666 /* Message info test value */ -#ifdef CONFIG_KERNEL_V2 -/* unified kernel: sender (correctly) told that receiver consumed no data */ #define MSG_CANCEL_SIZE 0 #define DATA_PTR(x) x.data -#else -/* classic microkernel: sender (wrongly) told that receiver consumed all data */ -#define MSG_CANCEL_SIZE MSGSIZE -#define DATA_PTR(x) x.pointer_to_data -#endif static char myData1[MSGSIZE] = "This is myData1"; static char myData2[MSGSIZE] = "This is myData2"; diff --git a/tests/legacy/kernel/test_obj_tracing/microkernel/src/object_monitor.c b/tests/legacy/kernel/test_obj_tracing/microkernel/src/object_monitor.c index 7188014fca7..88bf3593fa9 100644 --- a/tests/legacy/kernel/test_obj_tracing/microkernel/src/object_monitor.c +++ b/tests/legacy/kernel/test_obj_tracing/microkernel/src/object_monitor.c @@ -29,7 +29,7 @@ * */ -#define TOTAL_TEST_NUMBER 3 +#define TOTAL_TEST_NUMBER 2 /* 1 IPM console fiber if enabled */ #if defined(CONFIG_IPM_CONSOLE_RECEIVER) && defined(CONFIG_PRINTK) @@ -38,8 +38,6 @@ #define IPM_THREAD 0 #endif /* CONFIG_IPM_CONSOLE_RECEIVER && CONFIG_PRINTK*/ -#if defined(CONFIG_KERNEL_V2) - /* Must account for: * N Philosopher threads * 1 Object monitor thread @@ -55,55 +53,6 @@ void *force_sys_work_q_in = (void *)&k_sys_work_q; #define OBJ_LIST_NAME k_mutex #define OBJ_LIST_TYPE struct k_mutex -/* unified kernel doesn't support task-specific tracing, so it always passes */ -#define test_task_tracing() 1 - -#else - -/* Must account for: - * N Philosopher tasks - * 1 Object monitor task - * 1 Microkernel idle task - * 1 Microkernel server fiber - * 1 IPM console fiber - * - * Also have philosopher demo task, but it terminates early on during the test - * so we don't need to account for it. - */ - -#define TOTAL_FIBERS (1 + IPM_THREAD) -#define TOTAL_TASKS (N_PHILOSOPHERS + 2) -#define TOTAL_THREADS (TOTAL_FIBERS + TOTAL_TASKS) - -#define OBJ_LIST_NAME micro_mutex -#define OBJ_LIST_TYPE struct _k_mutex_struct - -static inline int test_task_tracing(void) -{ - int obj_counter = 0; - struct k_task *task_list = - (struct k_task *)SYS_TRACING_HEAD(struct k_task, micro_task); - - while (task_list != NULL) { - TC_PRINT("TASK ID: 0x%x, PRIORITY: %d, GROUP %d\n", - task_list->id, task_list->priority, task_list->group); - task_list = (struct k_task *)SYS_TRACING_NEXT - (struct k_task, micro_task, task_list); - obj_counter++; - } - TC_PRINT("TASK QUANTITY: %d\n", obj_counter); - - if (obj_counter == TOTAL_TASKS) { - TC_END_RESULT(TC_PASS); - return 1; - } - - TC_END_RESULT(TC_FAIL); - return 0; -} - -#endif /* CONFIG_KERNEL_V2 */ - static inline int test_thread_monitor(void) { int obj_counter = 0; @@ -163,8 +112,6 @@ void object_monitor(void) test_counter += test_thread_monitor(); - test_counter += test_task_tracing(); - if (test_counter == TOTAL_TEST_NUMBER) { TC_END_REPORT(TC_PASS); } else { diff --git a/tests/legacy/kernel/test_obj_tracing/nanokernel/src/object_monitor.c b/tests/legacy/kernel/test_obj_tracing/nanokernel/src/object_monitor.c index 67072392b4a..436831cf179 100644 --- a/tests/legacy/kernel/test_obj_tracing/nanokernel/src/object_monitor.c +++ b/tests/legacy/kernel/test_obj_tracing/nanokernel/src/object_monitor.c @@ -38,8 +38,6 @@ #define IPM_THREAD 0 #endif /* CONFIG_IPM_CONSOLE_RECEIVER && CONFIG_PRINTK*/ -#if defined(CONFIG_KERNEL_V2) - /* Must account for: * N Philosopher threads * 1 Object monitor thread @@ -55,24 +53,6 @@ void *force_sys_work_q_in = (void *)&k_sys_work_q; #define OBJ_LIST_NAME k_sem #define OBJ_LIST_TYPE struct k_sem -#else - -/* Must account for: - * N Philosopher fibers - * 1 Object monitor fiber - * 1 main() task - * 1 IPM console fiber - */ - -#define TOTAL_FIBERS (N_PHILOSOPHERS + 1 + IPM_THREAD) -#define TOTAL_TASKS 1 -#define TOTAL_THREADS (TOTAL_FIBERS + TOTAL_TASKS) - -#define OBJ_LIST_NAME nano_sem -#define OBJ_LIST_TYPE struct nano_sem - -#endif /* CONFIG_KERNEL_V2 */ - static inline int test_thread_monitor(void) { int obj_counter = 0; diff --git a/tests/legacy/kernel/test_sema/microkernel/src/sema.c b/tests/legacy/kernel/test_sema/microkernel/src/sema.c index e196b15af9c..120bcdcd6fd 100644 --- a/tests/legacy/kernel/test_sema/microkernel/src/sema.c +++ b/tests/legacy/kernel/test_sema/microkernel/src/sema.c @@ -30,9 +30,7 @@ * fiber_sem_give() */ -#ifdef CONFIG_KERNEL_V2 #define __printf_like(f, a) -#endif #include #include @@ -323,7 +321,6 @@ int simpleGroupWaitTest(void) } } -#ifdef CONFIG_KERNEL_V2 /* * In the current implementation of semaphore groups, the taken * semaphore is the first semaphore in 'semList'. Note that the @@ -338,22 +335,6 @@ int simpleGroupWaitTest(void) return TC_FAIL; } } -#else - /* - * The Alternate Task will signal the semaphore group once. Note that - * when the semaphore group is signalled, the last semaphore in the - * group is the value that is returned, not the first. - */ - - for (i = 3; i >= 0; i--) { - sema = task_sem_group_take(semList, TICKS_UNLIMITED); - if (sema != semList[i]) { - TC_ERROR("task_sem_group_take() error. Expected %d, not %d\n", - (int) semList[3], (int) sema); - return TC_FAIL; - } - } -#endif /* * Again wait for a semaphore to be signalled. This time, the alternate diff --git a/tests/legacy/kernel/test_timer/microkernel/src/timer.c b/tests/legacy/kernel/test_timer/microkernel/src/timer.c index e9a2a552661..f92a01d3d06 100644 --- a/tests/legacy/kernel/test_timer/microkernel/src/timer.c +++ b/tests/legacy/kernel/test_timer/microkernel/src/timer.c @@ -31,16 +31,8 @@ This module tests the following microkernel timer routines: #include "fifo_timeout.c" -#ifdef CONFIG_KERNEL_V2 extern bool _timer_pool_is_empty(void); /* For white box testing only */ #define timer_pool_is_empty _timer_pool_is_empty -#else -extern struct nano_lifo _k_timer_free; /* For white box testing only */ -static inline bool timer_pool_is_empty(void) -{ - return (bool)(_k_timer_free.list == NULL); -} -#endif #define NTIMERS CONFIG_NUM_TIMER_PACKETS