Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers flash_blob.c Source File

flash_blob.c

00001 /**
00002  * @file    flash_blob.c
00003  * @brief   Flash algorithm for the nrf51
00004  *
00005  * DAPLink Interface Firmware
00006  * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved
00007  * SPDX-License-Identifier: Apache-2.0
00008  *
00009  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00010  * not use this file except in compliance with the License.
00011  * You may obtain a copy of the License at
00012  *
00013  * http://www.apache.org/licenses/LICENSE-2.0
00014  *
00015  * Unless required by applicable law or agreed to in writing, software
00016  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00017  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00018  * See the License for the specific language governing permissions and
00019  * limitations under the License.
00020  */
00021 
00022 #include "flash_blob.h"
00023 
00024 static const uint32_t nRF51822AA_FLM[] = {
00025     0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
00026 
00027     /*0x020*/ 0x47702000, 0x47702000, 0x4c26b570, 0x60602002, 0x60e02001, 0x68284d24, 0xd00207c0L, 0x60602000,
00028     /*0x040*/ 0xf000bd70L, 0xe7f6f82cL, 0x4c1eb570, 0x60612102, 0x4288491e, 0x2001d302, 0xe0006160L, 0x4d1a60a0,
00029     /*0x060*/ 0xf81df000L, 0x7c06828, 0x2000d0fa, 0xbd706060L, 0x4605b5f8, 0x4813088e, 0x46142101, 0x4f126041,
00030     /*0x080*/ 0xc501cc01L, 0x7c06838, 0x1e76d006, 0x480dd1f8, 0x60412100, 0xbdf84608L, 0xf801f000L, 0x480ce7f2,
00031     /*0x0A0*/ 0x6006840, 0xd00b0e00L, 0x6849490a, 0xd0072900L, 0x4a0a4909, 0xd00007c3L, 0x1d09600a, 0xd1f90840L,
00032     /*0x0C0*/ 0x4770, 0x4001e500, 0x4001e400, 0x10001000, 0x40010400, 0x40010500, 0x40010600, 0x6e524635,
00033     /*0x0E0*/ 0x0,
00034 };
00035 
00036 static const uint32_t nRF52832AA_FLM[] = {
00037     0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
00038     0x47702000, 0x47702000, 0x4c2bb570, 0x60202002, 0x20014929, 0x60083108, 0x68284d28, 0xd00207c0, 
00039     0x60202000, 0xf000bd70, 0xe7f6f833, 0x4c22b570, 0x60212102, 0x2f10f1b0, 0x491fd303, 0x31102001, 
00040     0x491de001, 0x60081d09, 0xf0004d1c, 0x6828f821, 0xd0fa07c0, 0x60202000, 0xe92dbd70, 0xf8df41f0, 
00041     0x088e8058, 0x46142101, 0xf8c84605, 0x4f131000, 0xc501cc01, 0x07c06838, 0x1e76d007, 0x2100d1f8, 
00042     0x1000f8c8, 0xe8bd4608, 0xf00081f0, 0xe7f1f801, 0x6800480b, 0x00fff010, 0x490ad00c, 0x29006809, 
00043     0x4908d008, 0x31fc4a08, 0xd00007c3, 0x1d09600a, 0xd1f90840, 0x00004770, 0x4001e504, 0x4001e400, 
00044     0x40010404, 0x40010504, 0x6e524635, 0x00000000, 
00045 };
00046 
00047 /**
00048 * List of start and size for each size of flash sector
00049 * The size will apply to all sectors between the listed address and the next address
00050 * in the list.
00051 * The last pair in the list will have sectors starting at that address and ending
00052 * at address start + size.
00053 */
00054 static const sector_info_t sectors_info[] = {
00055     {0, 1024},
00056  };
00057 
00058 static const program_target_t flash = {  // Default is nrf51
00059     .init = 0x20000021,
00060     .uninit = 0x20000025,
00061     .erase_chip = 0x20000029,
00062     .erase_sector = 0x20000049,
00063     .program_page = 0x20000071,
00064     .verify = 0x0,
00065     {
00066         .breakpoint = 0x20000001,
00067         .static_base = 0x20000020 + 0x00000150,
00068         .stack_pointer = 0x20001000
00069     },
00070     .program_buffer = 0x20000200,
00071     .algo_start = 0x20000000,
00072     .algo_size = 0x00000150,
00073     .algo_blob = nRF51822AA_FLM,
00074     .program_buffer_size = 512 // should be USBD_MSC_BlockSize
00075 };
00076 
00077 static const sector_info_t sectors_info_nrf52[] = {
00078     {0, 4096},
00079  };
00080 
00081 static const program_target_t flash_nrf52 = {
00082     .init = 0x20000021,
00083     .uninit = 0x20000025,
00084     .erase_chip = 0x20000029,
00085     .erase_sector = 0x2000004D,
00086     .program_page = 0x2000007B,
00087     .verify = 0x0,
00088     {
00089         .breakpoint = 0x20000001,
00090         .static_base = 0x20000020 + 0x00000150,
00091         .stack_pointer = 0x20001000
00092     },
00093     .program_buffer = 0x20000200,
00094     .algo_start = 0x20000000,
00095     .algo_size = 0x00000150,
00096     .algo_blob = nRF52832AA_FLM,
00097     .program_buffer_size = 512 // should be USBD_MSC_BlockSize
00098 };