14970b9 Implement memory load/store operations
~yerinalexey pushed to ~yerinalexey/scalc-os git
93ae247 Pass --no-undefined to the linker
~yerinalexey pushed to ~yerinalexey/scalc-os git
What if we replace all big kernels and userspace with just a calculator? This should be enough.
This project takes a lot of inspiration from scalc, hence the name. It
implements only the surface functionality though - decimal integers and
+
, -
, /
, *
, %
operations plus additional commands:
.
- print last value in the stackd
- drop last value from the stacks
- swap last two valuesc
- push a copy of the last valuem<character>
- save last value to a named variablel<character>
- push the value of a named variableInteractions are done through the default input device, in case of most systems, that would be serial. Entering a number to push it onto the stack works as expected, but the number has to be followed with any character to mark its ending.
Throughout the build, a cross-compiler will be used. If one is not
configured already, it's recommended to use riscv64-linux-musl
from musl.cc.
If anything else is used, make sure to set $CROSS_COMPILE
to reflect that.
Also - POSIX dd
, parted
and mtools
are needed to build the disk image.
$ make
Or:
$ make CROSS_COMPILE=riscv64-other-prefix-
To run it, a u-Boot build is necessary (by default, looked up in ../u-boot
),
see official QEMU instructions for more info.
$ make run
Default u-Boot configuration does not work correctly and isn't going to boot the image. So, press any key to pause startup and enter boot shell, then run:
=> virtio scan
=> load virtio 0:1 $kernel_addr_r /efi/boot/bootriscv64.efi
=> bootefi $kernel_addr_r
To not type this out every time, go to u-Boot source directory and run
make menuconfig
. In the menu, go into "Boot options", tick "Enable a default
value for bootcmd" and set "bootcmd value" to virtio scan; load virtio 0:1 $kernel_addr_r /efi/boot/bootriscv64.efi; bootefi $kernel_addr_r
.
After that, save the configuration and rebuild u-Boot.