mirror of
git://projects.qi-hardware.com/f32xbase.git
synced 2024-11-04 23:45:20 +02:00
Move platform-specific boot loader configuration into macros.
- fw/boot/boot.c (boot_loader): moved GTA-specific pull-up disable and I2C_SDA_PULL enable into macro PLATFORM_SETUP - fw/boot/boot.c (run_payload): moved GTA-specific pull-up enable and I2C_SDA_PULL disable into macro PLATFORM_EXIT - fw/boot/boot.c (boot_loader): moved GTA-specific I2C_SDA probe into macro PLATFORM_TEST - fw/common/Makefile.common: removed all references to dependencies on .target. The caller is now responsible for these. - fw/boot/dfu.c: don't include idbg/usb-ids.h; USB_VENDOR and USB_PRODUCT are now passed via macros
This commit is contained in:
parent
749a4e22a4
commit
fcfaec399a
@ -27,22 +27,44 @@
|
||||
#include "dfu.h"
|
||||
|
||||
|
||||
/*
|
||||
* GTA example:
|
||||
*
|
||||
|
||||
#define PLATFORM_SETUP \
|
||||
GPIOCN |= WEAKPUD; \
|
||||
I2C_SDA_PULL = 0; \
|
||||
delay();
|
||||
|
||||
// Re-enable pull-ups
|
||||
// Don't waste power in pull-down
|
||||
#define PLATFORM_EXIT \
|
||||
GPIOCN &= ~WEAKPUD; \
|
||||
I2C_SDA_PULL = 1;
|
||||
|
||||
#define PLATFORM_TEST \
|
||||
(!I2C_SDA || dfu.state != dfuIDLE)
|
||||
*/
|
||||
|
||||
#ifndef PLATFORM_SETUP
|
||||
#define PLATFORM_SETUP
|
||||
#endif
|
||||
|
||||
#ifndef PLATFORM_EXIT
|
||||
#define PLATFORM_EXIT
|
||||
#endif
|
||||
|
||||
|
||||
void run_payload(void)
|
||||
{
|
||||
PLAYFORM_EXIT;
|
||||
|
||||
/* No interrupts while jumping between worlds */
|
||||
EA = 0;
|
||||
|
||||
/* Restart USB */
|
||||
USB0XCN = 0;
|
||||
|
||||
/* Re-enable pull-ups */
|
||||
GPIOCN &= ~WEAKPUD;
|
||||
|
||||
#ifdef GTA
|
||||
/* Don't waste power in pull-down */
|
||||
I2C_SDA_PULL = 1;
|
||||
#endif
|
||||
|
||||
debug("launching payload\n");
|
||||
|
||||
__asm
|
||||
@ -182,21 +204,17 @@ static void boot_loader(void)
|
||||
* the GTA01/02, once the system is powered up, IDBG exits this loop.
|
||||
*/
|
||||
|
||||
GPIOCN |= WEAKPUD;
|
||||
#ifdef GTA
|
||||
I2C_SDA_PULL = 0;
|
||||
#endif
|
||||
delay();
|
||||
BOOT_SETUP;
|
||||
|
||||
dfu_init();
|
||||
usb_init();
|
||||
|
||||
#ifdef GTA
|
||||
#ifdef PLATFORM_TEST
|
||||
|
||||
while (!I2C_SDA || dfu.state != dfuIDLE)
|
||||
while (PLATFORM_TEST)
|
||||
usb_poll();
|
||||
|
||||
#else /* GTA */
|
||||
#else /* PLATFORM_TEST */
|
||||
|
||||
#define MS_TO_LOOPS(ms) ((uint32_t) (ms)*190)
|
||||
|
||||
@ -211,7 +229,7 @@ static void boot_loader(void)
|
||||
loop = 0;
|
||||
}
|
||||
}
|
||||
#endif /* !GTA */
|
||||
#endif /* !PLATFORM_TEST */
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "uart.h"
|
||||
#include "usb.h"
|
||||
#include "dfu.h"
|
||||
#include "idbg/usb-ids.h"
|
||||
|
||||
|
||||
#ifndef NULL
|
||||
|
@ -13,8 +13,7 @@
|
||||
|
||||
CC=sdcc
|
||||
CFLAGS=--std-c99 -I. -I../common \
|
||||
-DPAYLOAD_START=$(PAYLOAD_START) -DPAYLOAD_SIZE=$(PAYLOAD_SIZE) \
|
||||
-D`cat ../.target`
|
||||
-DPAYLOAD_START=$(PAYLOAD_START) -DPAYLOAD_SIZE=$(PAYLOAD_SIZE)
|
||||
LDFLAGS=--xram-size 1024
|
||||
|
||||
|
||||
@ -68,8 +67,6 @@ $(MAIN).ihx: $(OBJS:%=%.rel)
|
||||
.c.rel:
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
$(OBJS:%=%.rel): ../.target
|
||||
|
||||
# below, set dummy UART speed to make dependencies build without error
|
||||
|
||||
depend .depend:
|
||||
@ -81,8 +78,6 @@ depend .depend:
|
||||
{ rm -f .depend; exit 1; }; \
|
||||
done
|
||||
|
||||
.depend: ../.target
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user