Skip to content

Commit

Permalink
[moo_gnu] Make work with IAR
Browse files Browse the repository at this point in the history
The moo can now compile and run for both IAR and GCC
  • Loading branch information
schultetwin committed Nov 12, 2014
1 parent f9efa9a commit 959d784
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 89 deletions.
21 changes: 11 additions & 10 deletions compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

#ifdef __GNUC__
/* GNU C compiler supported */
#define DO_PRAGMA(x) _Pragma (#x)
#elif __IAR_SYSTEMS_ICC__
/* IAR compiler supported */
#define DO_PRAGMA(x) _Pragma (#x)
#else
#error Unsupported compiler
#endif
Expand All @@ -17,16 +19,16 @@
#ifdef __GNUC__
#define ISR(num, func_name) __attribute__((__interrupt__(num))) void func_name(void)
#elif __IAR_SYSTEMS_ICC__
#define ISR(num, func_name) #pragma vector=num \
__interrupt void func_name(void)
#define ISR(num, func_name) DO_PRAGMA(vector=num) \
__interrupt void func_name(void)
#endif
/* End Interrupts */

/* Data Alignment */
#ifdef __GNUC__
#define ALIGN(var_decl,al_num) var_decl __attribute__((aligned(al_num)))
#elif __IAR_SYSTEMS_ICC__
#define ALIGN(var_decl,al_num) _Pragma(data_alignement, al_num) \
#define ALIGN(var_decl,al_num) DO_PRAGMA(data_alignment=al_num) \
var_decl
#endif

Expand All @@ -36,7 +38,7 @@
#ifdef __GNUC__
#define LOCK_REG(reg_num, var_decl) register var_decl asm(EXPAND_AND_QUOTE(R ## reg_num))
#elif __IAR_SYSTEMS_ICC__
#define LOCK_REG(reg_num, var_decl) __regvar __no_init var_decl @ ## num ##
#define LOCK_REG(reg_num, var_decl) __regvar __no_init var_decl @ ## reg_num
#endif
/* End Lock Register */

Expand All @@ -56,10 +58,9 @@

/* Pragma Message */
#ifdef __GNUC__
#define DO_PRAGMA(x) _Pragma (#x)
#define MESSAGE(msg) DO_PRAGMA(message (msg))
#elif __IAR_SYSTEMS_ICC__
#define MESSAGE(msg) #pragma message (msg)
#define MESSAGE(msg) DO_PRAGMA(message (msg))
#endif
/* End Pragma Message */

Expand Down Expand Up @@ -95,10 +96,10 @@
#include <intrinsics.h>
#define __moo_segment_begin(x) (const struct sensor **) __segment_begin(x)
#define __moo_segment_end(x) (const struct sensor **) __segment_end(x)
#define __sensor_init_begin moo_segment_begin("SENSOR_INIT_I")
#define __sensor_init_end moo_segment_end("SENSOR_INIT_I")
#define __sensor_space_begin moo_segment_begin("SENSOR_SPACE")
#define __sensor_space_end moo_segment_end("SENSOR_SPACE")
#define __sensor_init_begin __moo_segment_begin("SENSOR_INIT_I")
#define __sensor_init_end __moo_segment_end("SENSOR_INIT_I")
#define __sensor_space_begin __moo_segment_begin("SENSOR_SPACE")
#define __sensor_space_end __moo_segment_end("SENSOR_SPACE")
#endif
/* End Register Sensors Segments */

