{"id":22097440,"url":"https://github.com/nuclei-software/npk-tflm","last_synced_at":"2025-07-24T22:33:03.923Z","repository":{"id":170580029,"uuid":"646741086","full_name":"Nuclei-Software/npk-tflm","owner":"Nuclei-Software","description":"TFLM NPK Package","archived":false,"fork":false,"pushed_at":"2024-08-13T11:00:39.000Z","size":3673,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-14T11:47:50.335Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nuclei-Software.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}},"created_at":"2023-05-29T08:30:52.000Z","updated_at":"2024-08-13T09:57:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"a673a9bc-180f-4170-ad86-dd9aea765e52","html_url":"https://github.com/Nuclei-Software/npk-tflm","commit_stats":null,"previous_names":["nuclei-software/npk-tflm"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nuclei-Software%2Fnpk-tflm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nuclei-Software%2Fnpk-tflm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nuclei-Software%2Fnpk-tflm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nuclei-Software%2Fnpk-tflm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nuclei-Software","download_url":"https://codeload.github.com/Nuclei-Software/npk-tflm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227482406,"owners_count":17779968,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-12-01T04:15:33.892Z","updated_at":"2025-07-24T22:33:03.894Z","avatar_url":"https://github.com/Nuclei-Software.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TFLM Ported To Nuclei RISC-V Processor\n\nTensorFlow Lite for Microcontrollers (TFLM)  is a port of TensorFlow Lite designed to run machine learning models on DSPs, microcontrollers and other devices with limited memory.\n\nWe have done TFLM NN kernel optimized implementations(main p/v extension) for Nuclei RISC-V Processor, and you can run the TFLM examples using software emulation or FPGA board.\n\n## Introduction of Nuclei Optimized TFLM\n\nTFLM has been ported to Nuclei RISC-V Processor and Nuclei SDK, you can evaluate it in Nuclei SDK and also in official TFLM build system.\n\n- If you want to use it in directly TFLM build system, please check this repo: https://github.com/Nuclei-Software/tflite-micro/tree/nuclei/nsdk_0.8.0\n- If you want to use it in Nuclei SDK or Nuclei Studio as a software component, you can follow the following steps:\n\n**Here are two ways to use Nuclei SDK TFLM component:**\n\n1. Use **Nuclei SDK 0.8.0** in terminal\n2. Use **Nuclei Studio IDE 2025.02**\n\n### Use TFLM in Terminal\n\n1. Get Nuclei SDK (v0.8.0) from https://github.com/Nuclei-Software/nuclei-sdk/releases/tag/0.8.0\n\n2. Get **tflm** zip package from https://github.com/Nuclei-Software/npk-tflm, unzip it and put under  the *Components* folder of **$NUCLEI_SDK_ROOT**.\n\n   ~~~shell\n   nuclei-sdk$ tree -L 2\n   .\n   ├── application\n   │   ├── baremetal\n   │   ├── freertos\n   │   ├── rtthread\n   │   ├── threadx\n   │   └── ucosii\n   ├── Build\n   │   ├── gmsl\n   │   ├── Makefile.base\n   │   ├── Makefile.components\n   │   ├── Makefile.conf\n   │   ├── Makefile.core\n   │   ├── Makefile.files\n   │   ├── Makefile.misc\n   │   ├── Makefile.rtos\n   │   ├── Makefile.rules\n   │   ├── Makefile.soc\n   │   ├── Makefile.toolchain\n   │   └── toolchain\n   ├── Components\n   │   ├── profiling\n   │   └── tflm\n   ├── doc\n   │   ├── Makefile\n   │   ├── requirements.txt\n   │   └── source\n   ├── ideprojects\n   │   └── iar\n   ├── LICENSE\n   ├── Makefile\n   ├── NMSIS\n   │   ├── build.mk\n   │   ├── Core\n   │   ├── DSP\n   │   ├── Library\n   │   ├── NN\n   │   └── npk.yml\n   ├── NMSIS_VERSION\n   ├── npk.yml\n   ....\n   ~~~\n\n3. Setup Tools and Environment, details can refer to https://doc.nucleisys.com/nuclei_sdk/quickstart.html.\n\n4. Build and run application.\n\n   Assuming that run application on nuclei evalsoc with nx900fd cpu.\n\n   **run qemu (software emulation):**\n\n   ~~~~shell\n   cd Components/tflm/examples/xxx\n   make SOC=evalsoc CORE=nx900fd DOWNLOAD=ilm clean all run_qemu\n\n   # select ARCH_EXT, for example, _xxldsp, v, v_xxldsp, use pure c version if not select ARCH_EXT\n   ## _xxldsp: Nuclei DSP extension present\n   ## v: v extension present\n   ## v_xxldsp: Nuclei DSP and v extension present\n   make SOC=evalsoc CORE=nx900fd ARCH_EXT=v_xxldsp DOWNLOAD=ilm all run_qemu\n   ~~~~\n\n   **run on FPGA Board:**\n\n   Use Correct FPGA Board and bitstream(contact Nuclei AE) should be prepared(512K ILM/DLM bitstream is preferred).\n\n   Configure the board and open UART terminal (the default UART baudrate is `115200`), then download the executable file.\n\n   ~~~shell\n   cd Components/tflm/examples/xxx\n   make SOC=evalsoc CORE=nx900fd DOWNLOAD=ilm clean all upload\n   ~~~\n\n   Then, result will be printed in the terminal.\n\n   Here take the `tflm/examples/person_detection` as an example.\n\n   ~~~log\n   Nuclei SDK Build Time: May 26 2023, 11:05:15\n   Download Mode: ILM\n   CPU Frequency 999999078 Hz\n   CPU HartID: 0\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   person score:-72 no person score 72\n   ~~~\n\n**FAQs: Default ilm/dlm size in evalsoc is 64K/64K, need to change it to 512K to run these cases**\n\nIf you met issue like this: `section .text will not fit in region ilm`, this is caused by ilm size is not big enough to store the code, 64K is not enough to run this application,\nplease use 512K, **if you want to run on hardware, please make sure your cpu bitstream configured with 512K ILM/DLM**.\n\n```shell\n# file: /path/to/nuclei_sdk/SoC/evalsoc/Board/nuclei_fpga_eval/Source/GCC/evalsoc.memory\n# Partial as follows:\n\n/* ILM Memory Information */\nILM_MEMORY_PRESENT = 1;\nILM_MEMORY_BASE = 0x80000000;\nILM_MEMORY_SIZE = 0x800000;\n\n/* DLM Memory Information */\nDLM_MEMORY_PRESENT = 1;\nDLM_MEMORY_BASE = 0x90000000;\nDLM_MEMORY_SIZE = 0x800000;\n```\n\n### Use TFLM in Nuclei Studio IDE\n\n1. Download Nuclei Studio IDE 2025.02 from https://www.nucleisys.com/download.php\n\n   \u003e Refer to the [Nuclei IDE User Guide](https://download.nucleisys.com/upload/files/doc/nucleistudio/NucleiStudio_User_Guide.202502.pdf) if necessary.\n\n2. Open the Nuclei Studio IDE\n\n3. Download the zip package of Nuclei SDK\n\n   \u003e Make sure the version of the SDK should be 0.8.0.\n\n   ![install_sdk](doc/images/install_sdk.png)\n\n4. Import the zip package of **tflm**\n\n   ![install_tflm.png](doc/images/install_tflm.png)\n\n5. Create a new Nuclei RISC-V C/C++ Project\n\n   - Choose the SoC, board and SDK, select the SDK corresponding to the SoC of the current subsystem.\n\n     ![create_project1](doc/images/create_project1.png)\n\n   - Select the example quickly by filtering category \"tflm application\", and then set the configuration items and click Finish, configurations are as follows:\n\n     ![create_project2](doc/images/create_project2.png)\n\n**Note:** If you meet memory overflow error when building project, you could use DDR download mode(evalsoc using nuclei 600/900 processor support this mode) that will meet memory requirement.\n\n6. Build and run application.\n\n   - Click \"build\" icon to build the application\n\n     ![build_project](doc/images/build_project.png)\n\n   - Click \"run\" icon to run the application\n\n     ![run_project_on_qemu](doc/images/run_project_on_qemu.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuclei-software%2Fnpk-tflm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnuclei-software%2Fnpk-tflm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuclei-software%2Fnpk-tflm/lists"}