PropGCC Propeller 2 Bug Fixes - and your chance for first-release Propeller hardware!

245

Comments

  • jac_goudsmitjac_goudsmit Posts: 415
    edited 2013-03-15 - 11:33:51
    David Betz wrote: »
    I guess I need to go back and read your messages on this topic. I can't remember why the hack of doing #foo>>2 won't work or even using the .cog_ram directive. Does your assembly have to be inline or can you put it all in a separate .S file? Will that even help?

    Let's continue the discussion in the PropGCC forum: http://forums.parallax.com/showthread.php/146333

    ===Jac
  • photomankcphotomankc Posts: 929
    edited 2013-03-15 - 11:55:28
    This is very cool. Doubt my meager coding skills will lead to any significant GCC bugs but I'll certainly give the merged compiler a try
  • David BetzDavid Betz Posts: 13,668
    edited 2013-03-15 - 11:56:54
    photomankc wrote: »
    This is very cool. Doubt my meager coding skills will lead to any significant GCC bugs but I'll certainly give the merged compiler a try
    Thanks! We can use all of the testing we can get!
  • Ken GraceyKen Gracey Posts: 6,560
    edited 2013-03-15 - 13:06:09
    Hi Ken,

    Edit: Note, this is not intended as a complaint, but to show that I intend to put effort into this. I'm still committed to writing a version of my project in C with inline assembly.

    ===Jac

    Thanks Jac - first time I had a detailed look into Propeddle. I'll get with Eric and Steve off-line and see what we can do to hunt down and eradicate this bug. - Ken
  • dgatelydgately Posts: 1,164
    edited 2013-03-15 - 17:27:00
    Dave or Jazzed...?

    What is the correct command-line options for loading an xmmc-built .elf file to a
    Propeller Platform DNA with a WinBond (1
    megabyte Flashchip) installed at U11 (see:http://mghdesigns.com/dnartc.html)?


    I compiled the propgcc demos with "make MODEL=xmmc" and tried to load dry.elf onto the board with:
    --$ propeller-load -r -t dry.elf -p /dev/cu.usbserial-A50066QC -S1 -b dnaPropeller Version 1 on /dev/cu.usbserial-A50066QC
    Loading the serial helper to hub memory
    9568 bytes sent                  
    Verifying RAM ... OK
    Loading cache driver 'spi_flash_cache.dat'
    1472 bytes sent                  
    Loading program image to flash
    Timeout waiting for ACK/NAK       
    error: SendPacket DATA failed
    error: Loading program image failed
    error: load failed
    
    Tried with "NWAY":
    
    $ propeller-load -r -t dry.elf -p /dev/cu.usbserial-A50066QC -S1 -b dna-NWAY
    Propeller Version 1 on /dev/cu.usbserial-A50066QC
    Loading the serial helper to hub memory
    9568 bytes sent                  
    Verifying RAM ... OK
    Loading cache driver 'spi_nway_flash_cache.dat'
    1520 bytes sent                  
    Loading program image to flash
    Timeout waiting for ACK/NAK
    error: Loading program image failed
    error: load failed
    
    

    propgcc was built on my Mac (OS X 10.8.3) with "./rebuild.sh" after using the following to update a clone of propgcc from code.google.com/p/propgcc/:
    hg pull
    hg update
    hg co p2test
    

    Do I need to specify the board type to propeller-load? Do i point "-b" to a copy of the DNA.cfg file that I use with SimpleIDE? Not sure what the actual board name is needed...


    Thanks to all the propgcc developers for their hard work!

    Dennis
  • David BetzDavid Betz Posts: 13,668
    edited 2013-03-15 - 19:51:14
    dgately wrote: »
    Dave or Jazzed...?

    What is the correct command-line options for loading an xmmc-built .elf file to a
    Propeller Platform DNA with a WinBond (1
    megabyte Flashchip) installed at U11 (see:http://mghdesigns.com/dnartc.html)?

    This works with my DNA board loading the xmmc version of the fibo demo:
    Davids-MacBook-Air:xmmc dbetz$ propeller-load -b dna fibo.elf -r -t
    Propeller Version 1 on /dev/cu.usbserial-A5VHCVI8
    Loading the serial helper to hub memory
    9568 bytes sent                  
    Verifying RAM ... OK
    Loading cache driver 'spi_flash_cache.dat'
    1472 bytes sent                  
    Loading program image to flash
    12772 bytes sent                  
    Loading .xmmkernel
    1472 bytes sent                  
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    hello, world!
    fibo(00) = 000000 (00000ms) (19344 ticks)
    fibo(01) = 000001 (00000ms) (4912 ticks)
    fibo(02) = 000001 (00000ms) (5296 ticks)
    fibo(03) = 000002 (00000ms) (5680 ticks)
    fibo(04) = 000003 (00000ms) (6432 ticks)
    fibo(05) = 000005 (00000ms) (7568 ticks)
    fibo(06) = 000008 (00000ms) (9456 ticks)
    fibo(07) = 000013 (00000ms) (12480 ticks)
    fibo(08) = 000021 (00000ms) (17392 ticks)
    fibo(09) = 000034 (00000ms) (25328 ticks)
    fibo(10) = 000055 (00000ms) (38176 ticks)
    fibo(11) = 000089 (00000ms) (58960 ticks)
    fibo(12) = 000144 (00001ms) (92592 ticks)
    fibo(13) = 000233 (00001ms) (147008 ticks)
    fibo(14) = 000377 (00002ms) (235056 ticks)
    fibo(15) = 000610 (00004ms) (377520 ticks)
    fibo(16) = 000987 (00007ms) (608032 ticks)
    fibo(17) = 001597 (00012ms) (981008 ticks)
    fibo(18) = 002584 (00019ms) (1584496 ticks)
    fibo(19) = 004181 (00032ms) (2560960 ticks)
    fibo(20) = 006765 (00051ms) (4140912 ticks)
    fibo(21) = 010946 (00083ms) (6697328 ticks)
    fibo(22) = 017711 (00135ms) (10833696 ticks)
    fibo(23) = 028657 (00219ms) (17526480 ticks)
    fibo(24) = 046368 (00354ms) (28355632 ticks)
    fibo(25) = 075025 (00573ms) (45877568 ticks)
    fibo(26) = 121393 (00927ms) (74228656 ticks)
    
  • dgatelydgately Posts: 1,164
    edited 2013-03-15 - 20:58:57
    David,

    Still no luck...
    [altergator@dgate ~/source/propgcc/demos/fibo/xmmc]$ ls
    Makefile fibo.c   fibo.elf fibo.o
    
    
    
    [altergator@dgate ~/source/propgcc/demos/fibo/xmmc]$ make clean
    rm -f *.o *.elf *.a *.cog *.ecog *.binary
    
    
    [altergator@dgate ~/source/propgcc/demos/fibo/xmmc]$ make
    propeller-elf-gcc -Os -mfcache -mxmmc  -o fibo.o -c fibo.c
    propeller-elf-gcc -Os -mfcache -mxmmc  -fno-exceptions -fno-rtti -o fibo.elf fibo.o 
    
    
    [altergator@dgate ~/source/propgcc/demos/fibo/xmmc]$ ls
    Makefile fibo.c   fibo.elf fibo.o
    
    
    [altergator@dgate ~/source/propgcc/demos/fibo/xmmc]$ propeller-load -b dna fibo.elf -r -t
    Propeller Version 1 on /dev/cu.usbserial-A50066QC
    Loading the serial helper to hub memory
    9568 bytes sent                  
    Verifying RAM ... OK
    error: failed to connect to helper                      [COLOR=#ff0000][FONT=arial black]<== ALWAYS FAILS IN THIS AREA OR WHEN LOADING THE IMAGE TO FLASH[/FONT][/COLOR]
    error: load failed
    

    Would it be possible to make your mac-built propgcc available as a .zip? I'm not quite sure that my build of propgcc is correct...

    Thanks,
    dgately
  • David BetzDavid Betz Posts: 13,668
    edited 2013-03-16 - 05:25:58
    dgately wrote: »
    Would it be possible to make your mac-built propgcc available as a .zip? I'm not quite sure that my build of propgcc is correct...

    Thanks,
    dgately
    Sorry you're having trouble with this. I can certainly upload a zip file with the Mac build. Do you mind if it's from the current sources rather than the tagged ones that the Windows build used?
  • dgatelydgately Posts: 1,164
    edited 2013-03-16 - 08:16:57
    David Betz wrote: »
    Sorry you're having trouble with this. I can certainly upload a zip file with the Mac build. Do you mind if it's from the current sources rather than the tagged ones that the Windows build used?

    No problem! Latest bits are fine for me...

    Thanks,
    dgately
  • doggiedocdoggiedoc Posts: 2,064
    edited 2013-03-16 - 11:01:04
    I too am having trouble building propgcc on Mac (OS 10.8.2) - I was following dgately's instructions here. Perhaps I am getting in over my head. I should start a new thread to focus on building the propgcc source for Mac OS.

    Paul
  • David BetzDavid Betz Posts: 13,668
    edited 2013-03-16 - 12:55:42
    doggiedoc wrote: »
    I too am having trouble building propgcc on Mac (OS 10.8.2) - I was following dgately's instructions here. Perhaps I am getting in over my head. I should start a new thread to focus on building the propgcc source for Mac OS.

    Paul

    Sorry about the Macintosh build problems. Can you tell me what sort of trouble you're running into?

    Anyway, I just uploaded a zip of a Macintosh build to Google Code.

    http://code.google.com/p/propgcc/downloads/detail?name=propgcc-2013-03-16-mac.zip&can=2&q=#makechanges
  • doggiedocdoggiedoc Posts: 2,064
    edited 2013-03-16 - 13:07:50
    Thanks David! I probably should have posted this here instead of Ken's thread in Prop1 Fourm. :D

    My first attempt at compiling failed:
    2:propgcc admin$ ./jbuild.sh 8
    Prefix is /opt/parallax
    Propgcc version is propellergcc_v0_3_5_1920
    BUGURL is http://code.google.com/p/propgcc/issues
    Building with: -j 8
    OS 'Darwin' detected.
    checking build system type... i386-apple-darwin12.2.0
    checking host system type... i386-apple-darwin12.2.0
    checking target system type... propeller-parallax-elf
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether ln works... yes
    checking whether ln -s works... yes
    checking for a sed that does not truncate output... /usr/bin/sed
    checking for gawk... no
    checking for mawk... no
    checking for nawk... no
    checking for awk... awk
    checking for gcc... no
    checking for cc... no
    checking for cl.exe... no
    [COLOR="#FF0000"]configure: error: in `/Users/admin/build/binutils':
    configure: error: no acceptable C compiler found in $PATH
    See `config.log' for more details.
    binutils configure failed.[/COLOR]
    2:propgcc admin$ 
    


    But I did make some progress - apparently a few versions back Xcode didn't install command line support by default. :D
    Solution was to edit preferences in Xcode.

    I got it to build but but I don't think it works properly. I'll follow with an example of what I mean.
  • doggiedocdoggiedoc Posts: 2,064
    edited 2013-03-16 - 13:21:37
    I will assume at this point that I can't just build propgcc source (without Mac OS specific changes) and expect it to work. Compiling an example program fails:



    This particular example had a Makefile already and works otherwise. But if I call propeller-elf-gcc ..., I get this:
    2:lmm_c_toggle admin$ propeller-elf-gcc -o Makefile toggle.c
    2:lmm_c_toggle admin$ make
    Makefile:1: warning: NUL character seen; rest of line ignored
    Makefile:1: *** missing separator.  Stop.
    2:lmm_c_toggle admin$
    
  • David BetzDavid Betz Posts: 13,668
    edited 2013-03-16 - 13:27:02
    doggiedoc wrote: »
    I will assume at this point that I can't just build propgcc source (without Mac OS specific changes) and expect it to work. Compiling an example program fails:



    This particular example had a Makefile already and works otherwise. But if I call propeller-elf-gcc ..., I get this:
    2:lmm_c_toggle admin$ propeller-elf-gcc -o Makefile toggle.c
    2:lmm_c_toggle admin$ make
    Makefile:1: warning: NUL character seen; rest of line ignored
    Makefile:1: *** missing separator.  Stop.
    2:lmm_c_toggle admin$
    
    Are you just trying to compile toggle.c to create a linkable object file? In that case you want:
    propeller-elf-gcc -mlmm -c toggle.c
    
    If you want to compile it into an executable you want:
    propeller-elf-gcc -mlmm -o toggle.elf toggle.c
    
    However, in the second example you probably also want -Os to get smaller and faster code. The Makefile does not get used when you invoke the compiler directly.
  • doggiedocdoggiedoc Posts: 2,064
    edited 2013-03-16 - 13:59:43
    Thanks David! Apparently I was confused about the Makefile. I was trying to follow the the instructions here. Now I understand my error.

    I was able to load the toggle example to a QuickStart Board just fine using propeller-load ..... Thanks!

    Paul
  • David BetzDavid Betz Posts: 13,668
    edited 2013-03-16 - 14:17:52
    doggiedoc wrote: »
    Thanks David! Apparently I was confused about the Makefile. I was trying to follow the the instructions here. Now I understand my error.

    I was able to load the toggle example to a QuickStart Board just fine using propeller-load ..... Thanks!

    Paul
    The problem you had before is that the "-o Makefile" part of your propeller-elf-gcc command line overwrote the Makefile with the executable generated by compiling toggle.c. After that any attempt to run make generated an error because the Makefile contained binary compiler output rather than the text commands it originally contained.
  • doggiedocdoggiedoc Posts: 2,064
    edited 2013-03-16 - 14:54:05
    Thanks David - I am educating myself on Makefiles now. I have successfully completed a hello world program using vi and command line tools to compile and load to my prop. With correcting typos, it quickly becomes evident the power of the Makefile for development.

    Paul
  • David BetzDavid Betz Posts: 13,668
    edited 2013-03-16 - 15:06:26
    doggiedoc wrote: »
    Thanks David - I am educating myself on Makefiles now. I have successfully completed a hello world program using vi and command line tools to compile and load to my prop. With correcting typos, it quickly becomes evident the power of the Makefile for development.

    Paul

    Hi Paul,

    I'm glad you got past that problem and are starting to see the value of Makefiles. I have to admit though that, even though I use them extensively, I still find them difficult to write without frequently referring to the documentation. They are far from perfect but they get the job done.
  • jazzedjazzed Posts: 11,803
    edited 2013-03-16 - 16:54:14
    Seems to me this thread is drifting into the unnecessarily complicated zone.

    Knowledge of Makefiles and building Propeller-GCC are not required for testing.
  • David BetzDavid Betz Posts: 13,668
    edited 2013-03-16 - 18:14:51
    jazzed wrote: »
    Seems to me this thread is drifting into the unnecessarily complicated zone.

    Knowledge of Makefiles and building Propeller-GCC are not required for testing.
    Not required but there are many people who prefer working that way and we should support them as well as the IDE users.
  • jazzedjazzed Posts: 11,803
    edited 2013-03-16 - 18:34:33
    David Betz wrote: »
    Not required but there are many people who prefer working that way and we should support them as well as the IDE users.

    Well let's keep rest out of trouble.
  • dgatelydgately Posts: 1,164
    edited 2013-03-16 - 19:06:31
    doggiedoc wrote: »
    I too am having trouble building propgcc on Mac (OS 10.8.2) - I was following dgately's instructions here. Perhaps I am getting in over my head. I should start a new thread to focus on building the propgcc source for Mac OS.

    Paul

    Paul,

    Those instructions may have gotten a little "long in the tooth" since written :-) I've been since able to build lately using just "./rebuild.sh" within the propgcc directory. I have found that I've needed to remove the older built and installed bits with "sudo rm -R /opt/parallax" first to avoid a permissions error when the build tries to overwrite some of /opt/parallax content...

    Sounds like you've gotten the source to build, though?


    Thanks,
    dgately
  • David BetzDavid Betz Posts: 13,668
    edited 2013-03-16 - 19:12:53
    dgately wrote: »
    Paul,

    Those instructions may have gotten a little "long in the tooth" since written :-) I've been since able to build lately using just "./rebuild.sh" within the propgcc directory. I have found that I've needed to remove the older built and installed bits with "sudo rm -R /opt/parallax" first to avoid a permissions error when the build tries to overwrite some of /opt/parallax content...

    Sounds like you've gotten the source to build, though?


    Thanks,
    dgately

    If you build with this command it will automatically remove /opt/parallax. You have to protect /opt/parallax with 777 to allow jbuild.sh to overwrite it though.
    ./jbuild.sh 5 rm-all
    
  • doggiedocdoggiedoc Posts: 2,064
    edited 2013-03-17 - 05:58:13
    @David - Thank for the tips.

    @Steve - sorry for the deviation from topic.

    I have now have a successfully built of the "p2test-2013-02-26" tag of the "p2test" branch. My hello.c code compiles and runs as expected.
    This build was on Mac OS 10.6.8 (Intel hardware). I am much more proficient with the command line builds now. So thanks again for all the help.

    One more question @Steve - Is there a more current build of SimpleIDE for the Mac than v0.7.2? I don't even see that one in the downloads at http://code.google.com/p/propgcc/.

    Thanks -
    Paul
  • David BetzDavid Betz Posts: 13,668
    edited 2013-03-17 - 06:12:11
    doggiedoc wrote: »
    @Steve - sorry for the deviation from topic.
    Questions about how to build and run PropGCC are not a deviation from this topic. Feel free to post any questions that might come up.
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-03-17 - 06:56:16
    Paul,

    Check here http://code.google.com/p/propside/downloads/list

    The 0-8-5 is the latest and it does SPIN too!
  • doggiedocdoggiedoc Posts: 2,064
    edited 2013-03-17 - 09:47:55
    Thanks Rick! I had a brain fart and was looking in the propgcc repository. DUH :D
    mindrobots wrote: »
    Paul,

    Check here http://code.google.com/p/propside/downloads/list

    The 0-8-5 is the latest and it does SPIN too!
  • RaymanRayman Posts: 10,071
    edited 2013-03-18 - 07:18:40
    Ok, just dove in this morning, but didn't get too far...

    I downloaded the Windows version of PropGCC from top post and used it to replace the propgcc folder already on my C drive.
    Downloaded the SimpleIDE mentioned earlier, but didn't intall because it's the same version that I've already had for at least a month, I think.

    Opened up hello.side project and ran on Propeller1 Demo Board and it works fine.
    Added "-mp2" to "Other Compiler Options" and tried to run on my DE0 setup and this is what I got:
    P
    Project Directory: C:/Users/allen/Documents/SimpleIDE/hello/propeller-elf-gcc.exe -o a.out -Os -mlmm -I . -fno-exceptions -Dprintf=__simple_printf -mp2 hello.c
    hello.c: In function 'main':
    hello.c:13:9: error: 'CNT' undeclared (first use in this function)
    hello.c:13:9: note: each undeclared identifier is reported only once for each function it appears in
    Done. Build Failed!
    

    I assume I'm doing something wrong that is very obvious...

    BTW: If I comment out the waitcnt line, it will build, but I get a "error: packet handshake failed" from the loader...

    Update: Ok, If I pick "DE2-115" for my board type, instead of "HUB", then it runs with waitcnt commented out.
  • David BetzDavid Betz Posts: 13,668
    edited 2013-03-18 - 07:25:42
    Rayman wrote: »
    Ok, just dove in this morning, but didn't get too far...

    I downloaded the Windows version of PropGCC from top post and used it to replace the propgcc folder already on my C drive.
    Downloaded the SimpleIDE mentioned earlier, but didn't intall because it's the same version that I've already had for at least a month, I think.

    Opened up hello.side project and ran on Propeller1 Demo Board and it works fine.
    Added "-mp2" to "Other Compiler Options" and tried to run on my DE0 setup and this is what I got:
    P
    Project Directory: C:/Users/allen/Documents/SimpleIDE/hello/propeller-elf-gcc.exe -o a.out -Os -mlmm -I . -fno-exceptions -Dprintf=__simple_printf -mp2 hello.c
    hello.c: In function 'main':
    hello.c:13:9: error: 'CNT' undeclared (first use in this function)
    hello.c:13:9: note: each undeclared identifier is reported only once for each function it appears in
    Done. Build Failed!
    

    I assume I'm doing something wrong that is very obvious...

    BTW: If I comment out the waitcnt line, it will build, but I get a "error: packet handshake failed" from the loader...

    Update: Ok, If I pick "DE2-115" for my board type, instead of "HUB", then it runs with waitcnt commented out.
    There is no CNT register on P2. You have to use built-in function getcnt() instead. I've started making some cross-chip macros/functions to handle this distinction but not all of the demos use them yet. Take a look at propeller.h/propeller1.h/propeller2.h in the standard PropGCC includes for the definitions or prototypes of these functions.
  • RaymanRayman Posts: 10,071
    edited 2013-03-18 - 07:46:30
    Thanks David. It works now with CNT replaced by getcnt()... No CNT register! I missed that... How can there be no CNT register?
Sign In or Register to comment.