• Main Page
  • Modules
  • Index
  • File List
  • Globals

projects/nrfgo_sdk/bootloader_32k/firmware/main.c

Go to the documentation of this file.
00001 /* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved.
00002  *
00003  * The information contained herein is confidential property of Nordic
00004  * Semiconductor ASA.Terms and conditions of usage are described in detail
00005  * in NORDIC SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
00006  *
00007  * Licensees are granted free, non-transferable use of the information. NO
00008  * WARRENTY of ANY KIND is provided. This heading must NOT be removed from
00009  * the file.
00010  *
00011  * $LastChangedRevision: 235 $
00012  */
00013 
00018 #include <srom.h>
00019 #include <stdint.h>
00020 
00021 #include "bootloader.h"
00022 #include "config.h"
00023 
00024 #if __C51__ < 810 && !defined(_lint)
00025 #error "This project requires Keil C51 v8.10 or higher"
00026 #endif
00027 
00028 //
00029 // For a description of the Special ROM (SROM) functionality in Keil please
00030 // search for SROM on the Keil web site and read the two articles
00031 // "C51: IN-SYSTEM FLASH PROGRAMMING (PART 1)" and "C51: IN-SYSTEM FLASH
00032 // PROGRAMMING (PART 2)"
00033 //
00034 // These macros will place the code/const from the BOOTLOADER segment in
00035 // the hex file/flash at the location given by SROM (see linker settings):
00036 SROM_MC (CODE_BOOTLOADER)
00037 SROM_MC (CONST_BOOTLOADER)
00038 
00039 void main(void)
00040 {
00041     uint16_t i;
00042 
00043     //
00044     // copy bootloader functions from FLASH to RAM:
00045     uint8_t code *psrc = (uint8_t code*)SROM_MC_SRC(CODE_BOOTLOADER);
00046     uint8_t xdata *pdest = (uint8_t xdata*)SROM_MC_TRG(CODE_BOOTLOADER);
00047     for(i=0;i<SROM_MC_LEN(CODE_BOOTLOADER);i++)
00048     {
00049         *pdest++ = *psrc++;
00050     }
00051     //
00052     // Copy bootloader constants from FLASH to RAM:
00053     psrc = (uint8_t code*)SROM_MC_SRC(CONST_BOOTLOADER);
00054     pdest = (uint8_t xdata*)SROM_MC_TRG(CONST_BOOTLOADER);
00055     for(i=0;i<SROM_MC_LEN(CONST_BOOTLOADER);i++)
00056     {
00057         *pdest++ = *psrc++;
00058     }
00059     bootloader(); // Will never return
00060 }

Generated on Fri Apr 20 2012 14:11:45 for nRFGo SDK by  doxygen 1.7.2