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

« Back to documentation index

Show/hide line numbers target_config.h Source File

target_config.h

Go to the documentation of this file.
00001 /**
00002  * @file    target_config.h
00003  * @brief
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 #ifndef TARGET_CONFIG_H
00023 #define TARGET_CONFIG_H
00024 
00025 #include <stddef.h>
00026 #include <stdint.h>
00027 
00028 #include "flash_blob.h"
00029 #include "util.h"
00030 
00031 //! This can vary from target to target and should be in the structure or flash blob
00032 #define TARGET_AUTO_INCREMENT_PAGE_SIZE    (1024)
00033 
00034 //! Additional flash and ram regions
00035 #define MAX_REGIONS (10)
00036 
00037 //! @brief Option flags for memory regions.
00038 enum _region_flags {
00039     kRegionIsDefault  = (1 << 0), /*!< Out of bounds regions will use the same flash algo if this is set */
00040     kRegionIsSecure   = (1 << 1), /*!< The region can only be accessed from the secure world. Only applies for TrustZone-enabled targets. */
00041 };
00042 
00043 /*!
00044  * @brief Details of a target flash or RAM memory region.
00045  */
00046 typedef struct __attribute__((__packed__)) region_info {
00047     uint32_t start;                 /*!< Region start address. */
00048     uint32_t end;                   /*!< Region end address. */
00049     uint32_t flags;                 /*!< Flags for this region from the #_region_flags enumeration. */
00050     uint32_t alias_index;           /*!< Use with flags; will point to a different index if there is an alias region */
00051     program_target_t *flash_algo;   /*!< A pointer to the flash algorithm structure */
00052 } region_info_t;
00053 
00054 /*!
00055  * @brief Information required to program target flash.
00056  */
00057 typedef struct __attribute__((__packed__)) target_cfg {
00058     uint32_t version;                           /*!< Target configuration version */
00059     const sector_info_t* sectors_info;          /*!< Sector start and length list */
00060     uint32_t sector_info_length;                /*!< Number of entries in the sectors_info array */
00061     region_info_t flash_regions[MAX_REGIONS];   /*!< Flash regions */
00062     region_info_t ram_regions[MAX_REGIONS];     /*!< RAM regions  */
00063     const char *rt_board_id;                    /*!< If assigned, this is a flexible board ID */
00064     uint16_t rt_family_id;                      /*!< If assigned, this is a flexible family ID */
00065     uint8_t erase_reset;                        /*!< Reset after performing an erase */
00066     uint8_t pad;
00067 } target_cfg_t;
00068 
00069 extern target_cfg_t target_device;
00070 
00071 
00072 #endif