Compare commits

..

2 commits

Author SHA1 Message Date
FintasticMan 7556d77025
Merge 88e5c641fa into 8598142c27 2024-10-10 10:09:30 +00:00
FintasticMan 88e5c641fa
clang-format: Update to 16 2024-10-10 12:09:20 +02:00
8 changed files with 326 additions and 5092 deletions

View file

@ -4,16 +4,16 @@ on:
pull_request:
branches: [main]
paths:
- "**.cpp"
- "**.h"
- "src/**.cpp"
- "src/**.h"
- "!src/libs/**"
- "!src/FreeRTOS/**"
jobs:
test-format:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 1000
@ -29,13 +29,13 @@ jobs:
run: tests/test-format.sh
- name: Upload patches
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: Patches
path: ./*.patch
test-clang-tidy:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
container:
image: infinitime/infinitime-build
steps:
@ -46,7 +46,7 @@ jobs:
- name: Workaround permission issues
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Checkout source files
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1000
@ -55,7 +55,7 @@ jobs:
- name: Install clang-tidy
run: |
apt-get update
apt-get -y install clang-tidy-14
apt-get -y install clang-tidy-16
- name: Prepare environment
shell: bash
env:

File diff suppressed because it is too large Load diff

View file

@ -23,7 +23,7 @@ if [ -z "$name" ] || [ -z "$bin" ]; then
exit 1
fi
args="--binary $bin -q --extensions cpp,h --style file --staged -- :!src/FreeRTOS :!src/libs"
args="--binary $bin -q --extensions cpp,h --style file --staged -- src :!src/FreeRTOS :!src/libs"
changedFiles="$(git "$name" --diffstat $args)"
git "$name" $args

View file

@ -26,9 +26,11 @@
* 1 tab == 4 spaces!
*/
#ifndef PORTMACRO_H
#define PORTMACRO_H
#include "portmacro_cmsis.h"
#endif /* PORTMACRO_H */

View file

