aboutsummaryrefslogtreecommitdiff
path: root/src/platforms/stlink/platform.c
diff options
context:
space:
mode:
authorUwe Bonnes2013-01-12 21:49:55 +0100
committerUwe Bonnes2013-01-21 11:02:43 +0100
commit67f8176c5bcaed5cddbd84c46984d2f94e78ba3e (patch)
tree925b0c33553618841d169026ac81e61f365b6483 /src/platforms/stlink/platform.c
parent35d6adc236f54e94231b1959eb2d16b785c7733a (diff)
stlink: Add the UART
Diffstat (limited to 'src/platforms/stlink/platform.c')
-rw-r--r--src/platforms/stlink/platform.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/platforms/stlink/platform.c b/src/platforms/stlink/platform.c
index f28764f..26e1ad2 100644
--- a/src/platforms/stlink/platform.c
+++ b/src/platforms/stlink/platform.c
@@ -32,6 +32,7 @@
#include "platform.h"
#include "jtag_scan.h"
+#include <usbuart.h>
#include <ctype.h>
@@ -48,6 +49,7 @@ int platform_init(void)
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USBEN);
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
+ rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
/* Setup GPIO ports */
gpio_set_mode(TMS_PORT, GPIO_MODE_OUTPUT_50_MHZ,
@@ -63,9 +65,15 @@ int platform_init(void)
/* Setup heartbeat timer */
systick_set_clocksource(STK_CTRL_CLKSOURCE_AHB_DIV8);
systick_set_reload(900000); /* Interrupt us at 10 Hz */
+ SCB_SHPR(11) &= ~((15 << 4) & 0xff);
+ SCB_SHPR(11) |= ((14 << 4) & 0xff);
systick_interrupt_enable();
systick_counter_enable();
+ usbuart_init();
+
+ SCB_VTOR = 0x2000; // Relocate interrupt vector table here
+
cdcacm_init();
jtag_scan(NULL);