The linker flags need to include --model-medium, too, otherwise it assumes small by default.
Please add the line
extra_scripts = link_medium.py
to your platformio.ini and, in the project folder at the same level of the platformio.ini, the file link_medium.py with the content
Import("env")
env.Append(LINKFLAGS=["--model-medium"])