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 # DAPLink Interface Firmware
Pawel Zarembski 0:01f31e923fe2 3 # Copyright (c) 2009-2018, ARM Limited, All Rights Reserved
Pawel Zarembski 0:01f31e923fe2 4 # SPDX-License-Identifier: Apache-2.0
Pawel Zarembski 0:01f31e923fe2 5 #
Pawel Zarembski 0:01f31e923fe2 6 # Licensed under the Apache License, Version 2.0 (the "License"); you may
Pawel Zarembski 0:01f31e923fe2 7 # not use this file except in compliance with the License.
Pawel Zarembski 0:01f31e923fe2 8 # You may obtain a copy of the License at
Pawel Zarembski 0:01f31e923fe2 9 #
Pawel Zarembski 0:01f31e923fe2 10 # http://www.apache.org/licenses/LICENSE-2.0
Pawel Zarembski 0:01f31e923fe2 11 #
Pawel Zarembski 0:01f31e923fe2 12 # Unless required by applicable law or agreed to in writing, software
Pawel Zarembski 0:01f31e923fe2 13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
Pawel Zarembski 0:01f31e923fe2 14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Pawel Zarembski 0:01f31e923fe2 15 # See the License for the specific language governing permissions and
Pawel Zarembski 0:01f31e923fe2 16 # limitations under the License.
Pawel Zarembski 0:01f31e923fe2 17 #
Pawel Zarembski 0:01f31e923fe2 18
Pawel Zarembski 0:01f31e923fe2 19 import json
Pawel Zarembski 0:01f31e923fe2 20
Pawel Zarembski 0:01f31e923fe2 21 def generate_custom_profile(build_dicts, compiler='ARM', tool_search='make_armcc', filename = 'custom_profile.json'):
Pawel Zarembski 0:01f31e923fe2 22 profile_dict = {
Pawel Zarembski 0:01f31e923fe2 23 compiler: {
Pawel Zarembski 0:01f31e923fe2 24 "common": [],
Pawel Zarembski 0:01f31e923fe2 25 "asm": [],
Pawel Zarembski 0:01f31e923fe2 26 "c": [],
Pawel Zarembski 0:01f31e923fe2 27 "cxx": [],
Pawel Zarembski 0:01f31e923fe2 28 "ld": []
Pawel Zarembski 0:01f31e923fe2 29 }
Pawel Zarembski 0:01f31e923fe2 30 }
Pawel Zarembski 0:01f31e923fe2 31 if 'tool_specific' in build_dicts:
Pawel Zarembski 0:01f31e923fe2 32 for entry in build_dicts['tool_specific']:
Pawel Zarembski 0:01f31e923fe2 33 if entry == tool_search:
Pawel Zarembski 0:01f31e923fe2 34 if 'misc' in build_dicts['tool_specific'][entry]:
Pawel Zarembski 0:01f31e923fe2 35 for flags in build_dicts['tool_specific'][entry]['misc']:
Pawel Zarembski 0:01f31e923fe2 36 if flags.endswith('_flags'):
Pawel Zarembski 0:01f31e923fe2 37 cli_entry = flags[:-len('_flags')]
Pawel Zarembski 0:01f31e923fe2 38 if cli_entry in profile_dict[compiler]:
Pawel Zarembski 0:01f31e923fe2 39 profile_dict[compiler][cli_entry].extend(build_dicts['tool_specific'][entry]['misc'][flags])
Pawel Zarembski 0:01f31e923fe2 40 else:
Pawel Zarembski 0:01f31e923fe2 41 profile_dict[compiler][cli_entry] = build_dicts['tool_specific'][entry]['misc'][flags]
Pawel Zarembski 0:01f31e923fe2 42
Pawel Zarembski 0:01f31e923fe2 43 with open(filename, 'w') as custom_profile:
Pawel Zarembski 0:01f31e923fe2 44 json.dump(profile_dict, custom_profile, indent=4, separators=(',', ': '))
Pawel Zarembski 0:01f31e923fe2 45
Pawel Zarembski 0:01f31e923fe2 46 def generate_custom_targets(target_name, build_dicts, out_ext='hex', filename = 'custom_targets.json'):
Pawel Zarembski 0:01f31e923fe2 47 target_dict = {
Pawel Zarembski 0:01f31e923fe2 48 target_name : {
Pawel Zarembski 0:01f31e923fe2 49 "core": build_dicts['common']['core'][0],
Pawel Zarembski 0:01f31e923fe2 50 "supported_toolchains": ["ARM"],
Pawel Zarembski 0:01f31e923fe2 51 "inherits": ["Target"],
Pawel Zarembski 0:01f31e923fe2 52 "OUTPUT_EXT": out_ext,
Pawel Zarembski 0:01f31e923fe2 53 "macros" : []
Pawel Zarembski 0:01f31e923fe2 54 }
Pawel Zarembski 0:01f31e923fe2 55 }
Pawel Zarembski 0:01f31e923fe2 56 if 'common' in build_dicts:
Pawel Zarembski 0:01f31e923fe2 57 for entry in build_dicts['common']:
Pawel Zarembski 0:01f31e923fe2 58 if entry == 'macros':
Pawel Zarembski 0:01f31e923fe2 59 if entry in target_dict[target_name]:
Pawel Zarembski 0:01f31e923fe2 60 target_dict[target_name][entry].extend(build_dicts['common'][entry])
Pawel Zarembski 0:01f31e923fe2 61 else:
Pawel Zarembski 0:01f31e923fe2 62 target_dict[target_name][entry] = build_dicts['common'][entry]
Pawel Zarembski 0:01f31e923fe2 63
Pawel Zarembski 0:01f31e923fe2 64 with open(filename, 'w') as custom_targets:
Pawel Zarembski 0:01f31e923fe2 65 json.dump(target_dict,custom_targets, indent=4, separators=(',', ': '))