hal_stm32 icon indicating copy to clipboard operation
hal_stm32 copied to clipboard

hal: legacy: remove conflicting PAGESIZE definition

Open cfriedt opened this issue 1 year ago • 2 comments
trafficstars

The PAGESIZE definition is typically used in POSIX systems as a measure of virtual memory granularity. In the stm32 HAL context it was used as a synonym for FLASH_PAGE_SIZE which might not be as conventional.

Remove the conflicting definition.

This should resolve the issue described in zephyrproject-rtos/zephyr#70136

cfriedt avatar Mar 21 '24 13:03 cfriedt

In the hypothesis it is merged, we'd need at least to document it in the README file of each series.

Then, this isn't my preferred solution for 2 reasons:

  • It won't be integrated in Cube deliveries, so this is a patch we'll have to carry on forever.

Oh weird - I assumed that the legacy header definitions would be deprecated at some point.

I didn't check, but is PAGESIZE even used elsewhere in the HAL?

  • It will have to be added each time a new series is integrated

True, if legacy header definitions are not deprecated.

I'd like to be sure there is no other option before integrating this.

One possible option would be to #undef PAGESIZE before defining in the hal (assuming that it is actually used in the hal). If it is not used in the hal, then maybe surround with #ifndef?

Ideally in the posix header, we would not even need to use #ifndef since it is a standard preprocessor symbol.

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html

cfriedt avatar Mar 21 '24 14:03 cfriedt

Oh weird - I assumed that the legacy header definitions would be deprecated at some point.

I think that was the point initially, but it's being carried out from one series to the next. In the end we need to live with it.

One possible option would be to #undef PAGESIZE before defining in the hal (assuming that it is actually used in the hal). If it is not used in the hal, then maybe surround with #ifndef?

This is indeed the option that I wanted to try (It is not used in the HAL), if working this would be preferable.

erwango avatar Mar 21 '24 14:03 erwango

I think this one can be closed in favour of a separate pr

cfriedt avatar Jun 02 '24 10:06 cfriedt