  Realtime trigger and localization of bursts are the key functions of GECAM,
which is an all-sky gamma-ray monitor launched in Dec 10, 2020. We developed a
multifunctional trigger and localization software operating on the CPU of the
GECAM electronic box (EBOX). This onboard software has the following features:
high trigger efficiency for real celestial bursts with a suppression of false
triggers caused by charged particle bursts and background fluctuation,
dedicated localization algorithm optimized for short and long bursts
respetively, short time latency of the trigger information which is downlinked
throught the BeiDou satellite navigation System (BDS). This paper presents the
detailed design and deveopment of this trigger and localization software system
of GECAM, including the main functions, general design, workflow and
algorithms, as well as the verification and demonstration of this software,
including the on-ground trigger tests with simulated gamma-ray bursts made by a
dedicated X-ray tube and the in-flight performance to real gamma-ray bursts and
magnetar bursts.
