Skip to content

Commit 787eaf5

Browse files
committed
Add lots more membrowse platforms
Lots more ARM Cortex, RiscV, AArch64, linuxkm and some Zephyr
1 parent 460a871 commit 787eaf5

8 files changed

Lines changed: 363 additions & 15 deletions

File tree

.github/membrowse-targets.json

Lines changed: 165 additions & 3 deletions
Large diffs are not rendered by default.

.github/scripts/zephyr-4.x/zephyr-test.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ LOG_DIR="${SCRIPT_DIR}/logs"
112112
mkdir -p "${LOG_DIR}"
113113
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
114114
LOG_FILE="${LOG_DIR}/${BOARD_SLUG}_${TIMESTAMP}.log"
115+
ARTIFACTS_DIR="${SCRIPT_DIR}/artifacts/${BOARD_SLUG}-${SAMPLE_NAME}"
116+
mkdir -p "${ARTIFACTS_DIR}"
117+
chmod 0755 "${ARTIFACTS_DIR}"
115118

116119
echo "==> wolfSSL repo: ${WOLFSSL_REPO}"
117120
echo "==> wolfSSL branch: ${WOLFSSL_BRANCH}"
@@ -256,6 +259,19 @@ else
256259
echo ""
257260
echo "==> [container] Build succeeded!"
258261
262+
# Stage Membrowse-relevant artifacts on the host-mounted volume.
263+
# /artifacts is bind-mounted by the host wrapper; if it isn't writable
264+
# (e.g. interactive runs without the mount), skip silently.
265+
if [[ -d /artifacts && -w /artifacts ]]; then
266+
BUILD_OUT="${WORKDIR}/zephyrproject/build/zephyr"
267+
if [[ -f "${BUILD_OUT}/zephyr.elf" ]]; then
268+
cp "${BUILD_OUT}/zephyr.elf" /artifacts/zephyr.elf
269+
fi
270+
if [[ -f "${BUILD_OUT}/linker.cmd" ]]; then
271+
cp "${BUILD_OUT}/linker.cmd" /artifacts/linker.cmd
272+
fi
273+
fi
274+
259275
# Run the app for emulator targets and watch for completion
260276
case "${BOARD_TARGET}" in
261277
native_sim*|qemu_*)
@@ -342,6 +358,7 @@ docker rm -f "${CONTAINER_NAME}" 2>/dev/null || true
342358
DOCKER_ARGS=(
343359
--name "${CONTAINER_NAME}"
344360
--rm
361+
-v "${ARTIFACTS_DIR}:/artifacts"
345362
)
346363

347364
if [[ "$INTERACTIVE" == "1" ]]; then

.github/workflows/membrowse-onboard.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
onboard:
2727
needs: load-targets
2828
runs-on: ubuntu-24.04
29-
timeout-minutes: 10
29+
timeout-minutes: 30
3030
strategy:
3131
fail-fast: false
3232
matrix:
@@ -43,6 +43,7 @@ jobs:
4343
uses: ./.github/actions/install-apt-deps
4444
with:
4545
packages: ${{ matrix.apt_packages }}
46+
cache: ${{ matrix.apt_cache || 'true' }}
4647

4748
- name: Run Membrowse Onboard Action
4849
uses: membrowse/membrowse-action/onboard-action@v1

.github/workflows/membrowse-report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
analyze:
2828
needs: load-targets
2929
runs-on: ubuntu-24.04
30-
timeout-minutes: 10
30+
timeout-minutes: 30
3131
strategy:
3232
fail-fast: false
3333
matrix:
@@ -44,6 +44,7 @@ jobs:
4444
uses: ./.github/actions/install-apt-deps
4545
with:
4646
packages: ${{ matrix.apt_packages }}
47+
cache: ${{ matrix.apt_cache || 'true' }}
4748

