Skip to content

Commit

Permalink
ARMv7M: Adjust implemented priority bit assertions (#665)
Browse files Browse the repository at this point in the history
Adjust assertions related to the CMSIS __NVIC_PRIO_BITS and FreeRTOS
configPRIO_BITS configuration macros such that these macros specify the
minimum number of implemented priority bits supported by a config
build rather than the exact number of implemented priority bits.

Related to Qemu issue #1122
  • Loading branch information
paulbartell authored Apr 20, 2023
1 parent aa987a3 commit 686b6e6
Show file tree
Hide file tree
Showing 16 changed files with 200 additions and 136 deletions.
20 changes: 12 additions & 8 deletions portable/CCS/ARM_CM3/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,19 +287,23 @@ BaseType_t xPortStartScheduler( void )

#ifdef __NVIC_PRIO_BITS
{
/* Check the CMSIS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == __NVIC_PRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the CMSIS
* __NVIC_PRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= __NVIC_PRIO_BITS );
}
#endif

#ifdef configPRIO_BITS
{
/* Check the FreeRTOS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == configPRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the FreeRTOS
* configPRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= configPRIO_BITS );
}
#endif

Expand Down
20 changes: 12 additions & 8 deletions portable/CCS/ARM_CM4F/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,19 +306,23 @@ BaseType_t xPortStartScheduler( void )

#ifdef __NVIC_PRIO_BITS
{
/* Check the CMSIS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == __NVIC_PRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the CMSIS
* __NVIC_PRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= __NVIC_PRIO_BITS );
}
#endif

#ifdef configPRIO_BITS
{
/* Check the FreeRTOS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == configPRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the FreeRTOS
* configPRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= configPRIO_BITS );
}
#endif

Expand Down
20 changes: 12 additions & 8 deletions portable/GCC/ARM_CM3/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,19 +330,23 @@ BaseType_t xPortStartScheduler( void )

#ifdef __NVIC_PRIO_BITS
{
/* Check the CMSIS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == __NVIC_PRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the CMSIS
* __NVIC_PRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= __NVIC_PRIO_BITS );
}
#endif

#ifdef configPRIO_BITS
{
/* Check the FreeRTOS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == configPRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the FreeRTOS
* configPRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= configPRIO_BITS );
}
#endif

Expand Down
28 changes: 16 additions & 12 deletions portable/GCC/ARM_CM3_MPU/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,21 +452,25 @@ BaseType_t xPortStartScheduler( void )
}

#ifdef __NVIC_PRIO_BITS
{
/* Check the CMSIS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == __NVIC_PRIO_BITS );
}
{
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the CMSIS
* __NVIC_PRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= __NVIC_PRIO_BITS );
}
#endif

#ifdef configPRIO_BITS
{
/* Check the FreeRTOS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == configPRIO_BITS );
}
{
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the FreeRTOS
* configPRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= configPRIO_BITS );
}
#endif

/* Shift the priority group value back to its position within the AIRCR
Expand Down
20 changes: 12 additions & 8 deletions portable/GCC/ARM_CM4F/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,19 +373,23 @@ BaseType_t xPortStartScheduler( void )

#ifdef __NVIC_PRIO_BITS
{
/* Check the CMSIS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == __NVIC_PRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the CMSIS
* __NVIC_PRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= __NVIC_PRIO_BITS );
}
#endif

#ifdef configPRIO_BITS
{
/* Check the FreeRTOS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == configPRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the FreeRTOS
* configPRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= configPRIO_BITS );
}
#endif

Expand Down
28 changes: 16 additions & 12 deletions portable/GCC/ARM_CM4_MPU/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,21 +495,25 @@ BaseType_t xPortStartScheduler( void )
}

#ifdef __NVIC_PRIO_BITS
{
/* Check the CMSIS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == __NVIC_PRIO_BITS );
}
{
/*
* Check that the number of implemented priority bits queried
* from hardware is at least as many as specified in the
* CMSIS __NVIC_PRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= __NVIC_PRIO_BITS );
}
#endif

#ifdef configPRIO_BITS
{
/* Check the FreeRTOS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == configPRIO_BITS );
}
{
/*
* Check that the number of implemented priority bits queried
* from hardware is at least as many as specified in the
* FreeRTOS configPRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= configPRIO_BITS );
}
#endif

/* Shift the priority group value back to its position within the AIRCR
Expand Down
20 changes: 12 additions & 8 deletions portable/GCC/ARM_CM7/r0p1/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,19 +361,23 @@ BaseType_t xPortStartScheduler( void )

#ifdef __NVIC_PRIO_BITS
{
/* Check the CMSIS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == __NVIC_PRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the CMSIS
* __NVIC_PRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= __NVIC_PRIO_BITS );
}
#endif

#ifdef configPRIO_BITS
{
/* Check the FreeRTOS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == configPRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the FreeRTOS
* configPRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= configPRIO_BITS );
}
#endif

Expand Down
20 changes: 12 additions & 8 deletions portable/IAR/ARM_CM3/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,19 +279,23 @@ BaseType_t xPortStartScheduler( void )

#ifdef __NVIC_PRIO_BITS
{
/* Check the CMSIS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == __NVIC_PRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the CMSIS
* __NVIC_PRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= __NVIC_PRIO_BITS );
}
#endif

#ifdef configPRIO_BITS
{
/* Check the FreeRTOS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == configPRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the FreeRTOS
* configPRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= configPRIO_BITS );
}
#endif

Expand Down
20 changes: 12 additions & 8 deletions portable/IAR/ARM_CM4F/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,19 +317,23 @@ BaseType_t xPortStartScheduler( void )

#ifdef __NVIC_PRIO_BITS
{
/* Check the CMSIS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == __NVIC_PRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the CMSIS
* __NVIC_PRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= __NVIC_PRIO_BITS );
}
#endif

#ifdef configPRIO_BITS
{
/* Check the FreeRTOS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == configPRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the FreeRTOS
* configPRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= configPRIO_BITS );
}
#endif

Expand Down
20 changes: 12 additions & 8 deletions portable/IAR/ARM_CM4F_MPU/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,19 +431,23 @@ BaseType_t xPortStartScheduler( void )

#ifdef __NVIC_PRIO_BITS
{
/* Check the CMSIS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == __NVIC_PRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the CMSIS
* __NVIC_PRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= __NVIC_PRIO_BITS );
}
#endif

#ifdef configPRIO_BITS
{
/* Check the FreeRTOS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == configPRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the FreeRTOS
* configPRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= configPRIO_BITS );
}
#endif

Expand Down
20 changes: 12 additions & 8 deletions portable/IAR/ARM_CM7/r0p1/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,19 +305,23 @@ BaseType_t xPortStartScheduler( void )

#ifdef __NVIC_PRIO_BITS
{
/* Check the CMSIS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == __NVIC_PRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the CMSIS
* __NVIC_PRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= __NVIC_PRIO_BITS );
}
#endif

#ifdef configPRIO_BITS
{
/* Check the FreeRTOS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == configPRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the FreeRTOS
* configPRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= configPRIO_BITS );
}
#endif

Expand Down
20 changes: 12 additions & 8 deletions portable/MikroC/ARM_CM4F/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,19 +367,23 @@ BaseType_t xPortStartScheduler( void )

#ifdef __NVIC_PRIO_BITS
{
/* Check the CMSIS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == __NVIC_PRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the CMSIS
* __NVIC_PRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= __NVIC_PRIO_BITS );
}
#endif

#ifdef configPRIO_BITS
{
/* Check the FreeRTOS configuration that defines the number of
* priority bits matches the number of priority bits actually queried
* from the hardware. */
configASSERT( ulImplementedPrioBits == configPRIO_BITS );
/*
* Check that the number of implemented priority bits queried from
* hardware is at least as many as specified in the FreeRTOS
* configPRIO_BITS configuration macro.
*/
configASSERT( ulImplementedPrioBits >= configPRIO_BITS );
}
#endif

Expand Down
Loading

0 comments on commit 686b6e6

Please sign in to comment.