Skip to content

Commit 4ee6a1f

Browse files
MPLAB PIC32MZ-EF - Adds an assert to catch register overflow (#1265) (#1267)
Add an assert to catch register overflow (#1265)
1 parent 03db672 commit 4ee6a1f

File tree

7 files changed

+16
-4
lines changed

7 files changed

+16
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88
jobs:
99
formatting:
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/[email protected]
1313
- name: Check Formatting of FreeRTOS-Kernel Files

.github/workflows/formatting.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ jobs:
1616
if: ${{ github.event.issue.pull_request &&
1717
( ( github.event.comment.body == '/bot run uncrustify' ) ||
1818
( github.event.comment.body == '/bot run formatting' ) ) }}
19-
runs-on: ubuntu-20.04
19+
runs-on: ubuntu-latest
2020
steps:
2121
- name: Apply Formatting Fix
2222
id: check-formatting
2323
uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@main
2424
with:
2525
exclude-dirs: portable
26+

.github/workflows/kernel-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on: [push, pull_request]
55
jobs:
66
kernel-checker:
77
name: FreeRTOS Kernel Header Checks
8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-latest
99
steps:
1010
# Install python 3
1111
- name: Tool Setup

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on: [push, pull_request]
33

44
jobs:
55
run:
6-
runs-on: ubuntu-20.04
6+
runs-on: ubuntu-latest
77
steps:
88
- name: Checkout Parent Repository
99
uses: actions/[email protected]

examples/template_configuration/FreeRTOSConfig.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,13 +415,16 @@
415415
* number of the failing assert (for example, "vAssertCalled( __FILE__, __LINE__
416416
* )" or it can simple disable interrupts and sit in a loop to halt all
417417
* execution on the failing line for viewing in a debugger. */
418+
419+
/* *INDENT-OFF* */
418420
#define configASSERT( x ) \
419421
if( ( x ) == 0 ) \
420422
{ \
421423
taskDISABLE_INTERRUPTS(); \
422424
for( ; ; ) \
423425
; \
424426
}
427+
/* *INDENT-ON* */
425428

426429
/******************************************************************************/
427430
/* FreeRTOS MPU specific definitions. *****************************************/

include/croutine.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,10 @@ void vCoRoutineSchedule( void );
246246
* \defgroup crSTART crSTART
247247
* \ingroup Tasks
248248
*/
249+
250+
/* *INDENT-OFF* */
249251
#define crEND() }
252+
/* *INDENT-ON* */
250253

251254
/*
252255
* These macros are intended for internal use by the co-routine implementation

portable/MPLAB/PIC32MZ/port.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,11 @@ __attribute__(( weak )) void vApplicationSetupTickTimerInterrupt( void )
234234
{
235235
const uint32_t ulCompareMatch = ( (configPERIPHERAL_CLOCK_HZ / portTIMER_PRESCALE) / configTICK_RATE_HZ ) - 1UL;
236236

237+
/* PR1 is 16-bit. Ensure that the configPERIPHERAL_CLOCK_HZ and
238+
* configTICK_RATE_HZ are defined such that ulCompareMatch value would fit
239+
* in 16-bits. */
240+
configASSERT( ( ulCompareMatch & 0xFFFF0000 ) == 0 );
241+
237242
T1CON = 0x0000;
238243
T1CONbits.TCKPS = portPRESCALE_BITS;
239244
PR1 = ulCompareMatch;

0 commit comments

Comments
 (0)