Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
526b235
Add cpu monitor tenant files
AarC10 Jun 18, 2025
8a0bd0b
Update cmake
AarC10 Jun 18, 2025
107a928
CPU monitor tenant header
AarC10 Jun 18, 2025
685c6f0
Fix singleton
AarC10 Jun 18, 2025
2d97b01
CPU monitor type
AarC10 Jun 18, 2025
25f879b
Add the monitor message port to csensor module
AarC10 Jun 18, 2025
2ed3fc8
Init the tenant in sensor mod
AarC10 Jun 18, 2025
29b76b0
Fix compiler errors and warnings
AarC10 Jun 18, 2025
d35b5d6
Add die temp to backplane module dts
AarC10 Jun 18, 2025
9a1fa01
Add die temp alias
AarC10 Jun 18, 2025
8640f64
Set uptime and die temp and fix aliases/chosen
AarC10 Jun 18, 2025
4048bc3
Need to add ADC for die temp to work on F446
AarC10 Jun 18, 2025
14d8b1c
Update defconfigs for rest of modules
AarC10 Jun 18, 2025
7b4cc66
Add die temp adc to the rest of the modules
AarC10 Jun 18, 2025
15b3455
Delete unnecessary code
AarC10 Jun 18, 2025
f54844d
Code for setting the cpu load
AarC10 Jun 18, 2025
e7451ea
Break out into functions. Cant use cpu load debug functions so lets t…
AarC10 Jun 18, 2025
add4f4b
Utilization function
AarC10 Jun 18, 2025
0b5fe09
Add new sample for cpu monitor testing
AarC10 Jun 18, 2025
a831613
Sample
AarC10 Jun 18, 2025
6e3c591
Update sample.yaml and prj.conf and cmake for sample
AarC10 Jun 18, 2025
f3cda63
Fix thread runtime stats struct
AarC10 Jun 18, 2025
aa9233e
Reverse cycles naming in equation because zephyr has sane naming
AarC10 Jun 18, 2025
cae0edd
Add die temp support in sample for f446
AarC10 Jun 18, 2025
573b3d3
Update sample.yaml
AarC10 Jun 18, 2025
b65b8ad
Fix warnings
AarC10 Jun 18, 2025
98afed9
Have CpuMonitorData defined in header and not an autocoder type
AarC10 Jun 25, 2025
15dca24
Dont integrate CpuMonitorTenant for now into backplane FSW
AarC10 Jun 25, 2025
844347b
Select relevant configs in F-Core
AarC10 Jun 25, 2025
cbe5fca
Fix power mod build
AarC10 Jun 25, 2025
e2a02da
Wipe duplicate
AarC10 Jun 25, 2025
280b2f9
Delta
AarC10 Jun 25, 2025
0a34caf
Merge branch 'main' into feature/Aaron/CPUMonitor
AarC10 Aug 25, 2025
3886abc
Improve accuracy
AarC10 Aug 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions app/backplane/power_module/.idea/editor.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions app/backplane/sensor_module/.idea/csv-editor.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions app/backplane/sensor_module/.idea/editor.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion app/backplane/sensor_module/src/c_sensor_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ static auto alertMsgQueue = CMsgqMessagePort<NAlerts::AlertPacket>(alertQueue);

CSensorModule::CSensorModule()
: CProjectConfiguration(), sensorDataBroadcastMessagePort(broadcastMsgQueue), downlinkMessagePort(downlinkMsgQueue),
sensorDataLogMessagePort(dataLogMsgQueue), alertMessagePort(alertMsgQueue), flight_log{"/lfs/flight_log.txt"} {}
sensorDataLogMessagePort(dataLogMsgQueue),
alertMessagePort(alertMsgQueue), flight_log{"/lfs/flight_log.txt"} {}

void CSensorModule::AddTenantsToTasks() {
// Networking
Expand Down
3 changes: 0 additions & 3 deletions app/samples/.template-project/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ CONFIG_F_CORE=y
CONFIG_F_CORE_OS=y

# outputs
CONFIG_SERIAL=y
CONFIG_FILE_SYSTEM_SHELL=y
CONFIG_HEAP_MEM_POOL_SIZE=8192

CONFIG_DEBUG=y
CONFIG_CBPRINTF_FP_SUPPORT=y

CONFIG_LZ4=y
CONFIG_MAIN_STACK_SIZE=4096

6 changes: 6 additions & 0 deletions app/samples/cpu_monitor/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions app/samples/cpu_monitor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.20.0)

