From a827a8ad5a7b2ffdd83c0eeba82ec7468df321f9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 5 Dec 2018 18:13:17 +0100 Subject: support static analysis of stack usage --- src/arch/arduino-nano-168/Makefile.inc | 8 +++++++- src/arch/arduino-nano/Makefile.inc | 8 +++++++- src/arch/blinkenrocket/Makefile.inc | 1 + src/arch/esp8266/Makefile.inc | 1 + src/arch/msp430fr5969lp/Makefile.inc | 5 +++++ src/arch/posix/Makefile.inc | 4 ++++ 6 files changed, 25 insertions(+), 2 deletions(-) (limited to 'src/arch') diff --git a/src/arch/arduino-nano-168/Makefile.inc b/src/arch/arduino-nano-168/Makefile.inc index 6ef50c6..4330d97 100644 --- a/src/arch/arduino-nano-168/Makefile.inc +++ b/src/arch/arduino-nano-168/Makefile.inc @@ -9,15 +9,21 @@ cpu_freq ?= 16000000 COMMON_FLAGS += -Werror=overflow COMMON_FLAGS += -mmcu=${MCU} -DMULTIPASS_ARCH_arduino_nano COMMON_FLAGS += -DF_CPU=${cpu_freq}UL -COMMON_FLAGS += -flto COMMON_FLAGS += -DMULTIPASS_ARCH_HAS_I2C +ifeq (${stack_usage}, ) + COMMON_FLAGS += -flto +endif + CC = avr-gcc CXX = avr-g++ NM = avr-nm OBJCOPY = avr-objcopy OBJDUMP = avr-objdump +# On each function call, the 2-Byte return address is pushed onto the stack +ARCH_CALL_COST = 2 + ifeq (${aspectc}, 1) CXX = ag++ -r build/repo.acp -v 0 --c_compiler avr-g++ -p . --Xcompiler endif diff --git a/src/arch/arduino-nano/Makefile.inc b/src/arch/arduino-nano/Makefile.inc index b057680..28bbead 100644 --- a/src/arch/arduino-nano/Makefile.inc +++ b/src/arch/arduino-nano/Makefile.inc @@ -9,15 +9,21 @@ cpu_freq ?= 16000000 COMMON_FLAGS += -Werror=overflow COMMON_FLAGS += -mmcu=${MCU} -DMULTIPASS_ARCH_arduino_nano COMMON_FLAGS += -DF_CPU=${cpu_freq}UL -COMMON_FLAGS += -flto COMMON_FLAGS += -DMULTIPASS_ARCH_HAS_I2C +ifeq (${stack_usage}, ) + COMMON_FLAGS += -flto +endif + CC = avr-gcc CXX = avr-g++ NM = avr-nm OBJCOPY = avr-objcopy OBJDUMP = avr-objdump +# On each function call, the 2-Byte return address is pushed onto the stack +ARCH_CALL_COST = 2 + ifeq (${aspectc}, 1) CXX = ag++ -r build/repo.acp -v 0 --c_compiler avr-g++ -p . --Xcompiler endif diff --git a/src/arch/blinkenrocket/Makefile.inc b/src/arch/blinkenrocket/Makefile.inc index b48b9ef..f2a4d68 100644 --- a/src/arch/blinkenrocket/Makefile.inc +++ b/src/arch/blinkenrocket/Makefile.inc @@ -12,6 +12,7 @@ CXX = avr-g++ NM = avr-nm OBJCOPY = avr-objcopy OBJDUMP = avr-objdump +ARCH_CALL_COST = 4 ifeq (${aspectc}, 1) CXX = ag++ -r build/repo.acp -v 0 --c_compiler avr-g++ -p . --Xcompiler diff --git a/src/arch/esp8266/Makefile.inc b/src/arch/esp8266/Makefile.inc index f9b6d85..ca28d1c 100644 --- a/src/arch/esp8266/Makefile.inc +++ b/src/arch/esp8266/Makefile.inc @@ -10,6 +10,7 @@ CXX = ${TOOLCHAIN_BASE}/xtensa-lx106-elf-g++ AR = ${TOOLCHAIN_BASE}/xtensa-lx106-elf-ar LD = ${TOOLCHAIN_BASE}/xtensa-lx106-elf-gcc OBJCOPY = ${TOOLCHAIN_BASE}/xtensa-lx106-elf-objcopy +OBJDUMP = ${TOOLCHAIN_BASE}/xtensa-lx106-elf-objdump ifeq (${aspectc}, 1) CXX = ag++ -r build/repo.acp -v 0 --c_compiler ${TOOLCHAIN_BASE}/xtensa-lx106-elf-g++ -p . --Xcompiler diff --git a/src/arch/msp430fr5969lp/Makefile.inc b/src/arch/msp430fr5969lp/Makefile.inc index ea84130..b2c0231 100644 --- a/src/arch/msp430fr5969lp/Makefile.inc +++ b/src/arch/msp430fr5969lp/Makefile.inc @@ -14,6 +14,11 @@ COMMON_FLAGS += -DMULTIPASS_ARCH_HAS_I2C CC = /opt/msp430/ti/gcc/bin/msp430-elf-gcc CXX = /opt/msp430/ti/gcc/bin/msp430-elf-g++ OBJCOPY = /opt/msp430/ti/gcc/bin/msp430-elf-objcopy +OBJDUMP = /opt/msp430/ti/gcc/bin/msp430-elf-objdump + +# For each function call, the 4-Byte (20 bits at 2-Byte alignment) return +# address is pushed onto the stack. +ARCH_CALL_COST = 4 CXX_TARGETS += src/arch/msp430fr5969lp/arch.cc diff --git a/src/arch/posix/Makefile.inc b/src/arch/posix/Makefile.inc index 1300012..e901aeb 100644 --- a/src/arch/posix/Makefile.inc +++ b/src/arch/posix/Makefile.inc @@ -4,6 +4,10 @@ COMMON_FLAGS += -DMULTIPASS_ARCH_posix CC = gcc CXX = g++ +OBJDUMP = objdump + +# For each function call, the 8-Byte return address is pushed onto the stack. +ARCH_CALL_COST = 8 ifeq (${aspectc}, 1) CXX = ag++ -r build/repo.acp -v 0 -p . --Xcompiler -- cgit v1.2.3