Size optimize#39
Open
AlexLanzano wants to merge 5 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces code/data footprint by simplifying how wolfHAL models peripheral register access: device handles now store only a peripheral base address (instead of a base+size regmap struct), and some register-access helpers are moved out of headers to reduce per-translation-unit codegen.
Changes:
- Replace
whal_Regmapusage in multiple device handle structs with a singlebasefield (size_t). - Remove the
whal_Regmapstruct fromwolfHAL/regmap.hand makewhal_Reg_ReadPoll()a non-inline function. - Update platform convenience macros from
*_REGMAPdesignated initializers to*_BASEconstants.
Reviewed changes
Copilot reviewed 155 out of 155 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfHAL/watchdog/watchdog.h | Watchdog handle switched from regmap to base; header include trimmed. |
| wolfHAL/watchdog/stm32wb_iwdg.h | Adds timeout.h include needed by the driver config. |
| wolfHAL/uart/uart.h | UART handle switched from regmap to base; header include trimmed. |
| wolfHAL/timer/timer.h | Timer handle switched from regmap to base; header include trimmed. |
| wolfHAL/spi/spi.h | SPI handle switched from regmap to base; header include trimmed. |
| wolfHAL/rng/rng.h | RNG handle switched from regmap to base; header include trimmed. |
| wolfHAL/regmap.h | Removes whal_Regmap type; whal_Reg_ReadPoll() moved out of the header. |
| wolfHAL/power/power.h | Power handle switched from regmap to base; replaces regmap include with <stddef.h>. |
| wolfHAL/power/pic32cz_supc.h | Adds error.h include to support whal_Error return type. |
| wolfHAL/platform/st/stm32wba55cg.h | Converts platform macros to *_BASE constants; retains most *_DRIVER macros but not for AES/HASH. |
| wolfHAL/platform/st/stm32wb55xx.h | Converts platform macros to *_BASE constants; updates AES driver macro naming. |
| wolfHAL/platform/st/stm32n657a0.h | Converts platform macros to *_BASE constants; CRYP/HASH driver macros are missing. |
| wolfHAL/platform/st/stm32l152re.h | Converts platform macros to *_BASE constants. |
| wolfHAL/platform/st/stm32h563xx.h | Converts platform macros to *_BASE constants. |
| wolfHAL/platform/st/stm32f411xx.h | Converts platform macros to *_BASE constants. |
| wolfHAL/platform/st/stm32f302r8.h | Converts platform macros to *_BASE constants (diff hunk truncated in prompt). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
33
to
+37
| /* | ||
| * @brief UART device instance tying a register map and driver. | ||
| */ | ||
| struct whal_Uart { | ||
| const whal_Regmap regmap; | ||
| const size_t base; |
Comment on lines
51
to
+55
| /* | ||
| * @brief SPI device instance tying a register map and driver. | ||
| */ | ||
| struct whal_Spi { | ||
| const whal_Regmap regmap; | ||
| const size_t base; |
Comment on lines
27
to
+31
| /* | ||
| * @brief RNG device instance tying a register map and driver. | ||
| */ | ||
| struct whal_Rng { | ||
| const whal_Regmap regmap; | ||
| const size_t base; |
Comment on lines
32
to
+36
| /* | ||
| * @brief Watchdog device instance tying a register map and driver. | ||
| */ | ||
| struct whal_Watchdog { | ||
| const whal_Regmap regmap; | ||
| const size_t base; |
Comment on lines
+66
to
+71
| #define WHAL_STM32WBA55_GPDMA1_BASE 0x40020000 | ||
| #define WHAL_STM32WBA55_GPDMA1_DRIVER &whal_Stm32wba_Gpdma_Driver | ||
|
|
||
| #define WHAL_STM32WBA55_AES_REGMAP \ | ||
| .base = 0x420C0000, \ | ||
| .size = 0x400 | ||
| #define WHAL_STM32WBA55_AES_DRIVER &whal_Stm32wba_Aes_Driver | ||
| #define WHAL_STM32WBA55_AES_BASE 0x420C0000 | ||
|
|
||
| #define WHAL_STM32WBA55_HASH_REGMAP \ | ||
| .base = 0x420C0400, \ | ||
| .size = 0x400 | ||
| #define WHAL_STM32WBA55_HASH_DRIVER &whal_Stm32wba_Hash_Driver | ||
| #define WHAL_STM32WBA55_HASH_BASE 0x420C0400 |
Comment on lines
+67
to
+72
| #define WHAL_STM32N657_RNG_BASE 0x44020000 | ||
| #define WHAL_STM32N657_RNG_DRIVER &whal_Stm32n6_Rng_Driver | ||
|
|
||
| #define WHAL_STM32N657_CRYP_REGMAP \ | ||
| .base = 0x44020800, \ | ||
| .size = 0x400 | ||
| #define WHAL_STM32N657_CRYP_DRIVER &whal_Stm32n6_Cryp_Driver | ||
| #define WHAL_STM32N657_CRYP_BASE 0x44020800 | ||
|
|
||
| #define WHAL_STM32N657_HASH_REGMAP \ | ||
| .base = 0x44020400, \ | ||
| .size = 0x400 | ||
| #define WHAL_STM32N657_HASH_DRIVER &whal_Stm32n6_Hash_Driver | ||
| #define WHAL_STM32N657_HASH_BASE 0x44020400 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.