Skip to content

Commit 9b187dc

Browse files
committed
Add SUPERTARGET! Use scan_resources to find duplicates
1 parent 685e2c5 commit 9b187dc

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

hal/targets.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@
1212
"public": false,
1313
"default_lib": "std"
1414
},
15+
".Super-Target": {
16+
"device_has": ["AACI", "ANALOGIN", "STDIO_MESSAGES", "STORAGE", "TSC", "PORTIN", "I2C_ASYNCH", "DEBUG_AWARENESS", "I2CSLAVE", "CAN", "RTC_LSI", "LOCALFILESYSTEM", "CLCD", "LOWPOWERTIMER", "RTC", "ERROR_PATTERN", "SPI", "SERIAL_ASYNCH", "SERIAL_FC", "SEMIHOST", "INTERRUPTIN", "SPI_ASYNCH", "PORTOUT", "SERIAL", "ANALOGOUT", "SPISLAVE", "PORTINOUT", "PWMOUT", "SLEEP", "ERROR_RED", "ETHERNET", "I2C", "SERIAL_ASYNCH_DMA"],
17+
"features": ["BLE", "IPV4", "IPV6", "CLIENT", "UVISOR"],
18+
"extra_labels": [],
19+
"core": "Cortex-M4",
20+
"fpu": "double",
21+
"public": true,
22+
"default_build": "standard",
23+
"release": true
24+
},
1525
"CM4_UARM": {
1626
"inherits": ["Target"],
1727
"core": "Cortex-M4",

tools/git_hooks/__init__.py

Whitespace-only changes.

tools/git_hooks/find_duplicates.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
from os import walk
2-
from os.path import join
2+
from os.path import join, abspath, dirname, basename
3+
import sys
4+
5+
ROOT = abspath(join(dirname(__file__), "..", ".."))
6+
sys.path.insert(0, ROOT)
7+
8+
from tools.toolchains.gcc import GCC_ARM
9+
from tools.targets import TARGET_MAP
310
from argparse import ArgumentParser
411

512
if __name__ == "__main__":
@@ -9,13 +16,16 @@
916
parser.add_argument("--silent", help="Supress printing of filenames, just return number of duplicates", action="store_true")
1017
args = parser.parse_args()
1118

19+
toolchain = GCC_ARM(TARGET_MAP[".Super-Target"])
20+
21+
resources = sum([toolchain.scan_resources(d) for d in args.dirs], None)
22+
1223
scanned_files = {}
1324

14-
for dir in args.dirs:
15-
for root, dirs, files in walk(dir):
16-
for file in files:
17-
scanned_files.setdefault(file, [])
18-
scanned_files[file].append(join(root, file))
25+
for r in [resources] + resources.features.values():
26+
for file in r.c_sources + r.s_sources + r.cpp_sources + r.objects + r.libraries + r.hex_files + r.bin_files:
27+
scanned_files.setdefault(basename(file), [])
28+
scanned_files[basename(file)].append(file)
1929

2030
count_dupe = 0
2131
for key, value in scanned_files.iteritems():

0 commit comments

Comments
 (0)