__asm("ldr r0, =0x40021000\n" ; RCC "ldr r1, =0x00004004\n" ; USART1EN | IOPAEN (GPIOA) "str r1, [r0, #0x18]\n" ; RCC_APB2ENR "ldr r0, =0x40010800\n" ; GPIOA "ldr r1, =0x444444B4\n" ; PA.9 USART1_TX 50MHz AF_PP "str r1, [r0, #4]\n" ; GPIOx_CRH "ldr r0, =0x4001380\n" ; UART1 "movs r1, #0\n" "strh r1, [r0, #4]\n" ; +4 USART_DR "movs r1, #69\n" ; 8MHz / 69 == 115200 "strh r1, [r0, #8]\n" ; +8 USART_BR "movs r1, #0x0600\n" "strh r1, [r0, #16]\n" ; +16 USART_CR2 = 0x600 "movs r1, #0\n" "strh r1, [r0, #16]\n" ; +16 USART_CR2 = 0 "movs r1, #0\n" "strh r1, [r0, #24]\n" ; +24 USART_GTPR = 0 - Prescaler "movw r1, #0x200C\n" ; 8-bit, no parity, enable TX,TX "strh r1, [r0, #12]\n" ; +12 USART_CR1 "ldr r2, =0x2000\n" ; Size = Length (8K) "ldr r3, =0x20000000\n" ; Mem = RAM Address "iu1 ldrh r1, [r0, #0]\n" ; USART->SR "ands r1, #0x80\n" ; TXE "beq iu1\n" "ldrb r1, [r3], #1\n" ; [Mem++] "strh r1, [r0, #4]\n" ; USART->DR "subs r2, r2, #1\n" ; Size-- "bne iu1\n") |