Close



Results 1 to 1 of 1
  1. #1
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182

    M99 Free Memory Watcher function for debug

    Attached is the M99 Free Memory Watcher function. It is primarily for developers, but if you are doing something where you are worried that you are running out of memory, this will help confirm or dismiss that concern.

    Put the attached file in your Marlin code directory. And then make these three changes to your code base:

    In Marlin_Main.cpp you need to add a declaration up at the top somewhere saying:

    Code:
    #ifdef M99_FREE_MEMORY_WATCHER
    void m99_code();
    #endif
    and then I put the actual call to it just above the M48 case: statement:

    Code:
    #ifdef M99_FREE_MEMORY_WATCHER
    case 99: m99_code();
    break;
    #endif
    // M48 Z-Probe repeatability measurement function
    And then in Configuration.h you need 1 line to control the option:

    Code:
    //
    // M99 Free Memory Watcher
    //
    #define M99_FREE_MEMORY_WATCHER // uncomment to add the M99 Free Memory Watcher for debug purpose
    There are instructions for its use at the top of the M99_Free_Mem_Chk.cpp file. They are repeated here:

    Code:
    // M99 Free Memory Watcher     
    //
    // This code watches the free memory block between the bottom of the heap and the top of the stack.
    // This memory block is initialized and watched via the M99 command.
    //
    // M99 I   Initializes the free memory block and prints vitals statistics about the area
    // M99 F   Identifies how much of the free memory block remains free and unused.  It also
    //         detects and reports any corruption within the free memory block that may have
    //         happened due to errant firmware.
    // M99 D   Does a hex display of the free memory block along with a flag for any errant
    //         data that does not match the expected value. 
    // M99 C x Corrupts x locations within the free memory block.   This is useful to check the
    //         correctness of the M99 F and M99 D commands.
    Attached Files Attached Files
    Last edited by Roxy; 07-05-2015 at 02:25 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •