Home > other >  STM32 HAL library 2.13 HAL_MPU_Disable repeated definition problem ()
STM32 HAL library 2.13 HAL_MPU_Disable repeated definition problem ()

Time:12-05

The problem is why libraries will write? Forget to change after adding is. C file. H file?

Compile error prompt stm32f7xx_hal_cortex. C (258) : error: # 247: the function of "HAL_MPU_Disable" has already had been defined


Stm32f7xx_hal_cortex. H:
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
# if (__MPU_PRESENT==1)

/* *
* @ brief, Disables the MPU
* @ retval None
*/
__STATIC_INLINE void HAL_MPU_Disable (void)
{
/* Disable fault exceptions */
SCB - & gt; SHCSR & amp;=~ SCB_SHCSR_MEMFAULTENA_Msk;

/* Disable the MPU */
MPU - & gt; CTRL & amp;=~ MPU_CTRL_ENABLE_Msk;
}

/* *
* @ brief, Enables the MPU
* @ param MPU_Control: Specifies the control mode of the MPU during hard fault,
* NMI FAULTMASK and ring access to the default memory
* This parameter can be one of the following values:
* @ arg MPU_HFNMI_PRIVDEF_NONE
* @ arg MPU_HARDFAULT_NMI
* @ arg MPU_PRIVILEGED_DEFAULT
* @ arg MPU_HFNMI_PRIVDEF
* @ retval None
*/
__STATIC_INLINE void HAL_MPU_Enable (uint32_t MPU_Control)
{
/* the Enable the MPU */
MPU - & gt; CTRL=MPU_Control | MPU_CTRL_ENABLE_Msk;

/* the Enable fault exceptions */
SCB - & gt; SHCSR |=SCB_SHCSR_MEMFAULTENA_Msk;
}

# endif __MPU_PRESENT/* */
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Stm32f7xx_hal_cortex. C:
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
# if (__MPU_PRESENT==1)
/* *
* @ brief, Disables the MPU
* @ retval None
*/
Void HAL_MPU_Disable (void)
{
/* Make sure outstanding transfers are done */
__DMB ();

/* Disable fault exceptions */
SCB - & gt; SHCSR & amp;=~ SCB_SHCSR_MEMFAULTENA_Msk;

/* Disable the MPU and clear the control register */
MPU - & gt; CTRL=0;
}

/* *
* @ brief, Enables the MPU
* @ param MPU_Control Specifies the control mode of the MPU during hard fault,
* NMI FAULTMASK and ring access to the default memory
* This parameter can be one of the following values:
* @ arg MPU_HFNMI_PRIVDEF_NONE
* @ arg MPU_HARDFAULT_NMI
* @ arg MPU_PRIVILEGED_DEFAULT
* @ arg MPU_HFNMI_PRIVDEF
* @ retval None
*/
Void HAL_MPU_Enable (uint32_t MPU_Control)
{
/* the Enable the MPU */
MPU - & gt; CTRL=MPU_Control | MPU_CTRL_ENABLE_Msk;

/* the Enable fault exceptions */
SCB - & gt; SHCSR |=SCB_SHCSR_MEMFAULTENA_Msk;

/* Ensure MPU setting take effects */
__DSB ();
__ISB ();
}
----------------------------------------------

CodePudding user response:

The bug? STM team forgot to test? Or C and. H is not form a complete set?
  • Related