{"id":17855897,"url":"https://github.com/ekoeppen/coreforth","last_synced_at":"2025-03-20T14:30:47.862Z","repository":{"id":2320356,"uuid":"3280841","full_name":"ekoeppen/CoreForth","owner":"ekoeppen","description":"Forth for the ARM Cortex-M3","archived":false,"fork":false,"pushed_at":"2017-11-20T20:29:01.000Z","size":1290,"stargazers_count":81,"open_issues_count":1,"forks_count":15,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-01T00:22:51.832Z","etag":null,"topics":["cortex-m0","cortex-m3","forth"],"latest_commit_sha":null,"homepage":"","language":"Assembly","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/ekoeppen.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}},"created_at":"2012-01-27T07:22:44.000Z","updated_at":"2025-02-19T14:15:55.000Z","dependencies_parsed_at":"2022-09-05T14:50:37.575Z","dependency_job_id":null,"html_url":"https://github.com/ekoeppen/CoreForth","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekoeppen%2FCoreForth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekoeppen%2FCoreForth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekoeppen%2FCoreForth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekoeppen%2FCoreForth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ekoeppen","download_url":"https://codeload.github.com/ekoeppen/CoreForth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244075615,"owners_count":20393979,"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":["cortex-m0","cortex-m3","forth"],"created_at":"2024-10-28T02:42:20.611Z","updated_at":"2025-03-20T14:30:47.457Z","avatar_url":"https://github.com/ekoeppen.png","language":"Assembly","readme":"Overview\n========\n\nThis is a simple indirect threaded Forth for the ARM Cortex M0/M3.\nIt can currently run on the\nthe Olimex STM32-P103 and the Olimexino STM32/LeafLabs Maple and supports\ngeneric STM32F103 and STM32F030 boards. Other targets boards should be easy to\nadd. CoreForth consists of a small core written in ARM assembler, and\nadditional Forth words which are compiled on the host for the target using a\nslightly modified version of\n[thumbulator](https://github.com/ekoeppen/thumbulator).\n\nCoreForth started based on\n[JonesForth](http://rwmj.wordpress.com/2010/08/07/jonesforth-git-repository/),\nbut evolved to be closer to Forth-79. Some words and ideas were taken also\ndirectly from [CamelForth](http://www.camelforth.com/) and the [excellent\narticle series](http://www.bradrodriguez.com/papers/moving1.htm) by\nCamelForth's author Brad Rodriguez.\n\nThe motivation behind CoreForth is to provide a simple platform to explore\nCortex M0/3 based development boards, not so much to be a fully fledged Forth\nimplementation (neither is ANS Forth compliance a goal), but there is nothing\npreventing CoreForth to be taken into that direction.\n\nCoreForth SE\n============\n\n[CoreForth SE](https://github.com/ekoeppen/CoreForthSE) is a subroutine threaded\nvariant of CoreForth. It is under active development and allows easier debugging\nand better performance.\n\nForth Implementation\n====================\n\nCoreForth is an indirect threaded Forth. Register r7 is holding the instruction\npointer, register r6 is the return stack pointer, and the parameter stack is\nhandled via register sp (r13).\n\nFour macros are used to define words within the assembler source:\n\n* defcode: Define a word implemented in assembler. The code field pointer\n  points to the words' body.\n* defword: Define a word implemented in indirected threaded code, each cell\n  contains the code field pointer of the word to invoke.  The code field\n  pointer points to the DOCOL function\n* defvar: Define a variable, the space is allocated at HERE from RAM.\n* defconst: Define a constant\n\nBoard Dependent Code\n====================\n\nThe CoreForth source is split into two parts. The actual Forth implementation\nunder generic in CoreForth.s and a number of Forth source files, and the board\ndependent code under e.g. olimexino-stm32. The board dependent code uses\n.include to bring in the Forth kernel, this is neccessary in order to be able\nto add new words to the board code due to the way the words are defined using\nmacros.\n\nBuilding\n========\n\nCoreForth is written in GNU Assembler, and requires the [ARM GCC cross\ncompiler](https://launchpad.net/gcc-arm-embedded) as well as\n[thumbulator](https://github.com/ekoeppen/thumbulator).  The Makefile will\ngenerate ELF and binary files, which can be flashed using e.g. OpenOCD. A good\noverview of bare metal programming and qemu can be found on [Franceso\nBalduzzi's\nblog](http://balau82.wordpress.com/2010/02/14/simplest-bare-metal-program-for-arm/),\nand using OpenOCD with hardware is explained in more detail on [Johan\nSimonsson's pages](http://fun-tech.se/stm32/index.php).\n\nCoreForth makes use of Forth words for the non-core functionality. The Forth\nsources are compiled into binary form using thumbulator as a runtime\nenvironment. The compiled assembler code and Forth sources are loaded into the\nthumbulator memory. The Forth core executes the Forth sources, building the\ntarget dictionary in memory as it processes the input data. At the end of the\ncompilation, the Forth core will dump itself plus the compiled dictionary into\none binary. For that purpose, thumbulator supports semihosting, including\nconsole output.\n\nThis target compilation step is automated, adding new Forth sources for target\ncompilation is as simple as adding them as parameters to the thumbulator\ninvocation in the Makefile.\n\nPrevious Versions\n=================\n\nThe branch \"1.0\" contains the previous, qemu based version of CoreForth. That\nbranch is not actively maintained anymore, but can serve as an example for an\nalternative cross compilation approach.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekoeppen%2Fcoreforth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fekoeppen%2Fcoreforth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekoeppen%2Fcoreforth/lists"}