1 /***********************************************************************************************//**
2  * \file cy_wifi_fw_section.h
3  *
4  * \brief
5  * Determines the start and end of the region the WiFi firmware is stored in.
6  *
7  ***************************************************************************************************
8  * \copyright
9  * Copyright 2020-2022 Cypress Semiconductor Corporation (an Infineon company) or
10  * an affiliate of Cypress Semiconductor Corporation
11  *
12  * SPDX-License-Identifier: Apache-2.0
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License");
15  * you may not use this file except in compliance with the License.
16  * You may obtain a copy of the License at
17  *
18  *     http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an "AS IS" BASIS,
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  **************************************************************************************************/
26 
27 #pragma once
28 
29 #if defined(CY_STORAGE_WIFI_DATA_OUTPUT)
30 
31 #include "cy_utils.h"
32 
33 #if defined(__ARMCC_VERSION)
34 
35 #define CY_SECTION_BASE_SYMBOL_BASE(SECTION) Image$$ ## SECTION ## $$Base
36 #define CY_SECTION_BASE_SYMBOL(SECTION) CY_SECTION_BASE_SYMBOL_BASE(SECTION)
37 extern char CY_SECTION_BASE_SYMBOL(CY_STORAGE_WIFI_DATA_OUTPUT);
38 #define CY_WIFI_FW_SECTION_START (&CY_SECTION_BASE_SYMBOL(CY_STORAGE_WIFI_DATA_OUTPUT))
39 
40 #define CY_SECTION_LIMIT_SYMBOL_BASE(SECTION) Image$$ ## SECTION ## $$Limit
41 #define CY_SECTION_LIMIT_SYMBOL(SECTION) CY_SECTION_LIMIT_SYMBOL_BASE(SECTION)
42 extern char CY_SECTION_LIMIT_SYMBOL(CY_STORAGE_WIFI_DATA_OUTPUT);
43 #define CY_WIFI_FW_SECTION_END (&CY_SECTION_LIMIT_SYMBOL(CY_STORAGE_WIFI_DATA_OUTPUT))
44 
45 #elif defined(__GNUC__)
46 
47 // Must define __<Output Section Name>_start and __<Output Section Name>_end in the linker script
48 
49 #define CY_SECTION_START_SYMBOL_BASE(SECTION) __ ## SECTION ## _start
50 #define CY_SECTION_START_SYMBOL(SECTION) CY_SECTION_START_SYMBOL_BASE(SECTION)
51 extern char CY_SECTION_START_SYMBOL(CY_STORAGE_WIFI_DATA_OUTPUT);
52 #define CY_WIFI_FW_SECTION_START (&CY_SECTION_START_SYMBOL(CY_STORAGE_WIFI_DATA_OUTPUT))
53 
54 #define CY_SECTION_END_SYMBOL_BASE(SECTION) __ ## SECTION ## _end
55 #define CY_SECTION_END_SYMBOL(SECTION) CY_SECTION_END_SYMBOL_BASE(SECTION)
56 extern char CY_SECTION_END_SYMBOL(CY_STORAGE_WIFI_DATA_OUTPUT);
57 #define CY_WIFI_FW_SECTION_END (&CY_SECTION_END_SYMBOL(CY_STORAGE_WIFI_DATA_OUTPUT))
58 
59 #elif defined(__ICCARM__)
60 
61 #define CY_DECLARE_SECTION_BASE(SECTION) CY_PRAGMA(section = #SECTION)
62 #define CY_DECLARE_SECTION(SECTION) CY_DECLARE_SECTION_BASE(SECTION)
63 CY_DECLARE_SECTION(CY_STORAGE_WIFI_DATA_OUTPUT)
64 
65 #define CY_SECTION_BEGIN_SYMBOL_BASE(SECTION) __section_begin(#SECTION)
66 #define CY_SECTION_BEGIN_SYMBOL(SECTION) CY_SECTION_BEGIN_SYMBOL_BASE(SECTION)
67 #define CY_WIFI_FW_SECTION_START (CY_SECTION_BEGIN_SYMBOL(CY_STORAGE_WIFI_DATA_OUTPUT))
68 
69 #define CY_SECTION_END_SYMBOL_BASE(SECTION) __section_end(#SECTION)
70 #define CY_SECTION_END_SYMBOL(SECTION) CY_SECTION_END_SYMBOL_BASE(SECTION)
71 #define CY_WIFI_FW_SECTION_END (CY_SECTION_END_SYMBOL(CY_STORAGE_WIFI_DATA_OUTPUT))
72 
73 #else // if defined(__ARMCC_VERSION)
74 #error "An unsupported toolchain"
75 #endif // defined(__ARMCC_VERSION)
76 
77 #endif // defined(CY_STORAGE_WIFI_DATA_OUTPUT)
78