diff --git a/targets/TARGET_STM/TARGET_STM32F7/flash_api.c b/targets/TARGET_STM/TARGET_STM32F7/flash_api.c index 94034fdd86a..e7da2142f4f 100644 --- a/targets/TARGET_STM/TARGET_STM32F7/flash_api.c +++ b/targets/TARGET_STM/TARGET_STM32F7/flash_api.c @@ -188,8 +188,9 @@ uint32_t flash_get_size(const flash_t *obj) static uint32_t GetSector(uint32_t address) { uint32_t sector = 0; - uint32_t tmp = address - ADDR_FLASH_SECTOR_0; + #if (MBED_CONF_TARGET_FLASH_DUAL_BANK) && defined(FLASH_OPTCR_nDBANK) + uint32_t tmp = address - ADDR_FLASH_SECTOR_0; if (address < ADDR_FLASH_SECTOR_4) { // Sectors 0 to 3 sector += tmp >> 14; } else if (address < ADDR_FLASH_SECTOR_5) { // Sector 4 diff --git a/targets/TARGET_STM/TARGET_STM32G4/STM32Cube_FW/STM32G4xx_HAL_Driver/stm32g4xx_hal_hrtim.c b/targets/TARGET_STM/TARGET_STM32G4/STM32Cube_FW/STM32G4xx_HAL_Driver/stm32g4xx_hal_hrtim.c index 19a03051f12..30782b7d5d6 100644 --- a/targets/TARGET_STM/TARGET_STM32G4/STM32Cube_FW/STM32G4xx_HAL_Driver/stm32g4xx_hal_hrtim.c +++ b/targets/TARGET_STM/TARGET_STM32G4/STM32Cube_FW/STM32G4xx_HAL_Driver/stm32g4xx_hal_hrtim.c @@ -1814,13 +1814,13 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleOCStart_DMA(HRTIM_HandleTypeDef * hhrtim, /* Check the parameters */ assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OCChannel)); - if((hhrtim->State == HAL_HRTIM_STATE_BUSY)) + if (hhrtim->State == HAL_HRTIM_STATE_BUSY) { return HAL_BUSY; } - if((hhrtim->State == HAL_HRTIM_STATE_READY)) + if (hhrtim->State == HAL_HRTIM_STATE_READY) { - if((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U)) + if ((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U)) { return HAL_ERROR; } @@ -2458,13 +2458,13 @@ HAL_StatusTypeDef HAL_HRTIM_SimplePWMStart_DMA(HRTIM_HandleTypeDef * hhrtim, /* Check the parameters */ assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, PWMChannel)); - if((hhrtim->State == HAL_HRTIM_STATE_BUSY)) + if (hhrtim->State == HAL_HRTIM_STATE_BUSY) { return HAL_BUSY; } - if((hhrtim->State == HAL_HRTIM_STATE_READY)) + if (hhrtim->State == HAL_HRTIM_STATE_READY) { - if((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U)) + if ((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U)) { return HAL_ERROR; } @@ -6597,7 +6597,7 @@ HAL_StatusTypeDef HAL_HRTIM_WaveformCountStart_DMA(HRTIM_HandleTypeDef * hhrtim, /* Check the parameters */ assert_param(IS_HRTIM_TIMERID(Timers)); - if((hhrtim->State == HAL_HRTIM_STATE_BUSY)) + if (hhrtim->State == HAL_HRTIM_STATE_BUSY) { return HAL_BUSY; } @@ -7159,13 +7159,13 @@ HAL_StatusTypeDef HAL_HRTIM_BurstDMATransfer(HRTIM_HandleTypeDef *hhrtim, /* Check the parameters */ assert_param(IS_HRTIM_TIMERINDEX(TimerIdx)); - if((hhrtim->State == HAL_HRTIM_STATE_BUSY)) + if (hhrtim->State == HAL_HRTIM_STATE_BUSY) { return HAL_BUSY; } - if((hhrtim->State == HAL_HRTIM_STATE_READY)) + if (hhrtim->State == HAL_HRTIM_STATE_READY) { - if((BurstBufferAddress == 0U ) || (BurstBufferLength == 0U)) + if ((BurstBufferAddress == 0U ) || (BurstBufferLength == 0U)) { return HAL_ERROR; } diff --git a/targets/TARGET_STM/TARGET_STM32G4/serial_device.c b/targets/TARGET_STM/TARGET_STM32G4/serial_device.c index 131812e1841..b452c64b13c 100644 --- a/targets/TARGET_STM/TARGET_STM32G4/serial_device.c +++ b/targets/TARGET_STM/TARGET_STM32G4/serial_device.c @@ -641,7 +641,7 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con } if (type == FlowControlRTS) { // Enable RTS - MBED_ASSERT(pinmap->rx_flow_pin != (UARTName)NC); + MBED_ASSERT(pinmap->rx_flow_pin != NC); obj_s->hw_flow_ctl = UART_HWCONTROL_RTS; obj_s->pin_rts = pinmap->rx_flow_pin; // Enable the pin for RTS function @@ -650,7 +650,7 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con } if (type == FlowControlCTS) { // Enable CTS - MBED_ASSERT(pinmap->tx_flow_pin != (UARTName)NC); + MBED_ASSERT(pinmap->tx_flow_pin != NC); obj_s->hw_flow_ctl = UART_HWCONTROL_CTS; obj_s->pin_cts = pinmap->tx_flow_pin; // Enable the pin for CTS function @@ -659,8 +659,8 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con } if (type == FlowControlRTSCTS) { // Enable CTS & RTS - MBED_ASSERT(pinmap->rx_flow_pin != (UARTName)NC); - MBED_ASSERT(pinmap->tx_flow_pin != (UARTName)NC); + MBED_ASSERT(pinmap->rx_flow_pin != NC); + MBED_ASSERT(pinmap->tx_flow_pin != NC); obj_s->hw_flow_ctl = UART_HWCONTROL_RTS_CTS; obj_s->pin_rts = pinmap->rx_flow_pin;; obj_s->pin_cts = pinmap->tx_flow_pin;; diff --git a/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_hrtim.c b/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_hrtim.c index 1d7efa13771..582ebbd4050 100644 --- a/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_hrtim.c +++ b/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_hrtim.c @@ -1618,13 +1618,13 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleOCStart_DMA(HRTIM_HandleTypeDef * hhrtim, /* Check the parameters */ assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OCChannel)); - if((hhrtim->State == HAL_HRTIM_STATE_BUSY)) + if (hhrtim->State == HAL_HRTIM_STATE_BUSY) { return HAL_BUSY; } - if((hhrtim->State == HAL_HRTIM_STATE_READY)) + if (hhrtim->State == HAL_HRTIM_STATE_READY) { - if((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U)) + if ((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U)) { return HAL_ERROR; } @@ -2235,13 +2235,13 @@ HAL_StatusTypeDef HAL_HRTIM_SimplePWMStart_DMA(HRTIM_HandleTypeDef * hhrtim, /* Check the parameters */ assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, PWMChannel)); - if((hhrtim->State == HAL_HRTIM_STATE_BUSY)) + if (hhrtim->State == HAL_HRTIM_STATE_BUSY) { return HAL_BUSY; } - if((hhrtim->State == HAL_HRTIM_STATE_READY)) + if (hhrtim->State == HAL_HRTIM_STATE_READY) { - if((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U)) + if ((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U)) { return HAL_ERROR; } @@ -5329,7 +5329,7 @@ HAL_StatusTypeDef HAL_HRTIM_WaveformCountStart_DMA(HRTIM_HandleTypeDef * hhrtim, /* Check the parameters */ assert_param(IS_HRTIM_TIMERID(Timers)); - if((hhrtim->State == HAL_HRTIM_STATE_BUSY)) + if (hhrtim->State == HAL_HRTIM_STATE_BUSY) { return HAL_BUSY; } @@ -5764,13 +5764,13 @@ HAL_StatusTypeDef HAL_HRTIM_BurstDMATransfer(HRTIM_HandleTypeDef *hhrtim, /* Check the parameters */ assert_param(IS_HRTIM_TIMERINDEX(TimerIdx)); - if((hhrtim->State == HAL_HRTIM_STATE_BUSY)) + if (hhrtim->State == HAL_HRTIM_STATE_BUSY) { return HAL_BUSY; } - if((hhrtim->State == HAL_HRTIM_STATE_READY)) + if (hhrtim->State == HAL_HRTIM_STATE_READY) { - if((BurstBufferAddress == 0U ) || (BurstBufferLength == 0U)) + if ((BurstBufferAddress == 0U ) || (BurstBufferLength == 0U)) { return HAL_ERROR; } diff --git a/targets/TARGET_STM/TARGET_STM32H7/analogin_device.c b/targets/TARGET_STM/TARGET_STM32H7/analogin_device.c index 3fb41a7997d..449b3a3e015 100644 --- a/targets/TARGET_STM/TARGET_STM32H7/analogin_device.c +++ b/targets/TARGET_STM/TARGET_STM32H7/analogin_device.c @@ -60,7 +60,7 @@ void analogin_init(analogin_t *obj, PinName pin) // ADC Internal Channels "pins" (Temperature, Vref, Vbat, ...) // are described in PinNames.h and PeripheralPins.c // Pin value must be between 0xF0 and 0xFF - if ((pin < 0xF0) || (pin >= ALT0)) { + if ((pin < 0xF0) || (pin >= (PinName)ALT0)) { // Normal channels // Get the peripheral name from the pin and assign it to the object obj->handle.Instance = (ADC_TypeDef *)pinmap_peripheral(pin, PinMap_ADC); diff --git a/targets/TARGET_STM/TARGET_STM32L4/STM32Cube_FW/STM32L4xx_HAL_Driver/Legacy/stm32l4xx_hal_can_legacy.c b/targets/TARGET_STM/TARGET_STM32L4/STM32Cube_FW/STM32L4xx_HAL_Driver/Legacy/stm32l4xx_hal_can_legacy.c index 8797ec0c545..9dfe829be3a 100644 --- a/targets/TARGET_STM/TARGET_STM32L4/STM32Cube_FW/STM32L4xx_HAL_Driver/Legacy/stm32l4xx_hal_can_legacy.c +++ b/targets/TARGET_STM/TARGET_STM32L4/STM32Cube_FW/STM32L4xx_HAL_Driver/Legacy/stm32l4xx_hal_can_legacy.c @@ -104,7 +104,8 @@ #error 'The HAL CAN driver cannot be used with its legacy, Please ensure to enable only one HAL CAN module at once in stm32l4xx_hal_conf.h file' #endif /* HAL_CAN_MODULE_ENABLED */ -#warning 'Legacy HAL CAN driver is enabled! It can be used with known limitations, refer to the release notes. However it is recommended to use rather the new HAL CAN driver' +// MBED current implementation +// #warning 'Legacy HAL CAN driver is enabled! It can be used with known limitations, refer to the release notes. However it is recommended to use rather the new HAL CAN driver' #if defined(CAN1) diff --git a/targets/TARGET_STM/TARGET_STM32L5/serial_device.c b/targets/TARGET_STM/TARGET_STM32L5/serial_device.c index 3f8ed5413b1..6a321f48228 100644 --- a/targets/TARGET_STM/TARGET_STM32L5/serial_device.c +++ b/targets/TARGET_STM/TARGET_STM32L5/serial_device.c @@ -654,7 +654,7 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con } if (type == FlowControlRTS) { // Enable RTS - MBED_ASSERT(pinmap->rx_flow_pin != (UARTName)NC); + MBED_ASSERT(pinmap->rx_flow_pin != NC); obj_s->hw_flow_ctl = UART_HWCONTROL_RTS; obj_s->pin_rts = pinmap->rx_flow_pin; // Enable the pin for RTS function @@ -663,7 +663,7 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con } if (type == FlowControlCTS) { // Enable CTS - MBED_ASSERT(pinmap->tx_flow_pin != (UARTName)NC); + MBED_ASSERT(pinmap->tx_flow_pin != NC); obj_s->hw_flow_ctl = UART_HWCONTROL_CTS; obj_s->pin_cts = pinmap->tx_flow_pin; // Enable the pin for CTS function @@ -672,8 +672,8 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con } if (type == FlowControlRTSCTS) { // Enable CTS & RTS - MBED_ASSERT(pinmap->rx_flow_pin != (UARTName)NC); - MBED_ASSERT(pinmap->tx_flow_pin != (UARTName)NC); + MBED_ASSERT(pinmap->rx_flow_pin != NC); + MBED_ASSERT(pinmap->tx_flow_pin != NC); obj_s->hw_flow_ctl = UART_HWCONTROL_RTS_CTS; obj_s->pin_rts = pinmap->rx_flow_pin;; obj_s->pin_cts = pinmap->tx_flow_pin;; diff --git a/targets/TARGET_STM/can_api.c b/targets/TARGET_STM/can_api.c index ad00e39a2b2..a2f34a96df7 100644 --- a/targets/TARGET_STM/can_api.c +++ b/targets/TARGET_STM/can_api.c @@ -142,16 +142,16 @@ static void _can_init_freq_direct(can_t *obj, const can_pinmap_t *pinmap, int hz // We use PLL1.Q clock right now so get its frequency PLL1_ClocksTypeDef pll1_clocks; HAL_RCCEx_GetPLL1ClockFreq(&pll1_clocks); - int ntq = pll1_clocks.PLL1_Q_Frequency / hz; + uint32_t ntq = pll1_clocks.PLL1_Q_Frequency / (uint32_t)hz; #else #if (defined RCC_PERIPHCLK_FDCAN1) - int ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN1) / hz; + uint32_t ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN1) / (uint32_t)hz; #else - int ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN) / hz; + uint32_t ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN) / (uint32_t)hz; #endif #endif - int nominalPrescaler = 1; + uint32_t nominalPrescaler = 1; // !When the sample point should be lower than 50%, this must be changed to // !IS_FDCAN_NOMINAL_TSEG2(ntq/nominalPrescaler), since // NTSEG2 and SJW max values are lower. For now the sample point is fix @75% @@ -322,16 +322,16 @@ int can_frequency(can_t *obj, int f) // STM32H7 doesn't support yet HAL_RCCEx_GetPeriphCLKFreq for FDCAN PLL1_ClocksTypeDef pll1_clocks; HAL_RCCEx_GetPLL1ClockFreq(&pll1_clocks); - int ntq = pll1_clocks.PLL1_Q_Frequency / f; + uint32_t ntq = pll1_clocks.PLL1_Q_Frequency / (uint32_t)f; #else #if (defined RCC_PERIPHCLK_FDCAN1) - int ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN1) / f; + uint32_t ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN1) / (uint32_t)f; #else - int ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN) / f; + uint32_t ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN) / (uint32_t)f; #endif #endif - int nominalPrescaler = 1; + uint32_t nominalPrescaler = 1; // !When the sample point should be lower than 50%, this must be changed to // !IS_FDCAN_DATA_TSEG2(ntq/nominalPrescaler), since // NTSEG2 and SJW max values are lower. For now the sample point is fix @75%