Skip to content

Commit 9ccae85

Browse files
ChaiTowKwayXiaodong Li
and
Xiaodong Li
authored
Create GitHub Workflows that execute the p3 FreeRTOS Kernel Demos (FreeRTOS#1018)
* test full demo * Revert "test full demo" This reverts commit 09efa00ec0a3f021f190112fa11bc0f4c6c058bb. revert back to origin * pre-define user demo to blinky demo * pre-define user demo to blinky demo with -j * test run win32-msvc demo * test run win32-msvc demo * test run win32-msvc demo * update git workflow to run WIN32-MSVC demo * update git workflow to run WIN32-MSVC demo * update git workflow to run WIN32-MSVC demo * update git workflow to run WIN32-MSVC demo * update git workflow to run WIN32-MSVC demo * update git workflow to run WIN32-MSVC demo * update git workflow to run WIN32-MSVC demo * update trigger action * build and run WIN32-MSVC blinky demo * build and run WIN32-MSVC blinky demo * build and run WIN32-MSVC blinky demo * update WIN32-MSVC workflow * update WIN32-MSVC Demo main.c file to remove buffer * Update main.c files to remove buffer when running executable_monitor file for Git Action * update formatting for WIN32-MSVC demos * update formatting for Posix demo * update comment for setvbuf function used in main.c * add git build and run action for WIN32-MingW Full and Blinky demos; update main.c file to set buffer size as 0 * add git build and run action for WIN32-MingW Full and Blinky demos; update main.c file to set buffer size as 0 * remove whitespace for freertos_demos.yml file * add function to Force stdout to write immediately by setting the buffer size for it to 0 in demo main.c file when running git Run Action; Correct formatting error for WIN32-MingW main.c file * add function to Force stdout to write immediately by setting the buffer size for it to 0 in demo main.c file when running git Run Action * update git run action commands for Posix_GCC demo * update git run action commands for Posix_GCC demo * update git run action commands for Posix_GCC demo * reduce timeout and correct formatting issue * reduce timeout --------- Co-authored-by: Xiaodong Li <xiaodonn@amazon.com>
1 parent d60b34c commit 9ccae85

File tree

5 files changed

+497
-394
lines changed

5 files changed

+497
-394
lines changed

.github/workflows/freertos_demos.yml

Lines changed: 103 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: FreeRTOS Demos
22
on:
33
push:
44
pull_request:
5+
workflow_dispatch:
56

67
jobs:
78
WIN32-MSVC:
@@ -19,13 +20,60 @@ jobs:
1920
- name: Add msbuild to PATH
2021
uses: microsoft/setup-msbuild@v1.1
2122

22-
- name: Build WIN32-MSVC Demo
23+
- name: Build WIN32-MSVC Full Demo
24+
id: build-win32-msvs-full-demo
2325
working-directory: FreeRTOS/Demo/WIN32-MSVC
24-
run: msbuild WIN32.sln -t:rebuild
26+
run: |
27+
$content = Get-Content -Path 'main.c' -Raw
28+
$newContent = $content -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );'
29+
$newContent | Set-Content -Path 'main.c'
30+
msbuild WIN32.sln -t:rebuild
31+
32+
- name: Run and monitor WIN32-MSVC Full Demo
33+
if: success() || failure() && steps.build-win32-msvs-full-demo.outcome == 'success'
34+
uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main
35+
with:
36+
exe-path: FreeRTOS/Demo/WIN32-MSVC/Debug/RTOSDemo.exe
37+
log-dir: demo_run_logs
38+
timeout-seconds: 60
39+
success-line: "No errors - tick count"
40+
41+
- name: Build WIN32-MSVC Blinky Demo
42+
id: build-win32-msvs-blinky-demo
43+
working-directory: FreeRTOS/Demo/WIN32-MSVC
44+
run: |
45+
$content = Get-Content -Path 'main.c' -Raw
46+
$newContent = $content -replace '#define\s+mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\s+0', '#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1'
47+
$newContent = $newContent -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );'
48+
$newContent | Set-Content -Path 'main.c'
49+
msbuild WIN32.sln -t:rebuild
50+
51+
- name: Run and monitor WIN32-MSVC Blinky Demo
52+
if: success() || failure() && steps.build-win32-msvs-blinky-demo.outcome == 'success'
53+
uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main
54+
with:
55+
exe-path: FreeRTOS/Demo/WIN32-MSVC/Debug/RTOSDemo.exe
56+
log-dir: demo_run_logs
57+
timeout-seconds: 60
58+
success-line: "Message received from software timer"
2559

2660
- name: Build WIN32-MSVC-Static-Allocation-Only Demo
61+
id: build-win32-msvs-static-allocation-only-demo
2762
working-directory: FreeRTOS/Demo/WIN32-MSVC-Static-Allocation-Only
28-
run: msbuild WIN32.sln -t:rebuild
63+
run: |
64+
$content = Get-Content -Path 'main.c' -Raw
65+
$newContent = $content -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );'
66+
$newContent | Set-Content -Path 'main.c'
67+
msbuild WIN32.sln -t:rebuild
68+
69+
- name: Run and monitor WIN32-MSVC-Static-Allocation-Only Demo
70+
if: success() || failure() && steps.build-win32-msvs-static-allocation-only-demo.outcome == 'success'
71+
uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main
72+
with:
73+
exe-path: FreeRTOS/Demo/WIN32-MSVC-Static-Allocation-Only/Debug/RTOSDemo.exe
74+
log-dir: demo_run_logs
75+
timeout-seconds: 60
76+
success-line: "No errors - tick count"
2977

