diff --git a/fw/boot/boot.c b/fw/boot/boot.c index f4b090c..cf7e80f 100644 --- a/fw/boot/boot.c +++ b/fw/boot/boot.c @@ -21,11 +21,17 @@ #include "version.h" #include "regs.h" -#include "io.h" #include "uart.h" #include "usb.h" #include "dfu.h" +#include "config.h" + + +#if !defined(CONFIG_DEBUG) && !defined(CONFIG_ERROR) && !defined(CONFIG_PRINTK) +#define uart_init(x) +#endif + /* * GTA example: @@ -57,7 +63,7 @@ void run_payload(void) { - PLAYFORM_EXIT; + PLATFORM_EXIT; /* No interrupts while jumping between worlds */ EA = 0; @@ -204,7 +210,7 @@ static void boot_loader(void) * the GTA01/02, once the system is powered up, IDBG exits this loop. */ - BOOT_SETUP; + PLATFORM_SETUP; dfu_init(); usb_init(); @@ -254,7 +260,9 @@ void main(void) */ OSCICN |= IFCN0; + uart_init(3); + if (REG0CN & VBSTAT) boot_loader(); run_payload(); diff --git a/fw/boot/config.h b/fw/boot/config.h deleted file mode 100644 index 2b6502f..0000000 --- a/fw/boot/config.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * boot/config.h - Boot loader configuration - * - * Written 2008 by Werner Almesberger - * Copyright 2008 Werner Almesberger - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifndef CONFIG_H -#define CONFIG_H - -//#define CONFIG_DEBUG -//#define CONFIG_ERROR -//#define CONFIG_PRINTK - -#endif /* !CONFIG_H */ diff --git a/fw/boot/dfu.c b/fw/boot/dfu.c index ad7ab9d..e5c0998 100644 --- a/fw/boot/dfu.c +++ b/fw/boot/dfu.c @@ -32,6 +32,8 @@ #include "usb.h" #include "dfu.h" +#include "config.h" + #ifndef NULL #define NULL 0 @@ -50,7 +52,7 @@ const uint8_t device_descriptor[] = { 0x00, /* bDeviceProtocol (per interface) */ EP0_SIZE, /* bMaxPacketSize */ LE(USB_VENDOR), /* idVendor */ - LE(USB_PRODUCT_IDBG_DFU),/* idProduct */ + LE(USB_PRODUCT), /* idProduct */ LE(0x0001), /* bcdDevice */ 0, /* iManufacturer */ 0, /* iProduct */ diff --git a/fw/common/Makefile.common b/fw/common/Makefile.common index 3bf1164..03e5968 100644 --- a/fw/common/Makefile.common +++ b/fw/common/Makefile.common @@ -12,7 +12,7 @@ CC=sdcc -CFLAGS=--std-c99 -I. -I../common \ +CFLAGS=--std-c99 -I. -I$(F32XBASE)/fw/common \ -DPAYLOAD_START=$(PAYLOAD_START) -DPAYLOAD_SIZE=$(PAYLOAD_SIZE) LDFLAGS=--xram-size 1024 diff --git a/fw/common/Makefile.system b/fw/common/Makefile.system index a7b7d6e..4d7abfc 100644 --- a/fw/common/Makefile.system +++ b/fw/common/Makefile.system @@ -10,10 +10,6 @@ # (at your option) any later version. # -# -# @@@ This is a template for now. Needs more work. -# - # # For now, we keep an 8k/7.5k division such that there's plenty of space for # debugging the boot loader. Later, we should move to something like 4k/11.5k. @@ -25,21 +21,3 @@ PAYLOAD_START=0x1000 PAYLOAD_SIZE=0x2c00 - -# -# Set the serial speed, depending on target type -# - -ifneq (../.target,$(wildcard ../.target)) -$(error Please create ../.target first) -endif - -ifeq ($(shell cat ../.target),GTA) -DEFINE_UART_SPEED=-DUART_115200_BPS -else ifeq ($(shell cat ../.target),BEN_V1) -DEFINE_UART_SPEED=-DUART_57600_BPS -else ifeq ($(shell cat ../.target),BEN_V2) -DEFINE_UART_SPEED=-DUART_57600_BPS -else -DEFINE_UART_SPEED= -endif diff --git a/fw/boot/version.h b/fw/common/version.h similarity index 100% rename from fw/boot/version.h rename to fw/common/version.h