Trying to plan your IO Resources on a Cortex Device is quite challenging. IMO you need a spreadsheet for that... so Check out the GitHub links.
Also see that ST offers a Tool for windows STM32F4CUBE (or it's part of CUBE, I am not sure) to interactively plan yout IO resources. My Spreadsheets are already a year old and I think CUBE was not yet available.
If you find an error, pleas write me.