sarmfsw: SMFSW Toolbox (for ARM & compatible with Arduino platform) 3.7
SMFSW collection of miscellaneous functions & macros (for ARM & compatible with Arduino platform)
Loading...
Searching...
No Matches
arm_chip_stm32.h File Reference

ARM common macros for STM32. More...

#include "main.h"
#include <ARM_CMSIS_INC>
Include dependency graph for arm_chip_stm32.h:

Macros

#define STM_HEADER(f)   XCAT(<stm32, XCAT(f, xx.h>))
 concatenate <stm32(f)xx.h> name following stm family f
 
#define STM_CONF_HEADER(f)   XCAT(<stm32, XCAT(f, xx_hal.h>))
 concatenate <stm32(f)xx_hal.h> name following stm family f
 
#define ARM_CMSIS_INC   STM_HEADER(STM_FAMILY)
 Alias for STM32 CMSIS include.
 
#define ARM_HAL_CFG   STM_CONF_HEADER(STM_FAMILY)
 Alias for STM32 HAL config include.
 
#define stm_port(mnem)   XCAT(mnem, _GPIO_Port)
 Wrapper for PORT Alias.
 
#define stm_pin(mnem)   XCAT(mnem, _Pin)
 Wrapper for PIN Alias.
 
#define GPIO(mnem)   stm_port(mnem), stm_pin(mnem)
 Wrapper for PORT/PIN Alias (when using HAL_GPIO_ReadPin for example)
 
#define stm_timer(mnem)   XCAT(mnem, _Tim)
 
#define stm_channel(mnem)   XCAT(mnem, _Chan)
 
#define TIM(mnem)   stm_timer(mnem), stm_channel(mnem)
 Wrapper for mnem TIM/CHAN Alias (when using HAL_TIM_PWM_Start for example)
 
#define STM32_OPTION_BYTES   (VAL_AT(OB_BASE, uint64_t))
 Option Bytes register address content.
 
#define STM32_FLASHSIZE   (VAL_AT(FLASHSIZE_BASE, uint16_t))
 Flash size register address content.
 
#define STM32_UNIQUE_ID   (VAL_AT(FLASHSIZE_UID, uint32_t))
 Unique ID register address content.
 
#define FLASH_SIZE   (STM32_FLASHSIZE * 1024)
 Flash size in bytes.
 
#define HAL_MAX_TICKS   ((uint32_t) -1)
 HAL max Ticks value.
 
#define HAL_MS_TICKS_FACTOR   1
 HAL milliseconds multiplier (depending tick counter frequency)
 
#define HAL_ResetSource()   Get_Reset_Source()
 Get STM32 Reset Source.
 

Typedefs

typedef enum eResetSource eResetSource
 

Enumerations

enum  eResetSource {
  RST_POR = 1 , RST_BOR , RST_PIN , RST_SW ,
  RST_IWDG , RST_WWDG , RST_LPWR , RST_OBL ,
  RST_V18PWR , RST_FW , RST_UNKNOWN = 0xFF
}
 Source of last reset. More...
 

Detailed Description

ARM common macros for STM32.

Author
SMFSW
Warning
Do not use macros for function qualifiers in this file

Macro Definition Documentation

◆ ARM_CMSIS_INC

#define ARM_CMSIS_INC   STM_HEADER(STM_FAMILY)

Alias for STM32 CMSIS include.

◆ ARM_HAL_CFG

#define ARM_HAL_CFG   STM_CONF_HEADER(STM_FAMILY)

Alias for STM32 HAL config include.

◆ FLASH_SIZE

#define FLASH_SIZE   (STM32_FLASHSIZE * 1024)

Flash size in bytes.

Note
FLASHSIZE_BASE is uint16_t type (given in kB)

◆ GPIO

#define GPIO ( mnem)    stm_port(mnem), stm_pin(mnem)

Wrapper for PORT/PIN Alias (when using HAL_GPIO_ReadPin for example)

◆ HAL_MAX_TICKS

#define HAL_MAX_TICKS   ((uint32_t) -1)

HAL max Ticks value.

Note
Define HAL_MAX_TICKS with custom max value in project if tick max value is not using 32b variable full scale

◆ HAL_MS_TICKS_FACTOR

#define HAL_MS_TICKS_FACTOR   1

HAL milliseconds multiplier (depending tick counter frequency)

Note
Define HAL_MS_TICKS_FACTOR with custom multiplier in project if tick period is not 1ms

◆ HAL_ResetSource

#define HAL_ResetSource ( void)    Get_Reset_Source()

Get STM32 Reset Source.

Warning
This function should be called soon after reset (before or after SystemClock_Config())
Note
This function using some special macros can't be inlined, thus can't be in sarmfsw stm32 header unfortunately
Returns
Last reset source Alias for HARMcksL Get_Reset_Source function

◆ STM32_FLASHSIZE

#define STM32_FLASHSIZE   (VAL_AT(FLASHSIZE_BASE, uint16_t))

Flash size register address content.

◆ STM32_OPTION_BYTES

#define STM32_OPTION_BYTES   (VAL_AT(OB_BASE, uint64_t))

Option Bytes register address content.

◆ STM32_UNIQUE_ID

#define STM32_UNIQUE_ID   (VAL_AT(FLASHSIZE_UID, uint32_t))

Unique ID register address content.

◆ stm_channel

#define stm_channel ( mnem)    XCAT(mnem, _Chan)
Note
Shall define mnemonic mnem name corresponding to TIMER instance defined in CubeMX (for consistency with STM32 HAL) Wrapper for mnem TIM Channel Alias

◆ STM_CONF_HEADER

#define STM_CONF_HEADER ( f)    XCAT(<stm32, XCAT(f, xx_hal.h>))

concatenate <stm32(f)xx_hal.h> name following stm family f

◆ STM_HEADER

#define STM_HEADER ( f)    XCAT(<stm32, XCAT(f, xx.h>))

concatenate <stm32(f)xx.h> name following stm family f

◆ stm_pin

#define stm_pin ( mnem)    XCAT(mnem, _Pin)

Wrapper for PIN Alias.

◆ stm_port

#define stm_port ( mnem)    XCAT(mnem, _GPIO_Port)

Wrapper for PORT Alias.

◆ stm_timer

#define stm_timer ( mnem)    XCAT(mnem, _Tim)
Note
Shall define mnemonic mnem name corresponding to TIMER instance defined in CubeMX (for consistency with STM32 HAL) Wrapper for mnem TIM Alias

◆ TIM

#define TIM ( mnem)    stm_timer(mnem), stm_channel(mnem)

Wrapper for mnem TIM/CHAN Alias (when using HAL_TIM_PWM_Start for example)

Note
Shall define mnemonic mnem name corresponding to TIMER instance defined in CubeMX (for consistency with STM32 HAL)

Typedef Documentation

◆ eResetSource

typedef enum eResetSource eResetSource

Enumeration Type Documentation

◆ eResetSource

Source of last reset.

Enumerator
RST_POR 

Power On Reset.

RST_BOR 

Brown Out Reset (H7)

RST_PIN 

Pin Reset (External Reset)

RST_SW 

Software Reset.

RST_IWDG 

Independent Watchdog Reset.

RST_WWDG 

Window Watchdog Reset.

RST_LPWR 

Low Power Reset.

RST_OBL 

Option Byte Load Reset.

RST_V18PWR 

1.8V Domain Power Reset (F3)

RST_FW 

Firewall Reset (L4)

RST_UNKNOWN 

Unknown Reset Source.