0
|
1 /**
|
|
2 ******************************************************************************
|
|
3 * @file stm32l4xx_hal_flash_ramfunc.c
|
|
4 * @author MCD Application Team
|
|
5 * @version V1.6.0
|
|
6 * @date 28-October-2016
|
|
7 * @brief FLASH RAMFUNC driver.
|
|
8 * This file provides a Flash firmware functions which should be
|
|
9 * executed from internal SRAM
|
|
10 * + FLASH HalfPage Programming
|
|
11 * + FLASH Power Down in Run mode
|
|
12 *
|
|
13 * @verbatim
|
|
14 ==============================================================================
|
|
15 ##### Flash RAM functions #####
|
|
16 ==============================================================================
|
|
17
|
|
18 *** ARM Compiler ***
|
|
19 --------------------
|
|
20 [..] RAM functions are defined using the toolchain options.
|
|
21 Functions that are executed in RAM should reside in a separate
|
|
22 source module. Using the 'Options for File' dialog you can simply change
|
|
23 the 'Code / Const' area of a module to a memory space in physical RAM.
|
|
24 Available memory areas are declared in the 'Target' tab of the
|
|
25 Options for Target' dialog.
|
|
26
|
|
27 *** ICCARM Compiler ***
|
|
28 -----------------------
|
|
29 [..] RAM functions are defined using a specific toolchain keyword "__ramfunc".
|
|
30
|
|
31 *** GNU Compiler ***
|
|
32 --------------------
|
|
33 [..] RAM functions are defined using a specific toolchain attribute
|
|
34 "__attribute__((section(".RamFunc")))".
|
|
35
|
|
36 @endverbatim
|
|
37 ******************************************************************************
|
|
38 * @attention
|
|
39 *
|
|
40 * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
|
41 *
|
|
42 * Redistribution and use in source and binary forms, with or without modification,
|
|
43 * are permitted provided that the following conditions are met:
|
|
44 * 1. Redistributions of source code must retain the above copyright notice,
|
|
45 * this list of conditions and the following disclaimer.
|
|
46 * 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
47 * this list of conditions and the following disclaimer in the documentation
|
|
48 * and/or other materials provided with the distribution.
|
|
49 * 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
50 * may be used to endorse or promote products derived from this software
|
|
51 * without specific prior written permission.
|
|
52 *
|
|
53 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
54 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
55 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
56 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
57 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
58 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
59 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
60 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
61 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
62 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
63 *
|
|
64 ******************************************************************************
|
|
65 */
|
|
66
|
|
67 /* Includes ------------------------------------------------------------------*/
|
|
68 #include "stm32l4xx_hal.h"
|
|
69
|
|
70 /** @addtogroup STM32L4xx_HAL_Driver
|
|
71 * @{
|
|
72 */
|
|
73
|
|
74 /** @defgroup FLASH_RAMFUNC FLASH_RAMFUNC
|
|
75 * @brief FLASH functions executed from RAM
|
|
76 * @{
|
|
77 */
|
|
78
|
|
79 #ifdef HAL_FLASH_MODULE_ENABLED
|
|
80
|
|
81 /* Private typedef -----------------------------------------------------------*/
|
|
82 /* Private define ------------------------------------------------------------*/
|
|
83 /* Private macro -------------------------------------------------------------*/
|
|
84 /* Private variables ---------------------------------------------------------*/
|
|
85 extern FLASH_ProcessTypeDef pFlash;
|
|
86
|
|
87 /* Private function prototypes -----------------------------------------------*/
|
|
88 /* Exported functions -------------------------------------------------------*/
|
|
89
|
|
90 /** @defgroup FLASH_RAMFUNC_Exported_Functions FLASH in RAM function Exported Functions
|
|
91 * @{
|
|
92 */
|
|
93
|
|
94 /** @defgroup FLASH_RAMFUNC_Exported_Functions_Group1 Peripheral features functions
|
|
95 * @brief Data transfers functions
|
|
96 *
|
|
97 @verbatim
|
|
98 ===============================================================================
|
|
99 ##### ramfunc functions #####
|
|
100 ===============================================================================
|
|
101 [..]
|
|
102 This subsection provides a set of functions that should be executed from RAM.
|
|
103
|
|
104 @endverbatim
|
|
105 * @{
|
|
106 */
|
|
107
|
|
108 /**
|
|
109 * @brief Enable the Power down in Run Mode
|
|
110 * @note This function should be called and executed from SRAM memory
|
|
111 * @retval None
|
|
112 */
|
|
113 __RAM_FUNC HAL_FLASHEx_EnableRunPowerDown(void)
|
|
114 {
|
|
115 /* Enable the Power Down in Run mode*/
|
|
116 __HAL_FLASH_POWER_DOWN_ENABLE();
|
|
117
|
|
118 return HAL_OK;
|
|
119
|
|
120 }
|
|
121
|
|
122 /**
|
|
123 * @brief Disable the Power down in Run Mode
|
|
124 * @note This function should be called and executed from SRAM memory
|
|
125 * @retval None
|
|
126 */
|
|
127 __RAM_FUNC HAL_FLASHEx_DisableRunPowerDown(void)
|
|
128 {
|
|
129 /* Disable the Power Down in Run mode*/
|
|
130 __HAL_FLASH_POWER_DOWN_DISABLE();
|
|
131
|
|
132 return HAL_OK;
|
|
133 }
|
|
134
|
|
135 /**
|
|
136 * @}
|
|
137 */
|
|
138
|
|
139 /**
|
|
140 * @}
|
|
141 */
|
|
142 #endif /* HAL_FLASH_MODULE_ENABLED */
|
|
143
|
|
144
|
|
145
|
|
146 /**
|
|
147 * @}
|
|
148 */
|
|
149
|
|
150 /**
|
|
151 * @}
|
|
152 */
|
|
153
|
|
154
|
|
155 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
156
|
|
157
|