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 target_config.h
Pawel Zarembski 0:01f31e923fe2 3 * @brief
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 #ifndef TARGET_CONFIG_H
Pawel Zarembski 0:01f31e923fe2 23 #define TARGET_CONFIG_H
Pawel Zarembski 0:01f31e923fe2 24
Pawel Zarembski 0:01f31e923fe2 25 #include <stddef.h>
Pawel Zarembski 0:01f31e923fe2 26 #include <stdint.h>
Pawel Zarembski 0:01f31e923fe2 27
Pawel Zarembski 0:01f31e923fe2 28 #include "flash_blob.h"
Pawel Zarembski 0:01f31e923fe2 29 #include "util.h"
Pawel Zarembski 0:01f31e923fe2 30
Pawel Zarembski 0:01f31e923fe2 31 //! This can vary from target to target and should be in the structure or flash blob
Pawel Zarembski 0:01f31e923fe2 32 #define TARGET_AUTO_INCREMENT_PAGE_SIZE (1024)
Pawel Zarembski 0:01f31e923fe2 33
Pawel Zarembski 0:01f31e923fe2 34 //! Additional flash and ram regions
Pawel Zarembski 0:01f31e923fe2 35 #define MAX_REGIONS (10)
Pawel Zarembski 0:01f31e923fe2 36
Pawel Zarembski 0:01f31e923fe2 37 //! @brief Option flags for memory regions.
Pawel Zarembski 0:01f31e923fe2 38 enum _region_flags {
Pawel Zarembski 0:01f31e923fe2 39 kRegionIsDefault = (1 << 0), /*!< Out of bounds regions will use the same flash algo if this is set */
Pawel Zarembski 0:01f31e923fe2 40 kRegionIsSecure = (1 << 1), /*!< The region can only be accessed from the secure world. Only applies for TrustZone-enabled targets. */
Pawel Zarembski 0:01f31e923fe2 41 };
Pawel Zarembski 0:01f31e923fe2 42
Pawel Zarembski 0:01f31e923fe2 43 /*!
Pawel Zarembski 0:01f31e923fe2 44 * @brief Details of a target flash or RAM memory region.
Pawel Zarembski 0:01f31e923fe2 45 */
Pawel Zarembski 0:01f31e923fe2 46 typedef struct __attribute__((__packed__)) region_info {
Pawel Zarembski 0:01f31e923fe2 47 uint32_t start; /*!< Region start address. */
Pawel Zarembski 0:01f31e923fe2 48 uint32_t end; /*!< Region end address. */
Pawel Zarembski 0:01f31e923fe2 49 uint32_t flags; /*!< Flags for this region from the #_region_flags enumeration. */
Pawel Zarembski 0:01f31e923fe2 50 uint32_t alias_index; /*!< Use with flags; will point to a different index if there is an alias region */
Pawel Zarembski 0:01f31e923fe2 51 program_target_t *flash_algo; /*!< A pointer to the flash algorithm structure */
Pawel Zarembski 0:01f31e923fe2 52 } region_info_t;
Pawel Zarembski 0:01f31e923fe2 53
Pawel Zarembski 0:01f31e923fe2 54 /*!
Pawel Zarembski 0:01f31e923fe2 55 * @brief Information required to program target flash.
Pawel Zarembski 0:01f31e923fe2 56 */
Pawel Zarembski 0:01f31e923fe2 57 typedef struct __attribute__((__packed__)) target_cfg {
Pawel Zarembski 0:01f31e923fe2 58 uint32_t version; /*!< Target configuration version */
Pawel Zarembski 0:01f31e923fe2 59 const sector_info_t* sectors_info; /*!< Sector start and length list */
Pawel Zarembski 0:01f31e923fe2 60 uint32_t sector_info_length; /*!< Number of entries in the sectors_info array */
Pawel Zarembski 0:01f31e923fe2 61 region_info_t flash_regions[MAX_REGIONS]; /*!< Flash regions */
Pawel Zarembski 0:01f31e923fe2 62 region_info_t ram_regions[MAX_REGIONS]; /*!< RAM regions */
Pawel Zarembski 0:01f31e923fe2 63 const char *rt_board_id; /*!< If assigned, this is a flexible board ID */
Pawel Zarembski 0:01f31e923fe2 64 uint16_t rt_family_id; /*!< If assigned, this is a flexible family ID */
Pawel Zarembski 0:01f31e923fe2 65 uint8_t erase_reset; /*!< Reset after performing an erase */
Pawel Zarembski 0:01f31e923fe2 66 uint8_t pad;
Pawel Zarembski 0:01f31e923fe2 67 } target_cfg_t;
Pawel Zarembski 0:01f31e923fe2 68
Pawel Zarembski 0:01f31e923fe2 69 extern target_cfg_t target_device;
Pawel Zarembski 0:01f31e923fe2 70
Pawel Zarembski 0:01f31e923fe2 71
Pawel Zarembski 0:01f31e923fe2 72 #endif