Skip to content

Commit 979f342

Browse files
committed
Add script to set cpu frequency, used in thermal tests
1 parent 420c1cc commit 979f342

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

recipes-support/arduino-ootb/arduino-ootb.bb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ SRC_URI = " \
1212
file://connection_status_led \
1313
file://ec200a-eu.service \
1414
file://compose-apps-aklite-offline-run.service \
15+
file://set_cpu_freq \
1516
"
1617

1718
inherit systemd
@@ -33,6 +34,11 @@ do_install() {
3334
install -m 0755 ${WORKDIR}/connection_status_led ${D}${bindir}/
3435
}
3536

37+
do_install:append:lmp-base() {
38+
install -d ${D}${bindir}
39+
install -m 0755 ${WORKDIR}/set_cpu_freq ${D}${bindir}/
40+
}
41+
3642
RDEPENDS:${PN} += "systemd udev-rules-portenta"
3743

3844
FILES:${PN} += " \
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
CPU_FREQUENCIES=(200 400 600 1200 1600)
4+
5+
if [[ ! " ${CPU_FREQUENCIES[@]} " =~ " $1 " ]]; then
6+
echo "Error: Invalid min frequency. Must be one of: ${CPU_FREQUENCIES[@]}"
7+
exit 1
8+
fi
9+
10+
if [[ ! " ${CPU_FREQUENCIES[@]} " =~ " $2 " ]]; then
11+
echo "Error: Invalid max frequency. Must be one of: ${CPU_FREQUENCIES[@]}"
12+
exit 1
13+
fi
14+
15+
echo "Min $1MHz, max $2MHz"
16+
for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "powersave" | sudo tee $i; done
17+
for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_min_freq; do echo "${1}000" | sudo tee $i; done
18+
for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq; do echo "${2}000" | sudo tee $i; done

0 commit comments

Comments
 (0)