Skip to content

Commit e07a47b

Browse files
committed
cortex-r82-smp-example: Add minor improvements
This commit adds multiple improvements to the example and adapt to the latest port code changes. Signed-off-by: Ahmed Ismail <Ahmed.Ismail@arm.com>
1 parent bf222b5 commit e07a47b

10 files changed

Lines changed: 103 additions & 56 deletions

File tree

CORTEX_R82_SMP_FVP_GCC_ARMCLANG/BSP/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ target_sources(bsp
1010
INTERFACE
1111
${CMAKE_CURRENT_SOURCE_DIR}/Source/port_asm_vectors.S
1212
${CMAKE_CURRENT_SOURCE_DIR}/Source/boot.S
13-
${CMAKE_CURRENT_SOURCE_DIR}/Source/xil-crt0.S
13+
${CMAKE_CURRENT_SOURCE_DIR}/Source/startup.S
1414
${CMAKE_CURRENT_SOURCE_DIR}/Source/gic.c
1515
)
1616

CORTEX_R82_SMP_FVP_GCC_ARMCLANG/BSP/Include/gic.h

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,38 @@
22
* SPDX-License-Identifier: MIT
33
*/
44

5-
#define GICD_BASE ( 0xAF000000UL ) /* Base of GIC Distributor on BaseR FVP */
6-
#define GICR_BASE_PER_CORE( core ) ( 0xAF100000 + (0x20000 * ( core ) ) ) /* Base of GIC Redistributor per core on BaseR FVP */
7-
#define SGI_BASE ( 0x10000 ) /* SGI Base */
8-
#define GICD_CTLR ( 0x000 ) /* Distributor Control Register */
9-
#define GICR_WAKER ( 0x14 ) /* ReDistributor Wake Register */
10-
#define GICR_PWRR ( 0x24 ) /* ReDistributor Power Register */
11-
#define GICR_IGROUPR0 ( SGI_BASE + 0x80 ) /* Interrupt Group Registers */
12-
#define GICR_ISENABLER0 ( SGI_BASE + 0x100 ) /* Interrupt Set-Enable Registers */
13-
#define GICR_IPRIORITYR( n ) ( SGI_BASE + ( 0x400 + ( 4 * n ) ) ) /* Interrupt Priority Registers */
14-
#define GICR_IGRPMODR0 ( SGI_BASE + 0xD00 ) /* Distributor Interrupt group modifier Register */
5+
#ifndef GIC_H
6+
#define GIC_H
157

16-
#define GICD_CTLR_ENABLEGRP1NS_BIT ( 1U ) /* GICD_CTRL.EnableGrp1NS bit */
17-
#define GICD_CTLR_ENABLEGRP1S_BIT ( 2U ) /* GICD_CTRL.EnableGrp1S bit */
18-
#define GICD_CTLR_ARES_BIT ( 4U ) /* GICD_CTRL.ARE_S bit */
19-
#define GICD_CTLR_DS_BIT ( 6U ) /* GICD_CTRL.DS bit */
8+
#include "FreeRTOSConfig.h"
209

21-
#define GICR_PWRR_RDPD_BIT ( 0U ) /* GICR_PWRR.RDPD bit */
10+
#if ( configNUMBER_OF_CORES == 1 )
11+
#define ucPortGetCoreID() ( 0 ) /* Single core system, always core 0 */
12+
#endif
2213