@ -45,144 +45,145 @@ extern "C" {
*/
/* Type definitions. */
#define portCHAR char
#define portFLOAT float
#define portDOUBLE double
#define portLONG long
#define portSHORT short
#define portSTACK_TYPE uint32_t
#define portBASE_TYPE long
#define portCHAR char
#define portFLOAT float
#define portDOUBLE double
#define portLONG long
#define portSHORT short
#define portSTACK_TYPE uint32_t
#define portBASE_TYPE long
typedef portSTACK_TYPE StackType_t;
typedef long BaseType_t;
typedef unsigned long UBaseType_t;
#if (configUSE_16_BIT_TICKS == 1)
typedef uint16_t TickType_t;
#define portMAX_DELAY (TickType_t) 0xffff
#if ( configUSE_16_BIT_TICKS == 1 )
typedef uint16_t TickType_t;
#define portMAX_DELAY ( TickType_t ) 0xffff
#else
typedef uint32_t TickType_t;
#define portMAX_DELAY (TickType_t) 0xffffffffUL
typedef uint32_t TickType_t;
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
not need to be guarded with a critical section. */
#define portTICK_TYPE_IS_ATOMIC 1
/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
not need to be guarded with a critical section. */
#define portTICK_TYPE_IS_ATOMIC 1
#endif
/*-----------------------------------------------------------*/
/* Architecture specifics. */
#define portSTACK_GROWTH (-1)
#define portTICK_PERIOD_MS ((TickType_t) 1000 / configTICK_RATE_HZ)
#define portBYTE_ALIGNMENT 8
#define portSTACK_GROWTH ( -1 )
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
#define portBYTE_ALIGNMENT 8
/* RTC register */
#define portNRF_RTC_REG NRF_RTC1
#define portNRF_RTC_REG NRF_RTC1
/* IRQn used by the selected RTC */
#define portNRF_RTC_IRQn RTC1_IRQn
#define portNRF_RTC_IRQn RTC1_IRQn
/* Constants required to manipulate the NVIC. */
#define portNRF_RTC_PRESCALER ((uint32_t) (ROUNDED_DIV(configSYSTICK_CLOCK_HZ, configTICK_RATE_HZ) - 1))
#define portNRF_RTC_PRESCALER ( (uint32_t) (ROUNDED_DIV(configSYSTICK_CLOCK_HZ, configTICK_RATE_HZ) - 1) )
/* Maximum RTC ticks */
#define portNRF_RTC_MAXTICKS ((1U << 24) - 1U)
#define portNRF_RTC_MAXTICKS ((1U<<24)-1U)
/*-----------------------------------------------------------*/
/* Scheduler utilities. */
#define portYIELD() \
do { \
/* Set a PendSV to request a context switch. */ \
SCB->ICSR = SCB_ICSR_PENDSVSET_Msk; \
__SEV(); \
/* Barriers are normally not required but do ensure the code is completely \
within the specified behaviour for the architecture. */ \
__DSB(); \
__ISB(); \
} while (0)
#define portYIELD() do \
{ \
/* Set a PendSV to request a context switch. */ \
SCB->ICSR = SCB_ICSR_PENDSVSET_Msk; \
__SEV(); \
/* Barriers are normally not required but do ensure the code is completely \
within the specified behaviour for the architecture. */ \
__DSB(); \
__ISB(); \
}while (0)
#define portEND_SWITCHING_ISR(xSwitchRequired) \
if ((xSwitchRequired) != pdFALSE) \
portYIELD()
#define portYIELD_FROM_ISR(x) portEND_SWITCHING_ISR(x)
#define portEND_SWITCHING_ISR( xSwitchRequired ) if ( (xSwitchRequired) != pdFALSE ) portYIELD()
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/
/* Critical section management. */
extern void vPortEnterCritical(void);
extern void vPortExitCritical(void);
extern uint32_t ulSetInterruptMaskFromISR(void) __attribute__((naked));
extern void vClearInterruptMaskFromISR(uint32_t ulMask) __attribute__((naked));
#define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMaskFromISR()
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vClearInterruptMaskFromISR(x)
#define portDISABLE_INTERRUPTS() __asm volatile(" cpsid i " ::: "memory")
#define portENABLE_INTERRUPTS() __asm volatile(" cpsie i " ::: "memory")
#define portENTER_CRITICAL() vPortEnterCritical()
#define portEXIT_CRITICAL() vPortExitCritical()
extern void vPortEnterCritical( void );
extern void vPortExitCritical( void );
extern uint32_t ulSetInterruptMaskFromISR( void ) __attribute__( ( naked ) );
extern void vClearInterruptMaskFromISR( uint32_t ulMask ) __attribute__( ( naked ) );
#define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMaskFromISR()
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vClearInterruptMaskFromISR( x )
#define portDISABLE_INTERRUPTS() __asm volatile ( " cpsid i " ::: "memory" )
#define portENABLE_INTERRUPTS() __asm volatile ( " cpsie i " ::: "memory" )
#define portENTER_CRITICAL() vPortEnterCritical()
#define portEXIT_CRITICAL() vPortExitCritical()
/*-----------------------------------------------------------*/
/* Task function macros as described on the FreeRTOS.org WEB site. These are
not necessary for to use this port. They are defined so the common demo files
(which build with all the ports) will build. */
#define portTASK_FUNCTION_PROTO(vFunction, pvParameters) void vFunction(void* pvParameters)
#define portTASK_FUNCTION(vFunction, pvParameters) void vFunction(void* pvParameters)
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
/*-----------------------------------------------------------*/
/* Tickless idle/low power functionality. */
#ifndef portSUPPRESS_TICKS_AND_SLEEP
extern void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime);
#define portSUPPRESS_TICKS_AND_SLEEP(xExpectedIdleTime) vPortSuppressTicksAndSleep(xExpectedIdleTime)
extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime );
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
#endif
/*-----------------------------------------------------------*/
/* Architecture specific optimisations. */
#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#endif
#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
/* Count leading zeros helper. */
#define ucPortCountLeadingZeros(bits) __CLZ(bits)
/* Count leading zeros helper. */
#define ucPortCountLeadingZeros( bits ) __CLZ( bits )
/* Check the configuration. */
#if (configMAX_PRIORITIES > 32)
#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice.
#endif
/* Check the configuration. */
#if ( configMAX_PRIORITIES > 32 )
#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice.
#endif
/* Store/clear the ready priorities in a bit map. */
#define portRECORD_READY_PRIORITY(uxPriority, uxReadyPriorities) (uxReadyPriorities) |= (1UL << (uxPriority))
#define portRESET_READY_PRIORITY(uxPriority, uxReadyPriorities) (uxReadyPriorities) &= ~(1UL << (uxPriority))
/* Store/clear the ready priorities in a bit map. */
#define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
#define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
#define portGET_HIGHEST_PRIORITY(uxTopPriority, uxReadyPriorities) uxTopPriority = (31 - ucPortCountLeadingZeros((uxReadyPriorities)))
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - ucPortCountLeadingZeros( ( uxReadyPriorities ) ) )
#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
/*-----------------------------------------------------------*/
#ifdef configASSERT
void vPortValidateInterruptPriority(void);
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority()
void vPortValidateInterruptPriority( void );
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority()
#endif
/*-----------------------------------------------------------*/
#define vPortSetBASEPRI(ulNewMaskValue) __set_BASEPRI(ulNewMaskValue)
#define vPortSetBASEPRI( ulNewMaskValue ) __set_BASEPRI(ulNewMaskValue)
/*-----------------------------------------------------------*/
#define vPortRaiseBASEPRI() vPortSetBASEPRI(configMAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
#define vPortRaiseBASEPRI( ) vPortSetBASEPRI(configMAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
/*-----------------------------------------------------------*/
__STATIC_INLINE uint32_t ulPortRaiseBASEPRI(void) {
uint32_t ulOriginalBASEPRI = __get_BASEPRI();
vPortRaiseBASEPRI();
return ulOriginalBASEPRI;
__STATIC_INLINE uint32_t ulPortRaiseBASEPRI( void )
{
uint32_t ulOriginalBASEPRI = __get_BASEPRI();
vPortRaiseBASEPRI();
return ulOriginalBASEPRI;
}
/*-----------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* PORTMACRO_CMSIS_H */

View file

@ -9,7 +9,7 @@
// 00020001-78fc-48fe-8e23-433b3a1942d0
#define NOTIFICATION_EVENT_SERVICE_UUID_BASE \
{0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x01, 0x00, 0x02, 0x00}
{ 0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x01, 0x00, 0x02, 0x00 }
namespace Pinetime {

View file

@ -20,7 +20,7 @@ do
*.cpp|*.h)
echo Checking "$file"
PATCH="$(basename "$file").patch"
git clang-format-14 -q --style file --diff "$GITHUB_BASE_REF" "$file" > "$PATCH"
git clang-format-16 -q --style file --diff "$GITHUB_BASE_REF" "$file" > "$PATCH"
if [ -s "$PATCH" ]
then
printf "\033[31mError:\033[0m Formatting error in %s\n" "$file"

View file

@ -17,7 +17,7 @@ do
src/libs/*|src/FreeRTOS/*) continue ;;
*.cpp|*.h)
echo "::group::$file"
clang-tidy-14 -p build "$file" || true
clang-tidy-16 -p build "$file" || true
echo "::endgroup::"
esac
done