4849
- name: Build firmware
4950
run: ${{ matrix.build_cmd }}
@@ -59,4 +60,3 @@ jobs:
5960
api_key: ${{ secrets.MEMBROWSE_API_KEY }}
6061
api_url: ${{ vars.MEMBROWSE_API_URL }}
6162
verbose: INFO
62-
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Membrowse Zephyr Report
2+
3+
# Triggered after the heavy Zephyr 4.x test workflow completes. Pulls the
4+
# pre-built zephyr.elf and linker.cmd artifacts staged by zephyr-test.sh and
5+
# feeds them to the Membrowse memory-tracking service. This avoids
6+
# duplicating the (slow) Zephyr build inside the Membrowse matrix.
7+
8+
on:
9+
workflow_run:
10+
workflows: [Zephyr 4.x tests]
11+
types:
12+
- completed
13+
14+
jobs:
15+
analyze:
16+
runs-on: ubuntu-24.04
17+
if: >
18+
github.event.workflow_run.conclusion == 'success' &&
19+
github.repository_owner == 'wolfssl'
20+
permissions:
21+
contents: read
22+
actions: read
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
include:
27+
- target_name: zephyr-native_sim
28+
artifact: membrowse-zephyr-native_sim
29+
- target_name: zephyr-frdm_rw612
30+
artifact: membrowse-zephyr-frdm_rw612
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v5
34+
with:
35+
fetch-depth: 0
36+
37+
- name: Download Zephyr build artifact
38+
id: download
39+
uses: actions/download-artifact@v4
40+
with:
41+
name: ${{ matrix.artifact }}
42+
path: zephyr-artifacts/${{ matrix.target_name }}
43+
run-id: ${{ github.event.workflow_run.id }}
44+
github-token: ${{ secrets.GITHUB_TOKEN }}
45+
continue-on-error: true
46+
47+
- name: Verify artifact present
48+
id: verify
49+
run: |
50+
ELF="zephyr-artifacts/${{ matrix.target_name }}/zephyr.elf"
51+
LD="zephyr-artifacts/${{ matrix.target_name }}/linker.cmd"
52+
if [[ -f "$ELF" && -f "$LD" ]]; then
53+
echo "have_artifacts=true" >> "$GITHUB_OUTPUT"
54+
else
55+
echo "have_artifacts=false" >> "$GITHUB_OUTPUT"
56+
echo "::warning::Membrowse artifact for ${{ matrix.target_name }} not found; the matching cell of zephyr-4.x.yml may have been skipped or excluded."
57+
fi
58+
59+
- name: Run Membrowse PR Action
60+
if: steps.verify.outputs.have_artifacts == 'true'
61+
uses: membrowse/membrowse-action@v1
62+
with:
63+
target_name: ${{ matrix.target_name }}
64+
elf: zephyr-artifacts/${{ matrix.target_name }}/zephyr.elf
65+
ld: zephyr-artifacts/${{ matrix.target_name }}/linker.cmd
66+
linker_vars: ""
67+
api_key: ${{ secrets.MEMBROWSE_API_KEY }}
68+
api_url: ${{ vars.MEMBROWSE_API_URL }}
69+
verbose: INFO

.github/workflows/zephyr-4.x.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,21 @@ jobs:
7878
path: .github/scripts/zephyr-4.x/logs/
7979
retention-days: 5
8080
if-no-files-found: ignore
81+
82+
# Stage Membrowse artifacts only for the cells we want to track on the
83+
# Membrowse dashboard. Keep this tight to avoid duplicate target_name
84+
# entries on the dashboard and unnecessary artifact uploads.
85+
- name: Upload Membrowse artifacts (selected cells only)
86+
if: >
87+
success() &&
88+
matrix.zephyr-ref == 'v4.3.0' &&
89+
matrix.sample == 'wolfssl_test' &&
90+
matrix.extra-conf == ''
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: membrowse-zephyr-${{ matrix.board == 'native_sim' && 'native_sim' || 'frdm_rw612' }}
94+
path: |
95+
.github/scripts/zephyr-4.x/artifacts/${{ matrix.board == 'native_sim' && 'native_sim' || 'frdm_rw612-rw612' }}-wolfssl_test/zephyr.elf
96+
.github/scripts/zephyr-4.x/artifacts/${{ matrix.board == 'native_sim' && 'native_sim' || 'frdm_rw612-rw612' }}-wolfssl_test/linker.cmd
97+
if-no-files-found: warn
98+
retention-days: 1

