• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  * Description:  share memory configurations
15  *
16  * Create:  2021-06-16
17  */
18 
19 #ifndef SHARE_MEM_CONFIG_H
20 #define SHARE_MEM_CONFIG_H
21 
22 #include "td_type.h"
23 
24 /* ROM的data段在初始阶段需要从flash拷贝到ram */
25 extern unsigned int __rom_data_begin__;
26 extern unsigned int __rom_data_load__;
27 extern unsigned int __rom_data_size__;
28 /* ROM的bss段在初始阶段需要清0 */
29 extern unsigned int __rom_bss_begin__;
30 extern unsigned int __rom_bss_end__;
31 
32 /* FlashPatch机制用到的remap table & cmp table; 和ROM2.0机制的跳转表 */
33 extern unsigned int __rom_patch_begin__;
34 extern unsigned int __rom_patch_load__;
35 extern unsigned int __rom_patch_size__;
36 
37 /* TCM的text&rodata&data段在初始阶段需要从flash拷贝到ram */
38 extern unsigned int __tcm_text_begin__;
39 extern unsigned int __tcm_text_end__;
40 extern unsigned int __tcm_text_load__;
41 extern unsigned int __tcm_text_size__;
42 extern unsigned int __tcm_data_begin__;
43 extern unsigned int __tcm_data_load__;
44 extern unsigned int __tcm_data_size__;
45 /* TCM的bss段在初始阶段需要清0 */
46 extern unsigned int __tcm_bss_begin__;
47 extern unsigned int __tcm_bss_end__;
48 
49 /* 放在SRAM运行的代码的text&rodata段在初始阶段需要从flash拷贝到ram */
50 extern unsigned int __sram_text_begin__;
51 extern unsigned int __sram_text_end__;
52 extern unsigned int __sram_text_load__;
53 extern unsigned int __sram_text_size__;
54 
55 /* 除去放在ROM&TCM运行的代码,其他代码的data段,在初始阶段需要从flash拷贝到ram */
56 extern unsigned int __data_begin__;
57 extern unsigned int __data_load__;
58 extern unsigned int __data_size__;
59 
60 /* 除去放在ROM&TCM运行的代码,其他代码的bss段,在初始阶段需要清0 */
61 extern unsigned int __bss_begin__;
62 extern unsigned int __bss_end__;
63 
64 extern unsigned int __text_begin__;
65 extern unsigned int __text_end__;
66 
67 #ifdef CONFIG_MEMORY_CUSTOMIZE_RSV
68 extern unsigned int __mem_rsv_load__;
69 extern unsigned int __mem_rsv_begin__;
70 extern unsigned int __mem_rsv_end__;
71 extern unsigned int __mem_rsv_size__;
72 
mem_rsv_load_addr_get(void)73 static inline uintptr_t mem_rsv_load_addr_get(void)
74 {
75     return (uintptr_t)(&__mem_rsv_load__);
76 }
77 
mem_rsv_start_addr_get(void)78 static inline uintptr_t mem_rsv_start_addr_get(void)
79 {
80     return (uintptr_t)(&__mem_rsv_begin__);
81 }
82 
mem_rsv_size_get(void)83 static inline uintptr_t mem_rsv_size_get(void)
84 {
85     return (uintptr_t)(&__mem_rsv_size__);
86 }
87 #endif // end of CONFIG_MEMORY_CUSTOMIZE_RSV
88 
89 #endif
90