Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 8 months ago.
How to have custom PeripheralPins.c on MBED 5
I am using NUCLEO_F446RE platform and needed to do some changes in PeripheralPins.c - mapping of which PWM timer is mapped to which PIN (the alternatives was already there, just commented out, so i uncommented the ones i needed and commented out conflicting ones)
Is there some way to achieve this without changing mbed-os source files? Like inherited platform with only this file changed or something?
Is there some best practice for this?
Thank you
2 Answers
6 years, 7 months ago.
Hi Pavel, I added some time ago a weak linker property to the PeripheralPins.c tables which has been now adapted to all STM32 targets. You can simply define your own custom PeripheralPins.c tables and the linker will use yours because the default tables are weak linked.
Please note that you cannot add more SPI, I2C etc. devices because this is somehow static in some of the STM code, however using the additional pins will work.
Regards Helmut
6 years, 7 months ago.
Hi Pavel,
You can alter the PeripheralPins.c file just for the NUCLEO_F466RE platform: https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F446xE/TARGET_NUCLEO_F446RE/PeripheralPins.c
That would be the easiest way to achieve a custom pin mapping. However, you can also try creating your own custom target for Mbed OS using your own custom code, you can follow ST's instructions for this here: https://os.mbed.com/teams/ST/wiki/steps-to-create-a-new-STM32-platform
- Jenny, team Mbed