Armed men attacked the French embassy in Burkina Faso and the country's military headquarters before being repelled in a battle that left dozens of dead or injured.