peterhinch / micropython-micro-gui

A lightweight MicroPython GUI library for display drivers based on framebuf, allows input via pushbuttons. See also micropython-touch.
MIT License
247 stars 37 forks source link

Issue on cross compile on rp2 with @micropython.viper decorator #26

Closed felinh closed 1 year ago

felinh commented 1 year ago

Hi and thank you for this nice job! I am working on Pico W and face to memory issue so I tried to cross compile some pieces of python files into mpy. in particular I wanted to cross-compile the driver "st7789_4bit"

as a workaround I did put in comment the @micropython.viper and get a valid mpy file, with the following HW instance:

spi = SPI(1, 30_000_000, sck=Pin(10), mosi=Pin(11), miso=None)
pcs = Pin(9, Pin.OUT)#, value=1)
prst = Pin(12, Pin.OUT)#, value=1)
pbl = Pin(13, Pin.OUT)# value=1)
pdc = Pin(8, Pin.OUT)#, value=0)
SSD = ST7789
ssd = SSD(spi, height=240, width=240, dc=pdc, cs=pcs, rst=prst, disp_mode=LANDSCAPE, display=PI_PICO_LCD_2)

but in this case the sceen display is squeezed as follow:

image

no information is lost it is just the image that is squeezed, (and color are not the one expected)

I guess by tricking code somewhere it is possible to recover this , can you please help? Thank you!

set up : screen Pico-LCD-1.3 MicroPython v1.19.1-992 compile on Raspberry 4 "Debian GNU/Linux 11 (bullseye)" HW target : Raspberry Pi Pico W with RP2040

Expected display (without compile): image

felinh commented 1 year ago

answering to my self: mpy-cross requires option -march=armv6m for rp2

./mpy-cross /home/pi/test/sources/st7789_4bit.py -march=armv6m