msfujino’s patch is great, but it modifies the code in the /core/arduino directory instead of /variant, and trust me, if your code is not aligned with ArduinoCore-mbed, compatibility will be an issue.
In 2.9.1, PIN_VBAT works, while P0_31 still does not. This was a serious mistake, for which I am sorry.
We will fix it soon (chatgpt go for it!