Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
hexiwear.c
00001 /** 00002 * @file hexiwear.c 00003 * 00004 * DAPLink Interface Firmware 00005 * Copyright (c) 2018, ARM Limited, All Rights Reserved 00006 * SPDX-License-Identifier: Apache-2.0 00007 * 00008 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00009 * not use this file except in compliance with the License. 00010 * You may obtain a copy of the License at 00011 * 00012 * http://www.apache.org/licenses/LICENSE-2.0 00013 * 00014 * Unless required by applicable law or agreed to in writing, software 00015 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00016 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00017 * See the License for the specific language governing permissions and 00018 * limitations under the License. 00019 */ 00020 00021 #include "swd_host.h" 00022 #include "target_board.h" 00023 #include "target_family.h" 00024 00025 char *board_id_kw41z = "0234"; 00026 00027 #define MDM_STATUS 0x01000000 00028 #define MDM_CTRL 0x01000004 00029 #define MDM_IDR 0x010000fc 00030 #define MDM_ID_K64 0x001c0000 // K64 00031 #define MDM_ID_KW4 0x001c0020 // KW4 00032 00033 /* Kinetis series ID */ 00034 #define K_SERIES 0 00035 #define KW_SERIES 5 00036 00037 /* KW4 subfamily defines */ 00038 #define KW40 0 00039 #define KW41 1 00040 00041 static void prerun_board_config(void); 00042 00043 00044 const board_info_t g_board_info = { 00045 .info_version = kBoardInfoVersion, 00046 .board_id = "0214", 00047 .family_id = kNXP_RapidIot_FamilyID, 00048 .flags = kEnablePageErase , 00049 .daplink_url_name = "PRODINFOHTM", 00050 .daplink_drive_name = "HEX-DAPLINK", 00051 .daplink_target_url = "http://www.hexiwear.com/", 00052 .target_cfg = &target_device, 00053 .prerun_board_config = prerun_board_config, 00054 }; 00055 00056 static void prerun_board_config(void) 00057 { 00058 // SIM peripheral 0x40047000 00059 // address offset 0x 1024 00060 uint32_t SDID = 0x40048024; 00061 uint32_t sdid; 00062 00063 // get a hold of the target 00064 if (target_set_state(HALT) == 0) { 00065 /* 00066 * When the Kinetis flash is empty the reset line toggles. This causes failures 00067 * when trying to halt the target. Use the reset halt method in this case. 00068 */ 00069 target_set_state(RESET_PROGRAM); 00070 } 00071 00072 // Read the system identification register 00073 swd_read_memory(SDID, (uint8_t *)&sdid, 4); 00074 00075 // Set the target flash algorithm 00076 if (((sdid >> 20) & 0xF) == KW_SERIES) { 00077 00078 if (((sdid >> 24) & 0x3) == KW40) { 00079 // Program to the KW40 flash 00080 extern target_cfg_t target_device_kw40; 00081 target_device = target_device_kw40; 00082 } else { 00083 // Program to the KW41 flash 00084 extern target_cfg_t target_device_kw41; 00085 target_device = target_device_kw41; 00086 target_device.rt_board_id = board_id_kw41z; 00087 } 00088 } 00089 00090 // Let the target run 00091 target_set_state(RUN); 00092 }
Generated on Tue Jul 12 2022 15:37:18 by
1.7.2