Drawing to screen on Badger 2350 using ARM assembly

Hi there.

I’m interested in buying the Badger 2350 for a specific use case.

I’m basically making a compiler for ARM assembly, but I don’t have any IO yet (drawing to the screen, writing to a terminal, playing sound, etc.). I can handle computation just fine though.

I’m interested in buying the Badger 2350 so I could draw to a screen using ARM assembly, since the RP2350 is an ARM board. I understand that this is probably not possible using the stock firmware, which only supports MicroPython (as well as C and C++, I think). So I may need to flash the device.

I haven’t found many resources to help me understand how to draw to the screen using an RP2350, though. My research did tell me that hardware peripherals (like screens, speakers or buttons) can be accessed from an RP2050 using memory-mapped IO (writing to certain addresses in memory will let you interact with that peripheral) but I didn’t find any specifics beyond that.

I would appreciate any help or assistance in finding this information, or being told that I am looking at the wrong place for what I want to do.

Thanks,

hummy

I don’t have any experience with the RP series of microcontrollers, and my Micropython experience is limited to porting it to my own operating system environment, keeping it as close to Unix as possible.

However, if you look in the Micropython distribution, there is a document called docs/pyboard/tutorial/assembler.rst which describes usage of the “inline assembler”. Effectively, you write function calls which resemble assembly language instructions, and I believe that Micropython generates the appropriate low-level code.

Obviously, this is not like assembling the code yourself and then deploying it to the board, but I would imagine that it gives an easier introduction and allows some investigation of the things you would like to do before going the “bare metal” route. For things like drawing to the screen, if there isn’t a hardware peripheral like a display controller being used (and I don’t know if the RP series would even have one, this usually being in the realm of SoCs), then you won’t be able to simply write pixel data to memory and get output on the display.

Instead, you will need to have a driver or a library that sends data to the screen, perhaps copying it from such a “framebuffer” and doing the necessary signalling. Such drivers/libraries are not that sophisticated, but you do need to familiarise yourself with technologies like SPI and I2C. And in fact, if the microcontroller supports those technologies in hardware, then you are actually going to be doing memory-mapped I/O when talking to those peripherals.

Another small point to make is that the assembly language is going to be Thumb2 on these microcontrollers, I think. You don’t get to write classic ARM code, as far as I am aware.

Thank you for your detailed response! I appreciate it; that’s a lot of information that I would have had difficulty finding and understanding myself.

I double-checked your point that only Thumb-2 instructions are supported instead of general ARM instructions, and you’re right. I will likely try targetting an emulate-able ARM machine such as the GBA, since I’ve been writing my compiler under the assumption that I will have classic ARM instructions available.

Thanks again! Your response has helped me decide in which direction I want to go next.

I will give my brother the credit for telling me about the Thumb2 situation since he is the one who has done a lot of low-level stuff on ARM-based microcontrollers (with the Inferno operating system amongst other things). The only hardware I do any low-level stuff with these days is MIPS-based, but I wrote ARM assembly language on one of Acorn’s original ARM machines, and that is largely where my experience with the architecture rests.

ARM (Arm, arm, whatever), the company, is great at proliferating a confusingly large number of technologies under the same umbrella, so anyone can be excused for not knowing what any given product might support. Given that Thumb was originally a way of providing shorter instructions that could be expanded to full ARM instructions under the covers, probably as an alternative to those full instructions, as opposed to being a replacement, what we have with these products now is a bit like what x86 and x86-64 processors have been doing for thirty years or so.