While the code you compile won’t itself run on a raspberry pi, it should theoretically be possible to use a raspberry pi to develop code to run on a supported mbed board (you can find the list of supported boards here: Free open source IoT OS and development tools from Arm | Mbed)
Someone else was trying to do this here: Yotta on raspberry pi 2, I’m not sure how far they got.
Hope that’s somewhat helpful!