mbed library sources
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_STM32F4/stm32f4xx_hal_flash_ramfunc.c@613:bc40b8d2aec4, 2015-08-20 (annotated)
- Committer:
- mbed_official
- Date:
- Thu Aug 20 10:45:13 2015 +0100
- Revision:
- 613:bc40b8d2aec4
- Parent:
- 532:fe11edbda85c
Synchronized with git revision 92ca8c7b60a283b6bb60eb65b183dac1599f0ade
Full URL: https://github.com/mbedmicro/mbed/commit/92ca8c7b60a283b6bb60eb65b183dac1599f0ade/
Nordic: update application start address in GCC linker script
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 235:685d5f11838f | 1 | /** |
mbed_official | 235:685d5f11838f | 2 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 3 | * @file stm32f4xx_hal_flash_ramfunc.c |
mbed_official | 235:685d5f11838f | 4 | * @author MCD Application Team |
mbed_official | 613:bc40b8d2aec4 | 5 | * @version V1.3.2 |
mbed_official | 613:bc40b8d2aec4 | 6 | * @date 26-June-2015 |
mbed_official | 235:685d5f11838f | 7 | * @brief FLASH RAMFUNC module driver. |
mbed_official | 235:685d5f11838f | 8 | * This file provides a FLASH firmware functions which should be |
mbed_official | 235:685d5f11838f | 9 | * executed from internal SRAM |
mbed_official | 235:685d5f11838f | 10 | * + Stop/Start the flash interface while System Run |
mbed_official | 235:685d5f11838f | 11 | * + Enable/Disable the flash sleep while System Run |
mbed_official | 235:685d5f11838f | 12 | @verbatim |
mbed_official | 235:685d5f11838f | 13 | ============================================================================== |
mbed_official | 235:685d5f11838f | 14 | ##### APIs executed from Internal RAM ##### |
mbed_official | 235:685d5f11838f | 15 | ============================================================================== |
mbed_official | 235:685d5f11838f | 16 | [..] |
mbed_official | 235:685d5f11838f | 17 | *** ARM Compiler *** |
mbed_official | 235:685d5f11838f | 18 | -------------------- |
mbed_official | 235:685d5f11838f | 19 | [..] RAM functions are defined using the toolchain options. |
mbed_official | 235:685d5f11838f | 20 | Functions that are be executed in RAM should reside in a separate |
mbed_official | 235:685d5f11838f | 21 | source module. Using the 'Options for File' dialog you can simply change |
mbed_official | 235:685d5f11838f | 22 | the 'Code / Const' area of a module to a memory space in physical RAM. |
mbed_official | 235:685d5f11838f | 23 | Available memory areas are declared in the 'Target' tab of the |
mbed_official | 235:685d5f11838f | 24 | Options for Target' dialog. |
mbed_official | 235:685d5f11838f | 25 | |
mbed_official | 235:685d5f11838f | 26 | *** ICCARM Compiler *** |
mbed_official | 235:685d5f11838f | 27 | ----------------------- |
mbed_official | 235:685d5f11838f | 28 | [..] RAM functions are defined using a specific toolchain keyword "__ramfunc". |
mbed_official | 235:685d5f11838f | 29 | |
mbed_official | 235:685d5f11838f | 30 | *** GNU Compiler *** |
mbed_official | 235:685d5f11838f | 31 | -------------------- |
mbed_official | 235:685d5f11838f | 32 | [..] RAM functions are defined using a specific toolchain attribute |
mbed_official | 235:685d5f11838f | 33 | "__attribute__((section(".RamFunc")))". |
mbed_official | 235:685d5f11838f | 34 | |
mbed_official | 235:685d5f11838f | 35 | @endverbatim |
mbed_official | 235:685d5f11838f | 36 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 37 | * @attention |
mbed_official | 235:685d5f11838f | 38 | * |
mbed_official | 532:fe11edbda85c | 39 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
mbed_official | 235:685d5f11838f | 40 | * |
mbed_official | 235:685d5f11838f | 41 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 235:685d5f11838f | 42 | * are permitted provided that the following conditions are met: |
mbed_official | 235:685d5f11838f | 43 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 235:685d5f11838f | 44 | * this list of conditions and the following disclaimer. |
mbed_official | 235:685d5f11838f | 45 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 235:685d5f11838f | 46 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 235:685d5f11838f | 47 | * and/or other materials provided with the distribution. |
mbed_official | 235:685d5f11838f | 48 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 235:685d5f11838f | 49 | * may be used to endorse or promote products derived from this software |
mbed_official | 235:685d5f11838f | 50 | * without specific prior written permission. |
mbed_official | 235:685d5f11838f | 51 | * |
mbed_official | 235:685d5f11838f | 52 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 235:685d5f11838f | 53 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 235:685d5f11838f | 54 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 235:685d5f11838f | 55 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 235:685d5f11838f | 56 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 235:685d5f11838f | 57 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 235:685d5f11838f | 58 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 235:685d5f11838f | 59 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 235:685d5f11838f | 60 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 235:685d5f11838f | 61 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 235:685d5f11838f | 62 | * |
mbed_official | 235:685d5f11838f | 63 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 64 | */ |
mbed_official | 235:685d5f11838f | 65 | |
mbed_official | 235:685d5f11838f | 66 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 67 | #include "stm32f4xx_hal.h" |
mbed_official | 235:685d5f11838f | 68 | |
mbed_official | 235:685d5f11838f | 69 | /** @addtogroup STM32F4xx_HAL_Driver |
mbed_official | 235:685d5f11838f | 70 | * @{ |
mbed_official | 235:685d5f11838f | 71 | */ |
mbed_official | 235:685d5f11838f | 72 | |
mbed_official | 532:fe11edbda85c | 73 | /** @defgroup FLASHRAMFUNC FLASH RAMFUNC |
mbed_official | 235:685d5f11838f | 74 | * @brief FLASH functions executed from RAM |
mbed_official | 235:685d5f11838f | 75 | * @{ |
mbed_official | 235:685d5f11838f | 76 | */ |
mbed_official | 235:685d5f11838f | 77 | |
mbed_official | 235:685d5f11838f | 78 | #ifdef HAL_FLASH_MODULE_ENABLED |
mbed_official | 235:685d5f11838f | 79 | |
mbed_official | 532:fe11edbda85c | 80 | #if defined(STM32F411xE) || defined(STM32F446xx) |
mbed_official | 235:685d5f11838f | 81 | |
mbed_official | 235:685d5f11838f | 82 | /* Private typedef -----------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 83 | /* Private define ------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 84 | /* Private macro -------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 85 | /* Private variables ---------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 86 | /* Private function prototypes -----------------------------------------------*/ |
mbed_official | 532:fe11edbda85c | 87 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 532:fe11edbda85c | 88 | /** @defgroup FLASHRAMFUNC_Exported_Functions FLASH RAMFUNC Exported Functions |
mbed_official | 235:685d5f11838f | 89 | * @{ |
mbed_official | 235:685d5f11838f | 90 | */ |
mbed_official | 235:685d5f11838f | 91 | |
mbed_official | 532:fe11edbda85c | 92 | /** @defgroup FLASHRAMFUNC_Exported_Functions_Group1 Peripheral features functions executed from internal RAM |
mbed_official | 235:685d5f11838f | 93 | * @brief Peripheral Extended features functions |
mbed_official | 235:685d5f11838f | 94 | * |
mbed_official | 235:685d5f11838f | 95 | @verbatim |
mbed_official | 235:685d5f11838f | 96 | |
mbed_official | 235:685d5f11838f | 97 | =============================================================================== |
mbed_official | 235:685d5f11838f | 98 | ##### ramfunc functions ##### |
mbed_official | 235:685d5f11838f | 99 | =============================================================================== |
mbed_official | 235:685d5f11838f | 100 | [..] |
mbed_official | 235:685d5f11838f | 101 | This subsection provides a set of functions that should be executed from RAM |
mbed_official | 235:685d5f11838f | 102 | transfers. |
mbed_official | 235:685d5f11838f | 103 | |
mbed_official | 235:685d5f11838f | 104 | @endverbatim |
mbed_official | 235:685d5f11838f | 105 | * @{ |
mbed_official | 235:685d5f11838f | 106 | */ |
mbed_official | 235:685d5f11838f | 107 | |
mbed_official | 235:685d5f11838f | 108 | /** |
mbed_official | 235:685d5f11838f | 109 | * @brief Stop the flash interface while System Run |
mbed_official | 235:685d5f11838f | 110 | * @note This mode is only available for STM32F411xx devices. |
mbed_official | 532:fe11edbda85c | 111 | * @note This mode couldn't be set while executing with the flash itself. |
mbed_official | 235:685d5f11838f | 112 | * It should be done with specific routine executed from RAM. |
mbed_official | 235:685d5f11838f | 113 | * @retval None |
mbed_official | 235:685d5f11838f | 114 | */ |
mbed_official | 235:685d5f11838f | 115 | __RAM_FUNC HAL_FLASHEx_StopFlashInterfaceClk(void) |
mbed_official | 235:685d5f11838f | 116 | { |
mbed_official | 235:685d5f11838f | 117 | /* Enable Power ctrl clock */ |
mbed_official | 532:fe11edbda85c | 118 | __HAL_RCC_PWR_CLK_ENABLE(); |
mbed_official | 235:685d5f11838f | 119 | /* Stop the flash interface while System Run */ |
mbed_official | 235:685d5f11838f | 120 | SET_BIT(PWR->CR, PWR_CR_FISSR); |
mbed_official | 235:685d5f11838f | 121 | |
mbed_official | 235:685d5f11838f | 122 | return HAL_OK; |
mbed_official | 235:685d5f11838f | 123 | } |
mbed_official | 235:685d5f11838f | 124 | |
mbed_official | 235:685d5f11838f | 125 | /** |
mbed_official | 235:685d5f11838f | 126 | * @brief Start the flash interface while System Run |
mbed_official | 235:685d5f11838f | 127 | * @note This mode is only available for STM32F411xx devices. |
mbed_official | 532:fe11edbda85c | 128 | * @note This mode couldn't be set while executing with the flash itself. |
mbed_official | 235:685d5f11838f | 129 | * It should be done with specific routine executed from RAM. |
mbed_official | 235:685d5f11838f | 130 | * @retval None |
mbed_official | 235:685d5f11838f | 131 | */ |
mbed_official | 235:685d5f11838f | 132 | __RAM_FUNC HAL_FLASHEx_StartFlashInterfaceClk(void) |
mbed_official | 235:685d5f11838f | 133 | { |
mbed_official | 235:685d5f11838f | 134 | /* Enable Power ctrl clock */ |
mbed_official | 532:fe11edbda85c | 135 | __HAL_RCC_PWR_CLK_ENABLE(); |
mbed_official | 235:685d5f11838f | 136 | /* Start the flash interface while System Run */ |
mbed_official | 235:685d5f11838f | 137 | CLEAR_BIT(PWR->CR, PWR_CR_FISSR); |
mbed_official | 235:685d5f11838f | 138 | |
mbed_official | 235:685d5f11838f | 139 | return HAL_OK; |
mbed_official | 235:685d5f11838f | 140 | } |
mbed_official | 235:685d5f11838f | 141 | |
mbed_official | 235:685d5f11838f | 142 | /** |
mbed_official | 235:685d5f11838f | 143 | * @brief Enable the flash sleep while System Run |
mbed_official | 235:685d5f11838f | 144 | * @note This mode is only available for STM32F411xx devices. |
mbed_official | 235:685d5f11838f | 145 | * @note This mode could n't be set while executing with the flash itself. |
mbed_official | 235:685d5f11838f | 146 | * It should be done with specific routine executed from RAM. |
mbed_official | 235:685d5f11838f | 147 | * @retval None |
mbed_official | 235:685d5f11838f | 148 | */ |
mbed_official | 235:685d5f11838f | 149 | __RAM_FUNC HAL_FLASHEx_EnableFlashSleepMode(void) |
mbed_official | 235:685d5f11838f | 150 | { |
mbed_official | 235:685d5f11838f | 151 | /* Enable Power ctrl clock */ |
mbed_official | 532:fe11edbda85c | 152 | __HAL_RCC_PWR_CLK_ENABLE(); |
mbed_official | 235:685d5f11838f | 153 | /* Enable the flash sleep while System Run */ |
mbed_official | 235:685d5f11838f | 154 | SET_BIT(PWR->CR, PWR_CR_FMSSR); |
mbed_official | 235:685d5f11838f | 155 | |
mbed_official | 235:685d5f11838f | 156 | return HAL_OK; |
mbed_official | 235:685d5f11838f | 157 | } |
mbed_official | 235:685d5f11838f | 158 | |
mbed_official | 235:685d5f11838f | 159 | /** |
mbed_official | 235:685d5f11838f | 160 | * @brief Disable the flash sleep while System Run |
mbed_official | 235:685d5f11838f | 161 | * @note This mode is only available for STM32F411xx devices. |
mbed_official | 532:fe11edbda85c | 162 | * @note This mode couldn't be set while executing with the flash itself. |
mbed_official | 235:685d5f11838f | 163 | * It should be done with specific routine executed from RAM. |
mbed_official | 235:685d5f11838f | 164 | * @retval None |
mbed_official | 235:685d5f11838f | 165 | */ |
mbed_official | 235:685d5f11838f | 166 | __RAM_FUNC HAL_FLASHEx_DisableFlashSleepMode(void) |
mbed_official | 235:685d5f11838f | 167 | { |
mbed_official | 235:685d5f11838f | 168 | /* Enable Power ctrl clock */ |
mbed_official | 532:fe11edbda85c | 169 | __HAL_RCC_PWR_CLK_ENABLE(); |
mbed_official | 235:685d5f11838f | 170 | /* Disable the flash sleep while System Run */ |
mbed_official | 235:685d5f11838f | 171 | CLEAR_BIT(PWR->CR, PWR_CR_FMSSR); |
mbed_official | 235:685d5f11838f | 172 | |
mbed_official | 235:685d5f11838f | 173 | return HAL_OK; |
mbed_official | 235:685d5f11838f | 174 | } |
mbed_official | 235:685d5f11838f | 175 | |
mbed_official | 235:685d5f11838f | 176 | /** |
mbed_official | 235:685d5f11838f | 177 | * @} |
mbed_official | 235:685d5f11838f | 178 | */ |
mbed_official | 235:685d5f11838f | 179 | |
mbed_official | 235:685d5f11838f | 180 | /** |
mbed_official | 235:685d5f11838f | 181 | * @} |
mbed_official | 235:685d5f11838f | 182 | */ |
mbed_official | 235:685d5f11838f | 183 | |
mbed_official | 532:fe11edbda85c | 184 | #endif /* STM32F411xE || STM32F446xx */ |
mbed_official | 235:685d5f11838f | 185 | #endif /* HAL_FLASH_MODULE_ENABLED */ |
mbed_official | 235:685d5f11838f | 186 | /** |
mbed_official | 235:685d5f11838f | 187 | * @} |
mbed_official | 235:685d5f11838f | 188 | */ |
mbed_official | 235:685d5f11838f | 189 | |
mbed_official | 235:685d5f11838f | 190 | /** |
mbed_official | 235:685d5f11838f | 191 | * @} |
mbed_official | 235:685d5f11838f | 192 | */ |
mbed_official | 235:685d5f11838f | 193 | |
mbed_official | 235:685d5f11838f | 194 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |