Skip to content

Commit

Permalink
re-solve IAR compiler issue
Browse files Browse the repository at this point in the history
  • Loading branch information
parai committed Oct 27, 2015
1 parent 1515fe7 commit 240adf2
Show file tree
Hide file tree
Showing 12 changed files with 166 additions and 112 deletions.
198 changes: 108 additions & 90 deletions .cproject

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,5 @@ pip-log.txt
*.exe
*.d
*.o
*.a

2 changes: 1 addition & 1 deletion com/as.infrastructure/arch/lm3s/DriverLib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endif
ifeq ($(host), Linux)
include ../../../../../release/make/cortexm3.gcc.mk
else
include ../../make/cortexm3.gcc.mk
include ../../../make/cortexm3.gcc.mk
endif

all:lib
Expand Down
Binary file not shown.
4 changes: 4 additions & 0 deletions com/as.infrastructure/clib/stdio_printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
#define SPECIAL (1 << 5) /* 0x */
#define LARGE (1 << 6) /* use 'ABCDEF' instead of 'abcdef' */

#ifndef _G_va_list
#define _G_va_list __gnuc_va_list
#endif


/* ============================ [ TYPES ] ====================================================== */
/* ============================ [ DECLARES ] ====================================================== */
Expand Down
24 changes: 20 additions & 4 deletions com/as.infrastructure/include/Compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,13 @@
(type *)( (char *)__mptr - offsetof(type,member) );})



#if defined(__GNUC__)
#define __balign(x) __attribute__ ((aligned (x)))
#elif defined(__CWCC__)
#define __balign(x) __attribute__ ((aligned (x)))
#elif defined(__DCC__)
#define __balign(x) __attribute__ ((aligned (x)))
#elif defined(__ICCHCS12__)
#elif defined(__ICCHCS12__) || defined(__ICCARM__)
#define Pragma(x) _Pragma(#x)
#define __balign(x) Pragma(data_alignment=x)
#else
Expand All @@ -75,14 +74,13 @@

#define SECTION_BALIGN(x) __balign(x)

#if defined(__ICCHCS12__)
#if defined(__ICCHCS12__) || defined(__ICCARM__)
#define restrict
#define DECLARE_WEAK
#define __simple __simple
#else
#define DECLARE_WEAK __attribute__ ((weak))
#define __simple
#endif

#ifndef __naked
# define __naked __attribute__((naked))
Expand All @@ -95,8 +93,26 @@
#ifndef __packed
# define __packed __attribute__((__packed__))
#endif
#endif

#if defined(__ICCHCS12__) || defined(__ICCARM__)
static inline unsigned int ilog2(unsigned long _x)
{
unsigned int i;
unsigned idx = 0;
for(i=0;i<32;i++)
{
if(_x&(1<i))
{
idx = i;
break;
}
}
return idx;
}
#else
#define ilog2(_x) __builtin_ffs(_x)
#endif

/* Does this really work on all compilers.... */
#define INLINE __inline__
Expand Down
2 changes: 2 additions & 0 deletions com/as.infrastructure/include/MemMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@

#elif defined(__ICCHCS12__)
#define SECTION_RAMLOG __no_init
#elif defined(__ICCARM__)

#else
#error Compiler not set
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ static void Usart_Init(void)
printf("Hello world from lm3s\n");
}


int putchar( int ch ) /* for printf */
{
UARTCharPut(UART0_BASE, ch);
Expand Down Expand Up @@ -253,7 +252,7 @@ void tool_initialize(void)
{

}

#ifdef __GNUC__
void __naked enaint( imask_t intsts )
{
__asm__ volatile(
Expand Down Expand Up @@ -433,6 +432,7 @@ __asm__ volatile(
"b ExitISR \n"
);
}
#endif /* __GNUC__ */

void __assert_fail (const char *__assertion, const char *__file,
unsigned int __line, const char *__function)
Expand Down
25 changes: 16 additions & 9 deletions release/ascore/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -359,31 +359,38 @@ clean-dist:clean
01:
make dep board=at91sam3s compiler=iccarm
02:
make all board=at91sam3s compiler=iccarm DEBUG=TRUE
make all board=at91sam3s compiler=iccarm debug=true
03:
make all board=at91sam3s compiler=iccarm DEBUG=FALSE
make all board=at91sam3s compiler=iccarm debug=false
# ---------------------------------- [ STM32F107VC ] ---------------------------------- #
11:
make dep board=stm32f107vc compiler=arm-none-eabi-gcc
12:
make all board=stm32f107vc compiler=arm-none-eabi-gcc DEBUG=TRUE
make all board=stm32f107vc compiler=arm-none-eabi-gcc debug=true
13:
make all board=stm32f107vc compiler=arm-none-eabi-gcc DEBUG=FALSE
make all board=stm32f107vc compiler=arm-none-eabi-gcc debug=false

15:
make dep board=stm32f107vc compiler=iccarm
16:
make all board=stm32f107vc compiler=iccarm debug=true
17:
make all board=stm32f107vc compiler=iccarm debug=false
# ---------------------------------- [ lm3s6965evb ] ---------------------------------- #
21:
make dep board=lm3s6965evb compiler=arm-none-eabi-gcc
22:
make all board=lm3s6965evb compiler=arm-none-eabi-gcc DEBUG=TRUE
make all board=lm3s6965evb compiler=arm-none-eabi-gcc debug=true
23:
make all board=lm3s6965evb compiler=arm-none-eabi-gcc DEBUG=FALSE
make all board=lm3s6965evb compiler=arm-none-eabi-gcc debug=false
# ---------------------------------- [ posix ] ---------------------------------- #
91:
make dep board=posix compiler=posix-gcc gui=GTK
92:
make all board=posix compiler=posix-gcc gui=GTK DEBUG=TRUE
make all board=posix compiler=posix-gcc gui=GTK debug=true
93:
make all board=posix compiler=posix-gcc gui=GTK DEBUG=FALSE
make all board=posix compiler=posix-gcc gui=GTK debug=false
94:
make dll board=posix compiler=posix-gcc gui=GTK DEBUG=TRUE
make dll board=posix compiler=posix-gcc gui=GTK debug=true


5 changes: 5 additions & 0 deletions release/make/cortexm3.gcc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ cflags-y += -mcpu=cortex-m3 -mthumb -std=gnu99
cflags-y += -mstructure-size-boundary=8 -ffreestanding
cflags-y += -pedantic -W -Wall

ifeq ($(debug),true)
cflags-y += -O2
asflags-y += -O2
else
cflags-y += -g -O0
asflags-y += -g -O0
endif

ldflags-y += -static -T $(link-script)
dir-y += $(src-dir)
Expand Down
4 changes: 2 additions & 2 deletions release/make/cortexm3.iar.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
AS = $(COMPILER_DIR)/arm/bin/iasmarm.exe
CC = $(COMPILER_DIR)/arm/bin/iccarm.exe
LD = $(COMPILER_DIR)/arm/bin/ilinkarm.exe
AR = ar
AR = $(COMPILER_DIR)/arm/bin/iarchive.exe
RM = rm

ifeq ($(CC), $(wildcard $(CC)))
Expand All @@ -17,7 +17,7 @@ cflags-y += --no_tbaa --no_clustering --no_scheduling
cflags-y += --cpu=Cortex-M3 -e --fpu=None --endian=little
cflags-y += --dlib_config $(COMPILER_DIR)/arm/INC/c/DLib_Config_Normal.h
cflags-y += --diag_suppress=Pa050
ifeq ($(DEBUG),TRUE)
ifeq ($(debug),true)
cflags-y += --debug -On
else
cflags-y += --debug -Oh
Expand Down
8 changes: 4 additions & 4 deletions release/make/posix.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ endif
cflags-y += -std=gnu99
ldflags-y += -std=gnu99
#common flags
ifeq ($(DEBUG),FALSE)
cflags-y += -c -O2 -Wall
ldflags-y += -O2 -Wall
else
ifeq ($(debug),true)
cflags-y += -c -g -O0 -Wall
ldflags-y += -g -O0 -Wall
else
cflags-y += -c -O2 -Wall
ldflags-y += -O2 -Wall
endif

dir-y += $(src-dir)
Expand Down

0 comments on commit 240adf2

Please sign in to comment.