1 /*
2 * Copyright (c) 2023 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include "nsi_cpu_if.h"
8 #include "nsi_tracing.h"
9
10 /*
11 * Stubbed embedded CPU images, which do nothing:
12 * The CPU does not boot, and interrupts are just ignored
13 * These are all defined as weak, so if an actual image is present for that CPU,
14 * that will be linked against.
15 *
16 * This exists in case the total device image is assembled lacking some of the embedded CPU images
17 */
18
nsi_boot_warning(const char * func)19 static void nsi_boot_warning(const char *func)
20 {
21 nsi_print_trace("%s: Attempted boot of CPU without image. "
22 "CPU shut down permanently\n", func);
23 }
24
25 /*
26 * These will define N functions like
27 * int nsif_cpu<n>_cleanup(void) { return 0; }
28 */
29 F_TRAMP_BODY_LIST(__attribute__((weak)) void nsif_cpu, _pre_cmdline_hooks(void) { })
30 F_TRAMP_BODY_LIST(__attribute__((weak)) void nsif_cpu, _pre_hw_init_hooks(void) { })
31 F_TRAMP_BODY_LIST(__attribute__((weak)) void nsif_cpu,
32 _boot(void) { nsi_boot_warning(__func__); })
33 F_TRAMP_BODY_LIST(__attribute__((weak)) int nsif_cpu, _cleanup(void) { return 0; })
34 F_TRAMP_BODY_LIST(__attribute__((weak)) void nsif_cpu, _irq_raised(void) { })
35 F_TRAMP_BODY_LIST(__attribute__((weak)) void nsif_cpu, _irq_raised_from_sw(void) { })
36 F_TRAMP_BODY_LIST(__attribute__((weak)) int nsif_cpu, _test_hook(void *p) { return 0; })
37