{"id":29014060,"url":"https://github.com/armmbed/spif-driver","last_synced_at":"2025-07-07T11:06:37.418Z","repository":{"id":72728353,"uuid":"81965986","full_name":"ARMmbed/spif-driver","owner":"ARMmbed","description":"Block device driver for NOR SPI flash devices that support SFDP, such as the MX25R or SST26F016B","archived":false,"fork":false,"pushed_at":"2018-10-04T09:39:26.000Z","size":84,"stargazers_count":26,"open_issues_count":4,"forks_count":16,"subscribers_count":101,"default_branch":"master","last_synced_at":"2025-06-25T20:12:42.846Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ARMmbed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2017-02-14T16:35:05.000Z","updated_at":"2023-09-08T17:20:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"25160055-e4d4-41e6-89b7-00cf8e7a778f","html_url":"https://github.com/ARMmbed/spif-driver","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ARMmbed/spif-driver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARMmbed%2Fspif-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARMmbed%2Fspif-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARMmbed%2Fspif-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARMmbed%2Fspif-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ARMmbed","download_url":"https://codeload.github.com/ARMmbed/spif-driver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARMmbed%2Fspif-driver/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261960985,"owners_count":23236669,"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":"2025-06-25T20:12:41.649Z","updated_at":"2025-07-07T11:06:37.412Z","avatar_url":"https://github.com/ARMmbed.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Warning\nStarting from mbed-os 5.10 this repository is deprecated. \nPlease refer to mbed-os 5.10 [documentation](https://github.com/ARMmbed/mbed-os-5-docs/blob/development/docs/api/storage/SPIFBlockDevice.md) and [code](https://github.com/ARMmbed/mbed-os/tree/master/components/storage/blockdevice/COMPONENT_SPIF) for more detail on how to enable SPIF support.\n\n# SPI Flash Driver\n\nBlock device driver for NOR based SPI flash devices that support SFDP.\n\nNOR based SPI flash supports byte-sized read and writes, with an erase size of around 4kbytes. An erase sets a block to all 1s, with successive writes clearing set bits.\n\nMore info on NOR flash can be found on wikipedia:\nhttps://en.wikipedia.org/wiki/Flash_memory#NOR_memories\n\n``` cpp\n// Here's an example using the MX25R SPI flash device on the K82F\n#include \"mbed.h\"\n#include \"SPIFBlockDevice.h\"\n\n// Create flash device on SPI bus with PTE5 as chip select\nSPIFBlockDevice spif(PTE2, PTE4, PTE1, PTE5);\n\nint main() {\n    printf(\"spif test\\n\");\n\n    // Initialize the SPI flash device and print the memory layout\n    spif.init();\n    printf(\"spif size: %llu\\n\",         spif.size());\n    printf(\"spif read size: %llu\\n\",    spif.get_read_size());\n    printf(\"spif program size: %llu\\n\", spif.get_program_size());\n    printf(\"spif erase size: %llu\\n\",   spif.get_erase_size());\n\n    // Write \"Hello World!\" to the first block\n    char *buffer = (char*)malloc(spif.get_erase_size());\n    sprintf(buffer, \"Hello World!\\n\");\n    spif.erase(0, spif.get_erase_size());\n    spif.program(buffer, 0, spif.get_erase_size());\n\n    // Read back what was stored\n    spif.read(buffer, 0, spif.get_erase_size());\n    printf(\"%s\", buffer);\n\n    // Deinitialize the device\n    spif.deinit();\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmmbed%2Fspif-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farmmbed%2Fspif-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmmbed%2Fspif-driver/lists"}