-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✅ ci(artifacts) add RAM/Flash usage CI, basic badges to README
- Loading branch information
1 parent
5907f23
commit 755d109
Showing
5 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: build-artifacts | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout main branch | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main # Ensure we're checking out the main branch | ||
submodules: true # Initialize and update submodules automatically | ||
fetch-depth: 0 # Fetch all history to ensure proper submodule handling | ||
|
||
- name: Initialize submodules (in case it's not done automatically) | ||
run: | | ||
git submodule sync | ||
git submodule update --init --recursive | ||
- name: Install dependencies | ||
run: sudo apt-get update && sudo apt-get install -y gcc-arm-none-eabi make | ||
|
||
- name: Build project | ||
run: | | ||
cd firmware/iot-risk-logger-stm32l4 | ||
make all | ||
- name: Calculate Flash and RAM usage | ||
run: | | ||
cd firmware/iot-risk-logger-stm32l4 | ||
SIZE_OUTPUT=$(arm-none-eabi-size build/iot-risk-logger-stm32l4.elf) | ||
TEXT_SIZE=$(echo "$SIZE_OUTPUT" | awk 'NR==2 {print $1}') | ||
DATA_SIZE=$(echo "$SIZE_OUTPUT" | awk 'NR==2 {print $2}') | ||
BSS_SIZE=$(echo "$SIZE_OUTPUT" | awk 'NR==2 {print $3}') | ||
FLASH_USAGE=$((TEXT_SIZE + DATA_SIZE)) | ||
RAM_USAGE=$((DATA_SIZE + BSS_SIZE)) | ||
echo "Flash usage: $FLASH_USAGE bytes" > flash_usage.txt | ||
echo "RAM usage: $RAM_USAGE bytes" > ram_usage.txt | ||
- name: Checkout artifacts branch | ||
run: | | ||
git fetch origin artifacts | ||
git checkout artifacts | ||
git merge main --no-edit # Merge changes from main into artifacts | ||
- name: Update artifacts | ||
run: | | ||
mv firmware/iot-risk-logger-stm32l4/flash_usage.txt docs/artifacts/ | ||
mv firmware/iot-risk-logger-stm32l4/ram_usage.txt docs/artifacts/ | ||
git add docs/artifacts/flash_usage.txt docs/artifacts/ram_usage.txt | ||
git commit -m "Update Flash and RAM usage artifacts" | ||
git push origin artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
echo "Transforming PlantUML text to diagrams .svg images" | ||
echo "TODO: implement me" |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
# Path to the ELF file generated by the build process | ||
ELF_FILE="firmware/iot-risk-logger-stm32l4/build/iot-risk-logger-stm32l4.elf" | ||
|
||
# Run arm-none-eabi-size and capture the output | ||
SIZE_OUTPUT=$(arm-none-eabi-size $ELF_FILE) | ||
|
||
# Extract text, data, and bss values | ||
TEXT_SIZE=$(echo "$SIZE_OUTPUT" | awk 'NR==2 {print $1}') | ||
DATA_SIZE=$(echo "$SIZE_OUTPUT" | awk 'NR==2 {print $2}') | ||
BSS_SIZE=$(echo "$SIZE_OUTPUT" | awk 'NR==2 {print $3}') | ||
|
||
# Calculate Flash usage (text + data) | ||
FLASH_USAGE=$((TEXT_SIZE + DATA_SIZE)) | ||
|
||
# Calculate RAM usage (data + bss) | ||
RAM_USAGE=$((DATA_SIZE + BSS_SIZE)) | ||
|
||
# Print the results | ||
echo "Memory usage:" | ||
echo "Flash usage: $FLASH_USAGE bytes" | ||
echo "RAM usage: $RAM_USAGE bytes" | ||
|
||
# Update README.md with the new values | ||
#sed -i "/## Flash and RAM Usage/c\## Flash and RAM Usage\n\n- Flash: $FLASH_USAGE bytes\n- RAM: $RAM_USAGE bytes" README.md | ||
|