Mapping of peripherals by compiler

Post here first, or if you can't find a relevant section!
Post Reply
moshelakin
Posts: 1
Joined: Wed Dec 29, 2021 7:50 am

Mapping of peripherals by compiler

Post by moshelakin »

I am looking for a convenient (lazy) way to determine how the Arduino IDE maps STM32 peripherals when it compiles a program. I am aware of the PeripheralPins.c file that is used to map generic functions (I2C communications e.g.) to specific pins for a selected board. And, working backwards through such files, I can find where to check for various physical interfaces. I'm hoping that there is a simpler way to accomplish this. Is there a way to create a compiler listing that gives that information?

For example, I bought an Adafruit si5351 shield, compiled the example file, uploaded to an Arduino Uno, connected the shield, and everything worked. I then created a new sketch using the same example file, and I selected the STM32F407G-DISC1 board. The sketch compiles, loads, and runs (at least I see the serial messages). The PeripheralPins.c file maps SDA to PB7, PB11, or PC9 and SCL to PA8 or PB8. I assume the compiler chooses the first pin that has not already been assigned to another alternate function. I can probe those pins to determine what the compiler chose. But, as I said, I looking for a lazy to accomplish that.
Top
User avatar
fpiSTM
Posts: 1723
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Mapping of peripherals by compiler

Post by fpiSTM »

Pins mapping and peripherals have to be defined by the user.
By default the variant define some default instance with specific pins.
User is responsible to know which pins he wants to use and with which peripheral.
Post Reply

Return to “General discussion”