Skip to content

Commit defd97c

Browse files
janjongboomzherczeg
authored andcommitted
target: mbedos5: Update generate_pins.py to use the new Python API for querying targets, and use the new location of target PinNames.h file. Previously make source/pins.cpp just failed silently, and returned an empty file. Therefore using pin names from JS (LED1) would silently fail when building JerryScript against mbed OS 5.2.3. We missed this because it does not happen when you upgrade an existing mbed OS 5.1 project. Fixes #1493. (#1494)
JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom [email protected]
1 parent eec3981 commit defd97c

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

targets/mbedos5/tools/generate_pins.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def enumerate_includes(root_dir, directories):
6565
"""
6666
for root, dirs, files in os.walk(root_dir, topdown=True):
6767
# modify dirs in place
68-
dirs[:] = filter(lambda x: x in directory_labels
68+
dirs[:] = filter(lambda x: x in directory_labels
6969
or ( not x.startswith('TARGET_')
7070
and not x.startswith('TOOLCHAIN_')), dirs)
7171
yield root
@@ -118,8 +118,8 @@ def enumerate_pins(c_source_file, include_dirs, definitions):
118118
"""
119119
definitions += ['__attribute(x)__=', '__extension__(x)=', 'register=', '__IO=', 'uint32_t=unsigned int']
120120

121-
gcc_args = ['-E', '-fmerge-all-constants']
122-
gcc_args += ['-I' + directory for directory in include_dirs]
121+
gcc_args = ['-E', '-fmerge-all-constants']
122+
gcc_args += ['-I' + directory for directory in include_dirs]
123123

124124
gcc_args += ['-D' + definition for definition in definitions]
125125
ast = parse_file(c_source_file,
@@ -159,15 +159,13 @@ def enumerate_pins(c_source_file, include_dirs, definitions):
159159
args = parser.parse_args()
160160
board_name = args.board.upper()
161161

162-
target = Target(board_name)
162+
target = Target.get_target(board_name)
163163

164-
directory_labels = ['TARGET_' + label for label in target.get_labels()] + target.macros
164+
directory_labels = ['TARGET_' + label for label in target.labels] + target.macros
165165

166-
targets_dir = os.path.join('.', 'mbed-os', 'hal', 'targets')
167-
hal_dir = os.path.join(targets_dir, 'hal')
168-
169-
pins_file = find_file(hal_dir, directory_labels, 'PinNames.h')
166+
targets_dir = os.path.join('.', 'mbed-os', 'targets')
170167

168+
pins_file = find_file(targets_dir, directory_labels, 'PinNames.h')
171169

172170
includes = enumerate_includes(targets_dir, directory_labels)
173171
defines = list(directory_labels)

0 commit comments

Comments
 (0)