make-stmconst.py script failed to parse STM32CubeU5 header file #9299
-
Hello all, Currently, I am trying to port the STM32U5 family to Python. I have updated the lib/stm32lib repository to include the STM32CubeU5 that I got from here this code snippet is taken from https://github.com/STMicroelectronics/STM32CubeU5/blob/main/Drivers/CMSIS/Device/ST/STM32U5xx/Include/stm32u575xx.h at lines 2063-2070 /**
* @brief RSSLib secure callable function pointer structure
*/
typedef struct
{
__IM uint32_t Reserved2[2];
__IM RSSLIB_S_CloseExitHDP_TypeDef CloseExitHDP; /*!< RSSLIB Bootloader Close and exit HDP Address offset: 0x28 */
}S_pFuncTypeDef; After some debugging, I found that the script failed to parse the line because of this particular regex at lines 73-76 (
"} TypeDef",
re.compile(r"} *(?P<id>[A-Z][A-Za-z0-9_]+)_(?P<global>([A-Za-z0-9_]+)?)TypeDef;$"),
), AFAIK, this regex will only match the line if the group id is consist of two characters or more. So the script will always fail to parse the struct with a single char in the group id. Can we change the regex to make the script able to parse the struct? (
"} TypeDef",
re.compile(r"} *(?P<id>[A-Za-z0-9_]+)_(?P<global>([A-Za-z0-9_]+)?)TypeDef;$"),
), Thank you for your help |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Yes we can change that regex. Although maybe it's a little more precise to have |
Beta Was this translation helpful? Give feedback.
Yes we can change that regex. Although maybe it's a little more precise to have
(?P<id>[A-Z][A-Za-z0-9_]*)