Skip to content

Commit ec95b17

Browse files
committed
Added STM32MP1 detection
1 parent 0de2f8b commit ec95b17

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

adafruit_platformdetect/board.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ def id(self):
125125
board_id = self._udoo_id()
126126
elif chip_id == chips.PENTIUM_N3710:
127127
board_id = self._udoo_id()
128+
elif chip_id == chips.STM32MP157:
129+
board_id = self._stm32mp1_id()
128130

129131
return board_id
130132

@@ -251,6 +253,13 @@ def _sama5_id(self):
251253
return boards.GIANT_BOARD
252254
return None
253255

256+
def _stm32mp1_id(self):
257+
"""Check what type stm32mp1 board."""
258+
board_value = self.detector.get_device_model()
259+
if "STM32MP157C-DK2" in board_value:
260+
return boards.STM32MP157C_DK2
261+
return None
262+
254263
def _imx8mx_id(self):
255264
"""Check what type iMX8M board."""
256265
board_value = self.detector.get_device_model()
@@ -430,6 +439,11 @@ def any_asus_tinker_board(self):
430439
"""Check to see if the current board is an ASUS Tinker Board"""
431440
return self.id in boards._ASUS_TINKER_BOARD_IDS
432441

442+
@property
443+
def any_stm32mp1(self):
444+
"""Check whether the current board is any stm32mp1 board."""
445+
return self.id in boards._STM32MP1_IDS
446+
433447
@property
434448
def any_embedded_linux(self):
435449
"""Check whether the current board is any embedded Linux device."""
@@ -451,6 +465,7 @@ def any_embedded_linux(self):
451465
self.any_clockwork_pi_board,
452466
self.any_udoo_board,
453467
self.any_asus_tinker_board,
468+
self.any_stm32mp1,
454469
]
455470
)
456471

adafruit_platformdetect/chip.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ def _linux_id(self):
133133
if self.detector.check_dt_compatible_value("rockchip,rk3288"):
134134
return chips.RK3288
135135

136+
if self.detector.check_dt_compatible_value("st,stm32mp157"):
137+
return chips.STM32MP157
138+
136139
linux_id = None
137140
hardware = self.detector.get_cpuinfo_field("Hardware")
138141

adafruit_platformdetect/constants/boards.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454
PYNQ_Z1 = "PYNQ_Z1"
5555
PYNQ_Z2 = "PYNQ_Z2"
5656

57+
# STM32 MPU boards
58+
STM32MP157C_DK2 = "STM32MP157C_DK2"
59+
5760
# Various Raspberry Pi models
5861
RASPBERRY_PI_B_REV1 = "RASPBERRY_PI_B_REV1"
5962
RASPBERRY_PI_B_REV2 = "RASPBERRY_PI_B_REV2"
@@ -109,6 +112,9 @@
109112
# Asus Tinkerboard
110113
_ASUS_TINKER_BOARD_IDS = (ASUS_TINKER_BOARD,)
111114

115+
# STM32MP1
116+
_STM32MP1_IDS = (STM32MP157C_DK2,)
117+
112118
# OrangePI
113119
_ORANGE_PI_IDS = (
114120
ORANGE_PI_PC,

adafruit_platformdetect/constants/chips.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@
3232
LPC4330 = "LPC4330"
3333
RK3288 = "RK3288"
3434
PENTIUM_N3710 = "PENTIUM_N3710" # SOC Braswell core
35+
STM32MP157 = "STM32MP157"
3536

3637
BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2835", "BCM2837"}

bin/detect.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
print("Is this a generic Linux PC?", detector.board.GENERIC_LINUX_PC)
2626
print("Is this a UDOO Bolt?", detector.board.UDOO_BOLT)
2727
print("Is this an ASUS Tinker Board?", detector.board.ASUS_TINKER_BOARD)
28+
print("Is this an STM32MP1 Board?", detector.board.any_stm32mp1)
2829
print(
2930
"Is this an OS environment variable special case?",
3031
detector.board.FTDI_FT232H

0 commit comments

Comments
 (0)