Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.

Upstream: https://github.com/ARMmbed/DAPLink

Committer:
Pawel Zarembski
Date:
Tue Apr 07 12:55:42 2020 +0200
Revision:
0:01f31e923fe2
hani: DAPLink with reset workaround

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Pawel Zarembski 0:01f31e923fe2 1 /**
Pawel Zarembski 0:01f31e923fe2 2 * @file flash_blob.c
Pawel Zarembski 0:01f31e923fe2 3 * @brief Flash algorithm for the nrf51
Pawel Zarembski 0:01f31e923fe2 4 *
Pawel Zarembski 0:01f31e923fe2 5 * DAPLink Interface Firmware
Pawel Zarembski 0:01f31e923fe2 6 * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved
Pawel Zarembski 0:01f31e923fe2 7 * SPDX-License-Identifier: Apache-2.0
Pawel Zarembski 0:01f31e923fe2 8 *
Pawel Zarembski 0:01f31e923fe2 9 * Licensed under the Apache License, Version 2.0 (the "License"); you may
Pawel Zarembski 0:01f31e923fe2 10 * not use this file except in compliance with the License.
Pawel Zarembski 0:01f31e923fe2 11 * You may obtain a copy of the License at
Pawel Zarembski 0:01f31e923fe2 12 *
Pawel Zarembski 0:01f31e923fe2 13 * http://www.apache.org/licenses/LICENSE-2.0
Pawel Zarembski 0:01f31e923fe2 14 *
Pawel Zarembski 0:01f31e923fe2 15 * Unless required by applicable law or agreed to in writing, software
Pawel Zarembski 0:01f31e923fe2 16 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
Pawel Zarembski 0:01f31e923fe2 17 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Pawel Zarembski 0:01f31e923fe2 18 * See the License for the specific language governing permissions and
Pawel Zarembski 0:01f31e923fe2 19 * limitations under the License.
Pawel Zarembski 0:01f31e923fe2 20 */
Pawel Zarembski 0:01f31e923fe2 21
Pawel Zarembski 0:01f31e923fe2 22 #include "flash_blob.h"
Pawel Zarembski 0:01f31e923fe2 23
Pawel Zarembski 0:01f31e923fe2 24 static const uint32_t nRF51822AA_FLM[] = {
Pawel Zarembski 0:01f31e923fe2 25 0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
Pawel Zarembski 0:01f31e923fe2 26
Pawel Zarembski 0:01f31e923fe2 27 /*0x020*/ 0x47702000, 0x47702000, 0x4c26b570, 0x60602002, 0x60e02001, 0x68284d24, 0xd00207c0L, 0x60602000,
Pawel Zarembski 0:01f31e923fe2 28 /*0x040*/ 0xf000bd70L, 0xe7f6f82cL, 0x4c1eb570, 0x60612102, 0x4288491e, 0x2001d302, 0xe0006160L, 0x4d1a60a0,
Pawel Zarembski 0:01f31e923fe2 29 /*0x060*/ 0xf81df000L, 0x7c06828, 0x2000d0fa, 0xbd706060L, 0x4605b5f8, 0x4813088e, 0x46142101, 0x4f126041,
Pawel Zarembski 0:01f31e923fe2 30 /*0x080*/ 0xc501cc01L, 0x7c06838, 0x1e76d006, 0x480dd1f8, 0x60412100, 0xbdf84608L, 0xf801f000L, 0x480ce7f2,
Pawel Zarembski 0:01f31e923fe2 31 /*0x0A0*/ 0x6006840, 0xd00b0e00L, 0x6849490a, 0xd0072900L, 0x4a0a4909, 0xd00007c3L, 0x1d09600a, 0xd1f90840L,
Pawel Zarembski 0:01f31e923fe2 32 /*0x0C0*/ 0x4770, 0x4001e500, 0x4001e400, 0x10001000, 0x40010400, 0x40010500, 0x40010600, 0x6e524635,
Pawel Zarembski 0:01f31e923fe2 33 /*0x0E0*/ 0x0,
Pawel Zarembski 0:01f31e923fe2 34 };
Pawel Zarembski 0:01f31e923fe2 35
Pawel Zarembski 0:01f31e923fe2 36 static const uint32_t nRF52832AA_FLM[] = {
Pawel Zarembski 0:01f31e923fe2 37 0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
Pawel Zarembski 0:01f31e923fe2 38 0x47702000, 0x47702000, 0x4c2bb570, 0x60202002, 0x20014929, 0x60083108, 0x68284d28, 0xd00207c0,
Pawel Zarembski 0:01f31e923fe2 39 0x60202000, 0xf000bd70, 0xe7f6f833, 0x4c22b570, 0x60212102, 0x2f10f1b0, 0x491fd303, 0x31102001,
Pawel Zarembski 0:01f31e923fe2 40 0x491de001, 0x60081d09, 0xf0004d1c, 0x6828f821, 0xd0fa07c0, 0x60202000, 0xe92dbd70, 0xf8df41f0,
Pawel Zarembski 0:01f31e923fe2 41 0x088e8058, 0x46142101, 0xf8c84605, 0x4f131000, 0xc501cc01, 0x07c06838, 0x1e76d007, 0x2100d1f8,
Pawel Zarembski 0:01f31e923fe2 42 0x1000f8c8, 0xe8bd4608, 0xf00081f0, 0xe7f1f801, 0x6800480b, 0x00fff010, 0x490ad00c, 0x29006809,
Pawel Zarembski 0:01f31e923fe2 43 0x4908d008, 0x31fc4a08, 0xd00007c3, 0x1d09600a, 0xd1f90840, 0x00004770, 0x4001e504, 0x4001e400,
Pawel Zarembski 0:01f31e923fe2 44 0x40010404, 0x40010504, 0x6e524635, 0x00000000,
Pawel Zarembski 0:01f31e923fe2 45 };
Pawel Zarembski 0:01f31e923fe2 46
Pawel Zarembski 0:01f31e923fe2 47 /**
Pawel Zarembski 0:01f31e923fe2 48 * List of start and size for each size of flash sector
Pawel Zarembski 0:01f31e923fe2 49 * The size will apply to all sectors between the listed address and the next address
Pawel Zarembski 0:01f31e923fe2 50 * in the list.
Pawel Zarembski 0:01f31e923fe2 51 * The last pair in the list will have sectors starting at that address and ending
Pawel Zarembski 0:01f31e923fe2 52 * at address start + size.
Pawel Zarembski 0:01f31e923fe2 53 */
Pawel Zarembski 0:01f31e923fe2 54 static const sector_info_t sectors_info[] = {
Pawel Zarembski 0:01f31e923fe2 55 {0, 1024},
Pawel Zarembski 0:01f31e923fe2 56 };
Pawel Zarembski 0:01f31e923fe2 57
Pawel Zarembski 0:01f31e923fe2 58 static const program_target_t flash = { // Default is nrf51
Pawel Zarembski 0:01f31e923fe2 59 .init = 0x20000021,
Pawel Zarembski 0:01f31e923fe2 60 .uninit = 0x20000025,
Pawel Zarembski 0:01f31e923fe2 61 .erase_chip = 0x20000029,
Pawel Zarembski 0:01f31e923fe2 62 .erase_sector = 0x20000049,
Pawel Zarembski 0:01f31e923fe2 63 .program_page = 0x20000071,
Pawel Zarembski 0:01f31e923fe2 64 .verify = 0x0,
Pawel Zarembski 0:01f31e923fe2 65 {
Pawel Zarembski 0:01f31e923fe2 66 .breakpoint = 0x20000001,
Pawel Zarembski 0:01f31e923fe2 67 .static_base = 0x20000020 + 0x00000150,
Pawel Zarembski 0:01f31e923fe2 68 .stack_pointer = 0x20001000
Pawel Zarembski 0:01f31e923fe2 69 },
Pawel Zarembski 0:01f31e923fe2 70 .program_buffer = 0x20000200,
Pawel Zarembski 0:01f31e923fe2 71 .algo_start = 0x20000000,
Pawel Zarembski 0:01f31e923fe2 72 .algo_size = 0x00000150,
Pawel Zarembski 0:01f31e923fe2 73 .algo_blob = nRF51822AA_FLM,
Pawel Zarembski 0:01f31e923fe2 74 .program_buffer_size = 512 // should be USBD_MSC_BlockSize
Pawel Zarembski 0:01f31e923fe2 75 };
Pawel Zarembski 0:01f31e923fe2 76
Pawel Zarembski 0:01f31e923fe2 77 static const sector_info_t sectors_info_nrf52[] = {
Pawel Zarembski 0:01f31e923fe2 78 {0, 4096},
Pawel Zarembski 0:01f31e923fe2 79 };
Pawel Zarembski 0:01f31e923fe2 80
Pawel Zarembski 0:01f31e923fe2 81 static const program_target_t flash_nrf52 = {
Pawel Zarembski 0:01f31e923fe2 82 .init = 0x20000021,
Pawel Zarembski 0:01f31e923fe2 83 .uninit = 0x20000025,
Pawel Zarembski 0:01f31e923fe2 84 .erase_chip = 0x20000029,
Pawel Zarembski 0:01f31e923fe2 85 .erase_sector = 0x2000004D,
Pawel Zarembski 0:01f31e923fe2 86 .program_page = 0x2000007B,
Pawel Zarembski 0:01f31e923fe2 87 .verify = 0x0,
Pawel Zarembski 0:01f31e923fe2 88 {
Pawel Zarembski 0:01f31e923fe2 89 .breakpoint = 0x20000001,
Pawel Zarembski 0:01f31e923fe2 90 .static_base = 0x20000020 + 0x00000150,
Pawel Zarembski 0:01f31e923fe2 91 .stack_pointer = 0x20001000
Pawel Zarembski 0:01f31e923fe2 92 },
Pawel Zarembski 0:01f31e923fe2 93 .program_buffer = 0x20000200,
Pawel Zarembski 0:01f31e923fe2 94 .algo_start = 0x20000000,
Pawel Zarembski 0:01f31e923fe2 95 .algo_size = 0x00000150,
Pawel Zarembski 0:01f31e923fe2 96 .algo_blob = nRF52832AA_FLM,
Pawel Zarembski 0:01f31e923fe2 97 .program_buffer_size = 512 // should be USBD_MSC_BlockSize
Pawel Zarembski 0:01f31e923fe2 98 };