What BLE module to upload sketches and how?

I'm planning to make super small project with bluetooth LE communication. I want to be able to upload sketches wirelessly. I found two chips that seem good to me. First and preferred (due to size) is nRF51822. I know it is entire Cortex M0 SOC, but it is often used for only bluetooth connectivity. Is there a way to upload sketches (restarting through pin)? If not can the more popular CC2540 be suited for this job? If yes how? (specific AT commands)