Help making nrf51822 work (PTR5518)
You will need to register with Nordic to get the development environment for the CortexM0 that's on the nRF51822.  If your module was intended to be programmed, it would have come with some sort of product key that lets you do this.  Alternatively, if your module is not intended to be third-party programmed, and is just designed to interface with your system via some serial protocol, you would not have received this code, and you would just program your own system to interact with it.

You'll also need a programmer to program it.  I'm not sure the ST-link on your Discovery board is capable of this.