Proper DEBUG flag

This commit is contained in:
Romain Goyet
2015-08-04 22:45:08 +02:00
parent f2863c6889
commit 96c2ad4228
4 changed files with 19 additions and 21 deletions

View File

@@ -1,4 +1,5 @@
PLATFORM ?= stm32f429
DEBUG ?= 1
#PLATFORM=simulator
include Makefile.$(PLATFORM)
ifndef USE_LIBA
@@ -13,12 +14,12 @@ SFLAGS += -Ilib -I.
SFLAGS += -Wall
# Flags - Optimizations
ifeq ($(PRODUCTION),1)
#echo "*** PRODUCTION BUILD ***"
SFLAGS += -Os -fdata-sections -ffunction-sections
LDFLAGS += --gc-sections
ifeq ($(DEBUG),1)
SFLAGS += -g -DDEBUG=1
else
SFLAGS += -g
SFLAGS += -Os -fdata-sections -ffunction-sections
#LDFLAGS += --gc-sections
#FIXME: --gc-sections doesn't seem to be working
endif
# Language-specific flags
@@ -35,11 +36,13 @@ lib/private/mem5.o: CFLAGS += -w
#objs += src/hello.o
.PHONY: default info
default: info clean boot.elf
default: info clean boot.elf size
ifeq ($(VERBOSE),1)
size: boot.elf
info:
@echo "========= BUILD SETTINGS ======"
@echo "DEBUG = $(DEBUG)"
@echo "PLATFORM = $(PLATFORM)"
@echo "CC = $(CC)"
@echo "CXX = $(CXX)"
@@ -49,8 +52,14 @@ info:
@echo "SFLAGS = $(SFLAGS)"
@echo "LDFLAGS = $(LDFLAGS)"
@echo "==============================="
size: boot.elf
@echo "========= BUILD OUTPUT ========"
@echo "File: $<"
@arm-none-eabi-size $< | tail -n 1 | awk '{print "Code: " $$1 " bytes";print "Data: " $$2 " bytes"; print "Total: " int(($$1+$$2)/1024) " kB (" $$1 + $$2 " bytes)";}'
@echo "==============================="
else
info:
size: boot.elf
endif
include boot/Makefile
@@ -67,12 +76,6 @@ include poincare/Makefile
objs += src/hello.o
size: boot.elf
@echo "========= BUILD OUTPUT ========"
@echo "File: $<"
@arm-none-eabi-size $< | tail -n 1 | awk '{print "Code: " $$1 " bytes";print "Data: " $$2 " bytes"; print "Total: " int(($$1+$$2)/1024) " kB (" $$1 + $$2 " bytes)";}'
@echo "==============================="
run: boot.elf
$(GDB) -x gdb_script.gdb boot.elf

View File

@@ -1,4 +1,5 @@
#include <ion.h>
#include <assert.h>
#include "display.h"
#include "init_kbd.h"

View File

@@ -3,10 +3,10 @@
#include "private/macros.h"
#ifdef NDEBUG
#define assert(e) ((void)0)
#else
#ifdef DEBUG
#define assert(e) ((void) ((e) ? ((void)0) : __assert(#e, __FILE__, __LINE__)))
#else
#define assert(e) ((void)0)
#endif
LIBA_BEGIN_DECLS

View File

@@ -1,12 +1,6 @@
#include <assert.h>
#include <stdlib.h>
#ifdef NDEBUG
#define assert(e) ((void)0)
#else
#define assert(e) ((void) ((e) ? ((void)0) : __assert(#e, __FILE__, __LINE__)))
#endif
void __assert(const char * expression, const char * file, int line) {
abort();
}