Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
44 lines (41 sloc) 1.85 KB
// Copyright 2019 Josh Pieper,
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stm32f4xx.h"
extern "C" {
/// This function initiates the multiplex server bootloader. It takes
/// over control of a UART and direction pin, and communicates over it
/// using the multiplex server async stream protocol. It implements a
/// minimal command set to support re-flashing of the application
/// portion of the onboard flash.
/// This function will never return, as it leaves the hardware in an
/// undefined state. It may internally cause the device to hard-reset
/// in order to restart the primary application.
/// It is intended to be placed into an alternate section of flash
/// from the main application, so that it can continue to execute
/// while the primary application is re-programmed.
/// Assumed hardware configuration:
/// The UART is already powered and configured to the proper baud rate.
/// TIM5 is configured to be a microsecond timer.
/// NOTE: All interrupts are disabled shortly after starting this
/// function. Any actions required to safe a moving system should be
/// taken before calling this.
void MultiplexBootloader(uint8_t source_id,
USART_TypeDef* uart,
GPIO_TypeDef* direction_port,
int direction_pin) __attribute__ ((noreturn));
You can’t perform that action at this time.