This paper details the comprehensive software architecture and implementation of an onboard control system developed for a small-scale unmanned aerial vehicle (UAV) helicopter. A PC-104 computer stack is devoted to flight control as well as the interaction with other devices in the onboard system. The consideration to construct the software system is primarily focused on its real-time runtime environment and its competence of flexible reconfiguration. As a result, the system is developed under QNX Real-time Operating System (RTOS). The interaction function of the flight control computer with external devices is built in modules and processes running in a predefined order. The entire software system has been successfully tested in both actual field flights and a hardware-in-the-loop simulation (HILs) environment. The flight results have shown that the software system is competent enough to go on with automatic flight of the UAV helicopter.