From 724fdb18e7cb0952fdefde7d66f19e4add9b4b76 Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Tue, 14 Feb 2017 10:57:30 +0100 Subject: [PATCH 1/7] [ion] Implement Log::print using SWO on the device Change-Id: I17e024535cc0f0daf74953c7221e2b98959e6c47 --- gdb_script.gdb | 2 ++ ion/src/device/Makefile | 1 + ion/src/device/log.cpp | 15 +++++++++++++++ ion/src/device/regs/itm.h | 32 ++++++++++++++++++++++++++++++++ ion/src/device/regs/register.h | 1 + ion/src/device/regs/regs.h | 1 + 6 files changed, 52 insertions(+) create mode 100644 ion/src/device/log.cpp create mode 100644 ion/src/device/regs/itm.h diff --git a/gdb_script.gdb b/gdb_script.gdb index 4d41c4a9b..b5640762a 100644 --- a/gdb_script.gdb +++ b/gdb_script.gdb @@ -8,6 +8,8 @@ set pagination off load # Tell OpenOCD to reset and halt +monitor itm ports on +monitor tpiu config internal swo.log.bin uart off 16000000 monitor reset halt break init diff --git a/ion/src/device/Makefile b/ion/src/device/Makefile index d6b5df1b8..c2ed1e605 100644 --- a/ion/src/device/Makefile +++ b/ion/src/device/Makefile @@ -7,6 +7,7 @@ objs += $(addprefix ion/src/device/, \ display.o\ keyboard.o\ led.o\ + log.o\ power.o\ sd_card.o\ ) diff --git a/ion/src/device/log.cpp b/ion/src/device/log.cpp new file mode 100644 index 000000000..2b6a25a99 --- /dev/null +++ b/ion/src/device/log.cpp @@ -0,0 +1,15 @@ +#include +#include "regs/itm.h" + +// We're printing using SWO. +// This is achieved by writing to the ITM register, which is sent through the +// Cortex Debug bus + +void Ion::Log::print(const char * message) { + char character = 0; + while ((character = *message++) != 0) { + if (ITM.TER()->get(0)) { + ITM.STIM(0)->set(character); + } + } +} diff --git a/ion/src/device/regs/itm.h b/ion/src/device/regs/itm.h new file mode 100644 index 000000000..196737ca3 --- /dev/null +++ b/ion/src/device/regs/itm.h @@ -0,0 +1,32 @@ +#ifndef REGS_ITM_H +#define REGS_ITM_H + +#include "register.h" + +// See ARM Cortex M4 TRM + +class ITM { +public: + class STIM : public Register8 { + }; + + // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0314h/Chdbicac.html + class TER : Register32 { + public: + bool get(int index) volatile { return (bool)getBitRange(index, index); } + }; + + constexpr ITM() {}; + volatile STIM * STIM(int i) const { + return (class STIM *)(Base() + 4*i); + }; + REGS_REGISTER_AT(TER, 0xE00); +private: + constexpr uint32_t Base() const { + return 0xE0000000; + } +}; + +constexpr ITM ITM; + +#endif diff --git a/ion/src/device/regs/register.h b/ion/src/device/regs/register.h index 45134acb4..87056ed7a 100644 --- a/ion/src/device/regs/register.h +++ b/ion/src/device/regs/register.h @@ -37,6 +37,7 @@ private: T m_value; }; +typedef Register Register8; typedef Register Register16; typedef Register Register32; typedef Register Register64; diff --git a/ion/src/device/regs/regs.h b/ion/src/device/regs/regs.h index 712fd56be..4b96a63a3 100644 --- a/ion/src/device/regs/regs.h +++ b/ion/src/device/regs/regs.h @@ -8,6 +8,7 @@ #include "flash.h" #include "fsmc.h" #include "gpio.h" +#include "itm.h" #include "pwr.h" #include "rcc.h" #include "sdio.h" From 335bccea4cb094e3b337b20806fb9e5ba355ff9a Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Tue, 14 Feb 2017 10:58:46 +0100 Subject: [PATCH 2/7] [ion] Add a C bridge for the logging function Change-Id: I70cc18700c6cf392e98c4ff89df897b330bde807 --- ion/include/ion/c.h | 14 ++++++++++++++ ion/src/c.cpp | 6 ++++++ 2 files changed, 20 insertions(+) create mode 100644 ion/include/ion/c.h create mode 100644 ion/src/c.cpp diff --git a/ion/include/ion/c.h b/ion/include/ion/c.h new file mode 100644 index 000000000..5bfacf3ae --- /dev/null +++ b/ion/include/ion/c.h @@ -0,0 +1,14 @@ +#ifndef ION_C_H +#define ION_C_H + +#ifdef __cplusplus +extern "C" { +#endif + +void ion_log_print(const char * message) { + +#ifdef __cplusplus +extern "C" { +#endif + +#endif diff --git a/ion/src/c.cpp b/ion/src/c.cpp new file mode 100644 index 000000000..8571b890a --- /dev/null +++ b/ion/src/c.cpp @@ -0,0 +1,6 @@ +#include +#include + +void ion_log_print(const char * message) { + Ion::Log::print(message); +} From 6e8d9c1a115cf336d1848e174599afaea407a411 Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Tue, 14 Feb 2017 11:05:00 +0100 Subject: [PATCH 3/7] [ion] Fix the blackbox platform Change-Id: I1edddefdbf163855acb949eef4c1579c8b3721d6 --- Makefile.blackbox | 3 ++- ion/src/blackbox/Makefile | 9 +++++++++ ion/src/blackbox/boot.c | 11 ----------- ion/src/blackbox/boot.cpp | 16 ++++++++++++++++ ion/src/blackbox/ion.c | 12 ------------ ion/src/blackbox/ion.cpp | 18 ++++++++++++++++++ 6 files changed, 45 insertions(+), 24 deletions(-) delete mode 100644 ion/src/blackbox/boot.c create mode 100644 ion/src/blackbox/boot.cpp delete mode 100644 ion/src/blackbox/ion.c create mode 100644 ion/src/blackbox/ion.cpp diff --git a/Makefile.blackbox b/Makefile.blackbox index a55824800..631225ea2 100644 --- a/Makefile.blackbox +++ b/Makefile.blackbox @@ -3,6 +3,7 @@ CXX=clang++ LD=clang++ SIZE=size -LDFLAGS = +SFLAGS += -DLOG_DYNAMIC_MEMORY USE_LIBA=1 +EXE=elf diff --git a/ion/src/blackbox/Makefile b/ion/src/blackbox/Makefile index dc1cff182..375d55f4b 100644 --- a/ion/src/blackbox/Makefile +++ b/ion/src/blackbox/Makefile @@ -1,4 +1,13 @@ objs += $(addprefix ion/src/blackbox/, boot.o ion.o) +objs += $(addprefix ion/src/shared/, \ + crc32.o \ + events.o \ + events_from_keyboard.o \ + log.o \ + power.o \ +) + +ion/src/shared/log.o: SFLAGS=-Iion/include #objs += $(addprefix ion/src/simulator/boot/, main.o) #objs += $(addprefix ion/src/simulator/display/, fltklcd.o) #objs += $(addprefix ion/src/simulator/keyboard/, fltkkbd.o) diff --git a/ion/src/blackbox/boot.c b/ion/src/blackbox/boot.c deleted file mode 100644 index 990b55a61..000000000 --- a/ion/src/blackbox/boot.c +++ /dev/null @@ -1,11 +0,0 @@ -#define HEAP_SIZE 65536 -char heap[HEAP_SIZE]; -char * _liba_heap_start = &heap[0]; -char * _liba_heap_end = &heap[HEAP_SIZE]; - -int main(int argc, char * argv[]) { - ion_app(); -/* while (1) { - }*/ - return 0; -} diff --git a/ion/src/blackbox/boot.cpp b/ion/src/blackbox/boot.cpp new file mode 100644 index 000000000..4d8e2ba0a --- /dev/null +++ b/ion/src/blackbox/boot.cpp @@ -0,0 +1,16 @@ +#include + +constexpr int kHeapSize = 131072; +char heap[kHeapSize]; +extern "C" { + char * _heap_start = (char *)heap; + char * _heap_end = _heap_start+kHeapSize; + int main(int argc, char * argv[]); +} + +int main(int argc, char * argv[]) { + ion_app(); +/* while (1) { + }*/ + return 0; +} diff --git a/ion/src/blackbox/ion.c b/ion/src/blackbox/ion.c deleted file mode 100644 index ba60a9b25..000000000 --- a/ion/src/blackbox/ion.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -void ion_set_pixel(uint16_t x, uint16_t y, uint8_t color) { -} - -bool ion_key_down(ion_key_t key) { - return 0; -} - -void ion_sleep() { -} diff --git a/ion/src/blackbox/ion.cpp b/ion/src/blackbox/ion.cpp new file mode 100644 index 000000000..d1548d194 --- /dev/null +++ b/ion/src/blackbox/ion.cpp @@ -0,0 +1,18 @@ +#include +#include + +void Ion::Display::pushRect(KDRect r, const KDColor * pixels) { +} + +void Ion::Display::pushRectUniform(KDRect r, KDColor c) { +} + +void Ion::Display::pullRect(KDRect r, KDColor * pixels) { +} + +bool Ion::Keyboard::keyDown(Ion::Keyboard::Key key) { + return false; +} + +void Ion::msleep(long ms) { +} From 6343a84735b340f342e5fe391efd7957cac8c069 Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Tue, 14 Feb 2017 11:11:57 +0100 Subject: [PATCH 4/7] [ion] Fix the C API Change-Id: Ifbe11515171d7ee919f90fb28d63907c3c4cfd42 --- ion/Makefile | 4 ++++ ion/include/ion/c.h | 4 ++-- ion/src/simulator/Makefile | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ion/Makefile b/ion/Makefile index 595b2a67a..f228308f7 100644 --- a/ion/Makefile +++ b/ion/Makefile @@ -1,6 +1,10 @@ SFLAGS += -Iion/include -DKD_CONFIG_H=1 include ion/src/$(PLATFORM)/Makefile +objs += $(addprefix ion/src/, \ + c.o \ +) + tests += $(addprefix ion/test/,\ crc32.cpp\ ) diff --git a/ion/include/ion/c.h b/ion/include/ion/c.h index 5bfacf3ae..ce2ce1b98 100644 --- a/ion/include/ion/c.h +++ b/ion/include/ion/c.h @@ -5,10 +5,10 @@ extern "C" { #endif -void ion_log_print(const char * message) { +void ion_log_print(const char * message); #ifdef __cplusplus -extern "C" { +} #endif #endif diff --git a/ion/src/simulator/Makefile b/ion/src/simulator/Makefile index 5091f72c7..83ff56b48 100644 --- a/ion/src/simulator/Makefile +++ b/ion/src/simulator/Makefile @@ -10,6 +10,7 @@ objs += $(addprefix ion/src/shared/, \ crc32.o \ events.o \ events_from_keyboard.o \ + log.o \ power.o \ ) From 61e48981ef6e1b9de8ad8382053ee30b76ded411 Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Tue, 14 Feb 2017 11:12:36 +0100 Subject: [PATCH 5/7] [liba] Enable malloc/free logging Change-Id: I65ab731091440854c6db486078fef49901f855fd --- Makefile.blackbox | 2 +- liba/src/malloc.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Makefile.blackbox b/Makefile.blackbox index 631225ea2..2eb21a1ed 100644 --- a/Makefile.blackbox +++ b/Makefile.blackbox @@ -3,7 +3,7 @@ CXX=clang++ LD=clang++ SIZE=size -SFLAGS += -DLOG_DYNAMIC_MEMORY +SFLAGS += -DLIBA_LOG_DYNAMIC_MEMORY USE_LIBA=1 EXE=elf diff --git a/liba/src/malloc.c b/liba/src/malloc.c index dd734b19f..e31ac3f86 100644 --- a/liba/src/malloc.c +++ b/liba/src/malloc.c @@ -2,6 +2,20 @@ #include #include +#if LIBA_LOG_DYNAMIC_MEMORY +#include +#include + +void write_uint32_in_buffer(uint32_t n, char * buffer) { + for (int i=0; i<2*sizeof(uint32_t); i++) { + unsigned char v = (n & 0xF); + char c = (v>9) ? 'A'+v-10 : '0'+v; + buffer[2*sizeof(uint32_t)-1-i] = c; + n = n >> 4; + } +} +#endif + extern char _heap_start; extern char _heap_end; @@ -26,6 +40,11 @@ static void configure_heap() { } void free(void *ptr) { +#if LIBA_LOG_DYNAMIC_MEMORY + char message[5+2*sizeof(uint32_t)+1] = {'F', 'R', 'E', 'E', '-'}; + write_uint32_in_buffer((uint32_t)ptr, message+5); + ion_log_print(message); +#endif if (ptr != NULL) { memsys5FreeUnsafe(ptr); } @@ -39,6 +58,14 @@ void * malloc(size_t size) { if (size > 0) { p = memsys5MallocUnsafe(memsys5Roundup(size)); } +#if LIBA_LOG_DYNAMIC_MEMORY + char message[7+2*sizeof(uint32_t)+1+2*sizeof(uint32_t)+1] = {'M','A','L','L','O','C','-'}; + write_uint32_in_buffer((uint32_t)p, message+7); + message[7+2*sizeof(uint32_t)] = '-'; + write_uint32_in_buffer(size, message+7+2*sizeof(uint32_t)+1); + message[7+2*sizeof(uint32_t)+1+2*sizeof(uint32_t)] = 0; + ion_log_print(message); +#endif return p; } From 5a0ecfc1bcb753de2e6796180223fe85ed1916c1 Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Tue, 14 Feb 2017 11:22:00 +0100 Subject: [PATCH 6/7] [ion/device] Enable powering the LCD controller from a GPIO Change-Id: I9d5000cda527d04b3505afb3ecfc0ec07f2f1281 --- ion/src/device/display.cpp | 7 +++++++ ion/src/device/display.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/ion/src/device/display.cpp b/ion/src/device/display.cpp index defb93b0f..c3a4e3385 100644 --- a/ion/src/device/display.cpp +++ b/ion/src/device/display.cpp @@ -61,6 +61,10 @@ void initGPIO() { g.group().AFR()->setAlternateFunction(g.pin(), GPIO::AFR::AlternateFunction::AF12); } + // Turn on the power + PowerPin.group().MODER()->setMode(PowerPin.pin(), GPIO::MODER::Mode::Output); + PowerPin.group().ODR()->set(PowerPin.pin(), true); + // Turn on the reset pin ResetPin.group().MODER()->setMode(ResetPin.pin(), GPIO::MODER::Mode::Output); ResetPin.group().ODR()->set(ResetPin.pin(), true); @@ -79,6 +83,9 @@ void shutdownGPIO() { // Set to true : sleep consumption = 154 uA // Set to false : sleep consumption = 92 uA ResetPin.group().ODR()->set(ResetPin.pin(), false); + + PowerPin.group().MODER()->setMode(PowerPin.pin(), GPIO::MODER::Mode::Analog); + PowerPin.group().PUPDR()->setPull(PowerPin.pin(), GPIO::PUPDR::Pull::None); } void initFSMC() { diff --git a/ion/src/device/display.h b/ion/src/device/display.h index c6e97aa4f..63b31d2c2 100644 --- a/ion/src/device/display.h +++ b/ion/src/device/display.h @@ -18,6 +18,7 @@ namespace Device { * PA3 | LCD D5 | Alternate Function 12 | FSMC_D5 | * PA4 | LCD D6 | Alternate Function 12 | FSMC_D6 | * PB12 | LCD D13 | Alternate Function 12 | FSMC_D13 | + * PB14 | LCD power | Output | | LCD controller is powered directly from GPIO * PD0 | LCD D2 | Alternate Function 12 | FSMC_D2 | * PD1 | LCD D3 | Alternate Function 12 | FSMC_D3 | * PD4 | LCD read signal | Alternate Function 12 | FSMC_NOE | @@ -76,6 +77,7 @@ constexpr static GPIOPin FSMCPins[] = { GPIOPin(GPIOE, 15) }; +constexpr static GPIOPin PowerPin = GPIOPin(GPIOB, 14); constexpr static GPIOPin ResetPin = GPIOPin(GPIOE, 9); constexpr static int FSMCMemoryBank = 1; From babfe507637c660be80e564b2c729b3b19d28dea Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Wed, 15 Feb 2017 18:02:01 +0100 Subject: [PATCH 7/7] Organize the build system Change-Id: Ib331bae99041b998eb721b44c3b0b44426270b38 --- Makefile | 17 +++++++---------- Makefile.blackbox | 9 --------- Makefile.device | 28 ---------------------------- Makefile.emscripten | 9 --------- Makefile.simulator | 7 ------- build/config.mak | 20 ++++++++++++++++++++ build/platform.blackbox.mak | 3 +++ build/platform.device.mak | 7 +++++++ build/platform.emscripten.mak | 3 +++ build/platform.simulator.mak | 3 +++ build/toolchain.afl.mak | 3 +++ build/toolchain.arm-gcc.mak | 13 +++++++++++++ build/toolchain.arm-llvm.mak | 4 ++++ build/toolchain.emscripten.mak | 5 +++++ build/toolchain.host-clang.mak | 4 ++++ build/toolchain.mingw.mak | 6 ++++++ escher/Makefile | 4 ++++ liba/Makefile | 4 ++++ 18 files changed, 86 insertions(+), 63 deletions(-) delete mode 100644 Makefile.blackbox delete mode 100644 Makefile.device delete mode 100644 Makefile.emscripten delete mode 100644 Makefile.simulator create mode 100644 build/config.mak create mode 100644 build/platform.blackbox.mak create mode 100644 build/platform.device.mak create mode 100644 build/platform.emscripten.mak create mode 100644 build/platform.simulator.mak create mode 100644 build/toolchain.afl.mak create mode 100644 build/toolchain.arm-gcc.mak create mode 100644 build/toolchain.arm-llvm.mak create mode 100644 build/toolchain.emscripten.mak create mode 100644 build/toolchain.host-clang.mak create mode 100644 build/toolchain.mingw.mak diff --git a/Makefile b/Makefile index 2ce1a48a1..62a51e587 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,18 @@ -PLATFORM ?= device -DEBUG ?= 1 +include build/config.mak -include Makefile.$(PLATFORM) ifndef USE_LIBA - $(error Makefile.PLATFORM should define USE_LIBA) + $(error platform.mak should define USE_LIBA) endif ifndef EXE - $(error Makefile.PLATFORM should define EXE, the extension for executables) + $(error platform.mak should define EXE, the extension for executables) endif HOSTCC = gcc HOSTCXX = g++ +# Flags - Optimizations +SFLAGS += $(OPTIM_SFLAGS) + # Flags - Header search path SFLAGS += -Ilib -I. @@ -21,12 +22,8 @@ SFLAGS += -Wall # Flags - Header dependency tracking SFLAGS += -MD -MP -# Flags - Optimizations ifeq ($(DEBUG),1) -SFLAGS += -ggdb3 -DDEBUG=1 -O0 -else -SFLAGS += -Os -fdata-sections -ffunction-sections -LDFLAGS += --gc-sections +SFLAGS += -DDEBUG=1 endif # Language-specific flags diff --git a/Makefile.blackbox b/Makefile.blackbox deleted file mode 100644 index 2eb21a1ed..000000000 --- a/Makefile.blackbox +++ /dev/null @@ -1,9 +0,0 @@ -CC=clang -CXX=clang++ -LD=clang++ -SIZE=size - -SFLAGS += -DLIBA_LOG_DYNAMIC_MEMORY - -USE_LIBA=1 -EXE=elf diff --git a/Makefile.device b/Makefile.device deleted file mode 100644 index 887f02fca..000000000 --- a/Makefile.device +++ /dev/null @@ -1,28 +0,0 @@ -TOOLCHAIN=arm-none-eabi -# FIXME decide which one to use. -#COMPILER=llvm - -ifeq ($(COMPILER),llvm) -CC=clang -CXX=clang++ -else -CC=$(TOOLCHAIN)-gcc -CXX=$(TOOLCHAIN)-g++ -endif - -LD=$(TOOLCHAIN)-ld.bfd -GDB=$(TOOLCHAIN)-gdb -OBJCOPY=$(TOOLCHAIN)-objcopy -SIZE=$(TOOLCHAIN)-size - -# Flags - Arch -ifeq ($(COMPILER),llvm) - SFLAGS += -target thumbv7em-unknown-eabi -else - SFLAGS += -mthumb -march=armv7e-m -mfloat-abi=hard -endif -SFLAGS += -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 - -# Platform configuration -USE_LIBA=1 -EXE=elf diff --git a/Makefile.emscripten b/Makefile.emscripten deleted file mode 100644 index 75c5abddb..000000000 --- a/Makefile.emscripten +++ /dev/null @@ -1,9 +0,0 @@ -CC=emcc -CXX=emcc -LD=emcc -LDFLAGS=-s EXPORTED_FUNCTIONS="['_main', '_IonEmscriptenPushEvent']" -Os --shell-file ion/src/emscripten/shell.html -SIZE=size -DEBUG=0 - -USE_LIBA=0 -EXE=html diff --git a/Makefile.simulator b/Makefile.simulator deleted file mode 100644 index 84d775678..000000000 --- a/Makefile.simulator +++ /dev/null @@ -1,7 +0,0 @@ -CC=clang -CXX=clang++ -LD=clang++ -SIZE=size - -USE_LIBA=0 -EXE=elf diff --git a/build/config.mak b/build/config.mak new file mode 100644 index 000000000..10f06af4e --- /dev/null +++ b/build/config.mak @@ -0,0 +1,20 @@ +# You can edit this file to change build settings + +PLATFORM ?= device +VERBOSE ?= 0 +DEBUG ?= 1 +LIBA_LOG_DYNAMIC_MEMORY ?= 0 +ESCHER_LOG_EVENTS ?= 0 +ION_EVENTS ?= keyboard +# Possible values : keyboard, stdin, random, replay + +# Do not edit below this + +ifeq ($(DEBUG),1) +OPTIM_SFLAGS ?= -O0 +else +OPTIM_SFLAGS ?= -Os +endif + +include build/platform.$(PLATFORM).mak +include build/toolchain.$(TOOLCHAIN).mak diff --git a/build/platform.blackbox.mak b/build/platform.blackbox.mak new file mode 100644 index 000000000..58e78ca17 --- /dev/null +++ b/build/platform.blackbox.mak @@ -0,0 +1,3 @@ +TOOLCHAIN ?= afl +USE_LIBA ?= 1 +EXE = bin diff --git a/build/platform.device.mak b/build/platform.device.mak new file mode 100644 index 000000000..0666aabaa --- /dev/null +++ b/build/platform.device.mak @@ -0,0 +1,7 @@ +TOOLCHAIN ?= arm-gcc +ifeq ($(COMPILER),llvm) +# Compatibility with old build system +TOOLCHAIN = arm-llvm +endif +USE_LIBA = 1 +EXE = elf diff --git a/build/platform.emscripten.mak b/build/platform.emscripten.mak new file mode 100644 index 000000000..be4c03822 --- /dev/null +++ b/build/platform.emscripten.mak @@ -0,0 +1,3 @@ +TOOLCHAIN = emscripten +USE_LIBA = 0 +EXE = html diff --git a/build/platform.simulator.mak b/build/platform.simulator.mak new file mode 100644 index 000000000..ad21bb801 --- /dev/null +++ b/build/platform.simulator.mak @@ -0,0 +1,3 @@ +TOOLCHAIN ?= host-clang +USE_LIBA = 0 +EXE = elf diff --git a/build/toolchain.afl.mak b/build/toolchain.afl.mak new file mode 100644 index 000000000..6813024f4 --- /dev/null +++ b/build/toolchain.afl.mak @@ -0,0 +1,3 @@ +CC = afl-clang +CXX = afl-clang++ +LD = afl-clang++ diff --git a/build/toolchain.arm-gcc.mak b/build/toolchain.arm-gcc.mak new file mode 100644 index 000000000..bf3990b77 --- /dev/null +++ b/build/toolchain.arm-gcc.mak @@ -0,0 +1,13 @@ +CC = arm-none-eabi-gcc +CXX = arm-none-eabi-g++ +LD = arm-none-eabi-ld.bfd +GDB = arm-none-eabi-gdb +OBJCOPY = arm-none-eabi-objcopy +SIZE = arm-none-eabi-size +ifeq ($(DEBUG),1) +OPTIM_SFLAGS += -ggdb3 +else +OPTIM_SFLAGS += -fdata-sections -ffunction-sections +LDFLAGS = --gc-sections +endif +SFLAGS = -mthumb -march=armv7e-m -mfloat-abi=hard -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 diff --git a/build/toolchain.arm-llvm.mak b/build/toolchain.arm-llvm.mak new file mode 100644 index 000000000..f1732fb8b --- /dev/null +++ b/build/toolchain.arm-llvm.mak @@ -0,0 +1,4 @@ +include build/toolchain.arm-gcc.mak +CC = clang +CXX = clang++ +SFLAGS = -target thumbv7em-unknown-eabi -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 diff --git a/build/toolchain.emscripten.mak b/build/toolchain.emscripten.mak new file mode 100644 index 000000000..56f4a13f4 --- /dev/null +++ b/build/toolchain.emscripten.mak @@ -0,0 +1,5 @@ +CC = emcc +CXX = emcc +LD = emcc +LDFLAGS = -s EXPORTED_FUNCTIONS="['_main', '_IonEmscriptenPushEvent']" -Os --shell-file ion/src/emscripten/shell.html +SIZE = size diff --git a/build/toolchain.host-clang.mak b/build/toolchain.host-clang.mak new file mode 100644 index 000000000..2fe5dda30 --- /dev/null +++ b/build/toolchain.host-clang.mak @@ -0,0 +1,4 @@ +CC = clang +CXX = clang++ +LD = clang++ +GDB = lldb diff --git a/build/toolchain.mingw.mak b/build/toolchain.mingw.mak new file mode 100644 index 000000000..eb588dc90 --- /dev/null +++ b/build/toolchain.mingw.mak @@ -0,0 +1,6 @@ +CC = mingw-w64-x86_64-gcc +CXX = mingw-w64-x86_64-g++ +LD = mingw-w64-x86_64-g++ +SFLAGS = -D_USE_MATH_DEFINES +LDFLAGS = -static -mwindows +EXE = exe diff --git a/escher/Makefile b/escher/Makefile index 0876a12e6..722079189 100644 --- a/escher/Makefile +++ b/escher/Makefile @@ -1,5 +1,9 @@ SFLAGS += -Iescher/include +ifeq ($(ESCHER_LOG_EVENTS),1) +SFLAGS += -DESCHER_LOG_EVENTS=1 +endif + objs += $(addprefix escher/src/,\ alternate_empty_view_controller.o\ app.o\ diff --git a/liba/Makefile b/liba/Makefile index aa2375c09..557451437 100644 --- a/liba/Makefile +++ b/liba/Makefile @@ -1,5 +1,9 @@ SFLAGS += -Iliba/include +ifeq ($(LIBA_LOG_DYNAMIC_MEMORY),1) +SFLAGS += -DLIBA_LOG_DYNAMIC_MEMORY=1 +endif + liba/src/external/sqlite/mem5.o: CFLAGS += -w objs += $(addprefix liba/src/, \