From 7e68d623b969c12b30e5096ce76298f1150306e0 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald@gmail.com" Date: Thu, 2 Oct 2014 07:43:57 +0000 Subject: [PATCH] nucleo boots up at 115kb --- platforms/stm32-f103rb-nucleo/main.c | 136 +++++++++++++++++++++++---- 1 file changed, 120 insertions(+), 16 deletions(-) diff --git a/platforms/stm32-f103rb-nucleo/main.c b/platforms/stm32-f103rb-nucleo/main.c index 9bcfbd3ad..fe5781e7e 100644 --- a/platforms/stm32-f103rb-nucleo/main.c +++ b/platforms/stm32-f103rb-nucleo/main.c @@ -1,8 +1,9 @@ -#include -#include -#include #include #include +#include +#include +#include +#include #include #include @@ -84,6 +85,49 @@ static void (*rx_done_handler)(void) = dummy_handler; static void (*tx_done_handler)(void) = dummy_handler; static void (*cts_irq_handler)(void) = dummy_handler; +static uint8_t * rx_buffer; +static int bytes_to_receive = 0; + +// DMA1_CHANNEL2 UART3_TX +void dma1_channel2_isr(void) { + int done = 0; + if ((DMA1_ISR & DMA_ISR_TCIF2) != 0) { + DMA1_IFCR |= DMA_IFCR_CTCIF2; + done = 1; + } + dma_disable_transfer_complete_interrupt(DMA1, DMA_CHANNEL2); + usart_disable_tx_dma(USART3); + dma_disable_channel(DMA1, DMA_CHANNEL2); + + if (done){ + (*tx_done_handler)(); +} +} + +// DMA1_CHANNEL2 UART3_RX +void dma1_channel3_isr(void){ + int done = 0; + if ((DMA1_ISR & DMA_ISR_TCIF3) != 0) { + DMA1_IFCR |= DMA_IFCR_CTCIF3; + done = 1; + } + dma_disable_transfer_complete_interrupt(DMA1, DMA_CHANNEL3); + usart_disable_rx_dma(USART3); + dma_disable_channel(DMA1, DMA_CHANNEL3); + if (done){ + gpio_clear(GPIOA, GPIO_LED2); +#if 0 + int i; + printf("RX: "); + for (i=0;i