Skip to content

Commit cf9d244

Browse files
authored
Merge pull request #10490 from LinuxJedi/more-membrowse
Add lots more membrowse platforms
2 parents 4c0c093 + 10c1816 commit cf9d244

12 files changed

Lines changed: 483 additions & 14 deletions

File tree

.github/membrowse-targets.json

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

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

Lines changed: 21 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,23 @@ 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+
# Map file enables Membrowse library/object attribution
274+
if [[ -f "${BUILD_OUT}/zephyr.map" ]]; then
275+
cp "${BUILD_OUT}/zephyr.map" /artifacts/zephyr.map
276+
fi
277+
fi
278+
259279
# Run the app for emulator targets and watch for completion
260280
case "${BOARD_TARGET}" in
261281
native_sim*|qemu_*)
@@ -342,6 +362,7 @@ docker rm -f "${CONTAINER_NAME}" 2>/dev/null || true
342362
DOCKER_ARGS=(
343363
--name "${CONTAINER_NAME}"
344364
--rm
365+
-v "${ARTIFACTS_DIR}:/artifacts"
345366
)
346367

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

.github/workflows/membrowse-onboard.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
needs: load-targets
3131
if: github.repository_owner == 'wolfssl'
3232
runs-on: ubuntu-24.04
33-
timeout-minutes: 10
33+
timeout-minutes: 30
3434
strategy:
3535
fail-fast: false
3636
matrix:
@@ -47,6 +47,7 @@ jobs:
4747
uses: ./.github/actions/install-apt-deps
4848
with:
4949
packages: ${{ matrix.apt_packages }}
50+
cache: ${{ matrix.apt_cache || 'true' }}
5051

5152
- name: Run Membrowse Onboard Action
5253
uses: membrowse/membrowse-action/onboard-action@v1

.github/workflows/membrowse-report.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
needs: [load-targets, check-changes]
6969
if: github.repository_owner == 'wolfssl' && (github.event_name != 'pull_request' || needs.check-changes.outputs.needs_build == 'true')
7070
runs-on: ubuntu-24.04
71-
timeout-minutes: 10
71+
timeout-minutes: 30
7272
strategy:
7373
fail-fast: false
7474
matrix:
@@ -86,6 +86,7 @@ jobs:
8686
uses: ./.github/actions/install-apt-deps
8787
with:
8888
packages: ${{ matrix.apt_packages }}
89+
cache: ${{ matrix.apt_cache || 'true' }}
8990

9091
- name: Build firmware
9192
if: needs.check-changes.outputs.needs_build == 'true'
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Membrowse Zephyr Report
2+
3+
# Triggered after the heavy Zephyr 4.x test workflow completes. Pulls the
4+
# pre-built zephyr.elf, zephyr.map and linker.cmd artifacts staged by
5+
# zephyr-test.sh and feeds them to the Membrowse memory-tracking service.
6+
# This avoids duplicating the (slow) Zephyr build inside the Membrowse
7+
# matrix.
8+
9+
on:
10+
workflow_run:
11+
workflows: [Zephyr 4.x tests]
12+
types:
13+
- completed
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_sha }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
analyze:
21+
runs-on: ubuntu-24.04
22+
timeout-minutes: 10
23+
# Only run from the wolfssl org to avoid burning forks' CI minutes
24+
# and reporting fork builds to the membrowse backend.
25+
if: >
26+
github.event.workflow_run.conclusion == 'success' &&
27+
github.repository_owner == 'wolfssl'
28+
permissions:
29+
contents: read
30+
actions: read
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
include:
35+
- target_name: zephyr-native_sim
36+
artifact: membrowse-zephyr-native_sim
37+
- target_name: zephyr-frdm_rw612
38+
artifact: membrowse-zephyr-frdm_rw612
39+
steps:
40+
# Check out the commit the Zephyr workflow actually built so Membrowse
41+
# attributes the report to the right commit. Only the last 2 commits
42+
# are needed (current + parent) to resolve the base for comparison.
43+
- name: Checkout repository
44+
uses: actions/checkout@v5
45+
with:
46+
ref: ${{ github.event.workflow_run.head_sha }}
47+
fetch-depth: 2
48+
49+
- name: Download Zephyr build artifact
50+
id: download
51+
uses: actions/download-artifact@v4
52+
with:
53+
name: ${{ matrix.artifact }}
54+
path: zephyr-artifacts/${{ matrix.target_name }}
55+
run-id: ${{ github.event.workflow_run.id }}
56+
github-token: ${{ secrets.GITHUB_TOKEN }}
57+
continue-on-error: true
58+
59+
- name: Verify artifact present
60+
id: verify
61+
run: |
62+
ELF="zephyr-artifacts/${{ matrix.target_name }}/zephyr.elf"
63+
LD="zephyr-artifacts/${{ matrix.target_name }}/linker.cmd"
64+
MAP="zephyr-artifacts/${{ matrix.target_name }}/zephyr.map"
65+
if [[ -f "$ELF" && -f "$LD" ]]; then
66+
echo "have_artifacts=true" >> "$GITHUB_OUTPUT"
67+
else
68+
echo "have_artifacts=false" >> "$GITHUB_OUTPUT"
69+
echo "::warning::Membrowse artifact for ${{ matrix.target_name }} not found; the matching cell of zephyr-4.x.yml may have been skipped or excluded."
70+
fi
71+
# The map file is optional; it enables library/object attribution.
72+
if [[ -f "$MAP" ]]; then
73+
echo "map_file=$MAP" >> "$GITHUB_OUTPUT"
74+
else
75+
echo "map_file=" >> "$GITHUB_OUTPUT"
76+
fi
77+
78+
- name: Run Membrowse PR Action
79+
if: steps.verify.outputs.have_artifacts == 'true'
80+
uses: membrowse/membrowse-action@v1
81+
with:
82+
target_name: ${{ matrix.target_name }}
83+
elf: zephyr-artifacts/${{ matrix.target_name }}/zephyr.elf
84+
ld: zephyr-artifacts/${{ matrix.target_name }}/linker.cmd
85+
map_file: ${{ steps.verify.outputs.map_file }}
86+
linker_vars: ""
87+
api_key: ${{ secrets.MEMBROWSE_API_KEY }}
88+
api_url: ${{ vars.MEMBROWSE_API_URL }}
89+
verbose: INFO
90+
91+
# Refresh the consolidated Membrowse PR comment after the Zephyr targets
92+
# have been submitted, mirroring membrowse-comment.yml.
93+
post-comment:
94+
needs: analyze
95+
runs-on: ubuntu-24.04
96+
timeout-minutes: 10
97+
if: >
98+
github.event.workflow_run.event == 'pull_request' &&
99+
github.repository_owner == 'wolfssl'
100+
permissions:
101+
contents: read
102+
pull-requests: write
103+
steps:
104+
- name: Checkout repository
105+
uses: actions/checkout@v5
106+
107+
- name: Post Membrowse PR comment
108+
if: ${{ env.MEMBROWSE_API_KEY != '' }}
109+
uses: membrowse/membrowse-action/comment-action@v1
110+
with:
111+
api_key: ${{ secrets.MEMBROWSE_API_KEY }}
112+
commit: ${{ github.event.workflow_run.head_sha }}
113+
env:
114+
MEMBROWSE_API_KEY: ${{ secrets.MEMBROWSE_API_KEY }}
115+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ SRC_C += ../../src/sniffer.c
8989
SRC_C += ../../src/ssl.c
9090
SRC_C += ../../src/tls.c
9191
SRC_C += ../../src/tls13.c
92+
SRC_C += ../../src/dtls.c
93+
SRC_C += ../../src/dtls13.c
9294
SRC_C += ../../src/wolfio.c
9395

