http://www.raspberrypi.org/phpBB3/viewt ... 94#p238194
Here's another anecdote:
Back in the days of the BBC Micro, the word processor of choice was WordStar, which came on a Sideways ROM. I had a Second Processor, which meant I had more memory for my documents. But WordStar refused to work on the second processor -- I had to switch it off and write my stuff on the unadorned BBC Micro. One day at a computer exhibition I came upon a representative of the distributors of WordStar and asked him why this was. It turned out it was to prevent copying: it checked to see if it was running in RAM by trying to write to itself, and if it was it would crash, on purpose, with no diagnostic or warning messages. On the second processor, the contents of the ROM were copied over the tube to the second processor's RAM, hence the test saw RAM, and the application crashed.
The thing was, every extension board on the market that had RAM, had a switch to disable writes. The copy-protection did almost nothing to stop copying, and nothing at all to stop real pirates copying the ROM into another ROM and selling it. All it did was to inconvenience innocent, paying customers such as myself.
As I said in the above post: you can't stop copying, and every step you take to try will annoy some innocent customers. If you must use some sort of copy-protection then make it as light and unobtrusive as possible. You will stop the casual pirates and not annoy too many of the people who provide your pay cheque. If you are too heavy handed about it, you will still have pirates, and you will have fewer customers.
It is a mathematically provable fact that you cannot protect the code in the manner you suggest. The processor has to execute the code, and at that point it has to be unencrypted. Any tests can be found and patched out, and they will be; pirates are doing just this sort of thing already. Read up on the PS3 cracking saga
, and that uses multiple levels of hardware protection inside the CPU.
build your dongle. It will add to your costs significantly in development, certification, hardware (for every sale) and customer support. It will mean that any prospective customers who need to use the on-board UART for their own purposes become customers of your competitors. It will also mean that if any customer fries, breaks or loses their dongle, they will think twice before buying a replacement.