You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

156 lines
5.3 KiB

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