1name: FreeRTOS-Kernel Demos
2on: [push, pull_request]
3
4env:
5  # The bash escape character is \033
6  bashPass:   \033[32;1mPASSED -
7  bashInfo:   \033[33;1mINFO -
8  bashFail:   \033[31;1mFAILED -
9  bashEnd:    \033[0m
10
11jobs:
12  WIN32-MSVC:
13    name: WIN32 MSVC
14    runs-on: windows-latest
15    steps:
16      - name: Checkout the FreeRTOS/FreeRTOS Repository
17        uses: actions/checkout@v4.1.1
18        with:
19          ref: main
20          repository: FreeRTOS/FreeRTOS
21          submodules: 'recursive'
22          fetch-depth: 1
23
24      # Checkout user pull request changes
25      - name: Checkout Pull Request
26        uses: actions/checkout@v4.1.1
27        with:
28          path: ./FreeRTOS/Source
29
30      - name: Add msbuild to PATH
31        uses: microsoft/setup-msbuild@v1.1
32
33      - name: Build WIN32-MSVC Demo
34        working-directory: FreeRTOS/Demo/WIN32-MSVC
35        run: msbuild WIN32.sln -t:rebuild
36
37      - name: Build WIN32-MSVC-Static-Allocation-Only Demo
38        working-directory: FreeRTOS/Demo/WIN32-MSVC-Static-Allocation-Only
39        run: msbuild WIN32.sln -t:rebuild
40
41  WIN32-MingW:
42    name: WIN32 MingW
43    runs-on: windows-latest
44    steps:
45      - name: Checkout the FreeRTOS/FreeRTOS Repository
46        uses: actions/checkout@v4.1.1
47        with:
48          ref: main
49          repository: FreeRTOS/FreeRTOS
50          submodules: 'recursive'
51          fetch-depth: 1
52
53      # Checkout user pull request changes
54      - name: Checkout Pull Request
55        uses: actions/checkout@v4.1.1
56        with:
57          path: ./FreeRTOS/Source
58
59      - name: Build WIN32-MingW Demo
60        working-directory: FreeRTOS/Demo/WIN32-MingW
61        run: |
62          gcc --version
63          make --version
64          make
65
66  POSIX-GCC:
67    name: Native GCC
68    strategy:
69      fail-fast: false
70      matrix:
71        os:
72          - macos-latest
73          - ubuntu-latest
74    runs-on: ${{ matrix.os }}
75    steps:
76      - name: Checkout the FreeRTOS/FreeRTOS Repository
77        uses: actions/checkout@v4.1.1
78        with:
79          ref: main
80          repository: FreeRTOS/FreeRTOS
81          submodules: 'recursive'
82          fetch-depth: 1
83
84      # Checkout user pull request changes
85      - name: Checkout Pull Request
86        uses: actions/checkout@v4.1.1
87        with:
88          path: ./FreeRTOS/Source
89
90      - name: Install GCC
91        shell: bash
92        if: matrix.os == 'ubuntu-latest'
93        run: |
94          sudo apt-get -y update
95          sudo apt-get -y install build-essential
96
97      - name: Build Posix_GCC Demo
98        shell: bash
99        working-directory: FreeRTOS/Demo/Posix_GCC
100        run: make -j
101
102      - name: Build Posix_GCC Demo for Coverage Test
103        shell: bash
104        working-directory: FreeRTOS/Demo/Posix_GCC
105        run: make -j COVERAGE_TEST=1
106
107  CMake-Example:
108    name: CMake Example with Native GCC
109    runs-on: ubuntu-latest
110    steps:
111      # Checkout user pull request changes
112      - name: Checkout Repository
113        uses: actions/checkout@v4.1.1
114
115      - name: Install GCC
116        shell: bash
117        run: |
118          sudo apt-get -y update
119          sudo apt-get -y install build-essential
120
121      - name: Build CMake Example Demo
122        shell: bash
123        working-directory: examples/cmake_example
124        run: |
125          cmake -S . -B build
126          cmake --build build
127
128      - name: Build CMake SMP Example Demo
129        shell: bash
130        working-directory: examples/cmake_example
131        run: |
132          cmake -S . -B build -DFREERTOS_SMP_EXAMPLE=1
133          cmake --build build
134
135  MSP430-GCC:
136    name: GNU MSP430 Toolchain
137    runs-on: ubuntu-latest
138    steps:
139      - name: Checkout the FreeRTOS/FreeRTOS Repository
140        uses: actions/checkout@v4.1.1
141        with:
142          ref: main
143          repository: FreeRTOS/FreeRTOS
144          submodules: 'recursive'
145          fetch-depth: 1
146
147      # Checkout user pull request changes
148      - name: Checkout Pull Request
149        uses: actions/checkout@v4.1.1
150        with:
151          path: ./FreeRTOS/Source
152
153      - env:
154          stepName: Install MSP430 Toolchain
155        shell: bash
156        run: |
157          # ${{ env.stepName }}
158          echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
159          sudo apt update -y
160          sudo apt install -y p7zip-full
161          pushd $HOME
162          curl -L -o msp430-gcc-full-linux-x64-installer-9.3.1.2.7z https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-LlCjWuAbzH/9.3.1.2/msp430-gcc-full-linux-x64-installer-9.3.1.2.7z
163
164          EXPECTED_MD5="2db2f99b4cd5c541ca0389ee20c67527"
165          GENERATED_MD5=$(md5sum msp430-gcc-full-linux-x64-installer-9.3.1.2.7z | awk '{print $1}')
166
167          if [ "$GENERATED_MD5" = "$EXPECTED_MD5" ]; then
168            7z x ./msp430-gcc-full-linux-x64-installer-9.3.1.2.7z
169            chmod +x ./msp430-gcc-full-linux-x64-installer-9.3.1.2.run
170            sudo ./msp430-gcc-full-linux-x64-installer-9.3.1.2.run --prefix /usr/bin/msp430-gcc --mode unattended
171            echo "::endgroup::"
172            popd
173            echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
174          else
175            popd
176            echo -e "${{ env.bashFail }} MD5 checksum verification failed for msp430-gcc-full-linux-x64-installer-9.3.1.2.7z ${{ env.bashEnd }}"
177            echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
178            exit -1
179          fi
180
181      - name: Build msp430_GCC Demo
182        shell: bash
183        working-directory: FreeRTOS/Demo/msp430_GCC
184        run: make -j CC=/usr/bin/msp430-gcc/bin/msp430-elf-gcc OPT="-Os -I/usr/bin/msp430-gcc/include -L/usr/bin/msp430-gcc/include"
185
186  MicroBlaze-GCC:
187    name: GCC MicroBlaze Toolchain
188    runs-on: ubuntu-latest
189    steps:
190      - name: Checkout the FreeRTOS/FreeRTOS Repository
191        uses: actions/checkout@v4.1.1
192        with:
193          ref: main
194          repository: FreeRTOS/FreeRTOS
195          fetch-depth: 1
196
197      - env:
198          stepName: Fetch Community-Supported-Demos Submodule
199        shell: bash
200        run: |
201          # ${{ env.stepName }}
202          echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
203          git submodule update --checkout --init --depth 1 FreeRTOS/Demo/ThirdParty/Community-Supported-Demos
204          # This repository contains the microblaze_instructions.h header file
205          git clone https://github.com/Xilinx/embeddedsw.git --branch xilinx_v2023.1
206          echo "::endgroup::"
207          echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
208
209      # Checkout user pull request changes
210      - name: Checkout Pull Request
211        uses: actions/checkout@v4.1.1
212        with:
213          path: ./FreeRTOS/Source
214
215      - env:
216          stepName: Install Dependancies
217        shell: bash
218        run: |
219          # ${{ env.stepName }}
220          echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
221          sudo apt update -y
222          sudo apt upgrade -y
223          sudo apt install -y build-essential m4 debhelper bison texinfo dejagnu flex
224          sudo apt install -y autogen gawk libgmp-dev libmpc-dev libmpfr-dev
225          sudo apt install -y patchutils sharutils zlib1g-dev autoconf2.64
226
227          pushd $HOME
228          # Download the mb-gcc toolchain from github
229          curl -L -o binutils-microblaze.deb https://github.com/mdednev/mb-gcc/releases/download/2021-0623%2B2/binutils-microblaze_2.35-2021-0623+1_amd64.deb;
230          curl -L -o gcc-microblaze.deb https://github.com/mdednev/mb-gcc/releases/download/2021-0623%2B2/gcc-microblaze_10.2.0-2021-0623+2_amd64.deb;
231          curl -L -o libnewlib-microblaze-dev.deb https://github.com/mdednev/mb-gcc/releases/download/2021-0623%2B2/libnewlib-microblaze-dev_3.3.0-2021-0623+3_all.deb;
232          curl -L -o libnewlib-microblaze-doc.deb https://github.com/mdednev/mb-gcc/releases/download/2021-0623%2B2/libnewlib-microblaze-doc_3.3.0-2021-0623+3_all.deb;
233          curl -L -o libnewlib-microblaze.deb https://github.com/mdednev/mb-gcc/releases/download/2021-0623%2B2/libnewlib-microblaze_3.3.0-2021-0623+3_all.deb;
234          curl -L -o newlib-source.deb https://github.com/mdednev/mb-gcc/releases/download/2021-0623%2B2/newlib-source_3.3.0-2021-0623+3_all.deb;
235          popd
236
237          # Install the packages for the toolchain
238          sudo apt install -y $HOME/binutils-microblaze.deb;
239          sudo apt install -y $HOME/gcc-microblaze.deb;
240          sudo apt install -y $HOME/libnewlib-microblaze-dev.deb;
241          sudo apt install -y $HOME/libnewlib-microblaze-doc.deb;
242          sudo apt install -y $HOME/libnewlib-microblaze.deb;
243          sudo apt install -y $HOME/newlib-source.deb;
244
245          # Validate that the toolchain is in the path and can be called
246          which mb-gcc
247          mb-gcc --version
248
249          echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
250
251      - env:
252          stepName: Compile Microblaze Port
253        shell: bash
254        run: |
255          # ${{ env.stepName }}
256          echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
257          # Compile MicroBlazeV9 Port files to validate they build
258          mb-gcc -mcpu=v9.5 -c \
259            FreeRTOS/Source/portable/GCC/MicroBlazeV9/port.c \
260            FreeRTOS/Source/portable/GCC/MicroBlazeV9/portasm.S \
261            FreeRTOS/Source/portable/GCC/MicroBlazeV9/port_exceptions.c \
262            FreeRTOS/Source/tasks.c \
263            FreeRTOS/Source/list.c \
264            -I embeddedsw/lib/bsp/standalone/src/microblaze \
265            -I FreeRTOS/Source/portable/GCC/MicroBlazeV9/ \
266            -I FreeRTOS/Source/include \
267            -I FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src \
268            -I FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/BSP/microblaze_0/libsrc/standalone_v5_4/src \
269            -I FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/BSP/microblaze_0/include \
270            -I FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/BSP/microblaze_0/libsrc/intc_v3_5/src
271          echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
272
273
274  ARM-GCC:
275    name: GNU ARM Toolchain
276    runs-on: ubuntu-latest
277    steps:
278      - name: Checkout the FreeRTOS/FreeRTOS Repository
279        uses: actions/checkout@v4.1.1
280        with:
281          ref: main
282          repository: FreeRTOS/FreeRTOS
283          fetch-depth: 1
284
285      - env:
286          stepName: Fetch Dependencies
287        shell: bash
288        run: |
289          # ${{ env.stepName }}
290          echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
291          git submodule update --checkout --init --depth 1 FreeRTOS/Demo/ThirdParty/Community-Supported-Demos FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace
292          echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
293
294      # Checkout user pull request changes
295      - name: Checkout Pull Request
296        uses: actions/checkout@v4.1.1
297        with:
298          path: ./FreeRTOS/Source
299
300      - name: Install GNU ARM Toolchain
301        shell: bash
302        run: |
303          sudo apt-get -y update
304          sudo apt-get -y install gcc-arm-none-eabi build-essential cmake git ninja-build python3-minimal
305
306      - name: Build CORTEX_MPU_M3_MPS2_QEMU_GCC Demo
307        shell: bash
308        working-directory: FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC
309        run: make -j
310
311      - name: Build CORTEX_MPU_R4F_TI_RM46_HERCULES_GCC Demo
312        shell: bash
313        working-directory: FreeRTOS/Demo/CORTEX_MPU_R4F_TI_RM46_HERCULES_GCC
314        run: cmake -S . -B build && make -j -C build all
315
316      - name: Build CORTEX_MPU_R5F_TI_RM57_HERCULES_GCC Demo
317        shell: bash
318        working-directory: FreeRTOS/Demo/CORTEX_MPU_R5F_TI_RM57_HERCULES_GCC
319        run: cmake -S . -B build && make -j -C build all
320
321      - name: Build CORTEX_LM3S102_GCC Demo
322        shell: bash
323        working-directory: FreeRTOS/Demo/CORTEX_LM3S102_GCC
324        run: make -j
325
326      - name: Build CORTEX_LM3S811_GCC Demo
327        shell: bash
328        working-directory: FreeRTOS/Demo/CORTEX_LM3S811_GCC
329        run: make -j
330
331      - name: Build CORTEX_M0+_RP2040 Demos
332        shell: bash
333        working-directory: FreeRTOS/Demo/ThirdParty/Community-Supported-Demos/CORTEX_M0+_RP2040
334        run: |
335          git clone https://github.com/raspberrypi/pico-sdk.git
336          cmake -B build -DPICO_SDK_PATH=pico-sdk -GNinja
337          ninja -C build --verbose
338
339      - name: Build CORTEX_MPS2_QEMU_IAR_GCC Demo
340        shell: bash
341        working-directory: FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC
342        run: make -C build/gcc -j
343