23-
#define GICR_WAKER_PS_BIT ( 1U ) /* GICR_WAKER.PS bit */
24-
#define GICR_WAKER_CA_BIT ( 2U ) /* GICR_WAKER.CA bit */
14+
#define GICD_BASE ( 0xAF000000UL ) /* Base of GIC Distributor on BaseR FVP */
15+
#define GICR_BASE_PER_CORE( core ) ( 0xAF100000UL + ( 0x20000UL * ( core ) ) ) /* Base of GIC Redistributor per core on BaseR FVP */
16+
#define SGI_BASE ( 0x10000UL ) /* SGI Base */
17+
#define GICD_CTLR ( 0x000 ) /* Distributor Control Register */
18+
#define GICR_WAKER ( 0x14 ) /* ReDistributor Wake Register */
19+
#define GICR_PWRR ( 0x24 ) /* ReDistributor Power Register */
20+
#define GICR_IGROUPR0 ( SGI_BASE + 0x80 ) /* Interrupt Group Registers */
21+
#define GICR_ISENABLER0 ( SGI_BASE + 0x100 ) /* Interrupt Set-Enable Registers */
22+
#define GICR_IPRIORITYR( n ) ( SGI_BASE + ( 0x400 + ( 4 * n ) ) ) /* Interrupt Priority Registers */
23+
#define GICR_IGRPMODR0 ( SGI_BASE + 0xD00 ) /* Distributor Interrupt group modifier Register */
2524

26-
#define GIC_MAX_INTERRUPT_ID ( 31UL ) /* Maximum Interrupt ID for PPIs and SGIs */
27-
#define GIC_WAIT_TIMEOUT ( 1000000U ) /* Timeout for waiting on GIC operations */
25+
#define GICD_CTLR_ENABLEGRP1NS_BIT ( 1U ) /* GICD_CTRL.EnableGrp1NS bit */
26+
#define GICD_CTLR_ENABLEGRP1S_BIT ( 2U ) /* GICD_CTRL.EnableGrp1S bit */
27+
#define GICD_CTLR_ARES_BIT ( 4U ) /* GICD_CTRL.ARE_S bit */
28+
#define GICD_CTLR_DS_BIT ( 6U ) /* GICD_CTRL.DS bit */
29+
30+
#define GICR_PWRR_RDPD_BIT ( 0U ) /* GICR_PWRR.RDPD bit */
31+
32+
#define GICR_WAKER_PS_BIT ( 1U ) /* GICR_WAKER.PS bit */
33+
#define GICR_WAKER_CA_BIT ( 2U ) /* GICR_WAKER.CA bit */
34+
35+
#define GIC_MAX_INTERRUPT_ID ( 31UL ) /* Maximum Interrupt ID for PPIs and SGIs */
36+
#define GIC_WAIT_TIMEOUT ( 1000000U ) /* Timeout for waiting on GIC operations */
2837

2938
/**
3039
* Assigns the specified interrupt to Group 1 and enables it
@@ -66,3 +75,5 @@ void vGIC_SetPriority( uint32_t ulInterruptID, uint32_t ulPriority );
6675
* sets SGI0 to be a Group 1 interrupt, and enables delivery of Group-1 IRQs to EL1.
6776
*/
6877
void vGIC_SetupSgi0( void );
78+
79+
#endif /* GIC_H */

CORTEX_R82_SMP_FVP_GCC_ARMCLANG/BSP/Source/boot.S

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@
4848
#error "Unsupported configNUMBER_OF_CORES value — must be a power‑of‑two up to 4"
4949
#endif
5050

51+
.set SCTLR_EL1_NTWE, 18 /* SCTLR_EL1.nTWE bit position */
52+
.set SCTLR_EL1_NTWI, 16 /* SCTLR_EL1.nTWI bit position */
53+
.set SCTLR_EL1_CACHE, 2 /* SCTLR_EL1.C bit position */
54+
5155
.section .boot,"ax"
5256

5357
_prestart:
@@ -87,10 +91,11 @@ start:
8791
mov x30, #0
8892

8993
mrs x0, currentEL
94+
/* Check we’ve come from EL1 (currentEL==0x4), otherwise fault */
9095
cmp x0, #0x4
9196
beq InitEL1
9297

93-
b error /* Check we’ve come from EL1 (currentEL==0x4), otherwise fault */
98+
b error
9499
InitEL1:
95100
/* Set vector table base address */
96101
ldr x1, =vector_base
@@ -103,8 +108,7 @@ InitEL1:
103108
isb
104109

105110
/* Clear FP status flags (FPSR) to avoid spurious exceptions on first use */
106-
mov x0, 0x0
107-
msr FPSR, x0
111+
msr FPSR, xzr
108112

