mirror of
git://projects.qi-hardware.com/f32xbase.git
synced 2024-11-04 23:21:53 +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"
|
#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)
|
void run_payload(void)
|
||||||
{
|
{
|
||||||
|
PLAYFORM_EXIT;
|
||||||
|
|
||||||
/* No interrupts while jumping between worlds */
|
/* No interrupts while jumping between worlds */
|
||||||
EA = 0;
|
EA = 0;
|
||||||
|
|
||||||
/* Restart USB */
|
/* Restart USB */
|
||||||
USB0XCN = 0;
|
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");
|
debug("launching payload\n");
|
||||||
|
|
||||||
__asm
|
__asm
|
||||||
@ -182,21 +204,17 @@ static void boot_loader(void)
|
|||||||
* the GTA01/02, once the system is powered up, IDBG exits this loop.
|
* the GTA01/02, once the system is powered up, IDBG exits this loop.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GPIOCN |= WEAKPUD;
|
BOOT_SETUP;
|
||||||
#ifdef GTA
|
|
||||||
I2C_SDA_PULL = 0;
|
|
||||||
#endif
|
|
||||||
delay();
|
|
||||||
|
|
||||||
dfu_init();
|
dfu_init();
|
||||||
usb_init();
|
usb_init();
|
||||||
|
|
||||||
#ifdef GTA
|
#ifdef PLATFORM_TEST
|
||||||
|
|
||||||
while (!I2C_SDA || dfu.state != dfuIDLE)
|
while (PLATFORM_TEST)
|
||||||
usb_poll();
|
usb_poll();
|
||||||
|
|
||||||
#else /* GTA */
|
#else /* PLATFORM_TEST */
|
||||||
|
|
||||||
#define MS_TO_LOOPS(ms) ((uint32_t) (ms)*190)
|
#define MS_TO_LOOPS(ms) ((uint32_t) (ms)*190)
|
||||||
|
|
||||||
@ -211,7 +229,7 @@ static void boot_loader(void)
|
|||||||
loop = 0;
|
loop = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !GTA */
|
#endif /* !PLATFORM_TEST */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "dfu.h"
|
#include "dfu.h"
|
||||||
#include "idbg/usb-ids.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
|
|
||||||
CC=sdcc
|
CC=sdcc
|
||||||
CFLAGS=--std-c99 -I. -I../common \
|
CFLAGS=--std-c99 -I. -I../common \
|
||||||
-DPAYLOAD_START=$(PAYLOAD_START) -DPAYLOAD_SIZE=$(PAYLOAD_SIZE) \
|
-DPAYLOAD_START=$(PAYLOAD_START) -DPAYLOAD_SIZE=$(PAYLOAD_SIZE)
|
||||||
-D`cat ../.target`
|
|
||||||
LDFLAGS=--xram-size 1024
|
LDFLAGS=--xram-size 1024
|
||||||
|
|
||||||
|
|
||||||
@ -68,8 +67,6 @@ $(MAIN).ihx: $(OBJS:%=%.rel)
|
|||||||
.c.rel:
|
.c.rel:
|
||||||
$(CC) $(CFLAGS) -c $<
|
$(CC) $(CFLAGS) -c $<
|
||||||
|
|
||||||
$(OBJS:%=%.rel): ../.target
|
|
||||||
|
|
||||||
# below, set dummy UART speed to make dependencies build without error
|
# below, set dummy UART speed to make dependencies build without error
|
||||||
|
|
||||||
depend .depend:
|
depend .depend:
|
||||||
@ -81,8 +78,6 @@ depend .depend:
|
|||||||
{ rm -f .depend; exit 1; }; \
|
{ rm -f .depend; exit 1; }; \
|
||||||
done
|
done
|
||||||
|
|
||||||
.depend: ../.target
|
|
||||||
|
|
||||||
ifeq (.depend,$(wildcard .depend))
|
ifeq (.depend,$(wildcard .depend))
|
||||||
include .depend
|
include .depend
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user