JeremyGrosser / rp2040_hal

Ada drivers for the Raspberry Pi RP2040 SoC
https://pico-doc.synack.me/
BSD 3-Clause "New" or "Revised" License
38 stars 11 forks source link

ROM versioning #32

Closed JeremyGrosser closed 10 months ago

JeremyGrosser commented 2 years ago

We should find a way to handle different ROM versions. The V2 and V3 ROMs contain functions that are not present in V1. If we setup __aeabi symbols for those new functions, we lose the gcc soft math implementations, so the binary is then not compatible with V1 chips. We need to find a way to either link in a soft math implementation as a fallback or provide a compile-time minimum ROM version.

As far as I can tell, the majority of RP2040 chips in the wild have the V2 or V3 ROMs, I believe the V1s were sent to vendors like Adafruit and Arduino prior to public RP2040 availability and some of those early chips got placed on boards shipped to customers. So V1 is rare, but not that rare.

JeremyGrosser commented 10 months ago

Having used it for a few projects, I think it's okay that the trig functions in the V2 and V3 ROM aren't hooked up to aeabi symbols. These functions are approximations and may not be suitable for all applications. I think it's reasonable to expect application developers to call into RP.ROM.Floating_Point if these "fast math" routines are desired.