{"id":27446304,"url":"https://github.com/stnolting/neorv32-micropython","last_synced_at":"2026-05-12T07:39:47.092Z","repository":{"id":287951479,"uuid":"966249991","full_name":"stnolting/neorv32-micropython","owner":"stnolting","description":"🐍 Port of MicroPython for the NEORV32 RISC-V Processor.","archived":false,"fork":false,"pushed_at":"2026-05-02T06:46:12.000Z","size":113,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-02T08:34:29.182Z","etag":null,"topics":["embedded","microcontroller","micropython","neorv32","python","risc-v"],"latest_commit_sha":null,"homepage":"https://github.com/stnolting/neorv32","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stnolting.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-14T16:23:26.000Z","updated_at":"2026-05-02T06:46:14.000Z","dependencies_parsed_at":"2025-08-01T07:09:52.066Z","dependency_job_id":"e94fafb3-2bb2-4f79-91f9-d49bb76e759c","html_url":"https://github.com/stnolting/neorv32-micropython","commit_stats":null,"previous_names":["stnolting/neorv32-micropython"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stnolting/neorv32-micropython","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stnolting%2Fneorv32-micropython","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stnolting%2Fneorv32-micropython/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stnolting%2Fneorv32-micropython/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stnolting%2Fneorv32-micropython/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stnolting","download_url":"https://codeload.github.com/stnolting/neorv32-micropython/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stnolting%2Fneorv32-micropython/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32929255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-11T17:09:15.040Z","status":"online","status_checked_at":"2026-05-12T02:00:06.338Z","response_time":102,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["embedded","microcontroller","micropython","neorv32","python","risc-v"],"created_at":"2025-04-15T04:15:58.336Z","updated_at":"2026-05-12T07:39:47.086Z","avatar_url":"https://github.com/stnolting.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NEORV32 MicroPython Port\n\n[![neorv32-micropython](https://img.shields.io/github/actions/workflow/status/stnolting/neorv32-micropython/main.yml?branch=main\u0026longCache=true\u0026style=flat-square\u0026label=neorv32-micropython%20build\u0026logo=Github%20Actions\u0026logoColor=fff)](https://github.com/stnolting/neorv32-micropython/actions/workflows/main.yml)\n[![License](https://img.shields.io/github/license/stnolting/neorv32-micropython?longCache=true\u0026style=flat-square\u0026label=License)](https://github.com/stnolting/neorv32-micropython/blob/main/LICENSE)\n\nA simple out-of-tree port of [MicroPython](https://github.com/micropython/micropython)\nfor the [NEORV32 RISC-V Processor](https://github.com/stnolting/neorv32) loosely based on\nthe upstream [stm32 port](https://github.com/micropython/micropython/tree/master/ports).\nIt is highly recommended to keep the current folder structure as an upstream port within\nthe MicroPython repository is not available. This port is still under development.\nHelp and contributions are very welcome!\n\nTODOs:\n\n* add ports for further hardware modules (SPI, I²C, 1-Wire, NeoPixel, etc.)\n* add arbitrary number of _software_ timers\n* add support for custom hardware modules\n* optimize the port (e.g. usage of `MICROPY_EVENT_POLL_HOOK`)\n* ...\n\n\n## Setup\n\n\u003e [!IMPORTANT]\n\u003e This MicroPython port requires UART0, the CLINT, the GPIO controller and at least 512kB of ROM\n\u003e (IMEM) and 256kB \u003e of RAM (IMEM). The memory layout (base addresses and sizes) can be customized\n\u003e in the Makefile. Make sure to adjust your NEORV32 processor configuration accordingly.\n\n1. Clone this repository:\n\n```bash\n$ git clone https://github.com/stnolting/neorv32-micropython.git\n```\n\n2. Fetch the `neorv32` and `micropython` submodules:\n\n```bash\n$ cd neorv32-micropython\nneorv32-micropython$ git submodule init\nneorv32-micropython$ git submodule update\n```\n\n3. Get a RISC-V GCC toolchain. For example you can use the pre-built toolchain provided\nby [xPack](https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack). Download and\ninstall the toolchain and add it to your system's `PATH` environment variable. The default\nGCC prefix is `riscv-none-elf-`. This can be adjusted in the Makefile.\n\n4. Compile the NEORV32 MicroPython port. This will generate a single ELF file\n(`build/firmware.elf`). A pre-compiled ELF can be downloaded as\n[CI artifact](https://github.com/stnolting/neorv32-micropython/actions).\n\n```bash\nneorv32-micropython$ make all\n...\nLINK build/firmware.elf\n   text    data     bss     dec     hex filename\n 247600    2972   33804  284376   456d8 build/firmware.elf\n```\n\n5. The ELF can be loaded via the processor's on-chip debugger (using openOCD + DGB):\n\n```\n(gdb) monitor reset halt\nJTAG tap: neorv32.cpu tap/device found: 0x00000001 (mfg: 0x000 (\u003cinvalid\u003e), part: 0x0000, ver: 0x0)\n(gdb) file build/firmware.elf\nA program is being debugged already.\nAre you sure you want to change the file? (y or n) y\nReading symbols from build/firmware.elf...\n(gdb) load\nLoading section .text, size 0x34024 lma 0x0\nLoading section .rodata, size 0x873c lma 0x34024\nLoading section .data, size 0xb9c lma 0x3c760\nStart address 0x00000000, load size 250620\nTransfer rate: 190 KB/sec, 13923 bytes/write.\n(gdb) c\nContinuing.\n```\n\n6. The MicroPython REPL console is available via UART0 using a 19200-8-N-1 configuration:\n\n```python\nMicroPython v1.25.0 on 2025-04-20; neorv32-default with neorv32\nType \"help()\" for more information.\n\u003e\u003e\u003e\n```\n\n\n## Standard Modules\n\n\u003e [!TIP]\n\u003e The MicroPython shell supports auto-completion. Type a module name and press TAB to\n\u003e see all methods of that module.\n\nSeveral standard MicroPathon modules are enabled by default. Additionally, the `machine`\nand `time` have been ported. Run `modules(\"help\")` to see all available modules.\n\n```python\n\u003e\u003e\u003e help(\"modules\")\n__main__          collections       machine           sys\narray             gc                micropython       time\nbuiltins          io                struct\nPlus any modules on the filesystem\n```\n\nTo check the NEORV32 processor configuration you can use the `machine.info()` method:\n\n```python\n\u003e\u003e\u003e import machine\n\u003e\u003e\u003e machine.info()\nNEORV32 version 1.11.2.9\nClock: 150000000 Hz\nMISA:  0x40901105\nMXISA: 0x66006cd3\nSoC:   0x480ba97b\n```\n\nThe CLINT's machine timer is used for wall clock time-keeping. It is initialized with a pre-defined\nstart time in `ports/main.c`. To print the current time use `time.localtime()`. This will return\na tuple with 8 entries showing the current date and time.\n\n```python\n\u003e\u003e\u003e import time\n\u003e\u003e\u003e time.localtime()\n(2025, 4, 20, 19, 52, 46, 6, 110)\n```\n\n\u003e [!TIP]\n\u003e Additional standard MicroPython modules can be enabled in `mpconfigport.h`.\n\n\n## Port-Specific Modules\n\nA port-specific module called `neorv32` is part of the standard `builtins` module.\n\n```python\n\u003e\u003e\u003e import builtins\n\u003e\u003e\u003e builtins.\nArithmeticError                 AssertionError  AttributeError\nBaseException   EOFError        Ellipsis        Exception\nGeneratorExit   ImportError     IndentationError\nIndexError      KeyError        KeyboardInterrupt\nLookupError     MemoryError     NameError\nNotImplementedError             OSError         OverflowError\nRuntimeError    StopIteration   SyntaxError     SystemExit\nTypeError       ValueError      ZeroDivisionError\nabs             all             any             bool\nbytearray       bytes           callable        chr\nclassmethod     dict            dir             divmod\neval            exec            getattr         globals\nhasattr         hash            id              int\nisinstance      issubclass      iter            len\nlist            locals          map             next\nobject          open            ord             pow\nprint           range           repr            round\nset             setattr         sorted          staticmethod\nstr             sum             super           tuple\ntype            zip             StopAsyncIteration\n__build_class__                 __dict__        __import__\n__repl_print__  bin             delattr         enumerate\nfilter          help            hex             max\nmin             neorv32         oct             property\nreversed        slice\n```\n\nThe `neorv32` module provides some basic hardware access function. A help menu is available that\nshows all currently implemented functions. For example, the `gpio_pin_*` functions provide access\nto the processor's GPIO output port.\n\n```python\n\u003e\u003e\u003e builtins.neorv32.help()\nneorv32 - helper functions:\n  gpio_pin_set(pin, level)       - Set GPIO.output [pin] to [level]\n  gpio_pin_toggle(pin)           - Toggle GPIO.output [pin]\n  systick_set_callback(callback) - Call [callback] from SysTICK IRQ\n  help()                         - Show this text\n```\n\nThe NEORV32 port implements a SYSTICK timer interrupt based on the processor's CLINT machine-timer\ninterrupt. This interrupt triggers every 10ms. A single callback function can be called from this\ninterrupt to execute a periodic Python method. The `neorv32` module provides a method `systick_set_callback()`\nto install this handler method.\n\nThe following example defines a new method called `systick_handler`. It uses a global variable `ticks`\nto \"pre-scale\" the actual execution time of the core functionality. Every 10ms x 100 = 1s it toggles\noutput pin 1of the processor's GPIO output to provide a simple heart-beat LED:\n\n```python\n\u003e\u003e\u003e ticks = 0\n\u003e\u003e\u003e def systick_handler(_):\n...     global ticks\n...     if ticks \u003e 100:\n...         ticks = 0\n...         builtins.neorv32.gpio_pin_toggle(1)\n...     else:\n...         ticks = ticks + 1\n...\n\u003e\u003e\u003e builtins.neorv32.systick_set_callback(systick_handler)\n```\n\n\n## Resources\n\nResources that were used for creating this port:\n\n* https://docs.micropython.org/en/latest/develop/porting.html\n* https://firmware.card10.badge.events.ccc.de/pycardium-guide.html\n* https://micropython-usermod.readthedocs.io/en/latest/usermods_05.html\n* https://docs.micropython.org/en/latest/develop/library.html\n* https://docs.micropython.org/en/latest/develop/extendingmicropython.html\n* ChatGPT, GitHub Copilot and a lot of coffee\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstnolting%2Fneorv32-micropython","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstnolting%2Fneorv32-micropython","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstnolting%2Fneorv32-micropython/lists"}