incremental simulator into build folder

This commit is contained in:
rusefi 2017-03-29 16:52:57 -04:00 committed by Fabien Poussin
parent 73a352159d
commit 8b6b47e50d
6 changed files with 154 additions and 121 deletions

View File

@ -1,152 +1,168 @@
#
# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!!
#
##############################################################################################
#
# On command line:
#
# make all = Create project
#
# make clean = Clean project files.
#
# To rebuild project do "make clean" and "make all".
##############################################################################
# Build global options
# NOTE: Can be overridden externally.
#
##############################################################################################
# Start of default section
#
# Compiler options here.
ifeq ($(USE_OPT),)
USE_OPT = -O2 -ggdb
endif
#TRGT = mingw32-
TRGT = i686-w64-mingw32-
CC = $(TRGT)gcc
AS = $(TRGT)gcc -x assembler-with-cpp
# C specific options here (added to USE_OPT).
ifeq ($(USE_COPT),)
USE_COPT =
endif
# List all default C defines here, like -D_DEBUG=1
DDEFS = -DSIMULATOR
# C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -fno-rtti
endif
# List all default ASM defines here, like -D_DEBUG=1
DADEFS =
# Enable this if you want the linker to remove unused code and data.
ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
# List all default directories to look for include files here
DINCDIR =
# Linker extra options here.
ifeq ($(USE_LDOPT),)
USE_LDOPT =
endif
# List the default directory to look for the libraries here
DLIBDIR =
# Enable this if you want link time optimizations (LTO)
ifeq ($(USE_LTO),)
USE_LTO = no
endif
# List all default libraries here
DLIBS = -lws2_32
# Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = no
endif
# If enabled, this option makes the build process faster by not compiling
# modules not used in the current configuration.
ifeq ($(USE_SMART_BUILD),)
USE_SMART_BUILD = yes
endif
#
# End of default section
##############################################################################################
# Build global options
##############################################################################
##############################################################################################
# Start of user section
##############################################################################
# Architecture or project specific options
#
#
# Architecture or project specific options
##############################################################################
##############################################################################
# Project, sources and paths
#
# Define project name here
PROJECT = ch
PROJECT = ch.exe
# Define linker script file here
LDSCRIPT =
# Imported source files and paths
CHIBIOS = ../../..
# Startup files.
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/boards/simulator/board.mk
include $(CHIBIOS)/os/hal/ports/simulator/win32/platform.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/rt/ports/SIMIA32/compilers/GCC/port.mk
# Other files (optional).
include $(CHIBIOS)/test/rt/test.mk
include $(CHIBIOS)/os/hal/lib/streams/streams.mk
include $(CHIBIOS)/os/various/shell/shell.mk
# C sources here.
CSRC = $(STARTUPSRC) \
$(KERNSRC) \
$(PORTSRC) \
$(OSALSRC) \
$(HALSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
$(TESTSRC) \
$(STREAMSSRC) \
$(SHELLSRC) \
main.c
# C++ sources here.
CPPSRC =
# List ASM source files here
ASMSRC =
ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
INCDIR = $(CHIBIOS)/os/license \
$(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
$(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
$(STREAMSINC) $(SHELLINC)
#
# Project, sources and paths
##############################################################################
##############################################################################
# Compiler settings
#
#TRGT = powerpc-eabi-
#TRGT = mingw32-
TRGT = i686-w64-mingw32-
CC = $(TRGT)gcc
CPPC = $(TRGT)g++
# Enable loading with g++ only if you need C++ runtime support.
# NOTE: You can use C++ even without C++ support if you are careful. C++
# runtime support makes code size explode.
LD = $(TRGT)gcc
#LD = $(TRGT)g++
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
AR = $(TRGT)ar
OD = $(TRGT)objdump
SZ = $(TRGT)size
BIN = $(CP) -O binary
COV = gcov
# Define C warning options here
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
# Define C++ warning options here
CPPWARN = -Wall -Wextra -Wundef
#
# Compiler settings
##############################################################################
##############################################################################
# Start of user section
#
# List all user C define here, like -D_DEBUG=1
UDEFS =
UDEFS = -DSIMULATOR
# Define ASM defines here
UADEFS =
# Imported source files
CHIBIOS = ../../..
include $(CHIBIOS)/os/hal/boards/simulator/board.mk
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/ports/simulator/win32/platform.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
include $(CHIBIOS)/os/rt/ports/SIMIA32/compilers/GCC/port.mk
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/test/rt/test.mk
# List C source files here
SRC = $(PORTSRC) \
$(KERNSRC) \
$(TESTSRC) \
$(HALSRC) \
$(OSALSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
$(CHIBIOS)/os/various/shell.c \
$(CHIBIOS)/os/hal/lib/streams/memstreams.c \
$(CHIBIOS)/os/hal/lib/streams/chprintf.c \
main.c
# List ASM source files here
ASRC =
# List all user directories here
UINCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
$(HALINC) $(OSALINC) $(PLATFORMINC) $(BOARDINC) \
$(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various
UINCDIR =
# List the user directory to look for the libraries here
ULIBDIR =
# List all user libraries here
ULIBS =
# Define optimisation level here
OPT = -ggdb -O2
ULIBS = -lws2_32
#
# End of user defines
##############################################################################################
##############################################################################
INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
DEFS = $(DDEFS) $(UDEFS)
ADEFS = $(DADEFS) $(UADEFS)
OBJS = $(ASRC:.s=.o) $(SRC:.c=.o)
LIBS = $(DLIBS) $(ULIBS)
LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR)
ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
CPFLAGS = -Wall -Wextra -Wundef -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS)
# Generate dependency information
CPFLAGS += -MD -MP -MF .dep/$(@F).d
#
# makefile rules
#
all: $(OBJS) $(PROJECT).exe
%.o : %.c
$(CC) -c $(OPT) $(CPFLAGS) -I . $(INCDIR) $< -o $@
%.o : %.s
$(AS) -c $(OPT) $(ASFLAGS) $< -o $@
%exe: $(OBJS)
$(CC) $(OPT) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
gcov:
-mkdir gcov
$(COV) -u $(subst /,\,$(SRC))
-mv *.gcov ./gcov
clean:
-rm -f $(OBJS)
-rm -f $(PROJECT).exe
-rm -f $(PROJECT).map
-rm -f $(SRC:.c=.c.bak)
-rm -f $(SRC:.c=.lst)
-rm -f $(ASRC:.s=.s.bak)
-rm -f $(ASRC:.s=.lst)
-rm -fR .dep
#
# Include the dependency files, should be the last of the makefile
#
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# *** EOF ***
RULESPATH = $(CHIBIOS)/os/common/startup/SIMIA32/compilers/GCC
include $(RULESPATH)/rules.mk

View File

@ -0,0 +1 @@

View File

@ -28,6 +28,8 @@
#ifndef _HALCONF_H_
#define _HALCONF_H_
#define efiAssert(condition, message, result) { }
/*#include "mcuconf.h"*/
/**

View File

@ -250,3 +250,7 @@ int main(void) {
chEvtUnregister(chnGetEventSource(&SD2), &sd2fel);
return 0;
}
int getRemainingStack(thread_t *otp) {
return 0;
}

View File

@ -0,0 +1,6 @@
# RT Shell files.
STREAMSSRC = $(CHIBIOS)/os/hal/lib/streams/chprintf.c \
$(CHIBIOS)/os/hal/lib/streams/memstreams.c \
$(CHIBIOS)/os/hal/lib/streams/nullstreams.c
STREAMSINC = $(CHIBIOS)/os/hal/lib/streams

View File

@ -0,0 +1,4 @@
# RT Shell files.
SHELLSRC = $(CHIBIOS)/os/various/shell.c
SHELLINC = $(CHIBIOS)/os/various/