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 lpc824
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 LPC824_FLM[] = {
00025     0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
00026 
00027     /*0x020*/ 0x47700a80, 0x21004841, 0x22016301, 0x63416342, 0x6b416342, 0xd0fc07c9L, 0x493c6382, 0x39402002,
00028     /*0x040*/ 0x20006008, 0x20004770, 0xb5f84770L, 0x20324c38, 0x2500444c, 0x4622261f, 0x4621c261, 0x4f353114,
00029     /*0x060*/ 0x91004620L, 0x696047b8, 0xd10a2800L, 0x46212034, 0x4831c161, 0x462060e0, 0x47b89900, 0x28006960,
00030     /*0x080*/ 0x2001d000, 0xb5f8bdf8L, 0xa844d29, 0x2032444d, 0x4629606c, 0x311460ac, 0x4e266028, 0x4628460f,
00031     /*0x0A0*/ 0x696847b0, 0xd10b2800L, 0x2034606c, 0x602860ac, 0x60e84821, 0x46284639, 0x696847b0, 0xd0002800L,
00032     /*0x0C0*/ 0xbdf82001L, 0x4614b5f8, 0xd10e0006L, 0x68206861, 0x184068e2, 0x188968a1, 0x69211840, 0x69611840,
00033     /*0x0E0*/ 0x69a11840, 0x42401840, 0x4d1161e0, 0x444d0ab0, 0x60682132, 0x60a86029, 0x31144629, 0x46284f0d,
00034     /*0x100*/ 0x47b89100, 0x28006968, 0x606ed10e, 0x60ac2033, 0x20016028, 0x60e80240, 0x61284807, 0x99004628L,
00035     /*0x120*/ 0x696847b8, 0xd0002800L, 0xbdf82001L, 0x40048040, 0x4, 0x1fff1ff1, 0x2ee0, 0x0,
00036     /*0x140*/
00037 };
00038 
00039 /**
00040 * List of start and size for each size of flash sector
00041 * The size will apply to all sectors between the listed address and the next address
00042 * in the list.
00043 * The last pair in the list will have sectors starting at that address and ending
00044 * at address start + size.
00045 */
00046 static const sector_info_t sectors_info[] = {
00047     {0, 1024},
00048 };
00049 
00050 static const program_target_t flash = {
00051     0x10000025, // Init
00052     0x10000047, // UnInit
00053     0x1000004B, // EraseChip
00054     0x10000087, // EraseSector
00055     0x100000C5, // ProgramPage
00056     0x0,        // Verify
00057     
00058     // static_base : base address is address of Execution Region PrgData in map file
00059     //               to access global/static data
00060     // stack_pointer : Initial stack pointer
00061     {0x10000001, 0x10000200, 0x10001000}, // {breakpoint, static_base, stack_pointer}
00062 
00063     0x10000400, // program_buffer
00064     0x10000000, // algo_start
00065     0x00000140, // algo_size
00066 
00067     /*
00068         0x10000000   ----------------------  algo_start
00069                      | FLASH ALGORITHM    |
00070         0x10000001   |                    |  breakpoint
00071         0x10000025   |                    |  Init
00072         0x10000047   |                    |  UnInit
00073         0x1000004b   |                    |  EraseChip
00074         0x10000087   |                    |  EraseSector
00075         0x100000c5   |                    |  ProgramPage
00076                      |                    |
00077                      ----------------------  algo_start + algo_size
00078                      |      unused        |
00079         0x10000200   ----------------------  static_base
00080                      | GLOBAL/STATIC DATA |
00081                      |                    |
00082         0x10000400   ----------------------  program_buffer
00083                      | DATA TO BE WRITTEN |
00084                      |                    |
00085                      ----------------------  program_buffer + ram_to_flash_bytes_to_be_written
00086                      |      unused        |
00087                      ----------------------
00088                      | SPACE FOR STACK    |
00089         0x10001000   ----------------------  stack_pointer
00090                      |      unused        |
00091                      ----------------------
00092                      | 32 BYTES FOR IAP   |
00093         0x10??????   ----------------------  CHIP MEMORY LIMIT
00094     */
00095 
00096     LPC824_FLM, // image
00097 
00098     512         // ram_to_flash_bytes_to_be_written
00099 };
00100