Expand Down
File renamed without changes.
126 changes: 47 additions & 79 deletions iar/umassmoo.ewp
Original file line number Diff line number Diff line change
Expand Up @@ -4307,171 +4307,139 @@
</settings>
</configuration>
<file>
<name>$PROJ_DIR$\board.h</name>
<name>$PROJ_DIR$\..\board.h</name>
</file>
<file>
<name>$PROJ_DIR$\board_1_1.h</name>
<name>$PROJ_DIR$\..\board_1_1.h</name>
</file>
<file>
<name>$PROJ_DIR$\board_1_2.h</name>
<name>$PROJ_DIR$\..\board_1_2.h</name>
</file>
<file>
<name>$PROJ_DIR$\board_1_2_1.h</name>
<name>$PROJ_DIR$\..\board_1_2_1.h</name>
</file>
<file>
<name>$PROJ_DIR$\digital_accel_moo_interface.c</name>
<excluded>
<configuration>Moo1.1-Debug</configuration>
</excluded>
<name>$PROJ_DIR$\..\compiler.h</name>
</file>
<file>
<name>$PROJ_DIR$\digital_accel_moo_interface.h</name>
<excluded>
<configuration>Moo1.1-Debug</configuration>
</excluded>
<name>$PROJ_DIR$\..\digital_accel_moo_interface.c</name>
</file>
<file>
<name>$PROJ_DIR$\digital_accel_sensor.c</name>
<excluded>
<configuration>Moo1.1-Debug</configuration>
</excluded>
<name>$PROJ_DIR$\..\digital_accel_moo_interface.h</name>
</file>
<file>
<name>$PROJ_DIR$\digital_accel_sensor.h</name>
<excluded>
<configuration>Moo1.1-Debug</configuration>
</excluded>
<name>$PROJ_DIR$\..\digital_accel_sensor.c</name>
</file>
<file>
<name>$PROJ_DIR$\digital_accel_test.c</name>
<name>$PROJ_DIR$\..\digital_accel_sensor.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\digital_accel_test.c</name>
<excluded>
<configuration>Moo1.1-Debug</configuration>
<configuration>Moo1.2-Debug</configuration>
<configuration>Moo1.2.1-Debug</configuration>
</excluded>
</file>
<file>
<name>$PROJ_DIR$\int_temp_sensor.c</name>
<name>$PROJ_DIR$\..\flash.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\flash.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\int_temp_sensor.c</name>
<excluded>
<configuration>TEST_ACCEL</configuration>
<configuration>Moo1.1-Debug</configuration>
<configuration>Moo1.2-Debug</configuration>
<configuration>Moo1.2.1-Debug</configuration>
</excluded>
</file>
<file>
<name>$PROJ_DIR$\int_temp_sensor.h</name>
<name>$PROJ_DIR$\..\int_temp_sensor.h</name>
<excluded>
<configuration>TEST_ACCEL</configuration>
<configuration>Moo1.2.1-Debug</configuration>
</excluded>
</file>
<file>
<name>$PROJ_DIR$\moo.c</name>
<excluded>
<configuration>TEST_ACCEL</configuration>
</excluded>
<name>$PROJ_DIR$\..\moo.c</name>
</file>
<file>
<name>$PROJ_DIR$\moo.h</name>
<name>$PROJ_DIR$\..\moo.h</name>
</file>
<file>
<name>$PROJ_DIR$\mymoo.h</name>
<name>$PROJ_DIR$\..\mymoo.h</name>
</file>
<file>
<name>$PROJ_DIR$\port1_isr.asm</name>
<excluded>
<configuration>TEST_ACCEL</configuration>
</excluded>
<name>$PROJ_DIR$\..\port1_isr.asm</name>
</file>
<file>
<name>$PROJ_DIR$\quick_accel_sensor.c</name>
<name>$PROJ_DIR$\..\quick_accel_sensor.c</name>
<excluded>
<configuration>TEST_ACCEL</configuration>
<configuration>Moo1.2-Debug</configuration>
<configuration>Moo1.2.1-Debug</configuration>
</excluded>
</file>
<file>
<name>$PROJ_DIR$\quick_accel_sensor.h</name>
<name>$PROJ_DIR$\..\quick_accel_sensor.h</name>
<excluded>
<configuration>TEST_ACCEL</configuration>
<configuration>Moo1.2-Debug</configuration>
<configuration>Moo1.2.1-Debug</configuration>
</excluded>
</file>
<file>
<name>$PROJ_DIR$\rfid.c</name>
<name>$PROJ_DIR$\..\rfid.c</name>
</file>
<file>
<name>$PROJ_DIR$\rfid.h</name>
<name>$PROJ_DIR$\..\rfid.h</name>
</file>
<file>
<name>$PROJ_DIR$\send_to_reader.asm</name>
<excluded>
<configuration>TEST_ACCEL</configuration>
</excluded>
<name>$PROJ_DIR$\..\send_to_reader.asm</name>
</file>
<file>
<name>$PROJ_DIR$\sensor.c</name>
<name>$PROJ_DIR$\..\sensor.c</name>
</file>
<file>
<name>$PROJ_DIR$\sensor.h</name>
<name>$PROJ_DIR$\..\sensor.h</name>
</file>
<file>
<name>$PROJ_DIR$\sensor_api.h</name>
<name>$PROJ_DIR$\..\sensor_api.h</name>
</file>
<file>
<name>$PROJ_DIR$\sensor_read.c</name>
<name>$PROJ_DIR$\..\sensor_read.c</name>
</file>
<file>
<name>$PROJ_DIR$\sessions.c</name>
<excluded>
<configuration>TEST_ACCEL</configuration>
</excluded>
<name>$PROJ_DIR$\..\sessions.c</name>
</file>
<file>
<name>$PROJ_DIR$\sessions.h</name>
<excluded>
<configuration>TEST_ACCEL</configuration>
</excluded>
<name>$PROJ_DIR$\..\sessions.h</name>
</file>
<file>
<name>$PROJ_DIR$\simple_sensor.c</name>
<name>$PROJ_DIR$\..\simple_sensor.c</name>
<excluded>
<configuration>Moo1.1-Debug</configuration>
<configuration>Moo1.2-Debug</configuration>
<configuration>Moo1.2.1-Debug</configuration>
</excluded>
</file>
<file>
<name>$PROJ_DIR$\simple_sensor.h</name>
<name>$PROJ_DIR$\..\simple_sensor.h</name>
<excluded>
<configuration>Moo1.2.1-Debug</configuration>
</excluded>
</file>
<file>
<name>$PROJ_DIR$\states.h</name>
<name>$PROJ_DIR$\..\states.h</name>
</file>
<file>
<name>$PROJ_DIR$\temp_sensor.c</name>
<name>$PROJ_DIR$\..\temp_sensor.c</name>
<excluded>
<configuration>TEST_ACCEL</configuration>
<configuration>Moo1.1-Debug</configuration>
<configuration>Moo1.2-Debug</configuration>
<configuration>Moo1.2.1-Debug</configuration>
</excluded>
</file>
<file>
<name>$PROJ_DIR$\temp_sensor.h</name>
<name>$PROJ_DIR$\..\temp_sensor.h</name>
<excluded>
<configuration>TEST_ACCEL</configuration>
<configuration>Moo1.2.1-Debug</configuration>
</excluded>
</file>
<file>
<name>$PROJ_DIR$\timerA1_isr.asm</name>
<excluded>
<configuration>TEST_ACCEL</configuration>
</excluded>
<name>$PROJ_DIR$\..\timerA1_isr.asm</name>
</file>
<file>
<name>$PROJ_DIR$\version.h</name>
<name>$PROJ_DIR$\..\version.h</name>
</file>
</project>

Expand Down

0 comments on commit 959d784

Please sign in to comment.