9496
# wolfCrypt Core (FIPS)
@@ -185,6 +187,9 @@ SRC_C += ../../wolfcrypt/src/dsa.c
185187
SRC_C += ../../wolfcrypt/src/md2.c
186188
SRC_C += ../../wolfcrypt/src/md4.c
187189
SRC_C += ../../wolfcrypt/src/ripemd.c
190+
SRC_C += ../../wolfcrypt/src/wc_mldsa.c
191+
SRC_C += ../../wolfcrypt/src/wc_mlkem.c
192+
SRC_C += ../../wolfcrypt/src/wc_mlkem_poly.c
188193

189194

190195
FILENAMES_C = $(notdir $(SRC_C))

IDE/GCC-ARM/Source/wolf_main.c

Lines changed: 91 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
#include <stdio.h>
2828
#include <stdarg.h>
2929
#include <string.h>
30+
#ifdef NO_ASN_TIME
31+
#include <time.h>
32+
#endif
3033

3134

3235
/* TIME CODE */
@@ -37,21 +40,103 @@ static int hw_get_time_sec(void)
3740
{
3841
#warning Must implement your own time source if validating certificates
3942

40-
return ++gTimeMs;
43+
return ++gTimeMs;
44+
}
45+
46+
static int IsLeapYear(int year)
47+
{
48+
return ((year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0));
4149
}
4250

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

50125
#ifndef WOLFCRYPT_ONLY
51126
/* This is used by TLS only */
52-
unsigned int LowResTimer(void)
127+
word32 LowResTimer(void)
128+
{
129+
return (word32)hw_get_time_sec();
130+
}
131+
132+
/* This is used by TLS 1.3 ticket and PSK timeouts. */
133+
#ifdef WOLFSSL_32BIT_MILLI_TIME
134+
word32 TimeNowInMilliseconds(void)
135+
#else
136+
sword64 TimeNowInMilliseconds(void)
137+
#endif
53138
{
54-
return hw_get_time_sec();
139+
return (sword64)my_time(NULL) * 1000;
55140
}
56141
#endif
57142

IDE/GCC-ARM/include.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ EXTRA_DIST+= IDE/GCC-ARM/Source/test_main.c
1010
EXTRA_DIST+= IDE/GCC-ARM/Source/tls_client.c
1111
EXTRA_DIST+= IDE/GCC-ARM/Source/tls_server.c
1212
EXTRA_DIST+= IDE/GCC-ARM/linker.ld
13+
EXTRA_DIST+= IDE/GCC-ARM/linker_large.ld
1314
EXTRA_DIST+= IDE/GCC-ARM/linker_fips.ld
1415
EXTRA_DIST+= IDE/GCC-ARM/Makefile
1516
EXTRA_DIST+= IDE/GCC-ARM/Makefile.bench

0 commit comments

Comments
 (0)