Shop OBEX P1 Docs P2 Docs Learn Events
Where is “ load_cog_driver_xmm” — Parallax Forums

Where is “ load_cog_driver_xmm”

Mark MaraMark Mara Posts: 64
edited 2013-08-05 04:58 in Propeller 1
I am looking at the cog_c_toggle demo as an example of how to start a cog when using XMMC. The demo code has a #if defined to switch between cognew and load_cog_driver_xmm, however, when I compile it using load_cog_driver_xmm I get an undefined reference. I do have Auto Include Liberies checked.

Thanks for your help.

Code from the cog_c_toggle demo:
/*
 * function to start up a new cog running the toggle
 * code (which we've placed in the toggle_fw.cog section)
 */
void start(volatile void *parptr)
{
    extern unsigned int _load_start_toggle_fw_cog[];
#if defined(__PROPELLER_XMM__) || defined(__PROPELLER_XMMC__)
    load_cog_driver_xmm(_load_start_toggle_fw_cog, 496, (uint32_t *)parptr);
#else
    cognew(_load_start_toggle_fw_cog, parptr);
#endif
}

Comments

  • David BetzDavid Betz Posts: 14,516
    edited 2013-06-17 13:02
    Mark Mara wrote: »
    I am looking at the cog_c_toggle demo as an example of how to start a cog when using XMMC. The demo code has a #if defined to switch between cognew and load_cog_driver_xmm, however, when I compile it using load_cog_driver_xmm I get an undefined reference. I do have Auto Include Liberies checked.

    Thanks for your help.

    Code from the cog_c_toggle demo:
    /*
     * function to start up a new cog running the toggle
     * code (which we've placed in the toggle_fw.cog section)
     */
    void start(volatile void *parptr)
    {
        extern unsigned int _load_start_toggle_fw_cog[];
    #if defined(__PROPELLER_XMM__) || defined(__PROPELLER_XMMC__)
        load_cog_driver_xmm(_load_start_toggle_fw_cog, 496, (uint32_t *)parptr);
    #else
        cognew(_load_start_toggle_fw_cog, parptr);
    #endif
    }
    
    Are you compiling with -mxmmc? That function should be in the standard library.
  • Mark MaraMark Mara Posts: 64
    edited 2013-06-17 15:51
    I built the most current version of GCC and the undefined reference is gone, but now it just hangs in XMMC. It works fine when compiled using LMM. It is probably something that I am doing.

    I would really appreciate it if someone would try and run the cog_c_toggle demo and confirm that it works using XMMC.

    Thanks --markM
  • ersmithersmith Posts: 6,054
    edited 2013-06-18 05:47
    Mark Mara wrote: »
    I built the most current version of GCC and the undefined reference is gone, but now it just hangs in XMMC. It works fine when compiled using LMM. It is probably something that I am doing.

    I would really appreciate it if someone would try and run the cog_c_toggle demo and confirm that it works using XMMC.

    Thanks --markM

    cog_c_toggle seems to work OK for me in XMMC mode. Did you remove all the old files before building in XMMC mode? I know that make doesn't know that it has to do that when switching modes; I'm not sure about simpleide, but it may have the same problem.

    Eric
  • Mark MaraMark Mara Posts: 64
    edited 2013-06-18 06:52
    ersmith wrote: »
    cog_c_toggle seems to work OK for me in XMMC mode. Did you remove all the old files before building in XMMC mode? I know that make doesn't know that it has to do that when switching modes; I'm not sure about simpleide, but it may have the same problem.

    Eric

    Thanks for trying it. That confirms that it is me. I am uisng SimpileIDE. I tried removing all the old files, but it still displays: "hello,world!" , "toggle cog has started" and then hangs. It never toggles the led or displays the toggle count messages. I'll keep messing with it.

    Thanks for your help.
  • jazzedjazzed Posts: 11,803
    edited 2013-06-18 09:16
    This appears to be related to another problem found here: http://forums.parallax.com/showthread.php/148356-help-with-i2c

    SimpleIDE uses separate folders for output and always rebuilds except for libraries.

    I suggest for building the latest default update using ./jbuild.sh 6 rm-all (or for windows ./rebuild.sh rm-all).

    This ensures that all gcc libraries (and everything else) is updated in your build. If you are using windows, it can take a very long time to build.

    This bug is also in release_1_0 and work is in progress for that.



  • jazzedjazzed Posts: 11,803
    edited 2013-06-18 10:05
    I've verified that the default branch appears to have issues with cog_load on xmmc.

    CMM and LMM work fine, but XMMC does not. For example with Quickstart + EEPROM XMMC the loader started and reset the board immediately (this is really bad!). Also, I noticed this in all loads and am not sure what it means: "No value for __cfg_basepin in the configuration fileLoading the serial helper to hub memory"

    Sorry for the trouble. Please be patient while we work this out.

  • jazzedjazzed Posts: 11,803
    edited 2013-06-18 10:39
    Mark Mara wrote: »
    I would really appreciate it if someone would try and run the cog_c_toggle demo and confirm that it works using XMMC.
    This works with the release_1_0 code in CMM, LMM, and XMMC models.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-06-18 12:07
    jazzed wrote: »
    I've verified that the default branch appears to have issues with cog_load on xmmc.

    CMM and LMM work fine, but XMMC does not. For example with Quickstart + EEPROM XMMC the loader started and reset the board immediately (this is really bad!). Also, I noticed this in all loads and am not sure what it means: "No value for __cfg_basepin in the configuration fileLoading the serial helper to hub memory"

    Sorry for the trouble. Please be patient while we work this out.

    It worked on the C3 in xmmc mode. Not sure why it doesn't work with the EEPROM driver but I'll check into it.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-06-18 12:38
    jazzed wrote: »
    I've verified that the default branch appears to have issues with cog_load on xmmc.

    CMM and LMM work fine, but XMMC does not. For example with Quickstart + EEPROM XMMC the loader started and reset the board immediately (this is really bad!). Also, I noticed this in all loads and am not sure what it means: "No value for __cfg_basepin in the configuration fileLoading the serial helper to hub memory"

    Sorry for the trouble. Please be patient while we work this out.


    I must not understand the problem you're reporting. I just tried the cog_c_toggle demo on the C3 using both the C3 cache driver and the EEPROM cache driver and both seem to work. Here is the output:

    C3 cache driver:
    propeller-load -bc3 toggle.elf -r -t
    Propeller Version 1 on /dev/cu.usbserial-A8004ILf
    Loading toggle.elf to hub memory
    14220 bytes sent                  
    Verifying RAM ... OK
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    hello, world!
    toggle cog has started
    toggle count = 3
    toggle count = 5
    toggle count = 11
    toggle count = 25
    

    EEPROM cache driver:
    propeller-load -beeprom toggle.elf -r -t
    Propeller Version 1 on /dev/cu.usbserial-A8004ILf
    Loading toggle.elf to hub memory
    14220 bytes sent                  
    Verifying RAM ... OK
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    hello, world!
    toggle cog has started
    toggle count = 3
    toggle count = 5
    toggle count = 11
    toggle count = 25
    

    What isn't obvious from these transcripts is that the LED was toggling in both cases.

    What am I missing here? I don't have a QuickStart board with me on my trip so I can't try that until Friday.

    Edit: Is there any chance you were using the "kernel-work" branch? The EEPROM driver won't work in that branch because I haven't converted it yet to the new cache driver architecture.

    Edit 2: FORGET THIS MESSAGE FOR NOW!! Sorry for the irrelevant information. I just realized that by default the cog_c_toggle demo builds in LMM mode so of course it worked fine with both the C3 and the EEPROM board configuration files. No external memory was being used. I'll try this again with XMMC mode but I can't do it right now because I'm in the middle of building the release_1_0 branch. Stay tuned.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-06-18 14:07
    David Betz wrote: »
    I must not understand the problem you're reporting. I just tried the cog_c_toggle demo on the C3 using both the C3 cache driver and the EEPROM cache driver and both seem to work. Here is the output:

    C3 cache driver:
    propeller-load -bc3 toggle.elf -r -t
    Propeller Version 1 on /dev/cu.usbserial-A8004ILf
    Loading toggle.elf to hub memory
    14220 bytes sent                  
    Verifying RAM ... OK
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    hello, world!
    toggle cog has started
    toggle count = 3
    toggle count = 5
    toggle count = 11
    toggle count = 25
    

    EEPROM cache driver:
    propeller-load -beeprom toggle.elf -r -t
    Propeller Version 1 on /dev/cu.usbserial-A8004ILf
    Loading toggle.elf to hub memory
    14220 bytes sent                  
    Verifying RAM ... OK
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    hello, world!
    toggle cog has started
    toggle count = 3
    toggle count = 5
    toggle count = 11
    toggle count = 25
    

    What isn't obvious from these transcripts is that the LED was toggling in both cases.

    What am I missing here? I don't have a QuickStart board with me on my trip so I can't try that until Friday.

    Edit: Is there any chance you were using the "kernel-work" branch? The EEPROM driver won't work in that branch because I haven't converted it yet to the new cache driver architecture.

    Edit 2: FORGET THIS MESSAGE FOR NOW!! Sorry for the irrelevant information. I just realized that by default the cog_c_toggle demo builds in LMM mode so of course it worked fine with both the C3 and the EEPROM board configuration files. No external memory was being used. I'll try this again with XMMC mode but I can't do it right now because I'm in the middle of building the release_1_0 branch. Stay tuned.

    Okay, I built the default branch again and tried cog_c_toggle in xmmc mode with both the c3 and the eeprom cache drivers and it works for me in both cases. As I said before, I must be missing something about the problem that is being reported here. By the way, this is using propgcc/demos/toggle/cog_c_toggle.
  • Mark MaraMark Mara Posts: 64
    edited 2013-06-18 14:40
    Here is what I just did:
    bottomshotserver:propsrc mam1$ hg clone --uncompressed [URL]https://code.google.com/p/propgcc/[/URL]
    warning: code.google.com certificate with fingerprint 87:47:45:6e:15:63:f3:91:68:e4:d8:0d:d7:17:07:80:55:f6:49:75 not verified (check hostfingerprints or web.cacerts config setting)
    destination directory: propgcc
    requesting all changes
    adding changesets
    adding manifests
    adding file changes
    added 2076 changesets with 82122 changes to 75517 files (+4 heads)
    updating to branch default
    74714 files updated, 0 files merged, 0 files removed, 0 files unresolved
    bottomshotserver:propsrc mam1$ cd propgcc
    bottomshotserver:propgcc mam1$ ./jbuild.sh 6 rm-all
    Prefix is /opt/parallax
    Propgcc version is propellergcc-alpha_v1_9_0_2075
    BUGURL is [URL]http://code.google.com/p/propgcc/issues[/URL]
    Building with: -j 6
    Removing old build and /opt/parallax/*.
    OS 'Darwin' detected.
    checking build system type... x86_64-apple-darwin12.4.0
    checking host system type... x86_64-apple-darwin12.4.0
    checking target system type... propeller-parallax-elf
    .
    .
    .
    gcc -c -Wall -I../loader/src -DMACOSX -o kernel_image.o kernel_image.c
    gcc -Wall -I../loader/src -DMACOSX -o gdbstub gdbstub.o config.o expr.o system.o port.o PLoadLib.o  osint_linux.o kernel_image.o
    rm kernel_image.binary kernel_image.c
    Build complete.
    bottomshotserver:propgcc mam1$
    

    Now I don't even see a .cogc file
    bottomshotserver:cog_c_toggle mam1$ 
    bottomshotserver:cog_c_toggle mam1$ cd /Users/mam1/propSrc/propgcc/demos/toggle/cog_c_toggle 
    bottomshotserver:cog_c_toggle mam1$ ls
    Makefile    toggle.c    toggle.h    toggle_fw.c
    bottomshotserver:cog_c_toggle mam1$ 
    
  • David BetzDavid Betz Posts: 14,516
    edited 2013-06-18 16:29
    Mark Mara wrote: »
    Here is what I just did:
    bottomshotserver:propsrc mam1$ hg clone --uncompressed [URL]https://code.google.com/p/propgcc/[/URL]
    warning: code.google.com certificate with fingerprint 87:47:45:6e:15:63:f3:91:68:e4:d8:0d:d7:17:07:80:55:f6:49:75 not verified (check hostfingerprints or web.cacerts config setting)
    destination directory: propgcc
    requesting all changes
    adding changesets
    adding manifests
    adding file changes
    added 2076 changesets with 82122 changes to 75517 files (+4 heads)
    updating to branch default
    74714 files updated, 0 files merged, 0 files removed, 0 files unresolved
    bottomshotserver:propsrc mam1$ cd propgcc
    bottomshotserver:propgcc mam1$ ./jbuild.sh 6 rm-all
    Prefix is /opt/parallax
    Propgcc version is propellergcc-alpha_v1_9_0_2075
    BUGURL is [URL]http://code.google.com/p/propgcc/issues[/URL]
    Building with: -j 6
    Removing old build and /opt/parallax/*.
    OS 'Darwin' detected.
    checking build system type... x86_64-apple-darwin12.4.0
    checking host system type... x86_64-apple-darwin12.4.0
    checking target system type... propeller-parallax-elf
    .
    .
    .
    gcc -c -Wall -I../loader/src -DMACOSX -o kernel_image.o kernel_image.c
    gcc -Wall -I../loader/src -DMACOSX -o gdbstub gdbstub.o config.o expr.o system.o port.o PLoadLib.o  osint_linux.o kernel_image.o
    rm kernel_image.binary kernel_image.c
    Build complete.
    bottomshotserver:propgcc mam1$
    

    Now I don't even see a .cogc file
    bottomshotserver:cog_c_toggle mam1$ 
    bottomshotserver:cog_c_toggle mam1$ cd /Users/mam1/propSrc/propgcc/demos/toggle/cog_c_toggle 
    bottomshotserver:cog_c_toggle mam1$ ls
    Makefile    toggle.c    toggle.h    toggle_fw.c
    bottomshotserver:cog_c_toggle mam1$ 
    

    There is no need to use the .cogc extension to build COG drivers. This is just a convention used by SimpleIDE and some of the other demos. All that is necessary is to use -mcog on the command line. The Makefile for the demos/toggle/cog_c_toggle demo has a rule for building toggle_fw.c using the -mcog compiler option.
  • jazzedjazzed Posts: 11,803
    edited 2013-06-18 19:56
    There is no .cogc file in the compiler propeller-gcc demos. The .cogc files are used with SimpleIDE by convention and are in the demos that come with the SimpleIDE packages.
  • Mark MaraMark Mara Posts: 64
    edited 2013-06-19 22:09
    Using a copy of the repository taken yesterday; the demo is working as expected in XMMC mode from the command line.
    bottomshotserver:cog_c_toggle mam1$ make clean
    rm -f *.o *.elf *.a *.cog *.ecog *.binary
    bottomshotserver:cog_c_toggle mam1$ make MODEL=xmmc
    propeller-elf-gcc -Os -mxmmc  -o toggle.o -c toggle.c
    propeller-elf-gcc -Os  -mcog -r -o toggle_fw.cog toggle_fw.c
    propeller-elf-objcopy --localize-text --rename-section .text=toggle_fw.cog toggle_fw.cog
    propeller-elf-gcc -Os -mxmmc  -fno-exceptions -fno-rtti -o toggle.elf toggle.o toggle_fw.cog
    bottomshotserver:cog_c_toggle mam1$ propeller-load -r -t *.elf -b c3
    Propeller Version 1 on /dev/cu.usbserial-004214FD
    Loading the serial helper to hub memory
    9568 bytes sent                 
    Verifying RAM ... OK
    Loading cache driver 'c3_cache.dat'
    1704 bytes sent                 
    Loading program image to flash
    15496 bytes sent                 
    Loading .xmmkernel
    1460 bytes sent                 
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    hello, world!
    toggle cog has started
    toggle count = 3
    toggle count = 5
    toggle count = 11
    toggle count = 25
    

    I created a simpleIDE project and copied the files into it. When I compile the project it fails with a undefined reference (see below). What else should I have done?

    xxxxx.jpg


    Thank you for your help.

    --markM
    1024 x 832 - 113K
  • jazzedjazzed Posts: 11,803
    edited 2013-06-20 03:25
    Did you try the one from SimpleIDE propeller-gcc demos?
    Project Directory: C:/Users/Steve/Documents/SimpleIDE/Propeller GCC Demos/toggle/cog_c_toggle/
    
    
    propeller-elf-gcc.exe -r -Os -mcog -o xmmc/toggle_fw.cog -xc toggle_fw.cogc
    propeller-elf-objcopy --localize-text --rename-section .text=toggle_fw.cog xmmc/toggle_fw.cog
    propeller-elf-gcc.exe -I . -L . -o xmmc/toggle.elf -Os -mxmmc -fno-exceptions -Dprintf=__simple_printf xmmc/toggle_fw.cog toggle.c
    propeller-elf-objdump -h xmmc/toggle.elf
    Done. Build Succeeded!
    
    753 x 599 - 126K
  • Mark MaraMark Mara Posts: 64
    edited 2013-06-20 06:08
    jazzed wrote: »
    Did you try the one from SimpleIDE propeller-gcc demos?

    Yes – this is where I started. It compiles clean (using xmmc), but it displays “hello,world!”, “toggle cog has started” then hangs. It never starts flashing the led or displays the toggle count. I’ll reinstall simpleIDE and try again.
  • jazzedjazzed Posts: 11,803
    edited 2013-06-20 06:41
    Mark Mara wrote: »
    Yes – this is where I started. It compiles clean (using xmmc), but it displays “hello,world!”, “toggle cog has started” then hangs. It never starts flashing the led or displays the toggle count. I’ll reinstall simpleIDE and try again.

    What board type are you using?

    The demo will only work with EEPROM XMMC. This is not clear from the comments - sorry about that.
  • Mark MaraMark Mara Posts: 64
    edited 2013-06-20 06:45
    jazzed wrote: »
    What board type are you using?

    The demo will only work with EEPROM XMMC. This is not clear from the comments - sorry about that.

    I am using a C3. I was trying to run from flash. When I switch it over to EEPROM it now works.

    Thanks for your help.

    --markM
  • Mark MaraMark Mara Posts: 64
    edited 2013-08-04 07:37
    jazzed,

    If you are still monitoring this thread would you explain why the the demo (when compiled for xmmc) doesn't work using SimpleIDE using a board type C3F, but does work using EEPROM XMMC?

    I have switched over to building from the command line to keep moving on my project. That is working fine, but I would like to go back to using SimpleIDE if I could.
  • jazzedjazzed Posts: 11,803
    edited 2013-08-04 10:55
    The demo toggles all pins except the EEPROM and Serial port pins. On C3, the toggling causes the XMM access to break. If you change the pin toggling bits to not interfere with the C3 FLASH/SRAM, it would work there too. The IDE has nothing to do with it.
  • Mark MaraMark Mara Posts: 64
    edited 2013-08-04 11:38
    It does.

    Sorry to be so dense. Thanks
  • jazzedjazzed Posts: 11,803
    edited 2013-08-04 12:48
    Post your source here. Post the build output here from SimpleIDE and from the command-line tools.
  • jazzedjazzed Posts: 11,803
    edited 2013-08-04 21:25
    Does this have anything to do with the xmmc eeprom driver bug? If so, that fix has been committed to the release branch and will be part of the upcoming Education SimpleIDE release preview.
  • Mark MaraMark Mara Posts: 64
    edited 2013-08-05 04:58
    Mark Mara wrote: »
    It does.

    Sorry to be so dense. Thanks

    What I meant was it does work correctly after I changed the pin being toggled to just 15.
Sign In or Register to comment.