3078
WIN32-MingW:
3179
name: WIN32 MingW
@@ -44,15 +92,49 @@ jobs:
4492
run: |
4593
git submodule update --checkout --init --depth 1 FreeRTOS/Source
4694
47-
- name: Build WIN32-MingW Demo
95+
- name: Build WIN32-MingW Full Demo
96+
id: build-win32-mingw-full-demo
4897
working-directory: FreeRTOS/Demo/WIN32-MingW
4998
run: |
99+
$content = Get-Content -Path 'main.c' -Raw
100+
$newContent = $content -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );'
101+
$newContent | Set-Content -Path 'main.c'
50102
gcc --version
51103
make --version
52104
make
53105
106+
- name: Run and monitor WIN32-MingW Full Demo
107+
if: success() || failure() && steps.build-win32-mingw-full-demo.outcome == 'success'
108+
uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main
109+
with:
110+
exe-path: FreeRTOS/Demo/WIN32-MingW/build/RTOSDemo.exe
111+
log-dir: demo_run_logs
112+
timeout-seconds: 60
113+
success-line: "No errors - tick count"
114+
115+
- name: Build WIN32-MingW Blinky Demo
116+
id: build-win32-mingw-blinky-demo
117+
working-directory: FreeRTOS/Demo/WIN32-MingW
118+
run: |
119+
$content = Get-Content -Path 'main.c' -Raw
120+
$newContent = $content -replace '#define\s+mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\s+0', '#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1'
121+
$newContent = $newContent -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );'
122+
$newContent | Set-Content -Path 'main.c'
123+
gcc --version
124+
make --version
125+
make
126+
127+
- name: Run and monitor WIN32-MingW Blinky Demo
128+
if: success() || failure() && steps.build-win32-mingw-blinky-demo.outcome == 'success'
129+
uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main
130+
with:
131+
exe-path: FreeRTOS/Demo/WIN32-MingW/build/RTOSDemo.exe
132+
log-dir: demo_run_logs
133+
timeout-seconds: 60
134+
success-line: "Message received from software timer"
135+
54136
POSIX-GCC:
55-
name: Native GCC
137+
name: Posix GCC
56138
runs-on: ubuntu-latest
57139
steps:
58140
- name: Checkout Repository
@@ -73,40 +155,36 @@ jobs:
73155
shell: bash
74156
working-directory: FreeRTOS/Demo/Posix_GCC
75157
run: |
158+
sed -i -z "s/int[[:space:]]*main[[:space:]]*([[:space:]]*void[[:space:]]*)\n{/int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );/g" main.c
76159
make -j
77160
78161
- name: Run and monitor Posix_GCC Full Demo
79162
if: success() || failure() && steps.build-posix-gcc-full-demo.outcome == 'success'
80-
working-directory: FreeRTOS/Demo/Posix_GCC
81-
run: |
82-
timeout 5m build/posix_demo | tee output.txt
83-
if grep -q "OK: No errors" output.txt; then
84-
echo -e "\nSUCCESS - Found SUCCESS string in output."
85-
else
86-
echo -e "\nFAILURE - SUCCESS string not found in output."
87-
exit 1
88-
fi
163+
uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main
164+
with:
165+
exe-path: FreeRTOS/Demo/Posix_GCC/build/posix_demo
166+
log-dir: demo_run_logs
167+
timeout-seconds: 60
168+
success-line: "OK: No errors"
89169

90170
- name: Build Posix_GCC Blinky Demo
91171
id: build-posix-gcc-blinky-demo
92172
if: success() || failure()
93173
shell: bash
94174
working-directory: FreeRTOS/Demo/Posix_GCC
95175
run: |
96-
sed -i "s/#define[[:space:]]\+mainSELECTED_APPLICATION[[:space:]]\+FULL_DEMO/#define mainSELECTED_APPLICATION BLINKY_DEMO/g" main.c
97-
make -j
176+
sed -i -z "s/int[[:space:]]*main[[:space:]]*([[:space:]]*void[[:space:]]*)\n{/int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );/g" main.c
177+
rm -rf build
178+
make -j USER_DEMO=BLINKY_DEMO
98179
99180
- name: Run and monitor Posix_GCC Blinky Demo
100181
if: success() || failure() && steps.build-posix-gcc-blinky-demo.outcome == 'success'
101-
working-directory: FreeRTOS/Demo/Posix_GCC
102-
run: |
103-
timeout 30s build/posix_demo | tee output.txt
104-
if grep -q "Message received from software timer" output.txt; then
105-
echo -e "\nSUCCESS - Found SUCCESS string in output."
106-
else
107-
echo -e "\nFAILURE - SUCCESS string not found in output."
108-
exit 1
109-
fi
182+
uses: FreeRTOS/CI-CD-GitHub-Actions/executable-monitor@main
183+
with:
184+
exe-path: FreeRTOS/Demo/Posix_GCC/build/posix_demo
185+
log-dir: demo_run_logs
186+
timeout-seconds: 60
187+
success-line: "Message received from software timer"
110188

111189
MSP430-GCC:
112190
name: GNU MSP430 Toolchain

FreeRTOS/Demo/Posix_GCC/main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ static uint32_t ulEntryTime = 0;
449449

450450
void vTraceTimerReset( void )
451451
{
452-
ulEntryTime = xTaskGetTickCount();
452+
ulEntryTime = xTaskGetTickCount();
453453
}
454454

455455
uint32_t uiTraceTimerGetFrequency( void )
@@ -459,6 +459,5 @@ uint32_t uiTraceTimerGetFrequency( void )
459459

460460
uint32_t uiTraceTimerGetValue( void )
461461
{
462-
return ( xTaskGetTickCount() - ulEntryTime );
462+
return( xTaskGetTickCount() - ulEntryTime );
463463
}
464-

0 commit comments

Comments
 (0)