Saturday 15 June 2013

arm - How to printout string in qemu gumstix (connex/PXA255) emulation? -



arm - How to printout string in qemu gumstix (connex/PXA255) emulation? -

from site: http://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-using-qemu/ can utilize c code print out string in qemu simulator.

volatile unsigned int * const uart0dr = (unsigned int *)0x101f1000; void print_uart0(const char *s) { while(*s != '\0') { /* loop until end of string */ *uart0dr = (unsigned int)(*s); /* transmit char */ s++; /* next char */ } }

i need same thing in c code gumstix connex board in qemu (with -m connex option), uses 0x40100000 or 0x40700000 memory mapped uart address, nil shown in screen.

i tried info checking code, doesn't still work.

volatile unsigned int * const uart0dr = (unsigned int *)0x40100000; volatile unsigned int * const uart_lsr = (unsigned int *)0x40100014; #define lsr_tdrq (1 << 5) // transmit info request void print_uart0(const char *s) { while(*s != '\0') { /* loop until end of string */ while(( *uart_lsr & lsr_tdrq ) == 0 ); *uart0dr = (unsigned int)(*s); /* transmit char */ s++; /* next char */ } }

what might wrong? pxa255 uses different way utilize uart?

i searched source code of pxa, , gumstix, maybe gumstix may utilize different methods hart communication in qemu.

from linked page may have noticed next text:

the code emulates serial port within qemu (here in source repository) implements subset of functionalities of pl011 prime cell uart arm

and

the qemu model of pl011 serial port ignores transmit fifo capabilities; in real scheme on chip “transmit fifo full” flag must checked in uartfr register before writing on uartdr register.

you won't able utilize same code on both qemu , pxa255 since implementation of uart different.

to have uart function correctly on pxa255 board require lot more setup , typically involve following:

configuration of clock subsystem registers ensure uart peripheral receiving clock main clock scheme on cpu. configuration of uart peripheral registers according desired use. may need configure registers command baud rate register, parity control, number of info bits. modification of code writes uart. uart peripherals typically contain fifo (sometimes single byte) used during transmission , reception. transmit character first have ensure previous character has finished transmission before placing next character transmit in output info register.

there no substitute reading uart info sheet in detail , next info listed there.

arm qemu

No comments:

Post a Comment