Bootloader peripherals
The bootloader source uses a C/C++ preprocessor define to configure the bootloader based on the target device. Update this define to reference the correct set of device-specific header files.
Options for node “freedom_bootloader” 
If the memory configuration of the target device differs from the closest match, the linker file must be replaced. Refer to linker files in devices/<device>/<tool chain> and update it as per the bootloader project. Update the linker settings via the project options.
Porting guide change linker file

Supported peripherals
The bootloader uses the peripherals_<device>.c file to define which peripheral interfaces are active in the bootloader. The source file includes a single table, g_peripherals[], that contains active peripheral information and pointers to configuration structures. This file is found in middleware/mcu-boot/targets/<device>/src.
Only place configurations for peripherals that are present on the target device. Otherwise, the processor generates fault conditions when trying to initialize a peripheral that is not physically present.
For the content of each entry in the g_peripherals[] table, reuse existing entries and only modify the .instance member. For example, starting with the following UART0 member, make the change to UART1 by simply changing .instance from “0” to “1”.
{
.typeMask = kPeripheralType_UART,
.instance = 0,
.pinmuxConfig = uart_pinmux_config,
.controlInterface = &g_scuartControlInterface;
.byteInterface = &g_scuartByteInterfacek;
.packetInterface = &g_framingPacketInterface;
}
When the table has all required entries, it must be terminated with a null { 0 } entry.
Parent topic:Bootloader peripherals
Peripheral initialization
After the peripheral configuration has been selected, the low-level initialization must be accounted for. The bootloader automatically enables the clock and configures the peripheral, so the only thing required for the port is to tell the bootloader which pins to use for each peripheral. This is handled in the peripherals_pinmux.h file in middleware/ mcu-boot/targets/<device>/src. The hardware_init_<device>.c file selects the boot pin used by the bootloader, which may need to be changed for the new target device.
These files most likely require significant changes to account for the differences between devices when it comes to pin routing. Each function should be checked for correctness and modified as needed.
Parent topic:Bootloader peripherals
Clock initialization
The MCU bootloader typically uses the device default clock configuration in order to avoid dependencies on external components and simplify use. In some situations, the default clock configuration cannot be used due to accuracy requirements of supported peripherals. On devices that have on-chip USB and CAN, the default system configuration is not suficient and the bootloader configures the device to run from the high-precision internal reference clock (IRC) if available. Otherwise, it depends on the external oscillator supply.
The bootloader uses the clock_config_<device>.c file in middleware/mcu-boot/targets/ <device>/src to override the default clock behavior. If the port’s target device supports USB, this file can be used. If the port’s target device does not support USB, the functions within clock_config_<device>.c can be stubbed out or set to the required port value.
Parent topic:Bootloader peripherals
Parent topic:Primary porting tasks