Skip to content

Commit 3560308

Browse files
committed
Address code review suggestions
1 parent 48acdd2 commit 3560308

File tree

3 files changed

+34
-39
lines changed

3 files changed

+34
-39
lines changed

portable/GCC/ARM_CRx_No_GIC/port.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,8 @@
8282
#endif
8383

8484
/* The space on the stack required to hold the FPU registers. */
85-
#if ( configFPU_D32 == 1 )
86-
#define portFPU_REGISTER_WORDS ( ( 32 * 2 ) + 1 ) /* D0-D31 and FPSCR. */
87-
#else
88-
#define portFPU_REGISTER_WORDS ( ( 16 * 2 ) + 1 ) /* D0-D15 and FPSCR. */
89-
#endif
85+
#define portFPU_REGISTER_WORDS ( ( 16 * 2 ) + 1 ) /* D0-D15 and FPSCR. */
86+
9087
/*-----------------------------------------------------------*/
9188

9289
/*

portable/GCC/ARM_CRx_No_GIC/portASM.S

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363
/* Save the LR and SPSR onto the system mode stack before switching to
6464
* system mode to save the remaining system mode registers. */
65-
SRSDB sp!, #SYS_MODE
65+
SRSDB SP!, #SYS_MODE
6666
CPS #SYS_MODE
6767
PUSH {R0-R12, R14}
6868

@@ -80,9 +80,6 @@
8080
/* Save the floating point context, if any. */
8181
VMRSNE R1, FPSCR
8282
VPUSHNE {D0-D15}
83-
#if configFPU_D32 == 1
84-
VPUSHNE {D16-D31}
85-
#endif /* configFPU_D32 */
8683
PUSHNE {R1}
8784

8885
/* Save ulPortTaskHasFPUContext itself. */
@@ -129,7 +126,7 @@
129126
POP {R0-R12, R14}
130127

131128
/* Return to the task code, loading CPSR on the way. */
132-
RFEIA sp!
129+
RFEIA SP!
133130

134131
.endm
135132

@@ -291,67 +288,68 @@ svcApplicationCall:
291288
.type FreeRTOS_IRQ_Handler, %function
292289
FreeRTOS_IRQ_Handler:
293290
/* Return to the interrupted instruction. */
294-
SUB lr, lr, #4
291+
SUB LR, LR, #4
295292

296293
/* Push the return address and SPSR. */
297-
PUSH {lr}
298-
MRS lr, SPSR
299-
PUSH {lr}
294+
PUSH {LR}
295+
MRS LR, SPSR
296+
PUSH {LR}
300297

301298
/* Change to supervisor mode to allow reentry. */
302299
CPS #SVC_MODE
303300

304301
/* Push used registers. */
305-
PUSH {r0-r3, r12}
302+
PUSH {R0-R3, R12}
306303

307304
/* Increment nesting count. r3 holds the address of ulPortInterruptNesting
308305
* for future use. r1 holds the original ulPortInterruptNesting value for
309306
* future use. */
310-
LDR r3, =ulPortInterruptNesting
311-
LDR r1, [r3]
312-
ADD r0, r1, #1
313-
STR r0, [r3]
307+
LDR R3, =ulPortInterruptNesting
308+
LDR R1, [R3]
309+
ADD R0, R1, #1
310+
STR R0, [R3]
314311

315312
/* Ensure bit 2 of the stack pointer is clear. r2 holds the bit 2 value for
316313
* future use. */
317-
MOV r0, sp
318-
AND r2, r0, #4
319-
SUB sp, sp, r2
314+
MOV R0, SP
315+
AND R2, R0, #4
316+
SUB SP, SP, R2
320317

321318
/* Call the interrupt handler. */
322-
PUSH {r0-r3, lr}
319+
PUSH {R0-R3, LR}
323320
BLX vApplicationIRQHandler
324-
POP {r0-r3, lr}
325-
ADD sp, sp, r2
321+
POP {R0-R3, LR}
322+
ADD SP, SP, R2
326323

324+
/* Disable IRQs incase vApplicationIRQHandler enabled them for re-entry. */
327325
CPSID i
328326
DSB
329327
ISB
330328

331329
/* Write to the EOI register. */
332-
LDR r0, =ulICCEOIR
333-
LDR r2, [r0]
334-
STR r0, [r2]
330+
LDR R0, =ulICCEOIR
331+
LDR R2, [R0]
332+
STR R0, [R2]
335333

336334
/* Restore the old nesting count. */
337-
STR r1, [r3]
335+
STR R1, [R3]
338336

339337
/* A context switch is never performed if the nesting count is not 0. */
340-
CMP r1, #0
338+
CMP R1, #0
341339
BNE exit_without_switch
342340

343341
/* Did the interrupt request a context switch? r1 holds the address of
344342
* ulPortYieldRequired and r0 the value of ulPortYieldRequired for future
345343
* use. */
346-
LDR r1, =ulPortYieldRequired
347-
LDR r0, [r1]
348-
CMP r0, #0
344+
LDR R1, =ulPortYieldRequired
345+
LDR R0, [R1]
346+
CMP R0, #0
349347
BNE switch_before_exit
350348

351349
exit_without_switch:
352350
/* No context switch. Restore used registers, LR_irq and SPSR before
353351
* returning. */
354-
POP {r0-r3, r12}
352+
POP {R0-R3, R12}
355353
CPS #IRQ_MODE
356354
POP {LR}
357355
MSR SPSR_cxsf, LR
@@ -361,12 +359,12 @@ exit_without_switch:
361359
switch_before_exit:
362360
/* A context switch is to be performed. Clear the context switch pending
363361
* flag. */
364-
MOV r0, #0
365-
STR r0, [r1]
362+
MOV R0, #0
363+
STR R0, [R1]
366364

367365
/* Restore used registers, LR-irq and SPSR before saving the context
368366
* to the task stack. */
369-
POP {r0-r3, r12}
367+
POP {R0-R3, R12}
370368
CPS #IRQ_MODE
371369
POP {LR}
372370
MSR SPSR_cxsf, LR

portable/GCC/ARM_CRx_No_GIC/portmacro.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ UBaseType_t ulPortCountLeadingZeros( UBaseType_t ulBitmap );
149149
#if ( configUSE_TASK_FPU_SUPPORT != 2 )
150150
void vPortTaskUsesFPU( void );
151151
#else
152-
/* Each task has an FPU context already, so define this function away to
153-
* nothing to prevent it from being called accidentally. */
152+
/* Each task has an FPU context already, so define this function as a
153+
*no-op. */
154154
#define vPortTaskUsesFPU()
155155
#endif
156156
#define portTASK_USES_FLOATING_POINT() vPortTaskUsesFPU()

0 commit comments

Comments
 (0)