{"id":21388111,"url":"https://github.com/grisp/grisp2-rtems-toolchain","last_synced_at":"2026-01-03T11:39:24.410Z","repository":{"id":37085009,"uuid":"260209661","full_name":"grisp/grisp2-rtems-toolchain","owner":"grisp","description":"Basic tools and libraries to get an RTEMS system running on GRiSP2.","archived":false,"fork":false,"pushed_at":"2025-02-27T01:11:56.000Z","size":123388,"stargazers_count":13,"open_issues_count":11,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-08T18:36:06.121Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grisp.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":"2020-04-30T12:47:18.000Z","updated_at":"2025-02-27T01:12:01.000Z","dependencies_parsed_at":"2025-01-23T00:34:39.167Z","dependency_job_id":null,"html_url":"https://github.com/grisp/grisp2-rtems-toolchain","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grisp%2Fgrisp2-rtems-toolchain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grisp%2Fgrisp2-rtems-toolchain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grisp%2Fgrisp2-rtems-toolchain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grisp%2Fgrisp2-rtems-toolchain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grisp","download_url":"https://codeload.github.com/grisp/grisp2-rtems-toolchain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243871091,"owners_count":20361302,"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-11-22T12:16:00.455Z","updated_at":"2026-01-03T11:39:24.371Z","avatar_url":"https://github.com/grisp.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GRiSP2 RTEMS Toolchain\n\nThis repository contains the basic tools and libraries to get an RTEMS system\nrunning on GRiSP2. This includes:\n\n* A `Makefile` that collects commands for building everything in this\n  repository.\n* The `rtems-source-builder` for building the toolchain (as a submodule).\n* The bootloader `barebox` (as a submodule) and the necessary configuration.\n* RTEMS and rtems-libbsd (as a submodule).\n* A support library for some small GRiSP specific tasks `libgrisp` (as a\n  submodule).\n* A FDT (tested only with RTEMS)\n* A RTEMS demo application.\n* Some debugger scripts for a Lauterbach debugger (`t32`).\n\n## How to Build\n\n\n### Requirements\n\n#### macOS\n\nBuilding the toolchain on macOS requires the following dependencies:\n\n* [Xcode][1] or [Command Line Tools for Xcode][2].\n* `python` (2 or 3)\n* `dtc`\n* `u-boot-tools`\n* `texinfo`\n\nBuilding OpenOCD additionally requires\n\n* `autoconf`\n* `automake`\n* `libtool`\n* `libusb`\n* `pkg-config`\n\n**Install with Homebrew**\n\n```sh\nbrew install python dtc u-boot-tools texinfo\nbrew install autoconf automake libtool libusb pkg-config # OpenOCD\n```\n\n#### Ubuntu\n\nBuilding the toolchain on Ubuntu requires the following packages:\n\n* `build-essential`\n* `flex`\n* `bison`\n* `cmake`\n* `texinfo`\n* `device-tree-compiler`\n* `u-boot-tools`\n* `lzop`\n* `python3`\n* `python-is-python3`\n* `libpython3-dev`\n* `python3-dev`\n\nBuilding OpenOCD additionally requires\n\n* `libusb-1.0-0-dev`\n\n**Install with apt-get**\n\n```\nsudo apt-get install build-essential flex bison cmake texinfo device-tree-compiler u-boot-tools lzop libusb-1.0-0-dev python3 python-is-python3 libpython3-dev python3-dev\n```\n\n### Building\n\nFor building the basic stuff do a\n\n    make install\n\nThis will build the toolchain, RTEMS, necessary libraries, the FDT, the\nbootloader and basically everything that you need to create a RTEMS application\nfor the GRiSP2. Most of it will be installed to the `rtems/5` directory.\nException: fdt and bootloader. The fdt will be at\n`fdt/b-dtb/imx6ull-grisp2.dtb`. The bootloader image will be placed at\n`external/barebox/images/barebox-phytec-phycore-imx6ull-grisp2.img`.\n\nTo build the demo application use a\n\n    make demo\n\nin the project root directory.\n\n## How to Start an Application\n\nThe bootloader checks a number of boot devices. Among them is the SD-Card and\nthe eMMC. For these two the bootloader searches for an application image called\n`zImage` and a device tree image called `oftree`. If these two files are found\nthe application will be booted.\n\nFor example to start the demo application you can use a FAT formatted SD-Card,\ncopy `fdt/b-dtb/imx6ull-grisp2.dtb` to `\u003cSD-Path\u003e/oftree` and copy\n`demo/b-imx7/demo.zImage` to `\u003cSD-Path\u003e/zImage` and put the SD card in your\nGRiSP. The bootloader will start this application.\n\nNote that the eMMC has precedence. If the eMMC is written, the application from\neMMC will be started regardless of the SD content.\n\n## Writing an Image to eMMC\n\n:warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning:\n:warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning:\n\nMake absolutely sure the image that you write has a bootloader. Otherwise your\nGRiSP2 might can't boot any more and you have to use the [recovery sequence][7].\n\n:warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning:\n:warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning:\n\n### Using an SD Card\n\n1. Copy the image that you want onto an SD card. Put it in your GRiSP2.\n1. Power up the GRiSP2.\n1. Interrupt the boot loader when it outputs the `Hit m for menu or any key to\n   stop autoboot:` line. You should drop into a shell with a\n   `barebox@PHYTEC phyCORE-i.MX6 ULL SOM with eMMC:/` prompt.\n1. Force the board to boot the first system partition:\n    ```\n    setenv state.bootstate.active_system 0\n    setenv state.bootstate.update_system 0\n    setenv state.bootstate.update_boot_count 0\n    state -s\n    ```\n1. Type `mmc1.probe=1` to start the eMMC detection.\n1. Type `mmc0.probe=1` to start the SD detection.\n1. You can now do a ls on your SD card: `ls /mnt/mmc0.0`\n1. Copy your image to the eMMC, for big images, that needs quite some time.\n    1. With a raw image, use command `cp /mnt/mmc/grisp2_emmc.img /dev/mmc1`.\n    1. With a compressed image, use command `uncompress /mnt/mmc/grisp2_emmc.img.gz /dev/mmc1`.\n1. Reset the system with `reset` on the shell. Barebox should now boot your\n   application.\n\n### Using TFTP\n\nOne way to write an Image to eMMC is via the bootloader:\n\n1. Make sure you have a DHCP server and a TFTP (announced via DHCP). You can for\n   example use `dnsmasq` with the following config for that:\n\n        interface=eth0\n        bootp-dynamic\n        domain=my-pc.eb.localhost\n        dhcp-authoritative\n        log-dhcp\n        expand-hosts\n        local=/my-pc.eb.localhost/\n\n        enable-tftp=eth0\n        tftp-root=/srv/tftpboot/\n\n        ##############################\n        # GRiSP2\n        dhcp-host=50:2d:f4:14:26:0b,GRiSP2Proto009,set:grisp2\n        dhcp-range=tag:grisp2,172.24.0.130,172.24.0.140,255.255.255.0,2m\n\n1. Prepare an image to write on your PC. That can be a raw image copied from an\n   SD card or created with a loop-device on a Linux PC. Make sure that the image\n   isn't too big (images \u003e2GB maybe don't work depending on your tftp server).\n   Also make sure that it has a `barebox` bootloader at the beginning (see (eMMC\n   Image)[6]. The simplest possible image is to use the\n   `barebox/barebox-phytec-phycore-imx6ull-emmc-512mb.img` directly.\n1. Copy it to your tftp server directory with some simple name (e.g.\n   `grisp2.img`).\n1. Connect the network cable and power up the GRiSP2.\n1. Interrupt the boot loader when it outputs the `Hit m for menu or any key to\n   stop autoboot:` line. You should drop into a shell with a\n   `barebox@PHYTEC phyCORE-i.MX6 ULL SOM with eMMC:/` prompt.\n1. Type `mmc1.probe=1` to start the eMMC detection.\n1. Type `dhcp` to get an IP address.\n1. Now you have two alternatives. For both: If your tftp server isn't announced\n   via DHCP use `global dev.eth0.serverip=172.24.0.99` to explicitly set your\n   server.\n    1. For small images that fit into RAM: Type `tftp grisp2.img` and write the\n       received image to the eMMC with `cp grisp2.img /dev/mmc1`.\n    1. For big images: Directly copy from the mount point for the tftp server.\n       Note that tftp don's support listing files. Therefore a ls won't show you\n       what's on the server. As long as there isn't an error, the tftp is\n       mounted anyway. Use `cp /mnt/tftp/grisp2.img /dev/mmc1` for this method.\n1. Wait for the image to be written. That can need quite some time.\n1. Reset the system with `reset` on the shell. Barebox should now boot your\n   application.\n\n## Debugging\n\nDebugging is either possible by connecting your favorite JTAG adapter to the\nJTAG port. The connector pin out is the same as for the\n[ARM Cortex M connectors][4].\n\nAlternatively you can use the on-board FTDI to JTAG adapter. The adapter is\ncompatible to a [Floss-JTAG][3] supported by OpenOCD. The following text shows\nhow to use that on-board solution.\n\nFirst build and install OpenOCD by running `make submodule-update` (if you\nhavn't build the toolchain before) and `make openocd`.\n\nMake sure that your GRiSP2 starts some sample application with a sane FDT. The\ndebugger scripts will wait till the bootloader loads the FDT and the application\nand then replaces the application with the one that you want to debug.\n\nAfter that you should start openocd on one console using\n`./debug/openocd/start-openocd.sh`. This starts an GDB-Server. Do not terminate\nthe process. You can then start a gdb that connects to the server using\n`./debug/openocd/start-gdb.sh path/to/app.exe`. The script adds a `reset`\ncommand to the normal gdb that restarts the target and reloads the application.\nNote that for bigger applications, that might need quite some time.\n\n### Notes for MacOS\n\nTo build OpenOCD on mac, you need texinfo 6.7 from brw but also add it to th path:\n\n    export PATH=/usr/local/opt/texinfo/bin:$PATH\n    make openocd\n\n## Boot Loader\n\n* [Instructions for updating the boot loader on GRiSP 2](doc/grisp2/bootloader-update.md)\n\n### Recovery\n\nNote: you should prefer to use Linux for this, on MacOS this works very\nunreliably. A Linux VM with proper USB access is sufficient.\n\nFor some reason the boot loader has been damaged on your system? Here is the\nsolution:\n\n* Build the `imx_uart` tool with `make imx_uart`.\n* Set the `BOOT_MODE` Jumpers on your GRiSP2 so that the serial download mode\n  will be started.\n* Prepare to execute the following command. Don't execute it yet. Replace the\n  `picocom ...` part with your preferred serial terminal application.\n\n```\n./rtems/5/bin/imx_uart -nN /dev/ttyGRiSP ./rtems/5/etc/imx-loader.d/mx6ull_usb_work.conf barebox/barebox-phytec-phycore-imx6ul-emmc-512mb.img \u0026\u0026 picocom -l -b 115200 /dev/ttyGRiSP\n```\n\n* Power-Cycle or Power up the GRiSP2. A reset is not enough!\n* Press the reset button and execute the prepared command in the next seconds.\n* Wait till `imx_uart` finishes and a `barebox` starts. That will need quite a\n  bit of time (nearly a minute).\n* Interrupt the `barebox` start when it tells you to\n  `Hit m for menu or any to stop autoboot:    1`\n* Use the eMMC image from `barebox/grisp2_emmc.img.gz` and\n  follow the steps from the section [Writing an Image to eMMC][5]. The image\n  contains the initial factory image, with barebox, a first partition with\n  the grisp erlang demo and an uninitialized second partition.\n* Power down the GRiSP2 and remove the `BOOT_MODE` Jumpers.\n* Power up the GRiSP2. You should now get a Bootloader again. Interrupt the boot\n  when it tells you to `Hit m for menu or any to stop autoboot:`\n* Now you can copy new files onto the partition (mounted at `/mnt/emmc`).\n  If you want to copy from an SD Card you have to do a `mmc0.probe=1` first.\n  Then you can access the SD Card in `/mnt/mmc`.\n\n## eMMC Image\n\nThe eMMC has to contain the `barebox` bootloader. Basically that means that you\ncopy the image from `barebox/barebox-phytec-phycore-imx6ull-emmc-512mb.img` to\naddress 0x0 of your image before you create your partitions. Otherwise there is\nnothing special when creating the image.\n\nThe following is an example for creating an SD image with Linux. Please be\ncareful when partitioning the file and double or better tripple check that\neverything is set up correctly with the loop device and that you use the correct\nloop device. Otherwise you might destroy your Linux installation with these\ncommands.\n\n```\ndd if=/dev/zero of=grisp2_emmc.img bs=1M count=128\ndd if=barebox/barebox-phytec-phycore-imx6ul-emmc-512mb.img of=grisp2_emmc.img conv=notrunc\nsudo modprobe loop\nsudo losetup /dev/loop4 grisp2_emmc.img\necho 'type=83' | sudo sfdisk /dev/loop4\nsudo partprobe /dev/loop4\nsudo mkfs.vfat -n \"GRISP2\" -s 8 /dev/loop4p1\nsudo mount /dev/loop4p1 some/mount/point\nsudo cp demo/b-imx7/demo.zImage some/mount/point/zImage\nsudo cp fdt/b-dtb/imx6ul-grisp2.dtb some/mount/point/oftree\nsudo cp -r demo/loader some/mount/point/loader\nsudo umount some/mount/point\nsudo losetup -d /dev/loop4\n```\n\n[1]: https://apps.apple.com/de/app/xcode/id497799835\n[2]: https://developer.apple.com/library/archive/technotes/tn2339/_index.html\n[3]: https://github.com/esden/floss-jtag\n[4]: http://infocenter.arm.com/help/topic/com.arm.doc.faqs/attached/13634/cortex_debug_connectors.pdf\n[5]: #writing-an-image-to-emmc\n[6]: #emmc-image\n[7]: #boot-loader-recovery\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrisp%2Fgrisp2-rtems-toolchain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrisp%2Fgrisp2-rtems-toolchain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrisp%2Fgrisp2-rtems-toolchain/lists"}