startup.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
3  * Copyright 2016-2017 NXP
4  * All rights reserved.
5  *
6  * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
7  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
8  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
9  * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
10  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
12  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
13  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
14  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
15  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
16  * THE POSSIBILITY OF SUCH DAMAGE.
17  */
18 
19 #ifndef STARTUP_H
20 #define STARTUP_H
21 #include <stdint.h>
31 /*******************************************************************************
32  * API
33  ******************************************************************************/
34 
38 #if (defined(CPU_S32K148) || defined(CPU_S32K146) || defined(CPU_S32K144HFT0VLLT) || defined(CPU_S32K144LFT0MLLT) || defined(CPU_S32K142) || defined(CPU_S32K116) || defined(CPU_S32K118))
39  #if (defined(__ICCARM__))
40  #define INTERRUPTS_SECTION_START __section_begin(".intvec")
41  #define INTERRUPTS_SECTION_END __section_end(".intvec")
42  #define BSS_SECTION_START __section_begin(".bss")
43  #define BSS_SECTION_END __section_end(".bss")
44  #define DATA_SECTION_START __section_begin(".data")
45  #define DATA_SECTION_END __section_end(".data")
46  #define CUSTOMSECTION_SECTION_START __section_begin(".customSection")
47  #define CUSTOMSECTION_SECTION_END __section_end(".customSection")
48  #define CODE_RAM_SECTION_START __section_begin("__CODE_RAM")
49  #define CODE_RAM_SECTION_END __section_end("__CODE_RAM")
50  #define DATA_INIT_SECTION_START __section_begin(".data_init")
51  #define DATA_INIT_SECTION_END __section_end(".data_init")
52  #define CODE_ROM_SECTION_START __section_begin("__CODE_ROM")
53  #define CODE_ROM_SECTION_END __section_end("__CODE_ROM")
54 
55  #elif (defined(__ARMCC_VERSION))
56  #define INTERRUPTS_SECTION_START (uint8_t *)__VECTOR_ROM_START
57  #define INTERRUPTS_SECTION_END (uint8_t *)__VECTOR_ROM_END
58  #define BSS_SECTION_START (uint8_t *)__BSS_START
59  #define BSS_SECTION_END (uint8_t *)__BSS_END
60  #define DATA_SECTION_START (uint8_t *)__DATA_RAM_START
61  #define DATA_SECTION_END (uint8_t *)__DATA_RAM_END
62  #define CUSTOMSECTION_SECTION_START (uint8_t *)__CUSTOM_SECTION_START
63  #define CUSTOMSECTION_SECTION_END (uint8_t *)__CUSTOM_SECTION_END
64  #define CODE_RAM_SECTION_START (uint8_t *)__CODE_RAM_START
65  #define CODE_RAM_SECTION_END (uint8_t *)__CODE_RAM_END
66 
67  extern uint32_t __VECTOR_ROM_START
68  extern uint32_t __VECTOR_ROM_END
69  extern uint32_t __BSS_START
70  extern uint32_t __BSS_END
71  extern uint32_t __DATA_RAM_START
72  extern uint32_t __DATA_RAM_END
73  extern uint32_t __CUSTOM_SECTION_START
74  extern uint32_t __CUSTOM_SECTION_END
75  extern uint32_t __CODE_RAM_START
76  extern uint32_t __CODE_RAM_END
77  #else
78  #define INTERRUPTS_SECTION_START (uint8_t *)&__interrupts_start__
79  #define INTERRUPTS_SECTION_END (uint8_t *)&__interrupts_end__
80  #define BSS_SECTION_START (uint8_t *)&__bss_start__
81  #define BSS_SECTION_END (uint8_t *)&__bss_end__
82  #define DATA_SECTION_START (uint8_t *)&__data_start__
83  #define DATA_SECTION_END (uint8_t *)&__data_end__
84  #define CUSTOMSECTION_SECTION_START (uint8_t *)&__customSection_start__
85  #define CUSTOMSECTION_SECTION_END (uint8_t *)&__customSection_end__
86  #define CODE_RAM_SECTION_START (uint8_t *)&__code_ram_start__
87  #define CODE_RAM_SECTION_END (uint8_t *)&__code_ram_end__
88 
89  extern uint32_t __interrupts_start__;
90  extern uint32_t __interrupts_end__;
91  extern uint32_t __bss_start__;
92  extern uint32_t __bss_end__;
93  extern uint32_t __data_start__;
94  extern uint32_t __data_end__;
95  extern uint32_t __customSection_start__;
96  extern uint32_t __customSection_end__;
97  extern uint32_t __code_ram_start__;
98  extern uint32_t __code_ram_end__;
99  #endif
100 #endif
101 
102 #if (defined(__ICCARM__))
103  #pragma section = ".data"
104  #pragma section = ".data_init"
105  #pragma section = ".bss"
106  #pragma section = ".intvec"
107  #pragma section = ".customSection"
108  #pragma section = "__CODE_RAM"
109  #pragma section = "__CODE_ROM"
110 #endif
111 
119 void init_data_bss(void);
120 
121 #endif /* STARTUP_H*/
122 /*******************************************************************************
123  * EOF
124  ******************************************************************************/
125 
uint32_t __interrupts_end__
uint32_t __bss_start__
uint32_t __data_start__
void init_data_bss(void)
Make necessary initializations for RAM.
Definition: startup.c:92
uint32_t __interrupts_start__
uint32_t __code_ram_end__
uint32_t __data_end__
uint32_t __customSection_end__
uint32_t __code_ram_start__
uint32_t __customSection_start__
uint32_t __bss_end__