Skip to content

Commit fbc1d02

Browse files
authored
Adapt build for Mac OS and arm mode compilation (#62)
* Adapt makefile for mac OS and arm mode compilation * Add . zizmor scanning and fixes * Update rtems submodule * Update rtems-source-builder
1 parent 3263e4b commit fbc1d02

5 files changed

Lines changed: 67 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ on:
66
pull_request:
77
branches: [ master ]
88

9+
permissions: {}
10+
911
jobs:
1012
build:
13+
permissions:
14+
contents: read
1115
timeout-minutes: 150
1216
strategy:
1317
fail-fast: false
@@ -17,7 +21,9 @@ jobs:
1721
- macOS-latest
1822
runs-on: ${{ matrix.os }}
1923
steps:
20-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
25+
with:
26+
persist-credentials: false
2127
- name: Install dependencies
2228
shell: bash
2329
run: |
@@ -76,14 +82,16 @@ jobs:
7682
- name: Create package
7783
run: make package
7884
- name: Upload package artifact
79-
uses: actions/upload-artifact@v4
85+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
8086
with:
8187
name: package-${{ runner.os }}
8288
path: |
8389
package/*
8490
external/rtems-source-builder/rtems/rsb-report-*.txt
8591
8692
upload:
93+
permissions:
94+
actions: read
8795
if: ${{ github.ref == 'refs/heads/master' }} # Only upload on master builds
8896
needs: build
8997
strategy:
@@ -95,7 +103,7 @@ jobs:
95103
steps:
96104

97105
- name: Download a single artifact
98-
uses: actions/download-artifact@v4
106+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
99107
with:
100108
name: package-${{ runner.os }}
101109
path: package

.github/workflows/zizmor.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: GitHub Actions Security Analysis with zizmor 🌈
2+
3+
on:
4+
push:
5+
branches: ["**"]
6+
pull_request:
7+
branches: ["**"]
8+
9+
permissions: {}
10+
11+
jobs:
12+
zizmor:
13+
name: Run zizmor 🌈
14+
runs-on: ubuntu-latest
15+
permissions:
16+
security-events: write # Required for upload-sarif (used by zizmor-action) to upload SARIF files.
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20+
with:
21+
persist-credentials: false
22+
23+
- name: Run zizmor 🌈
24+
uses: zizmorcore/zizmor-action@0dce2577a4760a2749d8cfb7a84b7d5585ebcb7d # v0.5.0

Makefile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,24 @@ OPTIMIZATION = 2
7171
EXTRA_BSP_OPTS =
7272
endif
7373

74+
# On macOS, files downloaded via browser/AirDrop can inherit quarantine and
75+
# trigger Gatekeeper for freshly built cross-tools (e.g. arm-rtems5-ar).
76+
ifeq ($(UNAME),Darwin)
77+
define UNQUARANTINE_CMD
78+
if command -v xattr >/dev/null 2>&1; then \
79+
for d in "$(PREFIX)/$(TARGET)/bin" "$(PREFIX)/bin"; do \
80+
if [ -d "$$d" ]; then \
81+
xattr -dr com.apple.quarantine "$$d" 2>/dev/null || true; \
82+
fi; \
83+
done; \
84+
fi
85+
endef
86+
else
87+
define UNQUARANTINE_CMD
88+
true
89+
endef
90+
endif
91+
7492

7593
export ORGPATH := $(PATH)
7694
export PATH := $(PREFIX)/bin:$(PATH)
@@ -101,11 +119,13 @@ bootstrap:
101119
toolchain:
102120
mkdir -p $(BUILD_LOGS)
103121
rm -rf $(RSB)/rtems/build
122+
@$(UNQUARANTINE_CMD)
104123
cd $(RSB)/rtems && ../source-builder/sb-set-builder \
105124
--prefix=$(PREFIX) \
106125
--log=$(BUILD_LOGS)/rsb-toolchain.log \
107126
--with-fortran \
108127
$(RTEMS_VERSION)/rtems-$(ARCH)
128+
@$(UNQUARANTINE_CMD)
109129
rm -rf $(RSB)/rtems/build
110130

111131
.PHONY: toolchain-revision
@@ -338,6 +358,7 @@ cryptoauthlib: cmake_toolchain_config
338358
-DATCA_USE_ATCAB_FUNCTIONS=ON \
339359
-DATCA_PRINTF=OFF \
340360
-DUNIX=true \
361+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
341362
-DCMAKE_TOOLCHAIN_FILE=$(CMAKE_TOOLCHAIN_CONFIG) ..
342363
cd $(SRC_CRYPTOAUTHLIB)/build && \
343364
make DESTDIR=$(SRC_CRYPTOAUTHLIB)/install install && \
@@ -349,11 +370,20 @@ cryptoauthlib: cmake_toolchain_config
349370
touch $(PREFIX)/$(TARGET)/$(BSP)/lib/include/cryptoauthlib/atca_start_iface.h
350371

351372

373+
BLAS_CPU_FLAGS = -march=armv7-a -marm -mfloat-abi=hard -mtune=cortex-a7 -mfpu=neon
374+
BLAS_CFLAGS = -O3 $(BLAS_CPU_FLAGS)
375+
BLAS_FFLAGS = -O3 $(BLAS_CPU_FLAGS)
376+
BLAS_FFLAGS_NOOPT = -O0 -frecursive $(BLAS_CPU_FLAGS)
377+
352378
BLAS_TOOLS=\
353379
BLLIB='$(MAKEFILE_DIR)external/BLAS/CBLAS/lib/blas_ARM.a' \
354380
CBLIB='$(MAKEFILE_DIR)external/BLAS/CBLAS/lib/cblas_ARM.a' \
355381
CC='$(MAKEFILE_DIR)rtems/$(RTEMS_VERSION)/bin/$(ARCH)-rtems$(RTEMS_VERSION)-gcc' \
356382
FC='$(MAKEFILE_DIR)rtems/$(RTEMS_VERSION)/bin/$(ARCH)-rtems$(RTEMS_VERSION)-gfortran' \
383+
CFLAGS='$(BLAS_CFLAGS)' \
384+
FFLAGS='$(BLAS_FFLAGS)' \
385+
FFLAGS_DRV='$(BLAS_FFLAGS)' \
386+
FFLAGS_NOOPT='$(BLAS_FFLAGS_NOOPT)' \
357387
RANLIB='$(MAKEFILE_DIR)rtems/$(RTEMS_VERSION)/$(ARCH)-rtems$(RTEMS_VERSION)/bin/ranlib' \
358388
AR='$(MAKEFILE_DIR)rtems/$(RTEMS_VERSION)/$(ARCH)-rtems$(RTEMS_VERSION)/bin/ar' \
359389
ARCH=$(AR)

external/rtems

0 commit comments

Comments
 (0)