Functions

projects/nrfgo_sdk/bootloader_32k/firmware/main.c File Reference

#include <srom.h>
#include <stdint.h>
#include "bootloader.h"
#include "config.h"

Go to the source code of this file.

Functions

void main (void)

Detailed Description

This file copies the bootloader code to XDATA RAM and starts the bootlader command parser

Definition in file main.c.


Function Documentation

void main ( void   )

Definition at line 39 of file main.c.

{
    uint16_t i;

    //
    // copy bootloader functions from FLASH to RAM:
    uint8_t code *psrc = (uint8_t code*)SROM_MC_SRC(CODE_BOOTLOADER);
    uint8_t xdata *pdest = (uint8_t xdata*)SROM_MC_TRG(CODE_BOOTLOADER);
    for(i=0;i<SROM_MC_LEN(CODE_BOOTLOADER);i++)
    {
        *pdest++ = *psrc++;
    }
    //
    // Copy bootloader constants from FLASH to RAM:
    psrc = (uint8_t code*)SROM_MC_SRC(CONST_BOOTLOADER);
    pdest = (uint8_t xdata*)SROM_MC_TRG(CONST_BOOTLOADER);
    for(i=0;i<SROM_MC_LEN(CONST_BOOTLOADER);i++)
    {
        *pdest++ = *psrc++;
    }
    bootloader(); // Will never return
}