简体   繁体   中英

How to use the keyboard in bare metal ARM assembly?

I am writing my first Forth (on ARM). I want it on bare metal, since I think that is the whole point of Forth. However, I was unable to find information and examples on how to write KEY, EMIT and friends (essentially, handle the keyboard) without Linux syscalls. I also tried to read a bootloader source (U-Boot), but it's clearly out of my depth.

Can you please help me write a keyboard handler loop and REPL in bare metal ARM assembly? something like that , but for ARM. I am using a Cortex-A8 CPU (ARMv7).

Given that your target is a BeagleBone Black (mentioned in a comment), I assume you're thinking of a USB keyboard. If so, old_timer 's comment that you're 'confusing what baremetal is' is entirely correct. If you're really coding on bare metal, then you don't have a USB driver stack, so you're not going to be reading from a USB keyboard.

It is possible that whatever bootloader you choose to employ could include drivers for hardware components on the board, but then you're not really on bare metal any more.

If you want to stick with bare metal, you'll be interacting directly with hardware peripherals, and by far the simplest communications peripheral to work with is a serial port (UART), to which you can connect from another machine. This would also solve the output problem, which you haven't mentioned but which is potentially significantly bigger than the input problem (driving a screen from bare metal is a challenge!).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM