From 231889c8886a01a4914974fcdba762b90e664d4c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 24 Jan 2014 07:45:35 -0600 Subject: [PATCH] The optimization level can now be selected as part of the configuration --- arch/arm/src/arm/Toolchain.defs | 14 +++++++++----- arch/arm/src/armv6-m/Toolchain.defs | 4 ++++ arch/arm/src/armv7-a/Toolchain.defs | 14 +++++++++----- arch/arm/src/armv7-m/Toolchain.defs | 20 ++++++++++++-------- arch/avr/src/avr/Toolchain.defs | 12 ++++++++---- arch/mips/src/mips32/Toolchain.defs | 18 +++++++++++------- arch/z16/src/z16f/chip.h | 8 ++++---- 7 files changed, 57 insertions(+), 33 deletions(-) diff --git a/arch/arm/src/arm/Toolchain.defs b/arch/arm/src/arm/Toolchain.defs index 10e58c8319..5f000ca144 100644 --- a/arch/arm/src/arm/Toolchain.defs +++ b/arch/arm/src/arm/Toolchain.defs @@ -109,6 +109,10 @@ endif # reliable code generation. # +ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y) + MAXOPTIMIZATION := $(CONFIG_DEBUG_OPTLEVEL) +endif + # NuttX buildroot under Linux or Cygwin ifeq ($(CONFIG_ARM_TOOLCHAIN),BUILDROOT) @@ -119,7 +123,7 @@ else CROSSDEV ?= arm-nuttx-eabi- ARCROSSDEV ?= arm-nuttx-eabi- endif - MAXOPTIMIZATION = -Os + MAXOPTIMIZATION ?= -Os endif # CodeSourcery under Linux @@ -127,7 +131,7 @@ endif ifeq ($(CONFIG_ARM_TOOLCHAIN),CODESOURCERYL) CROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi- - MAXOPTIMIZATION = -O2 + MAXOPTIMIZATION ?= -O2 endif # CodeSourcery under Windows @@ -135,7 +139,7 @@ endif ifeq ($(CONFIG_ARM_TOOLCHAIN),CODESOURCERYW) CROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi- - MAXOPTIMIZATION = -O2 + MAXOPTIMIZATION ?= -O2 ifneq ($(CONFIG_WINDOWS_NATIVE),y) WINTOOL = y endif @@ -156,7 +160,7 @@ endif ifeq ($(CONFIG_ARM_TOOLCHAIN),GNU_EABIL) CROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi- - MAXOPTIMIZATION = -Os + MAXOPTIMIZATION ?= -Os endif # Generic GNU EABI toolchain under Windows @@ -164,7 +168,7 @@ endif ifeq ($(CONFIG_ARM_TOOLCHAIN),GNU_EABIW) CROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi- - MAXOPTIMIZATION = -Os + MAXOPTIMIZATION ?= -Os ifneq ($(CONFIG_WINDOWS_NATIVE),y) WINTOOL = y endif diff --git a/arch/arm/src/armv6-m/Toolchain.defs b/arch/arm/src/armv6-m/Toolchain.defs index 5af6a65524..d134d2e1a0 100644 --- a/arch/arm/src/armv6-m/Toolchain.defs +++ b/arch/arm/src/armv6-m/Toolchain.defs @@ -96,6 +96,10 @@ endif # reliable code generation. # +ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y) + MAXOPTIMIZATION := $(CONFIG_DEBUG_OPTLEVEL) +endif + # Atollic toolchain under Windows ifeq ($(CONFIG_ARMV6M_TOOLCHAIN),ATOLLIC) diff --git a/arch/arm/src/armv7-a/Toolchain.defs b/arch/arm/src/armv7-a/Toolchain.defs index f90307b250..91b4d9790e 100644 --- a/arch/arm/src/armv7-a/Toolchain.defs +++ b/arch/arm/src/armv7-a/Toolchain.defs @@ -90,6 +90,10 @@ endif # reliable code generation. # +ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y) + MAXOPTIMIZATION := $(CONFIG_DEBUG_OPTLEVEL) +endif + # NuttX buildroot under Linux or Cygwin ifeq ($(CONFIG_ARMV7A_TOOLCHAIN),BUILDROOT) @@ -100,7 +104,7 @@ else CROSSDEV ?= arm-nuttx-eabi- ARCROSSDEV ?= arm-nuttx-eabi- endif - MAXOPTIMIZATION = -Os + MAXOPTIMIZATION ?= -Os endif # CodeSourcery under Linux @@ -108,7 +112,7 @@ endif ifeq ($(CONFIG_ARMV7A_TOOLCHAIN),CODESOURCERYL) CROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi- - MAXOPTIMIZATION = -O2 + MAXOPTIMIZATION ?= -O2 endif # CodeSourcery under Windows @@ -116,7 +120,7 @@ endif ifeq ($(CONFIG_ARMV7A_TOOLCHAIN),CODESOURCERYW) CROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi- - MAXOPTIMIZATION = -O2 + MAXOPTIMIZATION ?= -O2 ifneq ($(CONFIG_WINDOWS_NATIVE),y) WINTOOL = y endif @@ -137,7 +141,7 @@ endif ifeq ($(CONFIG_ARMV7A_TOOLCHAIN),GNU_EABIL) CROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi- - MAXOPTIMIZATION = -Os + MAXOPTIMIZATION ?= -Os endif # Generic GNU EABI toolchain under Windows @@ -145,7 +149,7 @@ endif ifeq ($(CONFIG_ARMV7A_TOOLCHAIN),GNU_EABIW) CROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi- - MAXOPTIMIZATION = -Os + MAXOPTIMIZATION ?= -Os ifneq ($(CONFIG_WINDOWS_NATIVE),y) WINTOOL = y endif diff --git a/arch/arm/src/armv7-m/Toolchain.defs b/arch/arm/src/armv7-m/Toolchain.defs index f129c19133..ecdcb7f146 100644 --- a/arch/arm/src/armv7-m/Toolchain.defs +++ b/arch/arm/src/armv7-m/Toolchain.defs @@ -152,12 +152,16 @@ endif # reliable code generation. # +ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y) + MAXOPTIMIZATION := $(CONFIG_DEBUG_OPTLEVEL) +endif + # Atollic toolchain under Windows ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),ATOLLIC) CROSSDEV ?= arm-atollic-eabi- ARCROSSDEV ?= arm-atollic-eabi- - MAXOPTIMIZATION = -Os + MAXOPTIMIZATION ?= -Os ifeq ($(CONFIG_ARCH_CORTEXM4),y) ifeq ($(CONFIG_ARCH_FPU),y) ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard @@ -184,7 +188,7 @@ else ARCROSSDEV ?= arm-nuttx-eabi- ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft endif - MAXOPTIMIZATION = -Os + MAXOPTIMIZATION ?= -Os endif # Code Red RedSuite under Linux @@ -192,7 +196,7 @@ endif ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODEREDL) CROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi- - MAXOPTIMIZATION = -Os + MAXOPTIMIZATION ?= -Os ifeq ($(CONFIG_ARCH_CORTEXM4),y) ifeq ($(CONFIG_ARCH_FPU),y) ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard @@ -209,7 +213,7 @@ endif ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODEREDW) CROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi- - MAXOPTIMIZATION = -Os + MAXOPTIMIZATION ?= -Os ifeq ($(CONFIG_ARCH_CORTEXM4),y) ifeq ($(CONFIG_ARCH_FPU),y) ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard @@ -230,7 +234,7 @@ ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODESOURCERYL) CROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi- ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft - MAXOPTIMIZATION = -O2 + MAXOPTIMIZATION ?= -O2 endif # CodeSourcery under Windows @@ -238,7 +242,7 @@ endif ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODESOURCERYW) CROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi- - MAXOPTIMIZATION = -Os + MAXOPTIMIZATION ?= -Os ifeq ($(CONFIG_ARCH_CORTEXM4),y) ifeq ($(CONFIG_ARCH_FPU),y) ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard @@ -269,7 +273,7 @@ endif ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),GNU_EABIL) CROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi- - MAXOPTIMIZATION = -Os + MAXOPTIMIZATION ?= -Os ifeq ($(CONFIG_ARCH_CORTEXM4),y) ifeq ($(CONFIG_ARCH_FPU),y) ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard @@ -286,7 +290,7 @@ endif ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),GNU_EABIW) CROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi- - MAXOPTIMIZATION = -Os + MAXOPTIMIZATION ?= -Os ifeq ($(CONFIG_ARCH_CORTEXM4),y) ifeq ($(CONFIG_ARCH_FPU),y) ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard diff --git a/arch/avr/src/avr/Toolchain.defs b/arch/avr/src/avr/Toolchain.defs index e58b287cbb..b1b60587b9 100644 --- a/arch/avr/src/avr/Toolchain.defs +++ b/arch/avr/src/avr/Toolchain.defs @@ -82,11 +82,15 @@ else $(error "No valid CONFIG_ARCH_CHIP_ set in the configuration") endif +ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y) + MAXOPTIMIZATION := $(CONFIG_DEBUG_OPTLEVEL) +endif + # NuttX buildroot GCC toolchain under Linux or Cygwin ifeq ($(CONFIG_AVR_TOOLCHAIN),BUILDROOT) CROSSDEV ?= avr-nuttx-elf- - MAXOPTIMIZATION = -O2 + MAXOPTIMIZATION ?= -O2 LDFLAGS += -nostartfiles -nodefaultlibs endif @@ -94,7 +98,7 @@ endif ifeq ($(CONFIG_AVR_TOOLCHAIN),CROSSPACK) CROSSDEV ?= avr- - MAXOPTIMIZATION = -O2 + MAXOPTIMIZATION ?= -O2 LDFLAGS += -nostartfiles -nodefaultlibs endif @@ -102,7 +106,7 @@ endif ifeq ($(CONFIG_AVR_TOOLCHAIN),LINUXGCC) CROSSDEV ?= avr- - MAXOPTIMIZATION = -O2 + MAXOPTIMIZATION ?= -O2 LDFLAGS += -nostartfiles -nodefaultlibs endif @@ -113,7 +117,7 @@ ifeq ($(CONFIG_AVR_TOOLCHAIN),WINAVR) ifneq ($(CONFIG_WINDOWS_NATIVE),y) WINTOOL = y endif - MAXOPTIMIZATION = -O2 + MAXOPTIMIZATION ?= -O2 LDFLAGS += -nostartfiles -nodefaultlibs endif diff --git a/arch/mips/src/mips32/Toolchain.defs b/arch/mips/src/mips32/Toolchain.defs index 09c68db12b..dc34b8c76f 100644 --- a/arch/mips/src/mips32/Toolchain.defs +++ b/arch/mips/src/mips32/Toolchain.defs @@ -99,12 +99,16 @@ endif # reliable code generation. # +ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y) + MAXOPTIMIZATION := $(CONFIG_DEBUG_OPTLEVEL) +endif + # Generic GNU mip32 toolchain on OS X or Linux # including Pinguino mips-elf toolchain ifeq ($(CONFIG_MIPS32_TOOLCHAIN),GNU_ELF) CROSSDEV ?= mips-elf- - MAXOPTIMIZATION = -O2 + MAXOPTIMIZATION ?= -O2 ARCHCPUFLAGS = -mlong32 -membedded-data -msoft-float -march=24kc -EL ARCHPICFLAGS = -fpic -membedded-pic LDFLAGS += -nostartfiles -nodefaultlibs @@ -116,7 +120,7 @@ endif ifeq ($(CONFIG_MIPS32_TOOLCHAIN),MICROCHIPL) CROSSDEV ?= pic32- # CROSSDEV ?= xc32- - MAXOPTIMIZATION = -O2 + MAXOPTIMIZATION ?= -O2 ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data ARCHPICFLAGS = -fpic -membedded-pic LDFLAGS += -nostartfiles -nodefaultlibs @@ -131,7 +135,7 @@ ifeq ($(CONFIG_MIPS32_TOOLCHAIN),MICROCHIPW) ifneq ($(CONFIG_WINDOWS_NATIVE),y) WINTOOL = y endif - MAXOPTIMIZATION = -O2 + MAXOPTIMIZATION ?= -O2 ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data ARCHPICFLAGS = -fpic -membedded-pic LDFLAGS += -nostartfiles -nodefaultlibs @@ -143,7 +147,7 @@ endif ifeq ($(CONFIG_MIPS32_TOOLCHAIN),MICROCHIPL_LITE) CROSSDEV ?= pic32- # CROSSDEV ?= xc32- - # MAXOPTIMIZATION = -O2 + # MAXOPTIMIZATION ?= -O2 ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data ARCHPICFLAGS = -fpic -membedded-pic LDFLAGS += -nostartfiles -nodefaultlibs @@ -158,7 +162,7 @@ ifeq ($(CONFIG_MIPS32_TOOLCHAIN),MICROCHIPW_LITE) ifneq ($(CONFIG_WINDOWS_NATIVE),y) WINTOOL = y endif - # MAXOPTIMIZATION = -O2 + # MAXOPTIMIZATION ?= -O2 ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data ARCHPICFLAGS = -fpic -membedded-pic LDFLAGS += -nostartfiles -nodefaultlibs @@ -169,7 +173,7 @@ endif ifeq ($(CONFIG_MIPS32_TOOLCHAIN),MICROCHIPOPENL) CROSSDEV ?= mypic32- - # MAXOPTIMIZATION = -O2 + # MAXOPTIMIZATION ?= -O2 ARCHCPUFLAGS = -mprocessor=elf32pic32mx -mno-float -mlong32 -membedded-data ARCHPICFLAGS = -fpic -membedded-pic LDFLAGS += -nostartfiles -nodefaultlibs @@ -183,7 +187,7 @@ ifeq ($(CONFIG_MIPS32_TOOLCHAIN),PINGUINOW) ifneq ($(CONFIG_WINDOWS_NATIVE),y) WINTOOL = y endif - MAXOPTIMIZATION = -O2 + MAXOPTIMIZATION ?= -O2 ARCHCPUFLAGS = -mlong32 -membedded-data -msoft-float -march=24kc -EL ARCHPICFLAGS = -fpic -membedded-pic LDFLAGS += -nostartfiles -nodefaultlibs diff --git a/arch/z16/src/z16f/chip.h b/arch/z16/src/z16f/chip.h index 09e0d30976..f684652cb3 100644 --- a/arch/z16/src/z16f/chip.h +++ b/arch/z16/src/z16f/chip.h @@ -128,7 +128,7 @@ /* Most chip variants support external memory */ #ifdef Z16F_HAVE_EXTMEM -# define Z16F_EXTMEMCS0_BASE _HX32(00020000) /* External memory at CS0 */ +# define Z16F_EXTMEMCS0_BASE _HX32(00000000) /* External memory at CS0 */ # define Z16F_EXTMEMCS0_SIZE _HX32(007e0000) /* (actual depends on board) */ # define Z16F_EXTMEMCS1_BASE _HX32(ff800000) /* External memory at CS1 */ # define Z16F_EXTMEMCS1_SIZE _HX32(00700000) /* (actual depends on board) */ @@ -260,10 +260,10 @@ #define Z16F_OSCCTL_XTLEN _HX8(40) /* Bit 6: Crystal oscillator enabled */ #define Z16F_OSCCTL_WDTEN _HX8(20) /* Bit 5: Watchdog timer enabled */ #define Z16F_OSCCTL_POFEN _HX8(10) /* Bit 4: Failure detection enabled */ -#define Z16F_OSCCTL_WDFEN _HX8(08) /* Bit 3: WD Failuare detection enabled*/ +#define Z16F_OSCCTL_WDFEN _HX8(08) /* Bit 3: WD Failure detection enabled*/ #define Z16F_OSCCTL_FLPEN _HX8(04) /* Bit 2: Flash low power enabled */ -#define Z16F_OSCCTL_INT56 _HX8(00) /* Bits 0-1=0: Intenal 5.6 MHz */ -#define Z16F_OSCCTL_EXTCLK _HX8(02) /* Bits 0-1=2: Extenal clock */ +#define Z16F_OSCCTL_INT56 _HX8(00) /* Bits 0-1=0: Internal 5.6 MHz */ +#define Z16F_OSCCTL_EXTCLK _HX8(02) /* Bits 0-1=2: External clock */ #define Z16F_OSCCTL_WDT10KHZ _HX8(03) /* Bits 0-1=3: WD Timer 10 KHz*/ /* GPIO Port A-K ********************************************************************/