Shop OBEX P1 Docs P2 Docs Learn Events
Catalina - ANSI C for the Propeller 1 & 2 - Page 15 — Parallax Forums

Catalina - ANSI C for the Propeller 1 & 2

191011121315»

Comments

  • RossHRossH Posts: 5,416

    Just a couple of notes on using the 2-port and 8-port serial plugins in Propeller 2 XMM programs.

    1. The default pins for the second serial port are 52 & 50. However, these defaults WILL conflict with the pins used for PSRAM on the P2-EC32MB, and MAY conflict with the pins used for the HyperFlash/HyperRAM add-on board on other P2 EVAL or P2 EDGE boards. To use these plugins in an XMM program, change the pins to something else in the relevant Platform configuration file (e.g. P2_EDGE.inc or P2_EVAL.inc). Set both the tx and rx pins to -1 to disable the second port altogether.
    2. Apparently, the 2-port serial plugin works in both XMM SMALL and LARGE programs, but the 8-port serial plugin only works in XMM SMALL programs (and in non-XMM programs, of course). I have confirmed this, but it looks like it needs more than a simple configuration change, so I will need to investigate further and fix it in a future release.

    Ross.

  • RossHRossH Posts: 5,416

    Another d'oh! moment ...

    Unlike the 2 port serial plugin, the 8 port auto-initialize process (which automatically opens any ports defined in the platform configuration file) uses static data buffers, not local data buffers. In a SMALL XMM program, all data (static or local) is in Hub RAM so everything works, but in a LARGE XMM program, static data is in XMM RAM not Hub RAM, and this is out of reach of the plugin.

    A simple workaround is to manually close any auto-initialized ports (or disable the auto-initialize functionality in the relevant Platform file by setting the tx and rx pins to -1) and open them manually using local data buffers.

    I thought it must be something like this, but my d'oh moment was that the program I used to try and test it (demos/test_serial8_2.c) closes the auto-initialized ports, but then re-opens them using more static data buffers :(

    I will fix both the auto-initialize functionality and the test program in the next release.

    Ross.

  • RossHRossH Posts: 5,416

    Catalina 7.6.2 has been released here.

    No major new functionality, just fixes for a few more issues. It is a full release because it requires a rebuild of all the C libraries.

    Here is the relevant extract of the README.TXT file:

    RELEASE 7.6.2
    
    New Functionality
    -----------------
    
    1. Two new catapult multi-model demo programs have been added, which
       demonstrate a threaded secondary program being executed from an XMM 
       primary program (which would not support multi-threading if it was 
       compiled as a simple XMM program). See demos\catapult\thread_p1.c and 
       demos\catapult\thread_p2.c - note that the 'build_utilities' script
       must be used to build an XMM loader suitable to load them.
    
    2. The default pins used for the second serial port when the 2 port or 8 
       port serial plugins were in use (pins 50 & 52) conflicted with the pins 
       used for the PSRAM on the P2-EC32MB, and may conflict with the pins 
       used for the HyperFlash/HyperRAM add-on board, which made these plugins 
       unusable in XMM programs. The second port has now been disabled by 
       default by setting the tx and rx pins to -1 on all P2 platforms.
    
    Other Changes
    -------------
    
    1. Fixed a problem with Catapult when a secondary program required threads
       - e.g. the secondary pragma included "options(-lthreads)" - but the 
       primary program did not - the secondary program was being compiled to use 
       the threads library but was being started using the non-threaded kernel
       and thus would not execute correctly. Affected the Propeller 1 and 
       Propeller 2 under Windows and Linux.
    
    2. Fixed a bug in the XMM dynamic kernel, which broke the start.c program in
       the demos\p2_psram folder, which needs to load the XMM kernel dynamically.
       This was the only program that uses that particular version of the kernel. 
       Also, the Makefile referred to the target directory using a relative 
       reference, which only worked if the programs were built in the installed 
       source tree. Affected the Propeller 2 only under Windows and Linux.
    
    3. The 8 port serial plugin "autoinitialize" functionality, which opens any
       ports defined in the relevant platform file (e.g. P2EDGE.inc, P2EVAL.inc 
       etc) was allocating buffers using static data, not local data. This meant 
       that the plugin would not work an XMM LARGE program (it worked in all 
       other memory models, including XMM SMALL programs). Affected the Propeller
       2 only under Windows, Linux and Catalyst.
    
    4. The 8 port serial plugin test program (demos/test_serial8_2.c) was opening
       ports using static data buffers instead of local buffers, and so it would
       not work in XMM LARGE mode (it worked in all other memory models, including 
       XMM SMALL programs). Now it uses local buffers and works in all modes. Also, 
       the default pin numbers for the second port are now 18 (tx) and 20 (rx).
       Affected the Propeller 2 only under Windows, Linux and Catalyst.
    
  • RossHRossH Posts: 5,416

    Another d'oh moment :( ...

    The current version of catapult can't be used with the parallelizer because it strips out #pragma statements it doesn't understand. This means when the parallelizer runs (which also relies on pragmas), it thinks it has nothing to do. Silly of me.

    The next version will still warn about unrecognized pragmas but will leave them in the source, so that catapult can be used to build parallelized programs simply by adding the appropriate options to the the relevant pragmas.

    I will include a working demo in the next release.

    Ross.

  • RossHRossH Posts: 5,416

    Catalina 7.6.3 has been released here.

    No major new functionality, mainly just tweaks to allow Catapult to work with the Parallelizer.

    The Catapult documentation has also been revised and expanded - see Getting Started with Catapult.

    Here is the relevant extract of the README.TXT file:

    RELEASE 7.6.3
    
    New Functionality
    -----------------
    
    1. The Catalina Catapult utility now ignores pragmas it does not recognize,
       but leaves them intact. Only one warning message is now issued (for the 
       first such pragma) even if there are multiple unrecognised pragmas. This 
       allows primary and secondary programs to use the Catalina parallelizer.
    
    2  Four new demo programs are now included (in demos\catapult) for the
       Propeller 1 and 2 to demonstrate the use of the Catalina parallelizer 
       with Catapult:
    
       For the Propeller 1:
          ll_p_p1.c - Demonstrates a parallelized primary program.
          ll_s_p1.c - Demonstrates a parallelized secondary program.
    
       For the Propeller 2:
          ll_p_p2.c - Demonstrates a parallelized primary and secondary program.
          ll_s_p2.c - Demonstrates two parallelized secondary programs.
    
    3. The Catalina parallelizer utility now unregisters the factory kernel cogs 
       when they are stopped via the "#pragma propeller stop" pragma. Previously 
       these cogs were stopped but not unregistered.
    
    4. The Catalina catapult utility now unregisters the secondary kernel cog 
       when a secondary program terminates by exiting its function. Previously, 
       these cogs were stopped but not unregistered.
    
    5. On the Propeller 1, the cache cog is now registered when used. This means
       the registry is displayed correctly, and that this cog is correctly marked
       as being in use if a program wants to search the registry to locate an 
       unused cog (normally, ANY_COG is used to start a new cog, which does not
       depend on whether or not the cog was registered). This was already the 
       case on the Propeller 2.
    
    Other Changes
    -------------
    
    1. The Catalina Geany command to build utilities did not specify that it
       should run in the project directory, not the current directory. The 
       version in this release fixes this for all new installations of Geany, 
       but it may not fix it for existing versions of Geany or existing projects.
    
       For existing versions of Geany, select the "Build -> Set Build Commands" 
       menu item, and add %p to the "Working Directory" field of the "Build 
       Utilities" command. 
    
       For existing project files, open the project and select the "Project -> 
       Properties" menu item, then select the "Build" tab and add %p to the 
       "Working Directory" field of the "Build Utilities" command.
    
       Affected the Propeller 1 and Propeller 2 on Windows and Linux.
    
    2. Fixed a bug that may have led to some symbols being defined multiple
       times in complex parallelized or multi-model programs.
    
       The symbols that may have ended up multiply defined were:
          cmmd_array, lmmd_array, nmmd_array (on the Propeller 1 & 2), and
          CMM_LUT_LIBRARY_array, LMM_LUT_LIBRARY_array and NMM_LUT_LIBRARY_array
          (on the Propeller 2 only).
    
       Affected the Propeller 1 and Propeller 2 under Catalyst, Windows and Linux.
    
    3. Some superseded, unused (and undocumented) functions have been removed 
       from the threads libraries:
    
          _threadstart_CMM() and _threadstart_CMM_cog()
          _threadstart_LMM() and _threadstart_LMM_cog()
          _threadstart_NMM() and _threadstart_NMM_cog()
    
       The following functions should be used instead:
    
          _threaded_cogstart_CMM_cog()
          _threaded_cogstart_LMM_cog()
          _threaded_cogstart_NMM_cog()
    
       Affected the Propeller 1 and Propeller 2 under Catalyst, Windows and Linux.
    
    4. The example of using the Catalina Parallelizer with the Propeller version 
       of gcc was incorrectly modified to include Catalina's "prop2.h" rather 
       than gcc's "propeller2.h", which prevented it compiling.
    
Sign In or Register to comment.