set(FSW_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
include(${FSW_ROOT}/cmake/Autocoders.cmake)

list(APPEND CONF_FILE ${CMAKE_CURRENT_SOURCE_DIR}/prj.conf)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(cpu-monitor LANGUAGES CXX)

target_compile_options(app PRIVATE -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-ignored-qualifiers -Wno-missing-field-initializers)
FILE(GLOB app_sources src/*.cpp)
target_sources(app PRIVATE ${app_sources})

AutocodeTypes()
add_dependencies(app ac_types)
1 change: 1 addition & 0 deletions app/samples/cpu_monitor/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source "Kconfig.zephyr"
16 changes: 16 additions & 0 deletions app/samples/cpu_monitor/boards/nucleo_f446re.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/ {
aliases {
die-temp = &die_temp;
};
};

&die_temp {
status = "okay";
};

&adc1 {
pinctrl-0 = <&adc1_in0_pa0>;
pinctrl-names = "default";
st,adc-prescaler = <4>;
status = "okay";
};
26 changes: 26 additions & 0 deletions app/samples/cpu_monitor/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
CONFIG_CPP=y
CONFIG_REQUIRES_FULL_LIBCPP=y
CONFIG_STD_CPP20=y

CONFIG_F_CORE=y
CONFIG_F_CORE_OS=y

CONFIG_SERIAL=y
CONFIG_FILE_SYSTEM_SHELL=y
CONFIG_HEAP_MEM_POOL_SIZE=8192

CONFIG_DEBUG=y
CONFIG_CBPRINTF_FP_SUPPORT=y

CONFIG_MAIN_STACK_SIZE=4096

# CPU Utilization Support
CONFIG_THREAD_RUNTIME_STATS=y
CONFIG_SCHED_THREAD_USAGE=y

# Die Temperature Support
# .conf overlay didnt work :(
CONFIG_ADC=y
CONFIG_SENSOR=y
CONFIG_STM32_TEMP=y

9 changes: 9 additions & 0 deletions app/samples/cpu_monitor/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sample:
description: Sample application monitoring CPU utilization, uptime and die-temp.
name: cpu-monitor
common:
build_only: true
platform_allow:
- nucleo_f446re
tests:
samples.template.default: {}
24 changes: 24 additions & 0 deletions app/samples/cpu_monitor/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <f_core/os/tenants/c_cpu_monitor_tenant.h>
#include <f_core/messaging/c_msgq_message_port.h>
#include <n_autocoder_types.h>
#include <zephyr/kernel.h>

K_MSGQ_DEFINE(cpuMonitorQueue, sizeof(CpuMonitorData), 1, 4);

int main() {
auto cpuMonitorMsgQueue = CMsgqMessagePort<CpuMonitorData>(cpuMonitorQueue);
CCpuMonitorTenant cpuMonitorTenant(cpuMonitorMsgQueue);

cpuMonitorTenant.Startup();

while (true) {
CpuMonitorData cpuMonitorData{0, 0, 0};
cpuMonitorTenant.Run();
cpuMonitorMsgQueue.Receive(cpuMonitorData, K_FOREVER);
printk("Uptime: %u ms, Utilization: %u%%, Die Temperature: %d °C\n",
cpuMonitorData.Uptime, cpuMonitorData.Utilization, cpuMonitorData.DieTemperature);
k_msleep(1000);
}

return 0;
}
14 changes: 14 additions & 0 deletions boards/arm/deployment_module/deployment_module.dts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
pyro-ctrl-1 = &pyro_ctrl_1;
pyro-ctrl-2 = &pyro_ctrl_2;
pyro-ctrl-3 = &pyro_ctrl_3;

die-temp = &die_temp;
};

leds: leds {
Expand Down Expand Up @@ -251,6 +253,18 @@
status = "okay";
};

&adc1 {
pinctrl-0 = <&adc1_in0_pa0>;
pinctrl-names = "default";
st,adc-prescaler = <4>;
status = "okay";
};


&die_temp {
status = "okay";
};

&flash0 {
partitions {
compatible = "fixed-partitions";
Expand Down
7 changes: 6 additions & 1 deletion boards/arm/deployment_module/deployment_module_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ CONFIG_ENTROPY_STM32_RNG=y
CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR=y

# IO
CONFIG_ADC=y
CONFIG_GPIO=y
CONFIG_I2C=y
CONFIG_PINCTRL=y
CONFIG_RTC=y
CONFIG_SERIAL=y
CONFIG_SPI=y
CONFIG_SPI_ASYNC=y
CONFIG_LED=y
CONFIG_LED=y

# Sensors
CONFIG_SENSOR=y
CONFIG_STM32_TEMP=y
14 changes: 14 additions & 0 deletions boards/arm/power_module/power_module.dts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@

storage = &w25q128;
logfs = &lfs1;
rtc = &rtc;
};

aliases {
inabatt = &ina0;
ina3v3 = &ina1;
ina5v0 = &ina2;

vin = &adc1;
rtc = &rtc;
die-temp = &die_temp;
};

leds: leds {
Expand Down Expand Up @@ -214,6 +217,17 @@
status = "okay";
};

&adc1 {
pinctrl-0 = <&adc1_in0_pa0>;
pinctrl-names = "default";
st,adc-prescaler = <4>;
status = "okay";
};

&die_temp {
status = "okay";
};

&flash0 {

partitions {
Expand Down
4 changes: 3 additions & 1 deletion boards/arm/power_module/power_module_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CONFIG_ENTROPY_STM32_RNG=y
CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR=y

# IO
CONFIG_ADC=y
CONFIG_GPIO=y
CONFIG_I2C=y
#CONFIG_I2C_CALLBACK=y
Expand All @@ -26,4 +27,5 @@ CONFIG_LED=y
CONFIG_SENSOR=y
CONFIG_SENSOR_ASYNC_API=y
CONFIG_SENSOR_INFO=y
CONFIG_INA219=y
CONFIG_INA219=y
CONFIG_STM32_TEMP=y
14 changes: 14 additions & 0 deletions boards/arm/radio_module/radio_module.dts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

storage = &w25q128;
logfs = &lfs1;
rtc = &rtc;
};

fstab {
Expand Down Expand Up @@ -94,6 +95,8 @@

lora = &lora0;
gnss = &maxm10s;

rtc = &rtc;
};
};

Expand Down Expand Up @@ -241,6 +244,17 @@
status = "okay";
};

&adc1 {
pinctrl-0 = <&adc1_in0_pa0>;
pinctrl-names = "default";
st,adc-prescaler = <4>;
status = "okay";
};

&die_temp {
status = "okay";
};

&flash0 {
partitions {
compatible = "fixed-partitions";
Expand Down
5 changes: 5 additions & 0 deletions boards/arm/radio_module/radio_module_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ CONFIG_FPU=y
CONFIG_HW_STACK_PROTECTION=y

# IO
CONFIG_ADC=y
CONFIG_GPIO=y
CONFIG_I2C=y
#CONFIG_I2C_CALLBACK=y
Expand All @@ -26,3 +27,7 @@ CONFIG_POSIX_MAX_FDS=10
# Devices
CONFIG_LORA=y
CONFIG_LORA_SX127X=y

# Sensors
CONFIG_SENSOR=y
CONFIG_STM32_TEMP=y
13 changes: 13 additions & 0 deletions boards/arm/sensor_module/sensor_module.dts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
logfs = &lfs1;

rtc = &rtc;
die-temp = &die_temp;
};

aliases {
led0 = &red_led_1;
led1 = &red_led_2;
die-temp = &die_temp;
};

leds: leds {
Expand Down Expand Up @@ -248,6 +250,17 @@
status = "okay";
};

&adc1 {
pinctrl-0 = <&adc1_in0_pa0>;
pinctrl-names = "default";
st,adc-prescaler = <4>;
status = "okay";
};

&die_temp {
status = "okay";
};

&flash0 {
partitions {
compatible = "fixed-partitions";
Expand Down
4 changes: 3 additions & 1 deletion boards/arm/sensor_module/sensor_module_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ CONFIG_SPI_NOR_SLEEP_WHILE_WAITING_UNTIL_READY=y
CONFIG_LED=y

# Sensors
CONFIG_ADC=y
CONFIG_SENSOR=y
CONFIG_SENSOR_ASYNC_API=y
CONFIG_SENSOR_INFO=y
CONFIG_TMP116=y
CONFIG_BMP388=y
CONFIG_LSM6DSL=y
CONFIG_ADXL375=y
CONFIG_MS5611=y
CONFIG_MS5611=y
CONFIG_STM32_TEMP=y
2 changes: 1 addition & 1 deletion data/autocoder_inputs/types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,4 @@ LoRaReceiveStatistics:
- name: ReceivedSignalStrengthIndicator
type: int16_t
- name: SignalToNoiseRatio
type: int8_t
type: int8_t
Loading
Loading