summaryrefslogtreecommitdiff
path: root/core/host/main.c
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /core/host/main.c
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-stabilize-14345.B-ish.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'core/host/main.c')
-rw-r--r--core/host/main.c108
1 files changed, 0 insertions, 108 deletions
diff --git a/core/host/main.c b/core/host/main.c
deleted file mode 100644
index ed7032eb63..0000000000
--- a/core/host/main.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Entry point of unit test executable */
-
-#include "console.h"
-#include "flash.h"
-#include "hooks.h"
-#include "host_task.h"
-#include "keyboard_scan.h"
-#include "stack_trace.h"
-#include "system.h"
-#include "task.h"
-#include "test_util.h"
-#include "timer.h"
-#include "uart.h"
-
-/* Console output macros */
-#define CPUTS(outstr) cputs(CC_SYSTEM, outstr)
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-
-const char *__prog_name;
-
-const char *__get_prog_name(void)
-{
- return __prog_name;
-}
-
-static int test_main(void)
-{
- /*
- * In order to properly service IRQs before task switching is enabled,
- * we must set up our signal handler for the main thread.
- */
- task_register_interrupt();
-
- task_register_tracedump();
-
- register_test_end_hook();
-
- crec_flash_pre_init();
- system_pre_init();
- system_common_pre_init();
-
- test_init();
-
- timer_init();
-#ifdef HAS_TASK_KEYSCAN
- keyboard_scan_init();
-#endif
- uart_init();
-
- if (system_jumped_to_this_image()) {
- CPRINTS("Emulator initialized after sysjump");
- } else {
- CPUTS("\n\n--- Emulator initialized after reboot ---\n");
- CPUTS("[Reset cause: ");
- system_print_reset_flags();
- CPUTS("]\n");
- }
-
- task_start();
-
- return 0;
-}
-
-#ifdef TEST_FUZZ
-/*
- * Fuzzing tests need to start the main function in a thread, so that
- * LLVMFuzzerTestOneInput can run freely.
- */
-void *_main_thread(void *a)
-{
- test_main();
- return NULL;
-}
-
-int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
-{
- static int initialized;
- static pthread_t main_t;
- /*
- * We lose the program name as LLVM fuzzer takes over main function:
- * make up one.
- */
- static const char *name = STRINGIFY(PROJECT)".exe";
-
- if (!initialized) {
- __prog_name = name;
- pthread_create(&main_t, NULL, _main_thread, NULL);
- initialized = 1;
- /* We can't sleep yet, busy loop waiting for tasks to start. */
- wait_for_task_started_nosleep();
- /* Let tasks settle. */
- msleep(50 * MSEC);
- }
-
- return test_fuzz_one_input(data, size);
-}
-#else
-int main(int argc, char **argv)
-{
- __prog_name = argv[0];
- return test_main();
-}
-#endif