Skip to content

Commit 89fe045

Browse files
committed
Remove hardware dependence in portmacros.h
The IAR MSP430X port `#include "msp430.h"` which pulls all the hardware register definitions into anything which `#include "FreeRTOS.h"`. This removes that hardware dependency "leak" by removing the header file and re-defining the `portDISABLE_INTERRUPTS()` and `portENABLE_INTERRUPTS()` macros in terms of `__asm`.
1 parent 53c7e7c commit 89fe045

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

portable/IAR/MSP430X/port.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
#include "FreeRTOS.h"
3131
#include "task.h"
3232

33+
/* Hardware includes. */
34+
#include "msp430.h"
35+
3336
/*-----------------------------------------------------------
3437
* Implementation of functions defined in portable.h for the MSP430X port.
3538
*----------------------------------------------------------*/

portable/IAR/MSP430X/portmacro.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@
3939
*-----------------------------------------------------------
4040
*/
4141

42-
/* Hardware includes. */
43-
#include "msp430.h"
44-
4542
/* Type definitions. */
4643
#define portCHAR char
4744
#define portFLOAT float
@@ -75,8 +72,8 @@ typedef unsigned short UBaseType_t;
7572
/*-----------------------------------------------------------*/
7673

7774
/* Interrupt control macros. */
78-
#define portDISABLE_INTERRUPTS() _DINT(); _NOP()
79-
#define portENABLE_INTERRUPTS() _EINT(); _NOP()
75+
#define portDISABLE_INTERRUPTS() __asm volatile ( "DINT\n" "NOP" )
76+
#define portENABLE_INTERRUPTS() __asm volatile ( "EINT\n" "NOP" )
8077
/*-----------------------------------------------------------*/
8178

8279
/* Critical section control macros. */
@@ -126,7 +123,7 @@ extern void vPortYield( void );
126123
#define portBYTE_ALIGNMENT 2
127124
#define portSTACK_GROWTH ( -1 )
128125
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
129-
#define portNOP() __no_operation()
126+
#define portNOP() __asm volatile ( "NOP" )
130127
/*-----------------------------------------------------------*/
131128

132129
/* Task function macros as described on the FreeRTOS.org WEB site. */

0 commit comments

Comments
 (0)