Jonkman Microblog
  • Login
Show Navigation
  • Public

    • Public
    • Network
    • Groups
    • Popular
    • People

Conversation

Notices

  1. Vertigo (vertigo@mastodon.social)'s status on Saturday, 02-Sep-2017 12:15:06 EDT Vertigo Vertigo

    YES! Major milestone achieved with the Kestrel project. I managed to run my first C program on the Kestrel-2DX. https://hackaday.io/project/10035-kestrel-computer-project/log/66294-kestrel-2dx-runs-its-first-c-program

    This does two things for me:

    1) Finally have an approach to running C code, so I no longer have a need to port/invent a different programming language.

    2) It vindicates the compatibility of my homebrew processor design against the RISC-V ISA specifications.

    (I've since improved my build process since I posted the article.)

    In conversation Saturday, 02-Sep-2017 12:15:06 EDT from mastodon.social permalink

    Attachments

    1. Invalid filename.
      Kestrel-2DX Runs its First C Program | Details | Hackaday.io

      So, I decided to try getting my RISC-V GCC compiler working with my Kestrel-2DX again, and this time, for whatever reason, my mental model just "clicked" and things worked.  It was an iterative process to get this far; however, I'll describe things in the rough order I've accomplished things.

      Here's the C program I wanted to run:

      /* Invert the contents of the video frame buffer on cold boot. */
      unsigned long long *scrp, *endp;
      void
      _start(void) {
          scrp = (unsigned long long *)0x10000;
          endp = scrp + 2000;
          while(scrp < endp) {
              *scrp ^= 0xFFFFFFFFFFFFFFFF;
              scrp++;
          }
          while(1) ;
      }
      

      I was able to compile this into statically-linked ELF binary file with the following command:

      ./riscv64-unknown-elf-gcc -O1 -c floop.c -o floop.o -march=RV64I
      ./riscv64-unknown-elf-ld floop.ld floop.o -o floop.exe -nostdlib

      You'll notice that I have a custom loader script, which looks like this:

      ENTRY(_start)
      MEMORY
      {
              ROM (rx) : ORIGIN = 0x00000, LENGTH = 0x8000
          
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

Jonkman Microblog is a social network, courtesy of SOBAC Microcomputer Services. It runs on GNU social, version 1.2.0-beta5, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All Jonkman Microblog content and data are available under the Creative Commons Attribution 3.0 license.

Switch to desktop site layout.