Shop OBEX P1 Docs P2 Docs Learn Events
Propeller II: Emulation of the P2 on FPGA boards (Prop123-A7/A9, DE0-NANO, DE2-115, etc) - Page 16 — Parallax Forums

Propeller II: Emulation of the P2 on FPGA boards (Prop123-A7/A9, DE0-NANO, DE2-115, etc)

1131416181924

Comments

  • mindrobotsmindrobots Posts: 6,506
    edited 2012-12-30 18:30
    David,

    A command line version would be helpful (very helpful). Thank you!
  • David BetzDavid Betz Posts: 14,511
    edited 2012-12-30 18:48
    mindrobots wrote: »
    David,

    A command line version would be helpful (very helpful). Thank you!
    Okay, I'm building it now. However, it takes forever under Windows. Are you sure you guys wouldn't like to switch to Linux or the Mac? :-)
  • mindrobotsmindrobots Posts: 6,506
    edited 2012-12-30 19:00
    I can use it under any flavor OS. Whatever works best for you and the people doing real, productive P2 works opposed to my wanderings.
  • potatoheadpotatohead Posts: 10,253
    edited 2012-12-30 19:02
    I love Linux, and I have a Mac running the version just before Lion. I may entertain that Mac in the near future too, but right now I need to run Windows. Got a lot going on and it's pretty heavy Windows-centric stuff. For me, it's about managing head space, and sadly that means running Windows a whole lot of the time, OS X some of it, and Linux only when I need to.

    Had you known me in the 90's, I would have been nearly all IRIX / Linux with just a smattering of Windows for similar reasons. That's how I manage my hobby / work time and avoid burnout. Consolidate. Hmmm... I still had SGI machines with Propeller early on and ditched them partially due to lack of tools. Could reverse that here in the near future... Good grief, a nice O2 and a Prop? (drool)

    Will I need make and friends, or what? It's been a while since I ran GCC on Windows. Steve's IDE kicks a lot of Smile and it just worked. Love it. I know we are not there right now, and it's not a worry for me. Just wondering what I need to work reasonably here, no frills, just a lean setup. I'll do that.

    Honestly, I found C a little big for the little P1, and preferred to just do it the way I had been. P2 is a different story. Kind of excited about that. :)
  • David BetzDavid Betz Posts: 14,511
    edited 2012-12-30 19:09
    potatohead wrote: »
    I love Linux, and I have a Mac running the version just before Lion. I may entertain that Mac in the near future too, but right now I need to run Windows. Got a lot going on and it's pretty heavy Windows-centric stuff. For me, it's about managing head space, and sadly that means running Windows a whole lot of the time, OS X some of it, and Linux only when I need to.

    Had you known me in the 90's, I would have been nearly all IRIX / Linux with just a smattering of Windows for similar reasons. That's how I manage my hobby / work time and avoid burnout. Consolidate. Hmmm... I still had SGI machines with Propeller early on and ditched them partially due to lack of tools. Could reverse that here in the near future... Good grief, a nice O2 and a Prop? (drool)

    Will I need make and friends, or what? It's been a while since I ran GCC on Windows. Steve's IDE kicks a lot of Smile and it just worked. Love it. I know we are not there right now, and it's not a worry for me. Just wondering what I need to work reasonably here, no frills, just a lean setup. I'll do that.

    Honestly, I found C a little big for the little P1, and preferred to just do it the way I had been. P2 is a different story. Kind of excited about that. :)
    Yes, I know many people either prefer Windows or must use it for some reason. I was just kidding about switching. I use all three operating systems myself but mostly the Mac. It's not so much the Mac GUI that I like, it's the fact that it's BSD Unix underneath. Anyway, the Windows built is in progress. I'm afraid it probably won't finish before I turn in for the night. I'll have to post it tomorrow. Sorry.
  • potatoheadpotatohead Posts: 10,253
    edited 2012-12-30 19:19
    I like the Mac too, and for the same reason. No worries, no hurry. Appreciated. :)
  • David BetzDavid Betz Posts: 14,511
    edited 2012-12-30 19:58
    David Betz wrote: »
    Okay, I'm building it now. However, it takes forever under Windows. Are you sure you guys wouldn't like to switch to Linux or the Mac? :-)
    The build finished successfully. I'll do some sanity testing and add p2load.exe to it tomorrow morning and post it. Sorry for the delay!
  • mindrobotsmindrobots Posts: 6,506
    edited 2012-12-30 20:34
    How can you delay a gift we didn't know we were getting?
    Thank you!!
  • Heater.Heater. Posts: 21,230
    edited 2012-12-30 23:19
    Out of curiosity I just grabbed the p2 test branch of propgcc, "hg update p2test", however I don't see a jbuild2.sh script in there.

    Errr....scratch that. It helps to do a "hg pull" first. I need more coffee.
  • David BetzDavid Betz Posts: 14,511
    edited 2012-12-31 13:37
    David Betz wrote: »
    The build finished successfully. I'll do some sanity testing and add p2load.exe to it tomorrow morning and post it. Sorry for the delay!
    I've uploaded a very preliminary version here:

    http://code.google.com/p/propgcc/downloads/detail?name=prop2gcc-2012-12-31.zip&can=2&q=#makechanges

    This only does LMM but I'm working on COG mode as well. To get it to compile for P2 you need to use the -mp2 option. Check the propgcc/demos/fibo/p2 demo program to see how to use the P2 code generation. Also, this compiler should still work fine for P1 as well as long as you don't use the -mp2 option.
  • David BetzDavid Betz Posts: 14,511
    edited 2013-01-01 17:20
    I've just pushed changes to Google Code to allow both LMM2 and COG2 programs to be built and run. I've also added a new demo, propgcc/demos/multi-cog, that will run on the DE2-115 board and start six COGs each blinking one of the LEDs at different rates. I'll make a new Windows version tomorrow if there is any interest.
  • potatoheadpotatohead Posts: 10,253
    edited 2013-01-01 18:08
    By build a new version, do you mean one that will run the multi-cog demo code you just produced, or something else?
  • David BetzDavid Betz Posts: 14,511
    edited 2013-01-01 18:10
    potatohead wrote: »
    By build a new version, do you mean one that will run the multi-cog demo code you just produced, or something else?
    One that supports both LMM and COG modes. The one I built before only supports LMM mode. Also, because it supports both LMM and COG modes, it will run the multi-cog demo. The demo is just to illustrate how to launch multiple COGs on the DE2-115 board. Unfortunately, it won't work on the DE0-Nano board because it only supports one COG. However, you should be able to run single-COG LMM and probably COG mode programs on the DE0-Nano as long as they fit in the 32k of hub memory.
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-01-02 07:35
    David,

    (I started off simple because I can't do much more than simple)

    I loaded your prop2gcc package onto my Mac Parallels Win7 VM and tried compiling the hello.c demo that comes with SimpleIDE. This is the error I got:
    C:\demos\hello>propeller-elf-gcc -mp2 hello.c
    C:\Users\rapost\AppData\Local\Temp\ccAgkKIo.o: In function `_main':
    (.text+0x40): undefined reference to `CNT'
    collect2: ld returned 1 exit status

    I have a feeling this is more pilot error and not having everything I need on my Win7VM (yet). I'm going to try this again later today/tonight on my Win7 laptop which currently does run PropGCC from the command line and I'm also going to build Prop2GCC on my Mac which is also running the command line package of PropGCC. I'm afraid SimpleIDE has made me lazy and ignorant! :lol: (Thanks, Steve!!:smile:)

    I've never built this before, so we'll see how that goes!

    If you don't think it's pilot error, then by all means, let me know what you'd like me to try on the relatively clean VM to fix the problem.
  • David BetzDavid Betz Posts: 14,511
    edited 2013-01-02 07:42
    mindrobots wrote: »
    David,

    (I started off simple because I can't do much more than simple)

    I loaded your prop2gcc package onto my Mac Parallels Win7 VM and tried compiling the hello.c demo that comes with SimpleIDE. This is the error I got:


    I have a feeling this is more pilot error and not having everything I need on my Win7VM (yet). I'm going to try this again later today/tonight on my Win7 laptop which currently does run PropGCC from the command line and I'm also going to build Prop2GCC on my Mac which is also running the command line package of PropGCC. I'm afraid SimpleIDE has made me lazy and ignorant! :lol: (Thanks, Steve!!:smile:)

    I've never built this before, so we'll see how that goes!

    If you don't think it's pilot error, then by all means, let me know what you'd like me to try on the relatively clean VM to fix the problem.
    This isn't pilot error. It's because there is no CNT register in P2. The low-level stuff needs to be redone for P2. I've started that by defining some inline functions and macros in propgcc/demos/multi-cog/propstuff.h but I haven't finished yet. There is a prop_getcnt() function in there though that you can use to replace the references to CNT. Actually, I'm not remembering that the multi-cog demo isn't in the Windows zip file that I posted the other day. Steve has promised to make a new zip file though and it will contain that as well as support for both LMM2 and COG2 memory models. I hope that will get posted later today.

    Thanks for trying this stuff out!

    David
  • David BetzDavid Betz Posts: 14,511
    edited 2013-01-02 07:44
    David Betz wrote: »
    This isn't pilot error. It's because there is no CNT register in P2. The low-level stuff needs to be redone for P2. I've started that by defining some inline functions and macros in propgcc/demos/multi-cog/propstuff.h but I haven't finished yet. There is a prop_getcnt() function in there though that you can use to replace the references to CNT. Actually, I'm not remembering that the multi-cog demo isn't in the Windows zip file that I posted the other day. Steve has promised to make a new zip file though and it will contain that as well as support for both LMM2 and COG2 memory models. I hope that will get posted later today.

    Thanks for trying this stuff out!

    David
    Another thing, until Steve uploads a new release you can look at propgcc/demos/fibo/p2 for an example that will run on the P2.
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-01-02 07:57
    Great! Thank you!

    After I posted, I started looking and wondering about the low level P2 stuff. I always assume pilot error first, though!
  • David BetzDavid Betz Posts: 14,511
    edited 2013-01-02 07:59
    mindrobots wrote: »
    Great! Thank you!

    After I posted, I started looking and wondering about the low level P2 stuff. I always assume pilot error first, though!
    If you're running on a Mac and have Xcode and the command line tools installed you can build propgcc yourself. It only takes about 10 minutes to build this release since I've disabled the build of C++ and GDB.
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-01-02 08:11
    That's my next project today as soon as I finish downloading a .zip of the p2test branch.

    I'm staying out of the repository so I don't mess anything up. I'm much safer on an isolated machine for now!
  • David BetzDavid Betz Posts: 14,511
    edited 2013-01-02 08:23
    mindrobots wrote: »
    That's my next project today as soon as I finish downloading a .zip of the p2test branch.

    I'm staying out of the repository so I don't mess anything up. I'm much safer on an isolated machine for now!
    You won't mess anything up unless you do 'hg commit' and 'hg push'. Feel free to use the repository in read-only mode if you want.
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-01-02 11:41
    David,

    I did the hg clone of the default and the p2test repositories on my Mac.

    I ran j2build.sh and it happily went along until it got this error:
    propeller-elf-gcc -Wall -g -Os -mfcache -fno-exceptions -mlmm -fno-rtti -o ../../../build/lib/obj/lmm/tiny/c++-alloc.o -c c++-alloc.cpp
    c++-alloc.cpp:1:19: fatal error: cstdlib: No such file or directory
    compilation terminated.
    make[2]: *** [../../../build/lib/obj/lmm/tiny/c++-alloc.o] Error 1
    make[1]: *** [../../build/lib/obj/lmm/libtiny.a] Error 2
    make: *** [tiny] Error 2
    tiny library build failed - make
    macdev:p2test rapost$

    It appears to have built new propeller-elf-xx executables in the /opt/parallax/bin directory - I don't think this error would cause what I'm seeing but I don't know for sure.

    I then tried the gastest.s file you provided with:
    propeller-elf-as -ahl -p2 gastest.s

    and was told that -p2 was an unrecognized option. This is the same command I can use with your Windows package to assemble P2 GAS.

    Any thoughts on where I went astray?

    I'll try the C compiler a bit later but I need to run to a meeting.
  • David BetzDavid Betz Posts: 14,511
    edited 2013-01-02 11:45
    mindrobots wrote: »
    David,

    I did the hg clone of the default and the p2test repositories on my Mac.

    I ran j2build.sh and it happily went along until it got this error:



    It appears to have built new propeller-elf-xx executables in the /opt/parallax/bin directory - I don't think this error would cause what I'm seeing but I don't know for sure.

    I then tried the gastest.s file you provided with:
    propeller-elf-as -ahl -p2 gastest.s

    and was told that -p2 was an unrecognized option. This is the same command I can use with your Windows package to assemble P2 GAS.

    Any thoughts on where I went astray?

    I'll try the C compiler a bit later but I need to run to a meeting.
    Oops, sorry. You need to do this first before attempting to build "hg checkout p2test". This switches to the p2test branch where all of my P2 changes are.

    Also, I've just uploaded a new Windows zip file that supports both LMM2 and COG2 memory models. It's in the propgcc repository on Google Code.
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-01-02 17:37
    Ok, I've never done this before, so I'm guessing and floundering. Here's what I've done so far:

    Hg clone of default
    Hg clone of p2test
    Cd p2 test
    Hg update p2test
    sudo ./j2build.sh
    ..after build errored as above, I ran the newly created propeller-elf-as as above and got the message about the invalid -p2 option

    Tried hg checkout p2test
    ...all updates came back with 0 file indicators
    Ran the build again and got same errors

    Can you give me the steps I should need? I'm obviously missing something. I'll just wipe out what I have and start fresh.

    Thanks!!
  • David BetzDavid Betz Posts: 14,511
    edited 2013-01-02 17:52
    mindrobots wrote: »
    Ok, I've never done this before, so I'm guessing and floundering. Here's what I've done so far:

    Hg clone of default
    Hg clone of p2test
    Cd p2 test
    Hg update p2test
    sudo ./j2build.sh
    ..after build errored as above, I ran the newly created propeller-elf-as as above and got the message about the invalid -p2 option

    Tried hg checkout p2test
    ...all updates came back with 0 file indicators
    Ran the build again and got same errors

    Can you give me the steps I should need? I'm obviously missing something. I'll just wipe out what I have and start fresh.

    Thanks!!

    I'm not sure what you mean by "clone of p2test", it is a branch of the "propgcc" repository. You should do this:

    hg clone https://code.google.com/p/propgcc/
    cd propgcc
    hg checkout p2test
    ./jbuild2.sh

    That will check out the propgcc repository, switch to the "p2test" branch, and build it.
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-01-02 18:29
    Thanks, I'll try that tomorrow morning.

    I bet I created a default clone in a directory named p2test and never got you p2 changes.
  • David BetzDavid Betz Posts: 14,511
    edited 2013-01-03 06:28
    I'm sure everyone is looking for a program to flash the LEDs on their DE2-115 FPGA board, right? :-)

    I've attached a compiled version of my new multi-cog demo that will start a C program running on all 6 COGs on the DE2-115 board. The program just blinks 6 LEDs (one for each COG) at different rates. It illustrates using the LMM2 and COG2 memory models on the P2. The sources are also included in the attached zip file. After unzipping, you can run the demo by using the following commands:
    cd multi-cog
    .\p2load toggle.elf
    

    You should then see 6 LEDs blinking in a semi-random pattern.

    multi-cog.zip

    Note: This same program can be run on the P1 QuickStart board and will flash all 8 LEDs using 8 COGs. You just have to rebuild it commenting out the CHIP= definition at the start of the Makefile and load it, as is usual for P1, with propeller-load instead of p2load.
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-01-03 07:47
    VICTORY!!

    David, thanks for your help!!

    The instructions you provided above worked for building the p2test PropGCC on my Mac (OSX 10.8.2). I just pulled the repository, so it should be David's latest and greatest.
    I also build a mac version of p2load and put it in the /opt/parallax/bin directory.

    I've ran code through propeller-elf-as and it generated the same code as the windows version.
    I build the p2 version of fibo and p2load was able to find my nano, load it and start the terminal program so I could watch fibo.

    If anyone is interested, I can package this up (probably just .zip the /opt/propeller directories) and put it on the PropGCC Google code site. If there's a better way to package this for a Mac, please let me know.
  • David BetzDavid Betz Posts: 14,511
    edited 2013-01-03 07:49
    mindrobots wrote: »
    VICTORY!!

    David, thanks for your help!!

    The instructions you provided above worked for building the p2test PropGCC on my Mac (OSX 10.8.2). I just pulled the repository, so it should be David's latest and greatest.
    I also build a mac version of p2load and put it in the /opt/parallax/bin directory.

    I've ran code through propeller-elf-as and it generated the same code as the windows version.
    I build the p2 version of fibo and p2load was able to find my nano, load it and start the terminal program so I could watch fibo.

    If anyone is interested, I can package this up (probably just .zip the /opt/propeller directories) and put it on the PropGCC Google code site. If there's a better way to package this for a Mac, please let me know.
    Congratulations Rick! I'm glad you were able to build a working Mac version!
  • potatoheadpotatohead Posts: 10,253
    edited 2013-01-06 16:30
    I just downloaded everything. It was not clear that I needed to just overlay the special p2 build on top of the latest prop-gcc version.

    Is that true?

    My installation steps were:

    1. Fetch propellergcc 0.3.5
    2. Fetch propellergcc demos 0.3.5
    3. Fetch multi-cog.zip
    4. Fetch prop2gcc 2013-01-02

    Unzip them all, then copy propgcc 0.35 to C:\, drop demos folder in under that, copy multi-cog into there, copy prop2gcc into c:\ to overlay everything.

    From there, a double click on propgcc.bat opened up a window, which would run make and friends.

    CD into \demos\multi-cog
    make all
    make run
    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    
    C:\propgcc>cd demos
    
    C:\propgcc\demos>cd multi-cog
    
    C:\propgcc\demos\multi-cog>dir
     Volume in drive C is SystemDisk
     Volume Serial Number is 00F7-C0BA
    
     Directory of C:\propgcc\demos\multi-cog
    
    01/06/2013  04:10 PM    <DIR>          .
    01/06/2013  04:10 PM    <DIR>          ..
    01/03/2013  09:20 AM               491 Makefile
    01/03/2013  09:20 AM            79,134 p2load.exe
    01/03/2013  09:20 AM             4,102 propstuff.h
    01/03/2013  09:20 AM             4,881 toggle.c
    01/06/2013  04:10 PM             9,279 toggle.elf
    01/03/2013  09:20 AM               200 toggle.h
    01/06/2013  04:10 PM            18,305 toggle.i
    01/06/2013  04:10 PM             5,368 toggle.o
    01/06/2013  04:10 PM             2,645 toggle.s
    01/03/2013  09:20 AM             2,433 toggle_fw.c
    01/06/2013  04:10 PM             3,264 toggle_fw.cog
    01/06/2013  04:10 PM             7,132 toggle_fw.i
    01/06/2013  04:10 PM             2,108 toggle_fw.o
    01/06/2013  04:10 PM               845 toggle_fw.s
                  14 File(s)        140,187 bytes
                   2 Dir(s)  23,904,686,080 bytes free
    
    C:\propgcc\demos\multi-cog>make
    make: Nothing to be done for `all'.
    
    C:\propgcc\demos\multi-cog>make clean
    rm -f *.o *.elf *.a *.cog *.ecog *.binary
    
    C:\propgcc\demos\multi-cog>make all
    propeller-elf-gcc -save-temps -Os -DPARALLAX_I2C_BUS -mlmm -o toggle.o -c toggle
    .c
    propeller-elf-gcc -mlmm -fno-exceptions -fno-rtti -o toggle.elf toggle.o toggle_
    fw.cog
    
    C:\propgcc\demos\multi-cog>make run
    propeller-load  toggle.elf -r -t
    Propeller Version 32 on COM8
    No value for __cfg_basepin in the configuration file
    Loading toggle.elf to hub memory
    3464 bytes sent
    Verifying RAM ... Timeout Error!
    error: load failed
    error: load failed
    make: *** [run] Error 1
    
    C:\propgcc\demos\multi-cog>pwd
    'pwd' is not recognized as an internal or external command,
    operable program or batch file.
    
    C:\propgcc\demos\multi-cog>dir
     Volume in drive C is SystemDisk
     Volume Serial Number is 00F7-C0BA
    
     Directory of C:\propgcc\demos\multi-cog
    
    01/06/2013  04:18 PM    <DIR>          .
    01/06/2013  04:18 PM    <DIR>          ..
    01/03/2013  09:20 AM               491 Makefile
    01/03/2013  09:20 AM            79,134 p2load.exe
    01/03/2013  09:20 AM             4,102 propstuff.h
    01/03/2013  09:20 AM             4,881 toggle.c
    01/06/2013  04:18 PM             9,279 toggle.elf
    01/03/2013  09:20 AM               200 toggle.h
    01/06/2013  04:18 PM            18,305 toggle.i
    01/06/2013  04:18 PM             5,368 toggle.o
    01/06/2013  04:18 PM             2,645 toggle.s
    01/03/2013  09:20 AM             2,433 toggle_fw.c
    01/06/2013  04:10 PM             3,264 toggle_fw.cog
    01/06/2013  04:10 PM             7,132 toggle_fw.i
    01/06/2013  04:10 PM               845 toggle_fw.s
                  13 File(s)        138,079 bytes
                   2 Dir(s)  23,904,636,928 bytes free
    
    C:\propgcc\demos\multi-cog>type Makefile
    # #########################################################
    # this makefile allows building and cleaning the toggle demo
    #
    # Copyright (c) 2011 Steve Denson
    # MIT Licensed
    # #########################################################
    
    # Propeller Demo include
    PROPLIB = ../common
    
    CFLAGS = -save-temps -Os -DPARALLAX_I2C_BUS
    CHIP = -mp2
    
    #
    # objects for this program
    #
    
    NAME = toggle
    
    OBJS = \
    toggle.o \
    toggle_fw.cog
    
    all: $(NAME).elf
    
    include $(PROPLIB)/common.mk
    
    run2:
            p2load toggle.elf
    
    C:\propgcc\demos\multi-cog>make run2
    p2load toggle.elf
    Found propeller version 32
    Loading 'toggle.elf' on port COM8
    
    
    C:\propgcc\demos\multi-cog>
    

    I'm not sure how things are setup from here to troubleshoot. I'll be digging around, but thought I would post up a successful load, even if it didn't work yet. Close!

    Looks to me like it built a p1 binary maybe? That's what I'm reading through to learn right now.
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-01-06 18:06
    Try this on your .o file
    macdev:p2 rapost$ propeller-elf-objdump -f fibo.o
    
    fibo.o:     file format elf32-propeller
    architecture: prop2, flags 0x00000011:
    HAS_RELOC, HAS_SYMS
    start address 0x00000000
    

    If you have prop2 in the architecture, you probably got the right stuff.

    I built the P2 fibo demo to verify my toolchain - it's in the demos under fibo/p2
Sign In or Register to comment.