blob: 55d64021423761595a0204d4f48c300b62d91c6b [file] [log] [blame]
Summer Qin596f5552022-01-27 18:04:06 +08001/*
2 * Copyright (c) 2022, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#include "compiler_ext_defs.h"
9#include "runtime_defs.h"
10#include "sprt_partition_metadata_indicator.h"
11#include "sprt_main.h"
12
13#if defined(__ICCARM__)
14#pragma required = meta_init_c
15#endif
16
Kevin Peng43160d52022-02-11 13:35:56 +080017extern void common_sfn_thread(void);
18
Summer Qin596f5552022-01-27 18:04:06 +080019__used static uintptr_t runtime_init_c(void)
20{
Kevin Peng43160d52022-02-11 13:35:56 +080021 struct runtime_metadata_t *p_rt_meta;
22
23 p_rt_meta = PART_METADATA();
24
25 if (p_rt_meta->n_sfn == 0) {
26 /* IPC Partition */
27 return p_rt_meta->entry;
28 } else {
29 /* SFN Partition */
30 return (uintptr_t)common_sfn_thread;
31 }
Summer Qin596f5552022-01-27 18:04:06 +080032}
33
34__naked void sprt_main(void)
35{
36 __asm volatile(
37#if !defined(__ICCARM__)
38 ".syntax unified \n"
39#endif
40 "bl runtime_init_c \n"
41 "bx r0 \n"
42 );
43}