@@ -67,6 +67,8 @@ def id(self):
6767 board_id = boards .ONION_OMEGA
6868 elif chip_id == chips .MIPS24KEC :
6969 board_id = boards .ONION_OMEGA2
70+ elif chip_id == chips .ZYNQ7000 :
71+ board_id = self ._pynq_id ()
7072 elif chip_id == chips .A64 :
7173 board_id = self ._pine64_id ()
7274 return board_id
@@ -232,6 +234,22 @@ def _pine64_id(self):
232234 board = boards .PINEPHONE
233235 return board
234236
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+
235253 @property
236254 def any_96boards (self ):
237255 """Check whether the current board is any 96boards board."""
@@ -267,6 +285,11 @@ def any_coral_board(self):
267285 """Check whether the current board is any defined Coral."""
268286 return self .CORAL_EDGE_TPU_DEV
269287
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+
270293 @property
271294 def any_giant_board (self ):
272295 """Check whether the current board is any defined Giant Board."""
@@ -306,6 +329,7 @@ def any_embedded_linux(self):
306329 self .any_giant_board , self .any_jetson_board , self .any_coral_board ,
307330 self .any_odroid_40_pin , self .any_96boards , self .any_sifive_board ,
308331 self .any_onion_omega_board , self .any_pine64_board ,
332+ self .any_pynq_board ,
309333 ]
310334 )
311335
0 commit comments