1pub fn get_num_app() -> usize {
5 unsafe extern "C" {
6 safe fn _num_app();
7 }
8 unsafe { (linker_symbol_addr!(_num_app) as *const usize).read_volatile() }
9}
10
11pub fn get_app_data(app_id: usize) -> &'static [u8] {
13 unsafe extern "C" {
14 safe fn _num_app();
15 }
16 let num_app_ptr = linker_symbol_addr!(_num_app) as *const usize;
17 let num_app = get_num_app();
18 let app_start = unsafe { core::slice::from_raw_parts(num_app_ptr.add(1), num_app + 1) };
19 assert!(app_id < num_app);
20 unsafe {
21 core::slice::from_raw_parts(
22 app_start[app_id] as *const u8,
23 app_start[app_id + 1] - app_start[app_id],
24 )
25 }
26}