cancel
Showing results for 
Search instead for 
Did you mean: 

Usage of (uint32_t) in device headers.

Uwe Bonnes
Principal III
Posted on March 10, 2016 at 16:14

STM32 device headers use e.g.

#define FLASH_BASE            ((uint32_t)0x08000000U)

  /*!< FLASH(up to 1 MB) base address in the alias region  */

while e.g. Freescale uses in a similar situation

#define ADC0_BASE                                (0x4003B000u)

The usage of the (uint32_t) cast by ST denied to use FLASH_BASE in preprocessor expressions. Please consider dropping the sometimes harmfull (uint32_t) cast where not explicit needed!

6 REPLIES 6
Walid FTITI_O
Senior II
Posted on March 11, 2016 at 11:09

Hi bonnes.uwe,

Thanks for your feedback, I will report this to the team.

-Hannibal-

Walid FTITI_O
Senior II
Posted on March 31, 2016 at 13:20

Hi bonnes.uwe, 

Your feedback will be implimented in the new release. Thanks for the contribution.

-Hannibal-

Radosław
Senior II
Posted on March 31, 2016 at 14:05

Using macro sufix and cast to uint32 is double solution. 

First st add cast in last revision add ''U'' for misra compilance.  This is chaotic. 

Uwe Bonnes
Principal III
Posted on April 13, 2016 at 12:31

I can confirm the confusion.

Uwe Bonnes
Principal III
Posted on November 30, 2016 at 13:45

A construct like  ((uint32_t)0x08000000U is still used in some places in the most recent Cube library update, e.g. in the L4 library in all xxx_BASE definitions and

for F4 in the F423 AES definitions.

AvaTar
Lead
Posted on November 30, 2016 at 13:56

> A construct like  ((uint32_t)0x08000000U is still used in some places in the most recent Cube library update, ...

 

I'd guess as a kowtow towards (potential) MISRA-obsessed automotive customers ...