Skip to content

Commit c22e9db

Browse files
authored
Merge branch 'main' into fix-misra-11.3
2 parents d5024ea + 37678b0 commit c22e9db

File tree

6 files changed

+125
-7
lines changed

6 files changed

+125
-7
lines changed

.github/workflows/coverity_scan.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: FreeRTOS-Kernel Coverity Scan
2+
on:
3+
schedule: ## Scheduled to run at 1:15 AM UTC daily.
4+
- cron: '15 1 * * *'
5+
6+
7+
jobs:
8+
9+
Coverity-Scan:
10+
name: Coverity Scan
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout the Repository
14+
uses: actions/checkout@v3
15+
16+
- name: Install Build Essentials
17+
shell: bash
18+
run: |
19+
sudo apt-get -y update
20+
sudo apt-get -y install build-essential
21+
22+
- name: Install Coverity Build
23+
shell: bash
24+
env:
25+
COVERITY_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
26+
run: |
27+
wget -nv -qO- https://scan.coverity.com/download/linux64 --post-data "token=${COVERITY_TOKEN}&project=FreeRTOS-Kernel" | tar -zx --one-top-level=cov_scan --strip-components 1
28+
echo "cov_scan_path=$(pwd)/cov_scan/bin" >> $GITHUB_ENV
29+
30+
- name: Coverity Build & Upload for Scan
31+
shell: bash
32+
env:
33+
COVERITY_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
34+
run: |
35+
export PATH="$PATH:${{env.cov_scan_path}}"
36+
cmake -S ./examples/cmake_example/ -B build
37+
cd build
38+
cov-build --dir cov-int make -j
39+
tar czvf gcc_freertos_kerenl_sample_build.tgz cov-int
40+
COV_SCAN_UPLOAD_STATUS=$(curl --form token=${COVERITY_TOKEN} \
41+
42+
--form file=@gcc_freertos_kerenl_sample_build.tgz \
43+
--form version="Mainline" \
44+
--form description="FreeRTOS Kernel Nightly Scan" \
45+
https://scan.coverity.com/builds?project=FreeRTOS-Kernel)
46+
echo "${COV_SCAN_UPLOAD_STATUS}" | grep -q -e 'Build successfully submitted' || echo >&2 "Error submitting build for analysis: ${COV_SCAN_UPLOAD_STATUS}"

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ if(NOT FREERTOS_PORT)
106106
" GCC_PPC440_XILINX - Compiler: GCC Target: Xilinx PPC440\n"
107107
" GCC_RISC_V - Compiler: GCC Target: RISC-V\n"
108108
" GCC_RISC_V_PULPINO_VEGA_RV32M1RM - Compiler: GCC Target: RISC-V Pulpino Vega RV32M1RM\n"
109+
" GCC_RISC_V_GENERIC - Compiler: GCC Target: RISC-V with FREERTOS_RISCV_EXTENSION\n"
109110
" GCC_RL78 - Compiler: GCC Target: Renesas RL78\n"
110111
" GCC_RX100 - Compiler: GCC Target: Renesas RX100\n"
111112
" GCC_RX200 - Compiler: GCC Target: Renesas RX200\n"
@@ -156,6 +157,7 @@ if(NOT FREERTOS_PORT)
156157
" IAR_MSP430 - Compiler: IAR Target: MSP430\n"
157158
" IAR_MSP430X - Compiler: IAR Target: MSP430X\n"
158159
" IAR_RISC_V - Compiler: IAR Target: RISC-V\n"
160+
" IAR_RISC_V_GENERIC - Compiler: IAR Target: RISC-V with FREERTOS_RISCV_EXTENSION\n"
159161
" IAR_RL78 - Compiler: IAR Target: Renesas RL78\n"
160162
" IAR_RX100 - Compiler: IAR Target: Renesas RX100\n"
161163
" IAR_RX600 - Compiler: IAR Target: Renesas RX600\n"

portable/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
if( FREERTOS_PORT STREQUAL "GCC_RISC_V_GENERIC" )
2+
include( GCC/RISC-V/chip_extensions.cmake )
3+
endif()
4+
5+
if( FREERTOS_PORT STREQUAL "IAR_RISC_V_GENERIC" )
6+
include( IAR/RISC-V/chip_extensions.cmake )
7+
endif()
8+
19
# FreeRTOS internal cmake file. Do not use it in user top-level project
210

311
if (FREERTOS_PORT STREQUAL "A_CUSTOM_PORT")
@@ -292,6 +300,10 @@ add_library(freertos_kernel_port STATIC
292300
GCC/RISC-V/port.c
293301
GCC/RISC-V/portASM.S>
294302

303+
$<$<STREQUAL:${FREERTOS_PORT},GCC_RISC_V_GENERIC>:
304+
GCC/RISC-V/port.c
305+
GCC/RISC-V/portASM.S>
306+
295307
# Renesas RL78 port for GCC
296308
$<$<STREQUAL:${FREERTOS_PORT},GCC_RL78>:
297309
GCC/RL78/port.c
@@ -497,6 +509,10 @@ add_library(freertos_kernel_port STATIC
497509
IAR/RISC-V/port.c
498510
IAR/RISC-V/portASM.s>
499511

512+
$<$<STREQUAL:${FREERTOS_PORT},IAR_RISC_V_GENERIC>:
513+
IAR/RISC-V/port.c
514+
IAR/RISC-V/portASM.s>
515+
500516
# Renesas RL78 port for IAR EWRL78
501517
$<$<STREQUAL:${FREERTOS_PORT},IAR_RL78>:
502518
IAR/RL78/port.c
@@ -845,6 +861,10 @@ target_include_directories(freertos_kernel_port PUBLIC
845861
${CMAKE_CURRENT_LIST_DIR}/GCC/RISC-V
846862
${CMAKE_CURRENT_LIST_DIR}/GCC/RISC-V/chip_specific_extensions/Pulpino_Vega_RV32M1RM>
847863

864+
$<$<STREQUAL:${FREERTOS_PORT},GCC_RISC_V_GENERIC>:
865+
${CMAKE_CURRENT_LIST_DIR}/GCC/RISC-V
866+
${CMAKE_CURRENT_LIST_DIR}/GCC/RISC-V/chip_specific_extensions/${FREERTOS_RISCV_EXTENSION}>
867+
848868
# Renesas RL78 port for GCC
849869
$<$<STREQUAL:${FREERTOS_PORT},GCC_RL78>:${CMAKE_CURRENT_LIST_DIR}/GCC/RL78>
850870

@@ -942,6 +962,10 @@ target_include_directories(freertos_kernel_port PUBLIC
942962
${CMAKE_CURRENT_LIST_DIR}/IAR/RISC-V
943963
${CMAKE_CURRENT_LIST_DIR}/IAR/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions>
944964

965+
$<$<STREQUAL:${FREERTOS_PORT},IAR_RISC_V_GENERIC>:
966+
${CMAKE_CURRENT_LIST_DIR}/IAR/RISC-V
967+
${CMAKE_CURRENT_LIST_DIR}/IAR/RISC-V/chip_specific_extensions/${FREERTOS_RISCV_EXTENSION}>
968+
945969
# Renesas RL78 port for IAR EWRL78
946970
$<$<STREQUAL:${FREERTOS_PORT},IAR_RL78>:${CMAKE_CURRENT_LIST_DIR}/IAR/RL78>
947971

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
if( FREERTOS_PORT STREQUAL "GCC_RISC_V_GENERIC" )
2+
set( VALID_CHIP_EXTENSIONS
3+
"Pulpino_Vega_RV32M1RM"
4+
"RISCV_MTIME_CLINT_no_extensions"
5+
"RISCV_no_extensions"
6+
"RV32I_CLINT_no_extensions" )
7+
8+
if( ( NOT FREERTOS_RISCV_EXTENSION ) OR ( NOT ( ${FREERTOS_RISCV_EXTENSION} IN_LIST VALID_CHIP_EXTENSIONS ) ) )
9+
message(FATAL_ERROR
10+
"FREERTOS_RISCV_EXTENSION \"${FREERTOS_RISCV_EXTENSION}\" is not set or unsupported.\n"
11+
"Please specify it from top-level CMake file (example):\n"
12+
" set(FREERTOS_RISCV_EXTENSION RISCV_MTIME_CLINT_no_extensions CACHE STRING \"\")\n"
13+
" or from CMake command line option:\n"
14+
" -DFREERTOS_RISCV_EXTENSION=RISCV_MTIME_CLINT_no_extensions\n"
15+
"\n"
16+
" Available extension options:\n"
17+
" ${VALID_CHIP_EXTENSIONS} \n")
18+
endif()
19+
endif()
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
if( FREERTOS_PORT STREQUAL "IAR_RISC_V_GENERIC" )
2+
set( VALID_CHIP_EXTENSIONS
3+
"RV32I_CLINT_no_extensions" )
4+
5+
if( ( NOT FREERTOS_RISCV_EXTENSION ) OR ( NOT ( ${FREERTOS_RISCV_EXTENSION} IN_LIST VALID_CHIP_EXTENSIONS ) ) )
6+
message(FATAL_ERROR
7+
"FREERTOS_RISCV_EXTENSION \"${FREERTOS_RISCV_EXTENSION}\" is not set or unsupported.\n"
8+
"Please specify it from top-level CMake file (example):\n"
9+
" set(FREERTOS_RISCV_EXTENSION RISCV_MTIME_CLINT_no_extensions CACHE STRING \"\")\n"
10+
" or from CMake command line option:\n"
11+
" -DFREERTOS_RISCV_EXTENSION=RISCV_MTIME_CLINT_no_extensions\n"
12+
"\n"
13+
" Available extension options:\n"
14+
" ${VALID_CHIP_EXTENSIONS} \n")
15+
endif()
16+
endif()

tasks.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7231,13 +7231,24 @@ static void prvResetNextTaskUnblockTime( void )
72317231
if( uxConsumedBufferLength < ( uxBufferLength - 1 ) )
72327232
{
72337233
/* Write the rest of the string. */
7234-
iSnprintfReturnValue = snprintf( pcWriteBuffer,
7235-
uxBufferLength - uxConsumedBufferLength,
7236-
"\t%c\t%u\t%u\t%u\r\n",
7237-
cStatus,
7238-
( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority,
7239-
( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark,
7240-
( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber ); /*lint !e586 sprintf() allowed as this is compiled with many compilers and this is a utility function only - not part of the core kernel implementation. */
7234+
#if ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUMBER_OF_CORES > 1 ) )
7235+
iSnprintfReturnValue = snprintf( pcWriteBuffer,
7236+
uxBufferLength - uxConsumedBufferLength,
7237+
"\t%c\t%u\t%u\t%u\t0x%x\r\n",
7238+
cStatus,
7239+
( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority,
7240+
( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark,
7241+
( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber,
7242+
( unsigned int ) pxTaskStatusArray[ x ].uxCoreAffinityMask ); /*lint !e586 sprintf() allowed as this is compiled with many compilers and this is a utility function only - not part of the core kernel implementation. */
7243+
#else /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */
7244+
iSnprintfReturnValue = snprintf( pcWriteBuffer,
7245+
uxBufferLength - uxConsumedBufferLength,
7246+
"\t%c\t%u\t%u\t%u\r\n",
7247+
cStatus,
7248+
( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority,
7249+
( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark,
7250+
( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber ); /*lint !e586 sprintf() allowed as this is compiled with many compilers and this is a utility function only - not part of the core kernel implementation. */
7251+
#endif /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */
72417252
uxCharsWrittenBySnprintf = prvSnprintfReturnValueToCharsWritten( iSnprintfReturnValue, uxBufferLength - uxConsumedBufferLength );
72427253

72437254
uxConsumedBufferLength += uxCharsWrittenBySnprintf;

0 commit comments

Comments
 (0)