blob: e9ad7bef6a57b988868e149602c4f0012efc3cfe [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"
Ken Liu562f2a12022-05-12 20:02:33 +080011#include "rt_main.h"
Summer Qin596f5552022-01-27 18:04:06 +080012
Kevin Peng43160d52022-02-11 13:35:56 +080013extern void common_sfn_thread(void);
14
Summer Qin596f5552022-01-27 18:04:06 +080015__used static uintptr_t runtime_init_c(void)
16{
Kevin Peng43160d52022-02-11 13:35:56 +080017 struct runtime_metadata_t *p_rt_meta;
18
19 p_rt_meta = PART_METADATA();
20
21 if (p_rt_meta->n_sfn == 0) {
22 /* IPC Partition */
23 return p_rt_meta->entry;
24 } else {
25 /* SFN Partition */
26 return (uintptr_t)common_sfn_thread;
27 }
Summer Qin596f5552022-01-27 18:04:06 +080028}
29
Michel Jaouen87ab5542022-03-14 13:16:14 +010030#if defined(__ICCARM__)
31#pragma required = runtime_init_c
32#endif
33
Summer Qin596f5552022-01-27 18:04:06 +080034__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}