The firmware entrypoint uses the #[entry] macro from the Board Support Package (BSP) to define the main execution loop. To initialize the hardware, you must take ownership of the pac::Peripherals and pac::CorePeripherals, initialize the Watchdog and Sio, and configure the system clocks using init_clocks_and_plls based on your board's external crystal frequency.
#[entry]
fn main() -> ! {
let mut pac = pac::Peripherals::take().unwrap();
let core = pac::CorePeripherals::take().unwrap();
let mut watchdog = Watchdog::new(pac.WATCHDOG);
let sio = Sio::new(pac.SIO);
let external_xtal_freq_hz = 12_000_000u32;
let clocks = init_clocks_and_plls(
external_xtal_freq_hz,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
pac.PLL_USB,
&mut pac.RESETS,
&mut watchdog,
).ok().unwrap();
// ...
}