Shop OBEX P1 Docs P2 Docs Learn Events
propeller-load save to SD card — Parallax Forums

propeller-load save to SD card

Hello!

Is everything working fine, I install a SD card and I can do all the examples.
I want saving to the SD card because I have a large program.
I´m working with a Raspberry, I tested in two models.
I´m using CMake to creat the ".elf" files.

With the memory model "lmm" everything is working, I see the Hello World!
I wrote:
make debug
or
/opt/parallax/bin/propeller-load -b activityboard GettingStarted.elf -r -t
with the file CMakeLists.txt:
cmake_minimum_required(VERSION 3.3)
find_package(PropWare REQUIRED)

project(GettingStarted)

set(MODEL lmm)
set_compile_flags()

create_simple_executable(${PROJECT_NAME} GettingStarted.cpp)

Now I change the memory model to
...
set(MODEL xmmc)
...

After:
cmake ..
make
I can´t do the
make debug

but I can use:
/opt/parallax/bin/propeller-load -b activityboard -l GettingStarted.elf -r -t

Everything seems fine! No warnings No errors! BUT NO HELLO WORLD!? :(
And I have in the SD card the file AUTORUN.PEX
pi@raspberrypi:~/PropellerProjects/PropWare/Examples/GettingStarted/bin $ /opt/parallax/bin/propeller-load -b activityboard -l GettingStarted.elf -r -t
Propeller Version 1 on /dev/ttyUSB0
Patching __cfg_txpin with 0000001e
Patching __cfg_baudrate with 0001c200
Loading the serial helper to hub memory
10392 bytes sent
Verifying RAM ... OK
Loading 'GettingStarted.pex' to SD card
5100 bytes sent
Loading sd_loader.elf to hub memory
16444 bytes sent
Verifying RAM ... OK
[ Entering terminal mode. Type ESC or Control-C to exit. ]
Loading SD driver
Loading cache driver
Initializing SD card
Mounting filesystem
Opening 'autorun.pex'
Starting kernel
Loading flash/EEPROM at 0x30000000
Stopping the SD driver
Starting program            [BUT NO HELLO WORLD]

Now I can write:
/opt/parallax/bin/propeller-load -b activityboard -l -r -t
Everything seems fine! No warnings No errors! BUT NO HELLO WORLD!? :(
pi@raspberrypi:~/PropellerProjects/PropWare/Examples/GettingStarted/bin $ /opt/parallax/bin/propeller-load -b activityboard -l -r -t
Propeller Version 1 on /dev/ttyUSB0
Loading sd_loader.elf to hub memory
16444 bytes sent
Verifying RAM ... OK
[ Entering terminal mode. Type ESC or Control-C to exit. ]
Loading SD driver
Loading cache driver
Initializing SD card
Mounting filesystem
Opening 'autorun.pex'
Starting kernel
Loading flash/EEPROM at 0x30000000
Stopping the SD driver
Starting program            [BUT NO HELLO WORLD]

Any sugestion for this issue?
Thanks
«13

Comments

  • Hmm... interesting. I'll start looking into this. I also recently picked up an Activity Board so I should be able to replicate your issue exactly.
  • Oh, just FYI, you can remove the "set_compile_flags()" line. That was only needed in conjunction with "add_library()"
  • Can you please post the .elf file you're trying to load?
  • ASAS Posts: 149
    DavidZemon wrote: »
    Hmm... interesting. I'll start looking into this. I also recently picked up an Activity Board so I should be able to replicate your issue exactly.

    I take a foto with my propeller kit with the SD, I just choose the activityboard because I think that is the same!

    The file activityboard.cfg I don´t had change nothing:
    # Propeller activity board configuration.
    # IDE:SDXMMC
        clkfreq: 80000000
        clkmode: XTAL1+PLL16X
        baudrate: 115200
        rxpin: 31
        txpin: 30
        cache-driver: eeprom_cache.dat
        cache-size: 8K
        cache-param1: 0
        cache-param2: 0
        eeprom-first: TRUE
        sd-driver: sd_driver.dat
        sdspi-do: 22
        sdspi-clk: 23
        sdspi-di: 24
        sdspi-cs: 25
    

    About the "set_compile_flags()", Thanks!! (only for libraries :thumb: )
    I already try without them and I get the same result.
    I hope you can give any help.
    1755 x 561 - 235K
    foto.jpg 235.3K
  • ASAS Posts: 149
    edited 2016-02-13 22:21
    David Betz wrote: »
    Can you please post the .elf file you're trying to load?

    Thanks for your help.

    I send the file attached, I save it inside the rar because the forum don´t accept the .elf file.
  • AS wrote: »
    David Betz wrote: »
    Can you please post the .elf file you're trying to load?

    Thanks for your help.

    I send the file attached, I save it inside the rar because the forum don´t accept the .elf file.
    Can you post it as a .zip or .tar file? I don't have an application that can open a .rar file.

  • ASAS Posts: 149
    I attached the .zip file.
  • ASAS Posts: 149
    I was thinking about the "activityboard.cfg", I have only a EEPROM of 32kb and activity board have 64kb. I need change this file?
  • AS wrote: »
    I was thinking about the "activityboard.cfg", I have only a EEPROM of 32kb and activity board have 64kb. I need change this file?
    Yes, it does. You must have at least a 64k EEPROM to use the EEPROM cache driver. It won't work with a 32k EEPROM.

  • AS wrote: »
    I attached the .zip file.
    Thanks for posting this. Can you tell me what version of PropGCC you're using? Is it the old one that comes with SimpleIDE or a newer build?

  • I've been reading over this thread and I'm not sure what you're trying to do. Do you want to run a large program directly from the SD card or do you want to run it from EEPROM? You don't need a 64k EEPROM to use the SD cache driver. you only need it for the EEPROM cache driver.
  • ASAS Posts: 149
    I´m using the PropGCC version that comes with SimpleIDE for Raspberry.

    OK! sorry!
    I want use a large program directly from the SD card. In this case is not important the EEPROM if it is 32 or 64kb?
    I read something about the driver to open the "autorun.pex" and I thought that the size of EEPROM could be important!

    Thanks!

  • AS wrote: »
    I´m using the PropGCC version that comes with SimpleIDE for Raspberry.

    OK! sorry!
    I want use a large program directly from the SD card. In this case is not important the EEPROM if it is 32 or 64kb?
    I read something about the driver to open the "autorun.pex" and I thought that the size of EEPROM could be important!

    Thanks!
    Thanks. I'm building release_1_0 so I can test this. I've mostly been working on a much more recent version of propgcc lately.

  • I'm not sure what's going wrong with this program. I tried just loading and running it and it doesn't seem to print anything. I did this on a real ActivityBoard with a 64k EEPROM. What is it supposed to do?
    david-betzs-macbook-pro:Downloads dbetz$ propeller-load -b activityboard GettingStarted.elf -r -t
    Propeller Version 1 on /dev/cu.usbserial-PAYMDDM
    Patching __cfg_txpin with 0000001e
    Patching __cfg_baudrate with 0001c200
    Loading the serial helper to hub memory
    10392 bytes sent                  
    Verifying RAM ... OK
    Loading cache driver 'eeprom_cache.dat'
    1532 bytes sent                  
    Loading program image to flash
    3052 bytes sent                  
    Loading .xmmkernel
    1732 bytes sent                  
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    
  • ASAS Posts: 149
    The program is a simple "Hello World":
    #include <PropWare/printer/printer.h>
    
    /**
     * @example     GettingStarted.cpp
     *
     * Print some text to the terminal. A great place to start with PropWare to ensure your environment is functional!
     *
     * @include GettingStarted/CMakeLists.txt
     */
    int main () {
        pwOut << "Hello, world!";
        return 0;
    }
    

  • ASAS Posts: 149
    The same program with memory model "lmm" is working great.

    in this case I type:
    /opt/parallax/bin/propeller-load -b activityboard GettingStarted.elf -r -t
    
    and it works!

    I attached a .zip (of a .elf file) with the same program compiled in lmm mode.
  • ASAS Posts: 149
    edited 2016-02-14 17:26
    The 1st .elf I sent was built with "xmmc" memory model.
    To save the "AUTORUN.PEX" to the SD card I should write:
    /opt/parallax/bin/propeller-load -b activityboard -l GettingStarted.elf -r -t
    
    It´s necessary the "-l"? Right? To save the program to the SD card in the mode "xmmc"?

    and I obtain the result:
    pi@raspberrypi:~/PropellerProjects/PropWare/Examples/GettingStarted/bin $ /opt/parallax/bin/propeller-load -b activityboard -l GettingStarted.elf -r -t
    Propeller Version 1 on /dev/ttyUSB0
    Patching __cfg_txpin with 0000001e
    Patching __cfg_baudrate with 0001c200
    Loading the serial helper to hub memory
    10392 bytes sent
    Verifying RAM ... OK
    Loading 'GettingStarted.pex' to SD card
    5100 bytes sent
    Loading sd_loader.elf to hub memory
    16444 bytes sent
    Verifying RAM ... OK
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    Loading SD driver
    Loading cache driver
    Initializing SD card
    Mounting filesystem
    Opening 'autorun.pex'
    Starting kernel
    Loading flash/EEPROM at 0x30000000
    Stopping the SD driver
    Starting program                                   BUT NO HELLO WORLD
    



    At this moment I already have the "AUTORUN.PEX" file in the SD card.

    I write:
    /opt/parallax/bin/propeller-load -b activityboard -l -r -t
    

    and the result is similar, no "Hello World":
    pi@raspberrypi:~/PropellerProjects/PropWare/Examples/GettingStarted/bin $ /opt/parallax/bin/propeller-load -b activityboard -l -r -t
    Propeller Version 1 on /dev/ttyUSB0
    Loading sd_loader.elf to hub memory
    16444 bytes sent
    Verifying RAM ... OK
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    Loading SD driver
    Loading cache driver
    Initializing SD card
    Mounting filesystem
    Opening 'autorun.pex'
    Starting kernel
    Loading flash/EEPROM at 0x30000000
    Stopping the SD driver
    Starting program                                    BUT NO HELLO WORLD
    
  • David BetzDavid Betz Posts: 14,516
    edited 2016-02-14 18:35
    Something odd is going on. I tried your program on a C3 board it didn't work there either. Then I tried this program:
    #include <stdio.h>
    
    int main(void)
    {
        printf("Hello, world!\n");
        for (;;)
            ;
        return 0;
    }
    
    And it works fine with both the EEPROM cache driver and the C3 cache driver.
    david-betzs-macbook-pro:Downloads dbetz$ propeller-load -b activityboard hello.elf -r -t
    Propeller Version 1 on /dev/cu.usbserial-A8004ILf
    Loading the serial helper to hub memory
    10392 bytes sent                  
    Verifying RAM ... OK
    Loading cache driver 'eeprom_cache.dat'
    1532 bytes sent                  
    Loading program image to flash
    4048 bytes sent                  
    Loading .xmmkernel
    1736 bytes sent                  
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    Hello, world!
    
  • David Betz wrote: »
    Something odd is going on. I tried your program on a C3 board it didn't work there either. Then I tried this program:
    #include <stdio.h>
    
    int main(void)
    {
        printf("Hello, world!\n");
        for (;;)
            ;
        return 0;
    }
    
    And it works fine with both the EEPROM cache driver and the C3 cache driver.
    david-betzs-macbook-pro:Downloads dbetz$ propeller-load -b activityboard hello.elf -r -t
    Propeller Version 1 on /dev/cu.usbserial-A8004ILf
    Loading the serial helper to hub memory
    10392 bytes sent                  
    Verifying RAM ... OK
    Loading cache driver 'eeprom_cache.dat'
    1532 bytes sent                  
    Loading program image to flash
    4048 bytes sent                  
    Loading .xmmkernel
    1736 bytes sent                  
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    Hello, world!
    
    Could it be that you need a delay at the end to see the output? I'm not sure why that would be required in XMMC mode but not LMM mode though.

  • ASAS Posts: 149
    With LMM mode everything is working ok with me too, I see the "Hello World".

    The issue is when I compile in XMMC mode and try to upload to Propeller, using the SD Loader (-l) or SD CacheDriver (-z).
    I already made several tests and the Propeller don´t run the program. I try the delay too, but nothing.
  • AS wrote: »
    With LMM mode everything is working ok with me too, I see the "Hello World".

    The issue is when I compile in XMMC mode and try to upload to Propeller, using the SD Loader (-l) or SD CacheDriver (-z).
    I already made several tests and the Propeller don´t run the program. I try the delay too, but nothing.
    Can you try the simple program I posted a few messages ago and let me know if that works for you?

  • David Betz wrote: »
    AS wrote: »
    With LMM mode everything is working ok with me too, I see the "Hello World".

    The issue is when I compile in XMMC mode and try to upload to Propeller, using the SD Loader (-l) or SD CacheDriver (-z).
    I already made several tests and the Propeller don´t run the program. I try the delay too, but nothing.
    Can you try the simple program I posted a few messages ago and let me know if that works for you?
    Here is the output I get when I use -z on a real ActivityBoard with the version of PropGCC that comes with SimpleIDE:
    david-betzs-macbook-pro:Downloads dbetz$ propeller-load -b activityboard -z hello.elf -r -t
    Propeller Version 1 on /dev/cu.usbserial-PAYMDDM
    Loading the serial helper to hub memory
    10392 bytes sent                  
    Verifying RAM ... OK
    Loading 'hello.pex' to SD card
    6096 bytes sent                  
    Loading sd_cache_loader.elf to hub memory
    14232 bytes sent                  
    Verifying RAM ... OK
    [ Entering terminal mode. Type ESC or Control-C to exit. ]
    Loading cache driver
    Initializing SD card
    Mounting SD filesystem
    Opening AUTORUN.PEX
    Loading kernel
    Loading cluster map
    Initializing cache
    Starting program
    Hello, world!
    

  • ASAS Posts: 149
    edited 2016-02-14 21:20
    ok! with the code you send me it works!!! :D

    Really thanks!

    but I can´t understand why :D

    I should write in the code something like:
    ...
        for (;;)
            ;
        return 0;
    }
    

    with a "while(1)" I should write it in every cycle?
    Ok I will test it!
    thanks!
  • David BetzDavid Betz Posts: 14,516
    edited 2016-02-14 21:39
    The problem is that when main() exits it shuts down the COG and prevents any buffered output from being sent over the serial interface.
  • ASAS Posts: 149
    Thanks a lot!

    Is not easy to me really understand.
    But I will test it.
  • AS wrote: »
    Thanks a lot!

    Is not easy to me really understand.
    But I will test it.
    To be honest, I don't understand why this happens with the XMMC memory model but not with LMM either.

  • ASAS Posts: 149
    Exactly. :)

    I trying to understand how is the best way to deal with that.
  • Is this really a problem? Any real program will probably not just print a line of text and immediately exit. Normally, a program sits in a loop monitoring events and reacting to them. In fact, most microcontroller programs never exit from main() at all. The empty loop I put at the end of my example simulates the event handling loop that would normally be in any Propeller program.
  • ASAS Posts: 149
    edited 2016-02-14 23:13
    ok!

    But with this example I have the same issue:
    #include "simpletools.h"                                       
    
    int main(void)                                   
    {
    
      int Led_Intensity=0;
      pwm_start (1000);
    
      while(1)                                    // Endless loop
      {
        
        while (Led_Intensity<1000)
        {
          pwm_set (0,1,Led_Intensity);
          Led_Intensity ++;
          pause (1);
        }  
        
              
        while (Led_Intensity>0)
        {
          pwm_set (0,1, Led_Intensity);
          Led_Intensity --;
          pause (1);
        } 
         
    
      }
    
    }
    

    the led don´t react in XMMC mode.
    with LMM everything ok, with XMMC don´t work.
  • AS wrote: »
    ok!

    But with this example I have the same issue:
    #include "simpletools.h"                                       
    
    int main(void)                                   
    {
    
      int Led_Intensity=0;
      pwm_start (1000);
    
      while(1)                                    // Endless loop
      {
        
        while (Led_Intensity<1000)
        {
          pwm_set (0,1,Led_Intensity);
          Led_Intensity ++;
          pause (1);
        }  
        
              
        while (Led_Intensity>0)
        {
          pwm_set (0,1, Led_Intensity);
          Led_Intensity --;
          pause (1);
        } 
         
    
      }
    
    }
    

    the led don´t react in XMMC mode.
    with LMM everything ok, with XMMC don´t work.
    Well, this is certainly a different problem as you suggest. I'm afraid I'm not familiar with the PWM functions. I'll let someone else who is more familiar with the Simple Libraries answer this one.

Sign In or Register to comment.