Loading ...
Sorry, an error occurred while loading the content.

noob to *nix style OSs, Z80 and friends.

Expand Messages
  • Allison Parent
    The plan is to build for Z80 and mater ez80. However *nix style build environments are new to me. Most builds for 8 bitters are done here on real z80, Z80 sim
    Message 1 of 5 , Jan 3, 2009
    View Source
    • 0 Attachment
      The plan is to build for Z80 and mater ez80.

      However *nix style build environments are new to me.

      Most builds for 8 bitters are done here on real z80, Z80 sim
      or in a VAX/O-VMS cross envronment. Typically ASM/MAC code
      and maybe some C.

      Help on creating the build environment on either Cygwin on
      winders (NT4) or better Ubuntu 8.04/intel would be needed.


      Allison
    • Gregory Nutt
      ... I ve only built Z80 for an instruction set simulator; it seemed to work fine but the 16-bit address space makes things kind of tight. There was a guy
      Message 2 of 5 , Jan 4, 2009
      View Source
      • 0 Attachment
        > The plan is to build for Z80 and mater ez80.

        I've only built Z80 for an instruction set simulator; it seemed to
        work fine but the 16-bit address space makes things kind of tight.
        There was a guy porting NuttX to XTRS
        (http://www.tim-mann.org/xtrs.html) and there is XTR support in the
        source tree, but I don't think that was ever finished.

        Support for the Z80 "friends" is much better because they have larger
        address spaces and better tools. There are ports for ez8 (two
        boards), ez80 (two boards), and z16f.

        > Help on creating the build environment on either Cygwin on
        > winders (NT4) or better Ubuntu 8.04/intel would be needed.

        There is an overview of the development environments here:
        http://nuttx.sourceforge.net/NuttX.html#environments

        For the Z80, I use the SDCC toolchain: http://sdcc.sourceforge.net/ .
        You can download pre-built binaries or build-it-yourself on Linux or
        Cygwin. For the "friends," I think the only choice is one of the free
        ZiLOG ZDS toolchains available here: http://www.zilog.com . This will
        only work on Windows, so you have to use Cygwin for those.

        I'll explain how I set up my development environment, I'm sure there
        are other ways, but I know this works. I'll send two replies: (1)
        this one describing the Linux/Ubuntu setup, and (2) a second email
        describing the Cygwin setup.

        Linux Setup
        -----------

        1. Create a working directory. Here is the path I use:

        mkdir -p ~/projects/nuttx

        2. Download Nuttx

        cd ~/projects/nuttx
        [[Download nuttx-a.b.c.tar.gz here from
        http://sourceforge.net/project/showfiles.php?group_id=189573&package_id=222071]]

        3. Unpack and rename NuttX

        tar zxf nuttx-a.b.c.tar.gz
        mv nuttx-a.b.c nuttx

        4. Configure NuttX. In this case, I am configuring for the Z80
        instruction set simulator

        cd ~/projects/nuttx/nuttx/config
        ./configure.sh z80sim/ostest

        5. Download SDCC from http://sdcc.sourceforge.net/ . I have been using
        the 2.6.0 version.
        There are new versions available, but I have a patch that has to be
        applied.

        See configs/z80sim/README.txt

        6. Unpack and configure the SDCC toolchain:

        tar zxf sdcc-src-2.6.0.tar.gz
        tar zxf sdcc-doc-2.6.0.tar.gz
        cd sdcc
        ./configure

        7. But before making, we need to apply a patch to the SDCC 2.6.0 source
        so that the z80 assembler can handle long symbol names

        That <patchfile> is configs/z80sim/sdcc-2.6.0-asz80-symlen.patch
        but it
        is easier just to edit the file at sdcc/as/z80/asmn.h. BEFORE:

        #define NCPS 32 /* characters per symbol */

        AFTER:

        #define NCPS 80 /* characters per symbol */

        8. Then make the SDCC binaries

        cd sdcc
        make

        9. and install SDCC (you need root priveledges to do that)

        sudo make install

        10. Then build Nuttx

        cd ~/projects/nuttx/nuttx
        . ./setenv.sh
        make

        The results of the buils will be the files ~/projects/nuttx/nuttx/nuttx.*

        Note that when you configured NuttX (step 4), three files were copied:
        .config, Make.defs, and setenv.sh. The first file describes the
        configuration of NuttX; the second two files describe the build
        environment. If there are any problems with the build, then those two
        files would be the first place to look to fix the problem.

        The Z80 simulation target is not much use without the Z80 simulator.
        That is available in CVS and I can explain how to get that if necessary.

        Greg
      • Gregory Nutt
        ... PART II: The Cygwin Setup ... NuttX under Cygwin with the ZiLOG Windows ZDS tools was really painful to support, but unless I have undetected bugs, it
        Message 3 of 5 , Jan 4, 2009
        View Source
        • 0 Attachment
          > The plan is to build for Z80 and mater ez80.

          PART II: The Cygwin Setup
          --------------------------

          NuttX under Cygwin with the ZiLOG Windows ZDS tools was really painful
          to support, but unless I have undetected bugs, it should work almost
          as seamlessly as using a native Linux toolchain. The basic difficulty
          is that these two environments use pathes differently. For the Cygwin
          tools, a directly path might be like '/home/Owner/projects/nuttx' but
          when using the ZDS tools, this has to be converted to
          'C:\cygwin\home\Owner\projects\nuttx' Cygwin does include tool
          'cygpath' to make life easier.

          Another big difference is that Cygwin does not support "real" symbolic
          links and the ZDS tools don't understand Cygwin's fake symbolic links.
          So, for ZDS, the make system copies directories, rather than linking
          them (which sometimes causes some confusion when debugging -- Which
          version of the source am I editting?)

          But enough of my complaining... Here are the steps:

          1. Install Cygwin. The Cygwin install is easy but slow.

          See http://www.cygwin.com/ for installation instructions. Basically
          you just need to download a tiny setup.exe program and it does the
          real, internet installation for you.

          I install at C:\cygwin

          Note that: "Only the minimal base packages from the Cygwin
          distribution are installed by default. Clicking on categories and
          packages in the setup.exe package installation screen will provide you
          with the ability to control what is installed or updated. Clicking on
          the "Default" field next to the "All" category will provide you with
          the opportunity to install every Cygwin package. Be advised that this
          will download and install hundreds of megabytes to your computer." I
          install everything.

          2. Start Cygwin

          After installing Cygwin, you should have the following:

          - Some new icons on your desktop include "X-Cygwin" and "Cygwin" and
          - Home directory -- mine ended up at C:\cygwin\home\Owner

          First, double click on the "X-Cygwin" icon. A command window will a
          appear for awhile and then go away leaving a big "X" in your system
          tray. That is the X server. Make sure that your .bashrc has:

          export DISPLAY=127.0.0.1:0.0

          Then double click on the "Cygwin" icon. That will bring up another
          ugly, command window but this time with a bash prompt. You will be in
          your Cygwin home directory and you can create a nice xterm using:

          . ./bashrc
          exec xterm -sb -sl 5000 -e /usr/bin/bash -l &

          You can create several xterms in this way (you can put an alias in you
          .bashrc file). Now you are in business. And from here out, things
          are very Linux-like.

          3. Download NuttX

          mkdir -p ~/projects/nuttx
          cd ~/projects/nuttx
          [[Download nuttx-a.b.c.tar.gz here from
          http://sourceforge.net/project/showfiles.php?group_id=189573&package_id=222071]]
          tar zxf nuttx-a.b.c.tar.gz
          mv nuttx-a.b.c nuttx

          4. Download ZDS from
          http://www.zilog.com/index.php?option=com_content&task=view&id=40&Itemid=137/zds2.asp
          . I've been using 4.11.0 which has some know bugs. There is a new
          4.11.1 version available but might require modification of the linkcmd
          file and Make.defs files (hopefully not).

          5. Configure NuttX. In this case, I am configuring for the
          EZ80F910200KITG board:

          cd ~/projects/nuttx/nuttx/tools
          ./configure.sh z80f910200kitg/ostest

          6. And build it

          cd ~/projects/nuttx/nuttx
          make

          The result will be a nuttx.hex, nuttx.lod, and nuttx.map file in that
          directory.

          7. Running it:

          There is the stub of a ZDS project here:
          ~/projects/nuttx/nuttx/configs/ez80f910200kitg/ostest/ ostest.zdsproj
          .You should be able to start ZDS and use that project to download and
          debug the nuttx.lod file (Hmm... I am still working on the
          z80f910200kitg board, so that one might be a bad example).

          Make sure to look at all of the README.txt in the source directories.

          What's wrong with all of this? Well, the integration with the ZDS
          debug system is awkward. With some effort, it should be possible to
          create a ZDS project that builds the whole system. That would be give
          a much better integration of the development and debug system. If
          anyone wants to try that, I'll help.
        • Allison Parent
          ... Interesting, I d like to know what the core sized out as. However, when I say Z80 it s not hard to add 4/16/32k paged addressing to z80 to extend it s
          Message 4 of 5 , Jan 4, 2009
          View Source
          • 0 Attachment
            --- In nuttx@yahoogroups.com, "Gregory Nutt" <spudarnia@...> wrote:
            >
            > > The plan is to build for Z80 and mater ez80.
            >
            > I've only built Z80 for an instruction set simulator; it seemed to
            > work fine but the 16-bit address space makes things kind of tight.

            Interesting, I'd like to know what the core sized out as. However,
            when I say Z80 it's not hard to add 4/16/32k paged addressing to z80
            to extend it's physical address though your still stick with a 64K
            flat address, Z180 is not much better there.


            > There was a guy porting NuttX to XTRS
            > (http://www.tim-mann.org/xtrs.html) and there is XTR support in the
            > source tree, but I don't think that was ever finished.
            >

            Ah, Tim, know his work from other projects.


            > Support for the Z80 "friends" is much better because they have larger
            > address spaces and better tools. There are ports for ez8 (two
            > boards), ez80 (two boards), and z16f.
            >
            > > Help on creating the build environment on either Cygwin on
            > > winders (NT4) or better Ubuntu 8.04/intel would be needed.
            >
            > There is an overview of the development environments here:
            > http://nuttx.sourceforge.net/NuttX.html#environments
            >
            > For the Z80, I use the SDCC toolchain: http://sdcc.sourceforge.net/ .
            > You can download pre-built binaries or build-it-yourself on Linux or
            > Cygwin.

            SDCC is new but not unknown to me so thats a starting point.

            > For the "friends," I think the only choice is one of the free
            > ZiLOG ZDS toolchains available here: http://www.zilog.com . This will
            > only work on Windows, so you have to use Cygwin for those.
            >

            Not a favorite as it's sort of self contained.

            > I'll explain how I set up my development environment, I'm sure there
            > are other ways, but I know this works. I'll send two replies: (1)
            > this one describing the Linux/Ubuntu setup, and (2) a second email
            > describing the Cygwin setup.
            >
            > Linux Setup
            > -----------
            >
            > 1. Create a working directory. Here is the path I use:
            >
            > mkdir -p ~/projects/nuttx
            >
            > 2. Download Nuttx
            >
            > cd ~/projects/nuttx
            > [[Download nuttx-a.b.c.tar.gz here from
            >
            http://sourceforge.net/project/showfiles.php?group_id=189573&package_id=222071]]
            >
            > 3. Unpack and rename NuttX
            >
            > tar zxf nuttx-a.b.c.tar.gz
            > mv nuttx-a.b.c nuttx
            >
            > 4. Configure NuttX. In this case, I am configuring for the Z80
            > instruction set simulator
            >
            > cd ~/projects/nuttx/nuttx/config
            > ./configure.sh z80sim/ostest
            >
            > 5. Download SDCC from http://sdcc.sourceforge.net/ . I have been using
            > the 2.6.0 version.
            > There are new versions available, but I have a patch that has to be
            > applied.
            >
            > See configs/z80sim/README.txt
            >
            > 6. Unpack and configure the SDCC toolchain:
            >
            > tar zxf sdcc-src-2.6.0.tar.gz
            > tar zxf sdcc-doc-2.6.0.tar.gz
            > cd sdcc
            > ./configure
            >
            > 7. But before making, we need to apply a patch to the SDCC 2.6.0 source
            > so that the z80 assembler can handle long symbol names
            >
            > That <patchfile> is configs/z80sim/sdcc-2.6.0-asz80-symlen.patch
            > but it
            > is easier just to edit the file at sdcc/as/z80/asmn.h. BEFORE:
            >
            > #define NCPS 32 /* characters per symbol */
            >
            > AFTER:
            >
            > #define NCPS 80 /* characters per symbol */
            >
            > 8. Then make the SDCC binaries
            >
            > cd sdcc
            > make
            >
            > 9. and install SDCC (you need root priveledges to do that)
            >
            > sudo make install
            >
            > 10. Then build Nuttx
            >
            > cd ~/projects/nuttx/nuttx
            > . ./setenv.sh
            > make
            >
            > The results of the buils will be the files
            ~/projects/nuttx/nuttx/nuttx.*
            >
            > Note that when you configured NuttX (step 4), three files were copied:
            > .config, Make.defs, and setenv.sh. The first file describes the
            > configuration of NuttX; the second two files describe the build
            > environment. If there are any problems with the build, then those two
            > files would be the first place to look to fix the problem.
            >
            > The Z80 simulation target is not much use without the Z80 simulator.
            > That is available in CVS and I can explain how to get that if necessary.

            I have several Z80 sims My favorite two are DOS/win based and well
            known/used so I know what I'm getting into there. Sims can be less
            than fun if you start up a new one or version of one as it's not as
            proven. However I have real assortment hardware to launch on as well.

            Thanks,
            Allison
            > Greg
            >
          • Gregory Nutt
            ... That is a very difficult question to answer. The reason it is difficult to answer is because people want to see a number that says the size of the OS is
            Message 5 of 5 , Jan 4, 2009
            View Source
            • 0 Attachment
              > Interesting, I'd like to know what the core sized out as.

              That is a very difficult question to answer. The reason it is
              difficult to answer is because people want to see a number that says
              the size of the OS is XXX Kb.

              Some fixed number might make some sense for a monolithic OS like
              Linux, but NuttX is built from static libraries -- so you only include
              what you want -- and because it is highly configurable and scalable.
              There really isn't a "core" size that you can measure.

              But what you can do is to build programs and examine how much memory
              is used in total and get some idea of the footprint. For example, I
              just built that z80sim/ostest that I mentioned. That is a test of a
              fairly large subset of the OS interfaces and should be pretty big (but
              it is scaled down from the OS test that I run on larger platforms).

              That comes out to 19.4 Kb including RTOS and and the application (that
              includes code=18.8Kb, data, bss, but not heap).

              If I build the do nothing appication using the same OS configuration
              (examples/null), I get an executable of 12.8 Kb. That is the cost to
              boot the system, initialize the OS and drivers, and then start an
              application that does nothing but exit. I suppose that is a good
              measurement of the NuttX overhead.

              About 3-4Kb of this size is for Z80 math libraries and for printf (the
              NuttX printf is not a tiny printf), maybe 1.5 Kb for the boot up code,
              1Kb for memory management, and the rest is interrupt handling, C
              library functions, and actual OS code.

              Based on this, I would guess that the "core" logic for z80 is
              something like 16Kb -- maybe less. But, of course, could get bigger
              if you enable more features. Do you want file systems? A network?

              A more efficient compiler would help in the Z80 case. SDCC does not
              produce the most compact Z80 code that I have seen. I would really
              like to benchmark its code size compared to other compilers, but I
              don't have any other compilers. I have seen, however, Z80 SDCC builds
              that were larger than a corresponding ARM build -- one would think
              that that should never happen.

              > However,
              > when I say Z80 it's not hard to add 4/16/32k paged addressing to z80
              > to extend it's physical address though your still stick with a 64K
              > flat address, Z180 is not much better there.

              You would need a model of how this paging works and probably some
              logic in the context switching to handle the paging. I've done
              something similar in the past.

              > Ah, Tim, know his work from other projects.

              Tim did not do the NuttX port, he just provided the XTRS
              infrastructure that another guy was using.

              With XTRS, you have to be even more conservative because it only
              provides 48Kb of simulated RAM. I have tuned solutions that run in
              32Kb total (code, data, bss, heap for 8051), but that is really tight
              and not recommended. I am happiest with solutions that have like 64Kb
              of ROM/FLASH space and 32Kb of RAM space, but certainly smaller
              solutions are possible.

              > I have several Z80 sims My favorite two are DOS/win based and well
              > known/used so I know what I'm getting into there. ...

              I used this:
              http://nuttx.cvs.sourceforge.net/viewvc/nuttx/misc/sims/z80sim/ . I
              wrote the loader and debugger but used the instruction set simulator
              from Marat Fayzullin. The licensing of that simulator allows it to be
              used freely, but not redistributed so you would have to get it from
              http://fms.komkon.org/EMUL8/

              Greg
            Your message has been successfully submitted and would be delivered to recipients shortly.