109113
/* Define stack pointer for current exception level */
110114
#if configNUMBER_OF_CORES > 1
@@ -120,8 +124,8 @@ InitEL1:
120124
/* x4 = this CPU’s index (Aff0 field of MPIDR_EL1) */
121125
mrs x4, MPIDR_EL1
122126
and x4, x4, #0xFF /* core_id ∈ {0 … N_CPUS-1} */
123-
cmp x4, #configNUMBER_OF_CORES
124-
b.hs error
127+
cmp x4, #configNUMBER_OF_CORES
128+
b.hs error
125129
/* x0 = slice_size * core_id → how far to step back from the top */
126130
mul x0, x1, x4
127131
/* sp = top_of_pool – offset (so core 0 gets the very top) */
@@ -153,9 +157,9 @@ InitEL1:
153157
* - Allow EL0 to execute WFE/WFI (Set nTWE/nTWI so they don't trap)
154158
*/
155159
mrs x1, SCTLR_EL1
156-
orr x1, x1, #(1 << 18) /* nTWE = 1 → WFE at EL0 does not trap */
157-
orr x1, x1, #(1 << 16) /* nTWI = 1 → WFI at EL0 does not trap */
158-
orr x1, x1, #(1 << 2) /* C = 1 → enable data cache */
160+
orr x1, x1, #(1 << SCTLR_EL1_NTWE) /* nTWE = 1 → WFE at EL0 does not trap */
161+
orr x1, x1, #(1 << SCTLR_EL1_NTWI) /* nTWI = 1 → WFI at EL0 does not trap */
162+
orr x1, x1, #(1 << SCTLR_EL1_CACHE) /* C = 1 → enable data cache */
159163
msr SCTLR_EL1, x1
160164
isb
161165

CORTEX_R82_SMP_FVP_GCC_ARMCLANG/BSP/Source/gic.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* SPDX-License-Identifier: MIT
33
*/
44

5-
#include <stdint.h>
65
#include <stdio.h>
76
#include "FreeRTOS.h"
87
#include "FreeRTOSConfig.h"
@@ -22,8 +21,12 @@ void vGIC_EnableCPUInterface( void )
2221

2322
void vGIC_PowerUpRedistributor( void )
2423
{
25-
volatile uint32_t *pulPwrr = ( uint32_t * )( GICR_BASE_PER_CORE( xPortGetCoreID() ) + GICR_PWRR );
26-
volatile uint32_t *pulWaker = ( uint32_t * )( GICR_BASE_PER_CORE( xPortGetCoreID() ) + GICR_WAKER );
24+
volatile uint32_t *pulPwrr = ( volatile uint32_t * )( ( portPOINTER_SIZE_TYPE ) GICR_BASE_PER_CORE( ucPortGetCoreID() ) +
25+
( portPOINTER_SIZE_TYPE ) GICR_PWRR );
26+
27+
volatile uint32_t *pulWaker = ( volatile uint32_t * )( ( portPOINTER_SIZE_TYPE ) GICR_BASE_PER_CORE( ucPortGetCoreID() ) +
28+
( portPOINTER_SIZE_TYPE ) GICR_WAKER );
29+
2730
uint32_t ulTimeout = GIC_WAIT_TIMEOUT;
2831

2932
/* Clear RDPD (Redistributor Power-Down) to 0 → power on the redistributor */
@@ -59,10 +62,10 @@ void vGIC_InitDist( void )
5962
/* Enable Group-1 Non-Secure (NS) and Secure (S) interrupts, and turn on Affinity-routing (ARE_S)
6063
*plus Disable-Security (DS) for full GICv3 operation
6164
*/
62-
*( volatile uint32_t * )( GICD_BASE + GICD_CTLR ) = ( 1 << GICD_CTLR_ENABLEGRP1NS_BIT ) |
63-
( 1 << GICD_CTLR_ENABLEGRP1S_BIT ) |
64-
( 1 << GICD_CTLR_ARES_BIT ) |
65-
( 1 << GICD_CTLR_DS_BIT );
65+
*( volatile uint32_t * )( ( portPOINTER_SIZE_TYPE ) GICD_BASE + ( portPOINTER_SIZE_TYPE ) GICD_CTLR ) = ( 1 << GICD_CTLR_ENABLEGRP1NS_BIT ) |
66+
( 1 << GICD_CTLR_ENABLEGRP1S_BIT ) |
67+
( 1 << GICD_CTLR_ARES_BIT ) |
68+
( 1 << GICD_CTLR_DS_BIT );
6669

6770
/* Ensure distributor configuration is visible before continuing */
6871
__asm volatile ( "dsb sy" ::: "memory" );
@@ -78,7 +81,8 @@ void vGIC_SetPriority( uint32_t ulInterruptID, uint32_t ulPriority )
7881
uint32_t ulShift = ( ulInterruptID % 4U ) * 8U; /* Byte lane offset */
7982
uint32_t ulMask = 0xFFUL << ulShift; /* Field mask */
8083

81-
volatile uint32_t * pulPriorityReg = ( volatile uint32_t * ) ( ( uintptr_t ) GICR_BASE_PER_CORE( xPortGetCoreID() ) + GICR_IPRIORITYR( ulIndex ) );
84+
volatile uint32_t * pulPriorityReg = ( volatile uint32_t * ) ( ( portPOINTER_SIZE_TYPE ) GICR_BASE_PER_CORE( ucPortGetCoreID() ) +
85+
( portPOINTER_SIZE_TYPE ) GICR_IPRIORITYR( ulIndex ) );
8286
uint32_t ulRegValue = *pulPriorityReg;
8387
ulRegValue &= ~( ulMask );
8488
ulRegValue |= ( ( uint32_t ) ulPriority << ulShift );
@@ -99,10 +103,10 @@ void vGIC_EnableIRQ( uint32_t ulInterruptID )
99103
uint32_t ulBitMask = 1U << ulInterruptID;
100104

101105
/* 1. Assign the interrupt to group 1 */
102-
*( volatile uint32_t * )( GICR_BASE_PER_CORE( xPortGetCoreID() ) + GICR_IGROUPR0 ) |= ( 1U << ulInterruptID );
106+
*( volatile uint32_t * )( ( portPOINTER_SIZE_TYPE ) GICR_BASE_PER_CORE( ucPortGetCoreID() ) + ( portPOINTER_SIZE_TYPE ) GICR_IGROUPR0 ) |= ( 1U << ulInterruptID );
103107

104108
/* 2. Enable the interrupt in GIC */
105-
*( volatile uint32_t* )( GICR_BASE_PER_CORE( xPortGetCoreID() ) + GICR_ISENABLER0 ) |= ulBitMask;
109+
*( volatile uint32_t* )( ( portPOINTER_SIZE_TYPE ) GICR_BASE_PER_CORE( ucPortGetCoreID() ) + ( portPOINTER_SIZE_TYPE ) GICR_ISENABLER0 ) |= ulBitMask;
106110

107111
/* Ensure interrupt enable is visible */
108112
__asm volatile ( "dsb sy" ::: "memory" );

CORTEX_R82_SMP_FVP_GCC_ARMCLANG/BSP/Source/xil-crt0.S renamed to CORTEX_R82_SMP_FVP_GCC_ARMCLANG/BSP/Source/startup.S

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
#endif
1414

1515
#include "FreeRTOSConfig.h"
16-
.file "xil-crt0.S"
16+
#include "portmacro.h"
17+
.file "startup.S"
1718
.align 2
1819

1920
.extern _vector_table
@@ -98,6 +99,7 @@ c_init_end:
9899
#endif
99100
b jump_to_main
100101

102+
#if configNUMBER_OF_CORES > 1
101103
secondary_cores_hold:
102104
ldr x0, =ucPrimaryCoreInitDoneFlag
103105
ldr w1, [x0] /* Has the primary core set the flag? */
@@ -115,11 +117,12 @@ make_secondary_cores_ready:
115117
ldr x0, =ucSecondaryCoresReadyFlags
116118
mrs x1, MPIDR_EL1
117119
and x1, x1, #0xFF
118-
sub x1, x1, #1 /* Core 1 is index 0 in the array */
120+
sub x1, x1, #1 /* Core 1 is index 0 in the array */
119121
add x0, x0, x1
120122
mov w1, #1
121-
strb w1, [x0] /* Mark this core as ready */
122-
SVC 106 /* Start the first task on the secondary core */
123+
strb w1, [x0] /* Mark this core as ready */
124+
SVC # portSVC_START_FIRST_TASK /* Start the first task on the secondary core */
125+
#endif
123126

124127
jump_to_main:
125128
ldr X1, = freertos_vector_base
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright 2025-2026 Arm Limited and/or its affiliates <open-source-office@arm.com>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

CORTEX_R82_SMP_FVP_GCC_ARMCLANG/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ This example relies on the `FVP_BaseR_AEMv8R` implementing fully coherent caches
5959
| **Shared flag** | `ulSharedFlag` (64-bit) is cache-coherent across cores. |
6060
| **Tasks** | `prvTaskCore0` (core 0) prints **Ping**, sets flag to 1; `prvTaskCore1` (core 1) prints **Pong**, sets flag to 0. Each task delays for 1 s (`vTaskDelay( pdMS_TO_TICKS(1000) )`). |
6161
| **Core affinity** | After creation, tasks are pinned via `vTaskCoreAffinitySet()` to ensure deterministic execution. |
62-
| **Scheduler bring-up** | Only primary Core (i.e., Core 0) jumps to main, creates the user tasks, and calls `vTaskStartScheduler()`. Each secondary core starts and does all the its core specific initialisation and spin in `wfe` until `ucPrimaryCoreInitDoneFlag` is set to `1`, initialize the GIC redistributor and enable SGIs so interrupts from the primary core are receivable, signal the primary core that this secondary core is online and ready by setting the its flag in the `ucSecondaryCoresReadyFlags` array, finally issues an SVC with immediate value `106` to enter `FreeRTOS_SWI_Handler`, which will call `vPortRestoreContext()` based on the SVC number to start scheduling on the secondary core. |
62+
| **Scheduler bring-up** | Only primary Core (i.e., Core 0) jumps to main, creates the user tasks, and calls `vTaskStartScheduler()`. Each secondary core starts and does all the its core specific initialisation and spin in `wfe` until `ucPrimaryCoreInitDoneFlag` is set to `1`, initialize the GIC redistributor and enable SGIs so interrupts from the primary core are receivable, signal the primary core that this secondary core is online and ready by setting the its flag in the `ucSecondaryCoresReadyFlags` array, finally issues an SVC with immediate value `106` (i.e., `portSVC_START_FIRST_TASK`) to enter `FreeRTOS_SWI_Handler`, which will call `vPortRestoreContext()` based on the SVC number to start scheduling on the secondary core. |
6363
| **Tick timer** | `vConfigureTickInterrupt()` programs `CNTP_EL0` for the FreeRTOS tick and routes `IRQ 30` through the GIC to all cores. |
6464
| **Cache maintenance** | Each write to `ulSharedFlag` is followed by a `DSB SY` to guarantee visibility before the other core wakes. |
6565

@@ -134,4 +134,4 @@ Rebuild the example and launch the model as usual.
134134

135135
## License
136136

137-
This example is released under the **MIT License**.
137+
This example is released under the **MIT License**. See the [LICENSE](LICENSE.md) file.

CORTEX_R82_SMP_FVP_GCC_ARMCLANG/armclang_toolchain.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ set(CMAKE_C_STANDARD 11)
1515
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
1616

1717
# Common flags for compilation
18-
set(CMAKE_C_FLAGS "--target=aarch64-arm-none-eabi -mcpu=cortex-r82 -mlittle-endian -Werror -g -gdwarf-3 -mstrict-align" )
19-
set(CMAKE_ASM_FLAGS "--target=aarch64-arm-none-eabi -mcpu=cortex-r82 -Werror -g -gdwarf-3 -mstrict-align" )
18+
set(CMAKE_C_FLAGS "--target=aarch64-arm-none-eabi -mcpu=cortex-r82 -mlittle-endian -Werror -mstrict-align" )
19+
set(CMAKE_ASM_FLAGS "--target=aarch64-arm-none-eabi -mcpu=cortex-r82 -Werror -mstrict-align" )
2020

2121
set(CMAKE_EXE_LINKER_FLAGS_INIT "--entry=_boot" )
2222
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT}")

CORTEX_R82_SMP_FVP_GCC_ARMCLANG/gnu_toolchain.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ set(CMAKE_ASM_COMPILER "aarch64-none-elf-gcc")
1111

1212
set(CMAKE_C_STANDARD 11)
1313

14-
set(CMAKE_C_FLAGS "-mcpu=cortex-r82 -mabi=lp64 -mlittle-endian -Wall -Wextra -g -gdwarf-3 -mstrict-align")
15-
set(CMAKE_ASM_FLAGS "-mcpu=cortex-r82 -mabi=lp64 -Wall -g -gdwarf-3")
14+
set(CMAKE_C_FLAGS "-mcpu=cortex-r82 -mabi=lp64 -mlittle-endian -Wall -Wextra -Werror -mstrict-align")
15+
set(CMAKE_ASM_FLAGS "-mcpu=cortex-r82 -mabi=lp64 -Wall -Werror -mstrict-align")
1616

1717
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
1818

CORTEX_R82_SMP_FVP_GCC_ARMCLANG/main.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static void prvTaskCore0( void * arg )
6363
{
6464
if( ulSharedFlag == 0U )
6565
{
66-
printf( "Ping from Core %lu\r\n", xPortGetCoreID() );
66+
printf( "Ping from Core %d\r\n", ucPortGetCoreID() );
6767
ulSharedFlag = 1U;
6868
__asm volatile( "dsb sy");
6969
}
@@ -83,7 +83,7 @@ static void prvTaskCore1( void * arg )
8383
{
8484
if( ulSharedFlag == 1U )
8585
{
86-
printf( "Pong from Core %lu\r\n", xPortGetCoreID() );
86+
printf( "Pong from Core %d\r\n", ucPortGetCoreID() );
8787
ulSharedFlag = 0U;
8888
__asm volatile( "dsb sy");
8989
}
@@ -116,8 +116,10 @@ int main()
116116
return EXIT_FAILURE;
117117
}
118118

119-
vTaskCoreAffinitySet( prvTaskCore0Handle, 1UL << 0 ); /* Pin to Core 0 */
120-
vTaskCoreAffinitySet( prvTaskCore1Handle, 1UL << 1 ); /* Pin to Core 1 */
119+
#if ( configNUMBER_OF_CORES > 1 )
120+
vTaskCoreAffinitySet( prvTaskCore0Handle, 1UL << 0 ); /* Pin to Core 0 */
121+
vTaskCoreAffinitySet( prvTaskCore1Handle, 1UL << 1 ); /* Pin to Core 1 */
122+
#endif
121123

122124
xSharedFlagMutex = xSemaphoreCreateMutex();
123125

@@ -266,10 +268,12 @@ void vApplicationIRQHandler( uint32_t ulICCIAR )
266268
{
267269
FreeRTOS_Tick_Handler();
268270
}
269-
else if( ulInterruptID == SGI0_IRQ )
270-
{
271-
FreeRTOS_SGI_Handler();
272-
}
271+
#if ( configNUMBER_OF_CORES > 1 )
272+
else if( ulInterruptID == SGI0_IRQ )
273+
{
274+
FreeRTOS_SGI_Handler();
275+
}
276+
#endif
273277
else
274278
{
275279
/* Handle other interrupts as needed. */

0 commit comments

Comments
 (0)