aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGareth McMullin2012-06-10 17:34:26 +1200
committerGareth McMullin2012-06-10 17:34:26 +1200
commit89bcdcc60ab5e3c35e99c4f2cc7d052e831cc563 (patch)
treecca74100f607bfb8974c05ef9e5d567772c4bc65
parentacff8d44976c0ffec1821318c73ce8948a19d0d2 (diff)
Moved stm32 generic platform files out of native platform dir.
-rw-r--r--src/platforms/native/Makefile.inc2
-rw-r--r--src/platforms/native/platform.h3
-rw-r--r--src/platforms/native/usbuart.c4
-rw-r--r--src/platforms/stm32/gdb_if.c (renamed from src/platforms/native/gdb_if.c)6
-rw-r--r--src/platforms/stm32/jtagtap.c (renamed from src/platforms/native/jtagtap.c)0
-rw-r--r--src/platforms/stm32/swdptap.c (renamed from src/platforms/native/swdptap.c)0
6 files changed, 10 insertions, 5 deletions
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
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
index 8160be8..8160be8 100644
--- a/src/platforms/native/jtagtap.c
+++ b/src/platforms/stm32/jtagtap.c
diff --git a/src/platforms/native/swdptap.c b/src/platforms/stm32/swdptap.c
index dceb23e..dceb23e 100644
--- a/src/platforms/native/swdptap.c
+++ b/src/platforms/stm32/swdptap.c