From 75c0d6ad93c38e4bc305f56d365fee48d61a8fad Mon Sep 17 00:00:00 2001 From: Andrey Miroshnikov Date: Sun, 7 May 2023 16:17:00 +0100 Subject: [PATCH] microwatt_tutorial: Added section on Micropython. --- HDL_workflow/microwatt_tutorial.mdwn | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/HDL_workflow/microwatt_tutorial.mdwn b/HDL_workflow/microwatt_tutorial.mdwn index bba65aecb..d12d3b4cf 100644 --- a/HDL_workflow/microwatt_tutorial.mdwn +++ b/HDL_workflow/microwatt_tutorial.mdwn @@ -177,6 +177,37 @@ allowing you to look at processor signals and transitions during simulation. (microwatt):$ vcd2fst --vcdname=microwatt-verilator.vcd --fstname=microwatt-verilator.fst (microwatt):$ gtkwave microwatt-verilator.fst +## Micropython + +The microwatt repo comes witha pre-compiled micropython binary (version 1.12), +which you can try out after confirming 'hello world' works. Bear in mind, not +all features of python will be available. Such as floating-point numbers. + +For micropython to work, you'll need to increase the RAM size in the makefile. +Go to the microwatt-verilator makefile, and comment out the following lines: + + MEMORY_SIZE=8192 + RAM_INIT_FILE=hello_world/hello_world.hex + +And uncomment the following: + + MEMORY_SIZE=393216 + RAM_INIT_FILE=micropython/firmware.hex + +This will increase the RAM size from 8KiB to 384KiB. The `RAM_INIT_FILE` in +these examples isn't doing anything, however good practice to follow. + +Clean up generated files, and recompile: + + make clean + make microwatt-verilator + +Once the binary has been built, run the same way as before, but point to the +micropython firmware binary: + + microwatt-verilator micropython/firmware.bin + + ## Verilator runtime commands A few examples: -- 2.30.2