@@ -67,6 +67,8 @@ def id(self):
67
67
board_id = boards .ONION_OMEGA
68
68
elif chip_id == chips .MIPS24KEC :
69
69
board_id = boards .ONION_OMEGA2
70
+ elif chip_id == chips .ZYNQ7000 :
71
+ board_id = self ._pynq_id ()
70
72
elif chip_id == chips .A64 :
71
73
board_id = self ._pine64_id ()
72
74
return board_id
@@ -232,6 +234,22 @@ def _pine64_id(self):
232
234
board = boards .PINEPHONE
233
235
return board
234
236
237
+ # pylint: disable=no-self-use
238
+ def _pynq_id (self ):
239
+ """Try to detect the id for Xilinx PYNQ boards."""
240
+ try :
241
+ with open ("/proc/device-tree/chosen/pynq_board" , "r" ) as board_file :
242
+ board_model = board_file .read ()
243
+ match = board_model .upper ().replace ('-' , '_' ).rstrip ('\x00 ' )
244
+ for model in boards ._PYNQ_IDS :
245
+ if model == match :
246
+ return model
247
+
248
+ return None
249
+
250
+ except FileNotFoundError :
251
+ return None
252
+
235
253
@property
236
254
def any_96boards (self ):
237
255
"""Check whether the current board is any 96boards board."""
@@ -267,6 +285,11 @@ def any_coral_board(self):
267
285
"""Check whether the current board is any defined Coral."""
268
286
return self .CORAL_EDGE_TPU_DEV
269
287
288
+ @property
289
+ def any_pynq_board (self ):
290
+ """Check whether the current board is any defined PYNQ Board."""
291
+ return self .id in boards ._PYNQ_IDS
292
+
270
293
@property
271
294
def any_giant_board (self ):
272
295
"""Check whether the current board is any defined Giant Board."""
@@ -306,6 +329,7 @@ def any_embedded_linux(self):
306
329
self .any_giant_board , self .any_jetson_board , self .any_coral_board ,
307
330
self .any_odroid_40_pin , self .any_96boards , self .any_sifive_board ,
308
331
self .any_onion_omega_board , self .any_pine64_board ,
332
+ self .any_pynq_board ,
309
333
]
310
334
)
311
335
0 commit comments