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

« Back to documentation index

Show/hide line numbers target_board.c Source File

target_board.c

Go to the documentation of this file.
00001 /**
00002  * @file    target_board.c
00003  * @brief   Implementation of target_family.h
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 <string.h>
00023 #include "target_board.h"
00024 
00025 // Default empty board info.
00026 __attribute__((weak))
00027 const board_info_t g_board_info = {
00028         .info_version = kBoardInfoVersion,
00029         .board_id = "0000",
00030         .daplink_url_name =       "MBED    HTM",
00031         .daplink_drive_name =       "DAPLINK    ",
00032         .daplink_target_url = "https://mbed.org/device/?code=@U?version=@V?target_id=@T",
00033 };
00034 
00035 
00036 const char * get_board_id(void)
00037 {
00038     if (g_board_info.target_cfg && g_board_info.target_cfg->rt_board_id) {
00039         return g_board_info.target_cfg->rt_board_id; //flexible board id
00040     }else{
00041         return g_board_info.board_id;
00042     }
00043 }
00044 
00045 uint16_t get_family_id(void)
00046 {
00047     if (g_board_info.target_cfg && g_board_info.target_cfg->rt_family_id) {
00048         return g_board_info.target_cfg->rt_family_id; //flexible family id
00049     }else{
00050         return g_board_info.family_id;
00051     }
00052 }
00053 
00054 #if (defined(__ICCARM__))
00055 #pragma optimize = none
00056 uint8_t flash_algo_valid(void)
00057 #elif (defined(__CC_ARM))
00058 #pragma push
00059 #pragma O0
00060 uint8_t flash_algo_valid(void)
00061 #elif (!defined(__GNUC__))
00062 /* #pragma GCC push_options */
00063 /* #pragma GCC optimize("O0") */
00064 uint8_t __attribute__((optimize("O0"))) flash_algo_valid(void)
00065 #else
00066 #error "Unknown compiler"
00067 #endif
00068 {
00069     return (g_board_info.target_cfg != 0);
00070 }
00071 
00072 #if (defined(__CC_ARM))
00073 #pragma pop
00074 #endif
00075 #if (defined(__GNUC__))
00076 /* #pragma GCC pop_options */
00077 #endif