microwatt
microwatt copied to clipboard
Compatibility with compiled Micropython
I see that the prebuilt image in this repository is based on MicroPython v1.12-571 (some intermediate version I guess?)
I tried compiling micropython using GCC cross-compiler on Ubuntu 20.04 (with both buildroot download and gcc9.3 based from debian repositories)
I attempted using the current master branch, v1.13 and v1.12 from the micropython repo.
In all the cases, although I can compile without errors, when I run core_tb
, I am not able to issue any inputs in the terminal from the keyboard. This does not happen with the prebuilt image.
I am not sure how exactly shall I debug this. But I would be happy to help and provide more details if neeeded.
Thank you.
This sounds like your image is trying to access the potato UART but core_tb has the 16550-style UART.
Hi @paulusmack Paul @antonblanchard , i had the same issue.
I saw that you can set the 16550-style UART. but from my previous tests it wasn't functionnal. i'll check it with the latest version of micropython .
[Solved]
@paulusmack @antonblanchard @shenki @mikey to correct the issue, you can change in the makefile :
UART ?= potato
by
UART ?= lpc_serial
after you can rebuild and recreate the link
enjoy again ;->>
below the full modifications:
titof49@pcdev:~/uwatt/micropython/ports/powerpc$ diff Makefile Makefile.old
10c10
< UART ?= lpc_serial
---
> UART ?= potato
Thanks @titof49! We should update micropython to use the 16550 all the time, and eventually get rid of the potato UART in microwatt.
Instead of changing the makefile, you can compile like this:
make -j$(nproc) UART=lpc_serial
In the latest code this seems to be broken again:
(1) potato (default build of micropython):
rgc:~/i/microwatt$ ./core_tb > debug_log
MicroPython v1.19.1-782-g699477d12 on 2023-01-10; bare-metal with POWERPC
Type "help()" for more information.
>>>
- micropython seems to output the debug string properly
- but user is unable to perform any input
(2) UART (lpc_serial in micropython):
rgc:~/i/microwatt$ ./core_tb > debug_log
- micropython can't even output any debug string
AFAIK lpc_uart_init() is https://github.com/micropython/micropython/blob/1f371947309c5ea6023b6d9065415697cbc75578/ports/powerpc/uart_lpc_serial.c#L100
using a different base address now (LPC_UART_BASE). https://github.com/micropython/micropython/blob/1f371947309c5ea6023b6d9065415697cbc75578/ports/powerpc/uart_lpc_serial.c#L39
Edit # 1 It is an issue with micropython. Incorrect register offsets. So modifying uart_lpc_serial.c to something like below works.
diff --git a/ports/powerpc/uart_lpc_serial.c b/ports/powerpc/uart_lpc_serial.c
index 760615041..93a9af55f 100644
--- a/ports/powerpc/uart_lpc_serial.c
+++ b/ports/powerpc/uart_lpc_serial.c
@@ -36,21 +36,20 @@
#define PROC_FREQ 50000000
#define UART_FREQ 115200
#define UART_BASE 0xc0002000
-#define LPC_UART_BASE 0x60300d00103f8
-
-/* Taken from skiboot */
-#define REG_RBR 0
-#define REG_THR 0
-#define REG_DLL 0
-#define REG_IER 1
-#define REG_DLM 1
-#define REG_FCR 2
-#define REG_IIR 2
-#define REG_LCR 3
-#define REG_MCR 4
-#define REG_LSR 5
-#define REG_MSR 6
-#define REG_SCR 7
+#define LPC_UART_BASE UART_BASE
+
+#define REG_RBR 0x00
+#define REG_THR 0x00
+#define REG_DLL 0x00
+#define REG_IER 0x04
+#define REG_DLM 0x04
+#define REG_FCR 0x08
+#define REG_IIR 0x08
+#define REG_LCR 0x0c
+#define REG_MCR 0x10
+#define REG_LSR 0x14
+#define REG_MSR 0x18
+#define REG_SCR 0x1c
#define LSR_DR 0x01 /* Data ready */
#define LSR_OE 0x02 /* Overrun */
Both input and output works now for lpc_serial (UART=lpc_serial make
) build of micropython.
rgc:~/i/microwatt$ ./core_tb > debug_log
MicroPython v1.19.1-782-g699477d12-dirty on 2023-01-10; bare-metal with POWERPC
Type "help()" for more information.
>>> 1+19
20
>>>
You must change uart mode see #246 issue on git mocrowattLe 10 janv. 2023 03:36, rgc @.***> a écrit : In the latest code this seems to be broken again: (1) potato (default build of micropython):
rgc:~/i/microwatt$ ./core_tb > debug_log MicroPython v1.19.1-782-g699477d12 on 2023-01-10; bare-metal with POWERPC Type "help()" for more information.
========== micropython seems to output the debug string properlybut user is unable to perform any input (2) UART (lpc_serial in micropython):
rgc:~/i/microwatt$ ./core_tb > debug_log
micropython can't even output any debug string AFAIK lpc_uart_init() is https://github.com/micropython/micropython/blob/1f371947309c5ea6023b6d9065415697cbc75578/ports/powerpc/uart_lpc_serial.c#L100 using a different base address now (LPC_UART_BASE). https://github.com/micropython/micropython/blob/1f371947309c5ea6023b6d9065415697cbc75578/ports/powerpc/uart_lpc_serial.c#L39
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>