Skip to content

Commit

Permalink
Support '--package' option and tar all flashable, debug, and dbc outp…
Browse files Browse the repository at this point in the history
…uts as well as store as artifacts on PR's.
  • Loading branch information
JoshLafleur committed Feb 11, 2025
1 parent 2c5e86c commit 9185a88
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 68 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/standard_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jobs:
- name: Execute build for CFR24
run: |
scons --platform=cfr24 -j32 --flashable-bootloader
- name: Archive Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-cfr24
path: platform-artifacts/
cfr25:
runs-on: self-hosted
container:
Expand All @@ -37,6 +42,11 @@ jobs:
- name: Execute build for CFR25
run: |
scons --platform=cfr25 -j32 --flashable-bootloader
- name: Archive Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-cfr25
path: platform-artifacts/
updaters:
runs-on: self-hosted
container:
Expand All @@ -53,3 +63,8 @@ jobs:
- name: Execute build for all bootloader updaters
run: |
scons --targets=bl:1000,1001,1002,1003,1004,1005,1010,1011 -j32
- name: Archive Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-bootloader_updater
path: platform-artifacts/
32 changes: 31 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from os import environ
from re import compile, findall, search

from SCons.Node import NodeList
from SCons.Script import (
AddOption,
Default,
Expand All @@ -11,11 +12,12 @@ from SCons.Script import (
Exit,
GetOption,
SConscript,
File
)
from oyaml import safe_load

# create a global environment which all targets can start from
GlobalEnv = Environment(REPO_ROOT_DIR=Dir("#"), tools=[])
GlobalEnv = Environment(REPO_ROOT_DIR=Dir("#"), tools=[ "tar" ])
try:
GlobalEnv["ENV"]["TERM"] = environ["TERM"]
except Exception:
Expand Down Expand Up @@ -169,3 +171,31 @@ if PlatformEnv["ARTIFACTS"]:

openocd_gdb = debug_env.openocd_gdb(artifact, *args)
Default(openocd_gdb)

PlatformEnv.Append(
TARFLAGS = '-c -z',
)

def flatten(sequence: list) -> list:
new_list = []
for item in sequence:
if type(item) != list and type(item) != NodeList:
new_list.append(item)
else:
new_list.extend(flatten(item))
return new_list

AddOption("--package", dest="package", action="store_true")

artifacts = []
for key, value in PlatformEnv["ARTIFACTS"].items():
if type(value) is dict:
for name, val in value.items():
if "ARTIFACT" in name:
artifacts.append(val["artifact"])
plat_name = GetOption("platform") or "artifacts"
package = PlatformEnv.Tar(f"platform-artifacts/{plat_name}.tgz", [ file.abspath for file in flatten(artifacts) ])
Depends(package, artifacts)

if GetOption("package"):
Default(package)
32 changes: 15 additions & 17 deletions components/bootloaders/STM/stm32f1/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -274,22 +274,20 @@ Alias("asms", asms)
# Return artifacts to the caller
artifacts = {}

if len(binaries) == 1:
artifacts["FLASHABLE_ARTIFACT"] = {
"artifact": binaries[0],
"addr": APP_START_ADDR,
"tools": ["st-flash"],
}

if len(elfs) == 1:
artifacts["DEBUG_ARTIFACT"] = {
"artifact": elfs[0],
"args": [],
"tools": ["gcc-arm-none-eabi", "openocd"],
"env": {
"OPENOCD_INTERFACE": "stlink",
"OPENOCD_MCU": "stm32f103c8",
},
}
artifacts["FLASHABLE_ARTIFACT"] = {
"artifact": binaries_crced,
"addr": APP_START_ADDR,
"tools": ["st-flash"],
}

artifacts["DEBUG_ARTIFACT"] = {
"artifact": elfs,
"args": [],
"tools": ["gcc-arm-none-eabi", "openocd"],
"env": {
"OPENOCD_INTERFACE": "stlink",
"OPENOCD_MCU": "stm32f103c8",
},
}

Return("artifacts")
50 changes: 0 additions & 50 deletions site_scons/site_tools/package.py

This file was deleted.

0 comments on commit 9185a88

Please sign in to comment.