更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
los_builddef.h
浏览该文件的文档.
1/*
2 * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
3 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 * of conditions and the following disclaimer in the documentation and/or other materials
13 * provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
16 * to endorse or promote products derived from this software without specific prior written
17 * permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _LOS_BUILDEF_H
33#define _LOS_BUILDEF_H
34
35#ifdef __cplusplus
36#if __cplusplus
37extern "C" {
38#endif /* __cplusplus */
39#endif /* __cplusplus */
40
41#define OS_LITTLE_ENDIAN 0x1234 /* Little endian */
42#define OS_BIG_ENDIAN 0x4321 /* Big endian */
43
44#ifndef OS_BYTE_ORDER
45#define OS_BYTE_ORDER OS_LITTLE_ENDIAN
46#endif
47
48//通过关键字"__attribute__((section(".init_array")))"指定链接器将函数的地址放置到段".init_array"中
49
50/* Define OS code data sections */
51/* The indicator function is inline */
52#ifndef LITE_OS_SEC_ALW_INLINE
53#define LITE_OS_SEC_ALW_INLINE /* __attribute__((always_inline)) *///强制内联,所有加了__attribute__((always_inline))的函数再被调用时
54#endif //不会被编译成函数调用而是直接扩展到调用函数体内
55
56#ifndef LITE_OS_SEC_TEXT
57#define LITE_OS_SEC_TEXT /* __attribute__((section(".text.sram"))) */
58#endif
59
60#ifndef LITE_OS_SEC_TEXT_MINOR
61#define LITE_OS_SEC_TEXT_MINOR /* __attribute__((section(".text.ddr"))) */
62#endif
63
64#ifndef LITE_OS_SEC_TEXT_INIT
65#define LITE_OS_SEC_TEXT_INIT /* __attribute__((section(".text.init"))) */
66#endif
67
68#ifndef LITE_OS_SEC_DATA
69#define LITE_OS_SEC_DATA /* __attribute__((section(".data.sram"))) */
70#endif
71
72#ifndef LITE_OS_SEC_DATA_MINOR
73#define LITE_OS_SEC_DATA_MINOR /* __attribute__((section(".data.ddr"))) */
74#endif
75
76#ifndef LITE_OS_SEC_DATA_INIT
77#define LITE_OS_SEC_DATA_INIT /* __attribute__((section(".data.init"))) */
78#endif
79
80#ifndef LITE_OS_SEC_BSS
81#define LITE_OS_SEC_BSS /* __attribute__((section(".bss.sram"))) */
82#endif
83
84#ifndef LITE_OS_SEC_BSS_MINOR
85#define LITE_OS_SEC_BSS_MINOR /* __attribute__((section(".bss.ddr"))) */
86#endif
87
88#ifndef LITE_OS_SEC_BSS_INIT
89#define LITE_OS_SEC_BSS_INIT /* __attribute__((section(".bss.init"))) */
90#endif
91
92#ifndef LITE_OS_SEC_ITCM
93#define LITE_OS_SEC_ITCM /* __attribute__((section(".itcm "))) */
94#endif
95#ifndef LITE_OS_SEC_DTCM
96#define LITE_OS_SEC_DTCM /* __attribute__((section(".dtcm"))) */
97#endif
98
99#ifdef __cplusplus
100#if __cplusplus
101}
102#endif /* __cplusplus */
103#endif /* __cplusplus */
104
105#endif /* _LOS_BUILDEF_H */