Computer software that is designed to be run on a specific machine or device (such as a weapon), especially a machine that would not normally be thought of as a "computer" is called embedded software.
Embedded software is essential for the running of that machine, and is normally specialised for the particular hardware that it is running on. For example a "smart bomb" will have an onboard chip that runs embedded software to control the flight and timing of the bomb and increase the chance of it hitting a particular target.
Embedded software may run with an OS (called an embedded OS). For example Linux provides "Embedded Linux", used in set-top-boxes, networking equipment and elsewhere. Embedded software can also be designed to run without a separate OS.
Embedded software designed for weapons is specifically "military embedded software"