C++ microcontroller/processor selection
This sounds like a job for embedded Linux.


Persistent file system.  Forget IDE (save yourself 40 pins) and
go for a board that uses a flash card.
More RAM and Flash.  Typical embedded Linux boards have RAM in
    the megabytes.


As for peripherals, driving 40 servos could be a question here on its own.  How are you doing this now?  For the rest of your peripheral requirements, here's a board that seems to fit that has a good community as well:

http://beagleboard.org/static/beaglebone/latest/Docs/Hardware/BONE_SRM.pdf

The tool chain has a C++ compiler, it has SPI, UARTs, and even a PWM. This is what's being claimed in the PDF at least, you'll have to make sure that there are drivers for all those peripherals available to you at the application level for whichever distro of Linux that you put on.  Hopefully the one they provide has everything you need.

So basically, if you can port whatever you've written to a Linux PC, there's a good chance you can port it to an embedded linux target.  However, I'm willing to bet that if all you're using from C++ is &lt;fstream&gt; and &lt;string&gt;, you could probably do a C re-write and save yourself the overhead of Linux.