Skip to content

Commit 35050f0

Browse files
authored
Merge pull request #15193 from jeromecoutant/PR_WARNING
STM32 : remove several warnings
2 parents ff061e8 + de3f9ef commit 35050f0

File tree

8 files changed

+41
-39
lines changed

8 files changed

+41
-39
lines changed

targets/TARGET_STM/TARGET_STM32F7/flash_api.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,9 @@ uint32_t flash_get_size(const flash_t *obj)
188188
static uint32_t GetSector(uint32_t address)
189189
{
190190
uint32_t sector = 0;
191-
uint32_t tmp = address - ADDR_FLASH_SECTOR_0;
191+
192192
#if (MBED_CONF_TARGET_FLASH_DUAL_BANK) && defined(FLASH_OPTCR_nDBANK)
193+
uint32_t tmp = address - ADDR_FLASH_SECTOR_0;
193194
if (address < ADDR_FLASH_SECTOR_4) { // Sectors 0 to 3
194195
sector += tmp >> 14;
195196
} else if (address < ADDR_FLASH_SECTOR_5) { // Sector 4

targets/TARGET_STM/TARGET_STM32G4/STM32Cube_FW/STM32G4xx_HAL_Driver/stm32g4xx_hal_hrtim.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,13 +1814,13 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleOCStart_DMA(HRTIM_HandleTypeDef * hhrtim,
18141814
/* Check the parameters */
18151815
assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OCChannel));
18161816

1817-
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
1817+
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
18181818
{
18191819
return HAL_BUSY;
18201820
}
1821-
if((hhrtim->State == HAL_HRTIM_STATE_READY))
1821+
if (hhrtim->State == HAL_HRTIM_STATE_READY)
18221822
{
1823-
if((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
1823+
if ((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
18241824
{
18251825
return HAL_ERROR;
18261826
}
@@ -2458,13 +2458,13 @@ HAL_StatusTypeDef HAL_HRTIM_SimplePWMStart_DMA(HRTIM_HandleTypeDef * hhrtim,
24582458
/* Check the parameters */
24592459
assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, PWMChannel));
24602460

2461-
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
2461+
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
24622462
{
24632463
return HAL_BUSY;
24642464
}
2465-
if((hhrtim->State == HAL_HRTIM_STATE_READY))
2465+
if (hhrtim->State == HAL_HRTIM_STATE_READY)
24662466
{
2467-
if((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
2467+
if ((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
24682468
{
24692469
return HAL_ERROR;
24702470
}
@@ -6597,7 +6597,7 @@ HAL_StatusTypeDef HAL_HRTIM_WaveformCountStart_DMA(HRTIM_HandleTypeDef * hhrtim,
65976597
/* Check the parameters */
65986598
assert_param(IS_HRTIM_TIMERID(Timers));
65996599

6600-
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
6600+
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
66016601
{
66026602
return HAL_BUSY;
66036603
}
@@ -7159,13 +7159,13 @@ HAL_StatusTypeDef HAL_HRTIM_BurstDMATransfer(HRTIM_HandleTypeDef *hhrtim,
71597159
/* Check the parameters */
71607160
assert_param(IS_HRTIM_TIMERINDEX(TimerIdx));
71617161

7162-
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
7162+
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
71637163
{
71647164
return HAL_BUSY;
71657165
}
7166-
if((hhrtim->State == HAL_HRTIM_STATE_READY))
7166+
if (hhrtim->State == HAL_HRTIM_STATE_READY)
71677167
{
7168-
if((BurstBufferAddress == 0U ) || (BurstBufferLength == 0U))
7168+
if ((BurstBufferAddress == 0U ) || (BurstBufferLength == 0U))
71697169
{
71707170
return HAL_ERROR;
71717171
}

targets/TARGET_STM/TARGET_STM32G4/serial_device.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con
641641
}
642642
if (type == FlowControlRTS) {
643643
// Enable RTS
644-
MBED_ASSERT(pinmap->rx_flow_pin != (UARTName)NC);
644+
MBED_ASSERT(pinmap->rx_flow_pin != NC);
645645
obj_s->hw_flow_ctl = UART_HWCONTROL_RTS;
646646
obj_s->pin_rts = pinmap->rx_flow_pin;
647647
// Enable the pin for RTS function
@@ -650,7 +650,7 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con
650650
}
651651
if (type == FlowControlCTS) {
652652
// Enable CTS
653-
MBED_ASSERT(pinmap->tx_flow_pin != (UARTName)NC);
653+
MBED_ASSERT(pinmap->tx_flow_pin != NC);
654654
obj_s->hw_flow_ctl = UART_HWCONTROL_CTS;
655655
obj_s->pin_cts = pinmap->tx_flow_pin;
656656
// Enable the pin for CTS function
@@ -659,8 +659,8 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con
659659
}
660660
if (type == FlowControlRTSCTS) {
661661
// Enable CTS & RTS
662-
MBED_ASSERT(pinmap->rx_flow_pin != (UARTName)NC);
663-
MBED_ASSERT(pinmap->tx_flow_pin != (UARTName)NC);
662+
MBED_ASSERT(pinmap->rx_flow_pin != NC);
663+
MBED_ASSERT(pinmap->tx_flow_pin != NC);
664664
obj_s->hw_flow_ctl = UART_HWCONTROL_RTS_CTS;
665665
obj_s->pin_rts = pinmap->rx_flow_pin;;
666666
obj_s->pin_cts = pinmap->tx_flow_pin;;

targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_hrtim.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,13 +1618,13 @@ HAL_StatusTypeDef HAL_HRTIM_SimpleOCStart_DMA(HRTIM_HandleTypeDef * hhrtim,
16181618
/* Check the parameters */
16191619
assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OCChannel));
16201620

1621-
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
1621+
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
16221622
{
16231623
return HAL_BUSY;
16241624
}
1625-
if((hhrtim->State == HAL_HRTIM_STATE_READY))
1625+
if (hhrtim->State == HAL_HRTIM_STATE_READY)
16261626
{
1627-
if((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
1627+
if ((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
16281628
{
16291629
return HAL_ERROR;
16301630
}
@@ -2235,13 +2235,13 @@ HAL_StatusTypeDef HAL_HRTIM_SimplePWMStart_DMA(HRTIM_HandleTypeDef * hhrtim,
22352235
/* Check the parameters */
22362236
assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, PWMChannel));
22372237

2238-
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
2238+
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
22392239
{
22402240
return HAL_BUSY;
22412241
}
2242-
if((hhrtim->State == HAL_HRTIM_STATE_READY))
2242+
if (hhrtim->State == HAL_HRTIM_STATE_READY)
22432243
{
2244-
if((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
2244+
if ((SrcAddr == 0U ) || (DestAddr == 0U ) || (Length == 0U))
22452245
{
22462246
return HAL_ERROR;
22472247
}
@@ -5329,7 +5329,7 @@ HAL_StatusTypeDef HAL_HRTIM_WaveformCountStart_DMA(HRTIM_HandleTypeDef * hhrtim,
53295329
/* Check the parameters */
53305330
assert_param(IS_HRTIM_TIMERID(Timers));
53315331

5332-
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
5332+
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
53335333
{
53345334
return HAL_BUSY;
53355335
}
@@ -5764,13 +5764,13 @@ HAL_StatusTypeDef HAL_HRTIM_BurstDMATransfer(HRTIM_HandleTypeDef *hhrtim,
57645764
/* Check the parameters */
57655765
assert_param(IS_HRTIM_TIMERINDEX(TimerIdx));
57665766

5767-
if((hhrtim->State == HAL_HRTIM_STATE_BUSY))
5767+
if (hhrtim->State == HAL_HRTIM_STATE_BUSY)
57685768
{
57695769
return HAL_BUSY;
57705770
}
5771-
if((hhrtim->State == HAL_HRTIM_STATE_READY))
5771+
if (hhrtim->State == HAL_HRTIM_STATE_READY)
57725772
{
5773-
if((BurstBufferAddress == 0U ) || (BurstBufferLength == 0U))
5773+
if ((BurstBufferAddress == 0U ) || (BurstBufferLength == 0U))
57745774
{
57755775
return HAL_ERROR;
57765776
}

targets/TARGET_STM/TARGET_STM32H7/analogin_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void analogin_init(analogin_t *obj, PinName pin)
6060
// ADC Internal Channels "pins" (Temperature, Vref, Vbat, ...)
6161
// are described in PinNames.h and PeripheralPins.c
6262
// Pin value must be between 0xF0 and 0xFF
63-
if ((pin < 0xF0) || (pin >= ALT0)) {
63+
if ((pin < 0xF0) || (pin >= (PinName)ALT0)) {
6464
// Normal channels
6565
// Get the peripheral name from the pin and assign it to the object
6666
obj->handle.Instance = (ADC_TypeDef *)pinmap_peripheral(pin, PinMap_ADC);

targets/TARGET_STM/TARGET_STM32L4/STM32Cube_FW/STM32L4xx_HAL_Driver/Legacy/stm32l4xx_hal_can_legacy.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@
104104
#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'
105105
#endif /* HAL_CAN_MODULE_ENABLED */
106106

107-
#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'
107+
// MBED current implementation
108+
// #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'
108109

109110
#if defined(CAN1)
110111

targets/TARGET_STM/TARGET_STM32L5/serial_device.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con
654654
}
655655
if (type == FlowControlRTS) {
656656
// Enable RTS
657-
MBED_ASSERT(pinmap->rx_flow_pin != (UARTName)NC);
657+
MBED_ASSERT(pinmap->rx_flow_pin != NC);
658658
obj_s->hw_flow_ctl = UART_HWCONTROL_RTS;
659659
obj_s->pin_rts = pinmap->rx_flow_pin;
660660
// Enable the pin for RTS function
@@ -663,7 +663,7 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con
663663
}
664664
if (type == FlowControlCTS) {
665665
// Enable CTS
666-
MBED_ASSERT(pinmap->tx_flow_pin != (UARTName)NC);
666+
MBED_ASSERT(pinmap->tx_flow_pin != NC);
667667
obj_s->hw_flow_ctl = UART_HWCONTROL_CTS;
668668
obj_s->pin_cts = pinmap->tx_flow_pin;
669669
// Enable the pin for CTS function
@@ -672,8 +672,8 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con
672672
}
673673
if (type == FlowControlRTSCTS) {
674674
// Enable CTS & RTS
675-
MBED_ASSERT(pinmap->rx_flow_pin != (UARTName)NC);
676-
MBED_ASSERT(pinmap->tx_flow_pin != (UARTName)NC);
675+
MBED_ASSERT(pinmap->rx_flow_pin != NC);
676+
MBED_ASSERT(pinmap->tx_flow_pin != NC);
677677
obj_s->hw_flow_ctl = UART_HWCONTROL_RTS_CTS;
678678
obj_s->pin_rts = pinmap->rx_flow_pin;;
679679
obj_s->pin_cts = pinmap->tx_flow_pin;;

targets/TARGET_STM/can_api.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,16 @@ static void _can_init_freq_direct(can_t *obj, const can_pinmap_t *pinmap, int hz
142142
// We use PLL1.Q clock right now so get its frequency
143143
PLL1_ClocksTypeDef pll1_clocks;
144144
HAL_RCCEx_GetPLL1ClockFreq(&pll1_clocks);
145-
int ntq = pll1_clocks.PLL1_Q_Frequency / hz;
145+
uint32_t ntq = pll1_clocks.PLL1_Q_Frequency / (uint32_t)hz;
146146
#else
147147
#if (defined RCC_PERIPHCLK_FDCAN1)
148-
int ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN1) / hz;
148+
uint32_t ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN1) / (uint32_t)hz;
149149
#else
150-
int ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN) / hz;
150+
uint32_t ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN) / (uint32_t)hz;
151151
#endif
152152
#endif
153153

154-
int nominalPrescaler = 1;
154+
uint32_t nominalPrescaler = 1;
155155
// !When the sample point should be lower than 50%, this must be changed to
156156
// !IS_FDCAN_NOMINAL_TSEG2(ntq/nominalPrescaler), since
157157
// 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)
322322
// STM32H7 doesn't support yet HAL_RCCEx_GetPeriphCLKFreq for FDCAN
323323
PLL1_ClocksTypeDef pll1_clocks;
324324
HAL_RCCEx_GetPLL1ClockFreq(&pll1_clocks);
325-
int ntq = pll1_clocks.PLL1_Q_Frequency / f;
325+
uint32_t ntq = pll1_clocks.PLL1_Q_Frequency / (uint32_t)f;
326326
#else
327327
#if (defined RCC_PERIPHCLK_FDCAN1)
328-
int ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN1) / f;
328+
uint32_t ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN1) / (uint32_t)f;
329329
#else
330-
int ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN) / f;
330+
uint32_t ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN) / (uint32_t)f;
331331
#endif
332332
#endif
333333

334-
int nominalPrescaler = 1;
334+
uint32_t nominalPrescaler = 1;
335335
// !When the sample point should be lower than 50%, this must be changed to
336336
// !IS_FDCAN_DATA_TSEG2(ntq/nominalPrescaler), since
337337
// NTSEG2 and SJW max values are lower. For now the sample point is fix @75%

0 commit comments

Comments
 (0)