From 89bcdcc60ab5e3c35e99c4f2cc7d052e831cc563 Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Sun, 10 Jun 2012 17:34:26 +1200 Subject: [PATCH] Moved stm32 generic platform files out of native platform dir. --- src/platforms/native/Makefile.inc | 2 ++ src/platforms/native/platform.h | 3 +++ src/platforms/native/usbuart.c | 4 ++-- src/platforms/{native => stm32}/gdb_if.c | 6 +++--- src/platforms/{native => stm32}/jtagtap.c | 0 src/platforms/{native => stm32}/swdptap.c | 0 6 files changed, 10 insertions(+), 5 deletions(-) rename src/platforms/{native => stm32}/gdb_if.c (91%) rename src/platforms/{native => stm32}/jtagtap.c (100%) rename src/platforms/{native => stm32}/swdptap.c (100%) diff --git a/src/platforms/native/Makefile.inc b/src/platforms/native/Makefile.inc index 3bddde9..b60b562 100644 --- a/src/platforms/native/Makefile.inc +++ b/src/platforms/native/Makefile.inc @@ -8,6 +8,8 @@ LDFLAGS_BOOT = -lopencm3_stm32f1 -Wl,--defsym,_stack=0x20005000 \ -mthumb -mcpu=cortex-m3 -Wl,-gc-sections LDFLAGS = $(LDFLAGS_BOOT) -Wl,-Ttext=0x8002000 +VPATH += platforms/stm32 + SRC += cdcacm.c \ platform.c \ traceswo.c \ diff --git a/src/platforms/native/platform.h b/src/platforms/native/platform.h index c8f5f2b..1f4416d 100644 --- a/src/platforms/native/platform.h +++ b/src/platforms/native/platform.h @@ -35,6 +35,9 @@ #define CDCACM_PACKET_SIZE 64 #define PLATFORM_HAS_TRACESWO +#define CDCACM_GDB_ENDPOINT 1 +#define CDCACM_UART_ENDPOINT 3 + /* Important pin mappings for STM32 implementation: * * LED0 = PB2 (Yellow LED : Running) diff --git a/src/platforms/native/usbuart.c b/src/platforms/native/usbuart.c index 2fac6ee..0d46253 100644 --- a/src/platforms/native/usbuart.c +++ b/src/platforms/native/usbuart.c @@ -91,7 +91,7 @@ void usbuart_usb_out_cb(uint8_t ep) (void)ep; char buf[CDCACM_PACKET_SIZE]; - int len = usbd_ep_read_packet(0x03, buf, CDCACM_PACKET_SIZE); + int len = usbd_ep_read_packet(CDCACM_UART_ENDPOINT, buf, CDCACM_PACKET_SIZE); /* Don't bother if uart is disabled. * This will be the case on mini while we're being debugged. @@ -126,7 +126,7 @@ void usart1_isr(void) gpio_set(LED_PORT, LED_UART); /* Try to send now */ - if (usbd_ep_write_packet(0x83, &c, 1) == 1) + if (usbd_ep_write_packet(CDCACM_UART_ENDPOINT, &c, 1) == 1) return; /* We failed, so queue for later */ diff --git a/src/platforms/native/gdb_if.c b/src/platforms/stm32/gdb_if.c similarity index 91% rename from src/platforms/native/gdb_if.c rename to src/platforms/stm32/gdb_if.c index aa43293..30ad247 100644 --- a/src/platforms/native/gdb_if.c +++ b/src/platforms/stm32/gdb_if.c @@ -43,7 +43,7 @@ void gdb_if_putchar(unsigned char c, int flush) count_in = 0; return; } - while(usbd_ep_write_packet(1, buffer_in, count_in) <= 0); + while(usbd_ep_write_packet(CDCACM_GDB_ENDPOINT, buffer_in, count_in) <= 0); count_in = 0; } } @@ -56,7 +56,7 @@ unsigned char gdb_if_getchar(void) return 0x04; while(cdcacm_get_config() != 1); - count_out = usbd_ep_read_packet(1, buffer_out, + count_out = usbd_ep_read_packet(CDCACM_GDB_ENDPOINT, buffer_out, CDCACM_PACKET_SIZE); out_ptr = 0; } @@ -73,7 +73,7 @@ unsigned char gdb_if_getchar_to(int timeout) if(!cdcacm_get_dtr()) return 0x04; - count_out = usbd_ep_read_packet(1, buffer_out, + count_out = usbd_ep_read_packet(CDCACM_GDB_ENDPOINT, buffer_out, CDCACM_PACKET_SIZE); out_ptr = 0; } while(timeout_counter && !(out_ptr < count_out)); diff --git a/src/platforms/native/jtagtap.c b/src/platforms/stm32/jtagtap.c similarity index 100% rename from src/platforms/native/jtagtap.c rename to src/platforms/stm32/jtagtap.c diff --git a/src/platforms/native/swdptap.c b/src/platforms/stm32/swdptap.c similarity index 100% rename from src/platforms/native/swdptap.c rename to src/platforms/stm32/swdptap.c