diff options
Diffstat (limited to 'stm32')
-rw-r--r-- | stm32/Tupfile | 44 | ||||
-rw-r--r-- | stm32/z180-stamp-stm32.c | 14 |
2 files changed, 37 insertions, 21 deletions
diff --git a/stm32/Tupfile b/stm32/Tupfile index 8512bfe..1778623 100644 --- a/stm32/Tupfile +++ b/stm32/Tupfile @@ -1,13 +1,8 @@ include_rules PROG = z180-stamp-stm32 - SRC = z180-stamp-stm32.c serial.c z80-if.c - SRC_Z = ../z180/hdrom.c -PREDEP = ../z180/hdrom.h - -#SRC += $(SRC_Z) #TARGETS = $(PROG).elf FP_FLAGS = -msoft-float @@ -18,31 +13,62 @@ OPENCM3_DIR = $(TOP)/libopencm3 LDSCRIPT = stm32vl-discovery.ld ############################################################################### +# Executables TOOLCHAINDIR = /usr/local/gcc-arm-none-eabi-4_8-2014q2/bin TOOLCHAIN = $(TOOLCHAINDIR)/arm-none-eabi +CC = $(TOOLCHAIN)-gcc +LD = $(TOOLCHAIN)-gcc +AR = $(TOOLCHAIN)-ar +AS = $(TOOLCHAIN)-as +OBJCOPY = $(TOOLCHAIN)-objcopy +OBJDUMP = $(TOOLCHAIN)-objdump +SIZE = $(TOOLCHAIN)-size +GDB = $(TOOLCHAIN)-gdb + ############################################################################### INCLUDES += $(OPENCM3_DIR)/include LIBDIRS += $(OPENCM3_DIR)/lib +SCRIPT_DIR = $(OPENCM3_DIR)/scripts + ifdef DEBUG DEFS += -DDEBUG=2 endif +CFLAGS += -g -Os CFLAGS += -mthumb -mcpu=cortex-m3 $(FP_FLAGS) -mfix-cortex-m3-ldrd - +CFLAGS += -std=gnu99 +CFLAGS += -Wall -Wextra -Wimplicit-function-declaration +CFLAGS += -Wredundant-decls +#CFLAGS += -fno-common -ffunction-sections -fdata-sections CFLAGS += -I $(INCLUDES) CPPFLAGS += $(DEFS) # Linker flags LDFLAGS += --static -nostartfiles +LDFLAGS += -T$(LDSCRIPT) +LDFLAGS += -Wl,--gc-sections +LDFLAGS += -Wl,--cref + +LDLIBS += -L$(LIBDIRS) -l$(LIBNAME) +LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group + + +!cc = |> ^ CC %f^ $(CC) $(CFLAGS) $(CPPFLAGS) -c %f -o %o |> %B.o +!LINK = |> ^ LINK %o^ $(LD) $(CFLAGS) $(LDFLAGS) -Wl,-Map=%O.map %f $(LDLIBS) -o %o |> | %O.map +!OBJCOPY= |> ^ OBJCOPY %o^ $(OBJCOPY) -Oihex %f %o |> +!OBJDUMP= |> ^ OBJDUMP %o^ $(OBJDUMP) -h -S %f > %o |> %O.lss +!SIZE = |> ^ SIZE^ $(SIZE) %f |> -LDLIBS += -L$(LIBDIRS) -l$(LIBNAME) -LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group +: foreach $(SRC) $(SRC_Z) | ../z180/hdrom.h |> !cc |> {objs} +: {objs} |> !LINK |> $(PROG).elf +: $(PROG).elf |> !OBJCOPY |> %B.hex +: $(PROG).elf |> !OBJDUMP |> %B.lss +: $(PROG).elf |> !SIZE |> -include $(CONFIG)/gcc.tup diff --git a/stm32/z180-stamp-stm32.c b/stm32/z180-stamp-stm32.c index 96d724c..15d732d 100644 --- a/stm32/z180-stamp-stm32.c +++ b/stm32/z180-stamp-stm32.c @@ -1,6 +1,7 @@ /* */ +#include <stdio.h> #include <libopencmsis/core_cm3.h> #include <libopencm3/cm3/nvic.h> @@ -10,8 +11,6 @@ #include <libopencm3/stm32/gpio.h> #include <libopencm3/stm32/timer.h> -#include <stdio.h> - #define ODR 0x0c #define IDR 0x08 @@ -395,7 +394,7 @@ static uint32_t z80_sram_cmp(uint32_t addr, uint32_t length, uint8_t wval, int i uint8_t rval; int_fast8_t errors = 0; - DBG_P(1, "SRAM: Check 0x%.5lX byte... ", length); + DBG_P(1, "SRAM: Check %#.5x byte... ", length); while (length--) { if ((rval = z80_read(addr)) != wval) { if (errors == 0) { @@ -463,8 +462,6 @@ const char * const qbcat = "Zhe quick brown fox jumps over the lazy cat!"; #endif -/*--------------------------------------------------------------------------*/ - uint8_t z80_get_byte(uint32_t adr) { uint8_t data; @@ -511,7 +508,6 @@ struct msg_item { void (*func)(uint8_t, int, uint8_t *); }; -static uint32_t msg_to_addr(uint8_t *msg) { uint32_t addr = msg[0] | (msg[1] << 8) | ((uint32_t)msg[2] << 16); @@ -520,7 +516,6 @@ uint32_t msg_to_addr(uint8_t *msg) } -static void do_msg_ini_msgfifo(uint8_t subf, int len, uint8_t * msg) { (void)subf; (void)len; @@ -529,7 +524,6 @@ void do_msg_ini_msgfifo(uint8_t subf, int len, uint8_t * msg) } -static void do_msg_ini_memfifo(uint8_t subf, int len, uint8_t * msg) { (void)len; @@ -538,7 +532,6 @@ void do_msg_ini_memfifo(uint8_t subf, int len, uint8_t * msg) } -static void do_msg_char_out(uint8_t subf, int len, uint8_t * msg) { (void)subf; @@ -548,7 +541,6 @@ void do_msg_char_out(uint8_t subf, int len, uint8_t * msg) } -static const struct msg_item z80_messages[] = { { 0, /* fct nr. */ @@ -569,7 +561,6 @@ const struct msg_item z80_messages[] = -static void do_message(int len, uint8_t *msg) { uint8_t fct, sub_fct; @@ -614,7 +605,6 @@ void do_message(int len, uint8_t *msg) #define CTRBUF_LEN 256 -static void check_msg_fifo(void) { int ch; |