add installation script
[mTask.git] / int / Makefile
index f6e3402..d0f5454 100644 (file)
@@ -1,6 +1,234 @@
-CFLAGS:=-g -Wall -Wextra -Werror
-all: mTaskSymbols.h int
-
-mTaskSymbols.h:
-       CLMFLAGS=-nr make -BC .. mTaskInterpret
-       ../mTaskInterpret > $@
+##############################################################################\r
+# Build global options\r
+# NOTE: Can be overridden externally.\r
+#\r
+\r
+# Compiler options here.\r
+ifeq ($(USE_OPT),)\r
+  USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16\r
+endif\r
+\r
+# C specific options here (added to USE_OPT).\r
+ifeq ($(USE_COPT),)\r
+  USE_COPT = \r
+endif\r
+\r
+# C++ specific options here (added to USE_OPT).\r
+ifeq ($(USE_CPPOPT),)\r
+  USE_CPPOPT = -fno-rtti\r
+endif\r
+\r
+# Enable this if you want the linker to remove unused code and data\r
+ifeq ($(USE_LINK_GC),)\r
+  USE_LINK_GC = yes\r
+endif\r
+\r
+# Linker extra options here.\r
+ifeq ($(USE_LDOPT),)\r
+  USE_LDOPT = \r
+endif\r
+\r
+# Enable this if you want link time optimizations (LTO)\r
+ifeq ($(USE_LTO),)\r
+  USE_LTO = yes\r
+endif\r
+\r
+# If enabled, this option allows to compile the application in THUMB mode.\r
+ifeq ($(USE_THUMB),)\r
+  USE_THUMB = yes\r
+endif\r
+\r
+# Enable this if you want to see the full log while compiling.\r
+ifeq ($(USE_VERBOSE_COMPILE),)\r
+  USE_VERBOSE_COMPILE = no\r
+endif\r
+\r
+# If enabled, this option makes the build process faster by not compiling\r
+# modules not used in the current configuration.\r
+ifeq ($(USE_SMART_BUILD),)\r
+  USE_SMART_BUILD = yes\r
+endif\r
+\r
+#\r
+# Build global options\r
+##############################################################################\r
+\r
+##############################################################################\r
+# Architecture or project specific options\r
+#\r
+\r
+# Stack size to be allocated to the Cortex-M process stack. This stack is\r
+# the stack used by the main() thread.\r
+ifeq ($(USE_PROCESS_STACKSIZE),)\r
+  USE_PROCESS_STACKSIZE = 0x400\r
+endif\r
+\r
+# Stack size to the allocated to the Cortex-M main/exceptions stack. This\r
+# stack is used for processing interrupts and exceptions.\r
+ifeq ($(USE_EXCEPTIONS_STACKSIZE),)\r
+  USE_EXCEPTIONS_STACKSIZE = 0x400\r
+endif\r
+\r
+# Enables the use of FPU (no, softfp, hard).\r
+ifeq ($(USE_FPU),)\r
+  USE_FPU = no\r
+endif\r
+\r
+# FPU-related options.\r
+ifeq ($(USE_FPU_OPT),)\r
+  USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv5-d16\r
+endif\r
+\r
+#\r
+# Architecture or project specific options\r
+##############################################################################\r
+\r
+##############################################################################\r
+# Project, sources and paths\r
+#\r
+\r
+# Define project name here\r
+PROJECT = mTask\r
+\r
+# Imported source files and paths\r
+CHIBIOS = ./ChibiOS\r
+# Startup files.\r
+include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f7xx.mk\r
+# HAL-OSAL files (optional).\r
+include $(CHIBIOS)/os/hal/hal.mk\r
+include $(CHIBIOS)/os/hal/ports/STM32/STM32F7xx/platform.mk\r
+include $(CHIBIOS)/os/hal/boards/ST_NUCLEO144_F767ZI/board.mk\r
+include $(CHIBIOS)/os/hal/osal/rt/osal.mk\r
+# RTOS files (optional).\r
+include $(CHIBIOS)/os/rt/rt.mk\r
+include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk\r
+# Other files (optional).\r
+include $(CHIBIOS)/test/rt/test.mk\r
+\r
+# Define linker script file here\r
+LDSCRIPT= $(STARTUPLD)/STM32F76xxI.ld\r
+\r
+# C sources that can be compiled in ARM or THUMB mode depending on the global\r
+# setting.\r
+CSRC = $(STARTUPSRC) \\r
+       $(KERNSRC) \\r
+       $(PORTSRC) \\r
+       $(OSALSRC) \\r
+       $(HALSRC) \\r
+       $(PLATFORMSRC) \\r
+       $(BOARDSRC) \\r
+       $(TESTSRC) \\r
+          $(filter-out interface_linux.c,$(wildcard *.c))\r
+\r
+# C++ sources that can be compiled in ARM or THUMB mode depending on the global\r
+# setting.\r
+CPPSRC =\r
+\r
+# C sources to be compiled in ARM mode regardless of the global setting.\r
+# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler\r
+#       option that results in lower performance and larger code size.\r
+ACSRC =\r
+\r
+# C++ sources to be compiled in ARM mode regardless of the global setting.\r
+# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler\r
+#       option that results in lower performance and larger code size.\r
+ACPPSRC =\r
+\r
+# C sources to be compiled in THUMB mode regardless of the global setting.\r
+# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler\r
+#       option that results in lower performance and larger code size.\r
+TCSRC =\r
+\r
+# C sources to be compiled in THUMB mode regardless of the global setting.\r
+# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler\r
+#       option that results in lower performance and larger code size.\r
+TCPPSRC =\r
+\r
+# List ASM source files here\r
+ASMSRC =\r
+ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)\r
+\r
+INCDIR = $(CHIBIOS)/os/license \\r
+         $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \\r
+         $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \\r
+         $(CHIBIOS)/os/various\r
+\r
+#\r
+# Project, sources and paths\r
+##############################################################################\r
+\r
+##############################################################################\r
+# Compiler settings\r
+#\r
+\r
+MCU  = cortex-m7\r
+\r
+#TRGT = arm-elf-\r
+TRGT = arm-none-eabi-\r
+CC   = $(TRGT)gcc\r
+CPPC = $(TRGT)g++\r
+# Enable loading with g++ only if you need C++ runtime support.\r
+# NOTE: You can use C++ even without C++ support if you are careful. C++\r
+#       runtime support makes code size explode.\r
+LD   = $(TRGT)gcc\r
+#LD   = $(TRGT)g++\r
+CP   = $(TRGT)objcopy\r
+AS   = $(TRGT)gcc -x assembler-with-cpp\r
+AR   = $(TRGT)ar\r
+OD   = $(TRGT)objdump\r
+SZ   = $(TRGT)size\r
+HEX  = $(CP) -O ihex\r
+BIN  = $(CP) -O binary\r
+\r
+# ARM-specific options here\r
+AOPT =\r
+\r
+# THUMB-specific options here\r
+TOPT = -mthumb -DTHUMB\r
+\r
+# Define C warning options here\r
+CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes -Werror\r
+\r
+# Define C++ warning options here\r
+CPPWARN = -Wall -Wextra -Wundef\r
+\r
+#\r
+# Compiler settings\r
+##############################################################################\r
+\r
+##############################################################################\r
+# Start of user section\r
+#\r
+\r
+# List all user C define here, like -D_DEBUG=1\r
+UDEFS = -DSTM #-DDEBUG\r
+\r
+# Define ASM defines here\r
+UADEFS =\r
+\r
+# List all user directories here\r
+UINCDIR =\r
+\r
+# List the user directory to look for the libraries here\r
+ULIBDIR =\r
+\r
+# List all user libraries here\r
+ULIBS =\r
+\r
+#\r
+# End of user defines\r
+##############################################################################\r
+\r
+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC\r
+include $(RULESPATH)/rules.mk\r
+\r
+flash: build/$(PROJECT).bin\r
+       sudo `which openocd` \\r
+               -f interface/stlink-v2-1.cfg\\r
+               -c "transport select hla_swd"\\r
+               -f target/stm32f7x.cfg \\r
+               -c init\\r
+               -c "reset halt"\\r
+               -c "flash write_image erase "$<" 0x08000000"\\r
+               -c "reset run"\\r
+               -c shutdown\r