IDE/GCC-ARM/Header/user_settings.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,10 @@ extern "C" {
469469
/* Override Current Time */
470470
/* Allows custom "custom_time()" function to be used for benchmark */
471471
#define WOLFSSL_USER_CURRTIME
472-
#define WOLFSSL_GMTIME
472+
#define TIME_OVERRIDES
473473
#define USER_TICKS
474-
extern unsigned long my_time(unsigned long* timer);
475474
#define XTIME my_time
475+
#define XGMTIME my_gmtime
476476

477477

478478
/* ------------------------------------------------------------------------- */
@@ -656,4 +656,3 @@ extern unsigned int my_rng_seed_gen(void);
656656
#endif
657657

658658
#endif /* WOLFSSL_USER_SETTINGS_H */
659-

IDE/GCC-ARM/Source/wolf_main.c

Lines changed: 88 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,103 @@ static int hw_get_time_sec(void)
3737
{
3838
#warning Must implement your own time source if validating certificates
3939

40-
return ++gTimeMs;
40+
return ++gTimeMs;
41+
}
42+
43+
static int IsLeapYear(int year)
44+
{
45+
return ((year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0));
4146
}
4247

4348
/* This is used by wolfCrypt asn.c for cert time checking */
44-
unsigned long my_time(unsigned long* timer)
49+
time_t my_time(time_t* timer)
50+
{
51+
time_t curTime = (time_t)hw_get_time_sec();
52+
53+
if (timer != NULL) {
54+
*timer = curTime;
55+
}
56+
57+
return curTime;
58+
}
59+
60+
struct tm* my_gmtime(const time_t* timer, struct tm* tmp)
4561
{
46-
(void)timer;
47-
return hw_get_time_sec();
62+
static struct tm staticTime;
63+
static const unsigned char daysPerMonth[] =
64+
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
65+
time_t curTime;
66+
long days;
67+
long rem;
68+
int year;
69+
int yearDays;
70+
int month;
71+
int monthDays;
72+
73+
if (tmp == NULL) {
74+
tmp = &staticTime;
75+
}
76+
77+
curTime = (timer != NULL) ? *timer : my_time(NULL);
78+
if (curTime < 0) {
79+
curTime = 0;
80+
}
81+
82+
days = (long)(curTime / 86400);
83+
rem = (long)(curTime % 86400);
84+
85+
tmp->tm_hour = (int)(rem / 3600);
86+
rem %= 3600;
87+
tmp->tm_min = (int)(rem / 60);
88+
tmp->tm_sec = (int)(rem % 60);
89+
tmp->tm_wday = (int)((days + 4) % 7);
90+
91+
year = 1970;
92+
while (1) {
93+
yearDays = IsLeapYear(year) ? 366 : 365;
94+
if (days < yearDays) {
95+
break;
96+
}
97+
days -= yearDays;
98+
year++;
99+
}
100+
101+
tmp->tm_year = year - 1900;
102+
tmp->tm_yday = (int)days;
103+
104+
for (month = 0; month < 12; month++) {
105+
monthDays = daysPerMonth[month];
106+
if (month == 1 && IsLeapYear(year)) {
107+
monthDays++;
108+
}
109+
if (days < monthDays) {
110+
break;
111+
}
112+
days -= monthDays;
113+
}
114+
115+
tmp->tm_mon = month;
116+
tmp->tm_mday = (int)days + 1;
117+
tmp->tm_isdst = 0;
118+
119+
return tmp;
48120
}
49121

50122
#ifndef WOLFCRYPT_ONLY
51123
/* This is used by TLS only */
52-
unsigned int LowResTimer(void)
124+
word32 LowResTimer(void)
125+
{
126+
return (word32)hw_get_time_sec();
127+
}
128+
129+
/* This is used by TLS 1.3 ticket and PSK timeouts. */
130+
#ifdef WOLFSSL_32BIT_MILLI_TIME
131+
word32 TimeNowInMilliseconds(void)
132+
#else
133+
sword64 TimeNowInMilliseconds(void)
134+
#endif
53135
{
54-
return hw_get_time_sec();
136+
return (sword64)my_time(NULL) * 1000;
55137
}
56138
#endif
57139

0 commit comments

Comments
 (0)