RTEMS | Issuearm/raspberrypi: Serial port no input possible (#5260)
Heinz Junkes (@junkes)
gitlab at rtems.org
Mon Jun 9 16:49:06 UTC 2025
Heinz Junkes commented: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5260#note_123230
I try to adapt console-config.c.
But what I really don't understand (I don't get it) is why I can't set a breakpoint on 'input_char_pl011'. On 'output_char_pl011' works.
```
(gdb) b input_char_pl011
Function "input_char_pl011" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) b output_char_pl011
```
and when the breakpoint is reached I see the input function in the source code in the listing?
```
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) b output_char_pl011
Breakpoint 1 at 0x200b24: file ../../../bsps/arm/raspberrypi/console/console-config.c, line 58.
(gdb) c
Continuing.
Thread 1 hit Breakpoint 1, output_char_pl011 (c=13 '\r') at ../../../bsps/arm/raspberrypi/console/console-config.c:58
58 return arm_pl011_read_polled(&pl011_context.base);
(gdb) list
53
54 rpi_fb_context fb_context;
55
56 static int input_char_pl011(void)
57 {
58 return arm_pl011_read_polled(&pl011_context.base);
59 }
60
61 static void output_char_pl011(char c)
62 {
```
My students have implemented the following code (with the help op ChatGPT they say) with which you can read an input:
```
#define PL011_UART_BASE 0x3F201000
#define UART_POLL_INTERVAL 100 // Polling interval in milliseconds
typedef void (*BSP_output_char_function_type)(char c);
typedef int (*BSP_polling_getchar_function_type)(void);
extern BSP_output_char_function_type BSP_output_char;
extern BSP_polling_getchar_function_type BSP_poll_char;
static int pl011_poll_getchar(void)
{
volatile uint32_t *regs = (volatile uint32_t *) PL011_UART_BASE;
if (regs[0x18 / 4] & (1 << 4)) { // UART_FR_RXFE
return -1;
}
return regs[0x00 / 4] & 0xFF;
}
rtems_task Init(rtems_task_argument arg) {
printf("UART ready. Echoing:\n");
BSP_poll_char = pl011_poll_getchar;
while (1) {
int c = BSP_poll_char(); // Try to read a character
if (c >= 0) {
BSP_output_char((char)c); // Echo the character
}
rtems_task_wake_after(RTEMS_MILLISECONDS_TO_TICKS(UART_POLL_INTERVAL)); // Poll every 100 ms
}
}
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
```
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5260#note_123230
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250609/3835181a/attachment.htm>
More information about the bugs
mailing list