There are several uses of the small っ:
- Compounds with the first kanji ending in つ or ending in consonant + 'u' with the second kanji beginning with the same consonant: the elision of the 'u' happens naturally and ended up being written
- Euphonic modifications (e.g. -て form)
- Foreign words in katakana aiming at matching foreign pronunciation
Are there others? Is it always phonetic (e.g. elision) or are there other possible reasons? When in history did this happen? Can it also happen inside kun'yomi words (ignoring grammatical aspects)?