Skip to content

Commit 1efd200

Browse files
committed
Enable Cygwin build
Signed-off-by: Brennan Ashton <[email protected]>
1 parent d2d80e7 commit 1efd200

File tree

3 files changed

+105
-10
lines changed

3 files changed

+105
-10
lines changed

.github/workflows/build.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,64 @@ jobs:
144144
ccache -M 400M
145145
ccache -c
146146
147+
cygwin:
148+
runs-on: windows-latest
149+
150+
strategy:
151+
fail-fast: false
152+
matrix:
153+
boards: [arm-12-win, sim]
154+
155+
steps:
156+
- run: git config --global core.autocrlf false
157+
- name: Checkout nuttx repo
158+
uses: actions/checkout@v2
159+
with:
160+
repository: apache/incubator-nuttx
161+
path: nuttx
162+
fetch-depth: 0
163+
164+
- name: Fetch nuttx tags
165+
run: |
166+
cd nuttx
167+
git fetch --tags
168+
169+
- name: Checkout apps repo
170+
uses: actions/checkout@v2
171+
with:
172+
repository: apache/incubator-nuttx-apps
173+
path: apps
174+
fetch-depth: 0
175+
176+
- name: Checkout testing repo
177+
uses: actions/checkout@v2
178+
with:
179+
repository: apache/incubator-nuttx-testing
180+
path: testing
181+
182+
- name: Restore tools cache
183+
id: cache-tools
184+
uses: actions/cache@v2
185+
env:
186+
cache-name: ${{ runner.os }}-cache-tools
187+
with:
188+
path: prebuilt
189+
key: ${{ runner.os }}-tools-${{ hashFiles('./testing/cibuild.sh') }}
190+
191+
- name: Install cygwin base packages with chocolatey
192+
shell: pwsh
193+
run: |
194+
choco install --no-progress cygwin --version 3.1.4
195+
choco install cyg-get
196+
- name: Install Build Requirements for Cygwin
197+
run: |
198+
cyg-get make gcc-core gcc-g++ flex git bison byacc gperf gdb unzip awk `
199+
automake-1.15 autoconf wget xxd libmpc-devel libncurses-devel `
200+
libmpfr-devel zlib-devel
201+
- name: Set Cygwin PATH env
202+
run: |
203+
echo '::set-env name=PATH::C:\tools\cygwin\bin;C:\tools\cygwin\usr\bin'
204+
- name: Run builds
205+
shell: cmd
206+
run: |
207+
C:\tools\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -c "cd testing &&./cibuild.sh -i testlist/${{matrix.boards}}.dat"

cibuild.sh

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,18 @@ nuttx=$WORKSPACE/nuttx
3232
apps=$WORKSPACE/apps
3333
tools=$WORKSPACE/tools
3434
prebuilt=$WORKSPACE/prebuilt
35-
os=$(uname -s)
3635
EXTRA_PATH=
3736

37+
38+
kernel="$(uname -s)"
39+
case $kernel in
40+
Linux*) os=Linux;;
41+
Darwin*) os=Darwin;;
42+
CYGWIN*) os=Cygwin;;
43+
MINGW*) os=MinGw;;
44+
*) os="UNKNOWN:$kernel"
45+
esac
46+
3847
case $os in
3948
Darwin)
4049
install="python-tools u-boot-tools elf-toolchain gen-romfs kconfig-frontends arm-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain avr-gcc-toolchain c-cache binutils"
@@ -44,6 +53,9 @@ case $os in
4453
Linux)
4554
install="python-tools gen-romfs gperf kconfig-frontends arm-gcc-toolchain mips-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain rx-gcc-toolchain c-cache"
4655
;;
56+
Cygwin)
57+
install="gen-romfs kconfig-frontends arm-gcc-toolchain"
58+
;;
4759
esac
4860

4961
function add_path {
@@ -115,6 +127,9 @@ function kconfig-frontends {
115127
add_path $prebuilt/kconfig-frontends/bin
116128

117129
if [ ! -f "$prebuilt/kconfig-frontends/bin/kconfig-conf" ]; then
130+
if [ ! -d "$tools" ]; then
131+
git clone https://bitbucket.org/nuttx/tools.git $tools
132+
fi
118133
cd $tools/kconfig-frontends
119134
./configure --prefix=$prebuilt/kconfig-frontends \
120135
--disable-kconfig --disable-nconf --disable-qconf \
@@ -142,22 +157,33 @@ function bloaty {
142157

143158
function arm-gcc-toolchain {
144159
add_path $prebuilt/gcc-arm-none-eabi/bin
160+
urlbase="https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/"
161+
releasebase="gcc-arm-none-eabi-9-2019-q4-major"
145162

146163
if [ ! -f "$prebuilt/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then
147-
local flavor
164+
cd $prebuilt
165+
local filename
148166
case $os in
149167
Darwin)
150-
flavor=mac
151-
;;
168+
filename="$releasebase-mac.tar.bz2"
169+
wget --quiet $urlbase/$filename
170+
tar jxf $filename
171+
mv $releasebase gcc-arm-none-eabi
172+
;;
152173
Linux)
153-
flavor=x86_64-linux
174+
filename="$releasebase-x86_64.tar.bz2"
175+
wget --quiet $urlbase/$filename
176+
tar jxf $filename
177+
mv $releasebase gcc-arm-none-eabi
178+
;;
179+
Cygwin)
180+
filename="$releasebase-win32.zip"
181+
wget --quiet $urlbase/$filename
182+
mkdir -p gcc-arm-none-eabi
183+
unzip -qq $filename -d ./gcc-arm-none-eabi
154184
;;
155185
esac
156-
cd $prebuilt
157-
wget --quiet https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
158-
tar jxf gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
159-
mv gcc-arm-none-eabi-9-2019-q4-major gcc-arm-none-eabi
160-
rm gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
186+
rm $filename
161187
fi
162188
arm-none-eabi-gcc --version
163189
}
@@ -391,6 +417,9 @@ function run_builds {
391417
Linux)
392418
ncpus=`grep -c ^processor /proc/cpuinfo`
393419
;;
420+
Cygwin)
421+
ncpus=`grep -c ^processor /proc/cpuinfo`
422+
;;
394423
esac
395424

396425
options+="-j $ncpus"

testlist/arm-12-win.dat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/arm/stm32f0l0g0,CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW
2+
3+
/arm/stm32f7,CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW
4+
5+
/arm/stm32h7,CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW

0 commit comments

Comments
 (0)