MediaWiki API result

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "continue": {
        "gapcontinue": "Read_CSV_file_(Sample)",
        "continue": "gapcontinue||"
    },
    "query": {
        "pages": {
            "2025": {
                "pageid": 2025,
                "ns": 0,
                "title": "React on messages (Sample)",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "{| class=\"wikitable\" style=\"float:right; margin-left: 10px; background-color: #f9f9f9;\"\n! colspan=\"2\" style=\"font-weight:bold; font-size:17px; font-family:Arial, Helvetica, sans-serif !important;; background-color:#ceceff;\" | WIDGET_ReactOnMessages.c\n|-\n| colspan=\"2\" | [[File:WIDGET ReactOnMessages.gif | frame ]]\n|-\n| style=\"font-weight:bold; font-size:12px; font-family:Arial, Helvetica, sans-serif !important;;\" | File(s) required\n| style=\"font-size:12px; font-family:Arial, Helvetica, sans-serif !important;;\" | <div style=\"font-family: monospace,monospace;\">\n* WIDGET_ReactOnMessages.c\n</div>\n|-\n| style=\"font-weight:bold; font-size:12px; font-family:Arial, Helvetica, sans-serif !important;;\" | Runs in simulation\n| style=\"font-size:12px; font-family:Arial, Helvetica, sans-serif !important;;\" | Yes\n|-\n| style=\"font-weight:bold; font-size:12px; font-family:Arial, Helvetica, sans-serif !important;;\" | Runs on target\n| style=\"font-size:12px; font-family:Arial, Helvetica, sans-serif !important;;\" | Yes\n|-\n| style=\"font-weight:bold; font-size:12px; font-family:Arial, Helvetica, sans-serif !important;;\" | Download\n| style=\"font-size:12px; font-family:Arial, Helvetica, sans-serif !important;;\" | [https://wiki.segger.com/images/2/24/WIDGET_ReactOnMessages.c WIDGET_ReactOnMessages.c]\n|}\n\nThis sample demonstrates how the application can react on messages sent by widgets or windows.\n\n== Code ==\n\n<source lang=\"c\">\n/*********************************************************************\n*                    SEGGER Microcontroller GmbH                     *\n*        Solutions for real time microcontroller applications        *\n**********************************************************************\n*                                                                    *\n*        (c) 1996 - 2020  SEGGER Microcontroller GmbH                *\n*                                                                    *\n*        Internet: www.segger.com    Support:  support@segger.com    *\n*                                                                    *\n**********************************************************************\n\n** emWin V6.10 - Graphical user interface for embedded applications **\nemWin is protected by international copyright laws.   Knowledge of the\nsource code may not be used to write a similar product.  This file may\nonly  be used  in accordance  with  a license  and should  not be  re-\ndistributed in any way. We appreciate your understanding and fairness.\n----------------------------------------------------------------------\nFile        : WIDGET_ReactOnMessages.c\nPurpose     : Sample that shows how to react on different messages\n              from widgets.\nRequirements: WindowManager - (x)\n              MemoryDevices - ( )\n              AntiAliasing  - ( )\n              VNC-Server    - ( )\n              PNG-Library   - ( )\n              TrueTypeFonts - ( )\n---------------------------END-OF-HEADER------------------------------\n*/\n\n#include \"DIALOG.h\"\n\n/*********************************************************************\n*\n*       Defines\n*\n**********************************************************************\n*/\n#define BUTTON_SIZE 50\n\n/*********************************************************************\n*\n*       Static code\n*\n**********************************************************************\n*/\n\n/*********************************************************************\n*\n*       _cbWin\n*/\nstatic void _cbWin(WM_MESSAGE * pMsg) {\n  WM_HWIN    hButton;\n  int        Id;\n  int        NCode;\n  static int Clicked;\n\n  switch (pMsg->MsgId) {\n  case WM_CREATE:\n    Clicked = -1;\n    //\n    // Create a button\n    //\n    hButton = BUTTON_CreateEx(10, 10, BUTTON_SIZE, BUTTON_SIZE, pMsg->hWin, WM_CF_SHOW, 0, GUI_ID_BUTTON0);\n    break;\n  case WM_PAINT:\n    GUI_SetBkColor(GUI_WHITE);\n    GUI_Clear();\n\n    GUI_SetColor(GUI_BLACK);\n    if (Clicked == 1) {\n      GUI_DispStringAt(\"The button has been clicked.\", 10, 70);\n    } else if (Clicked == 0) {\n      GUI_DispStringAt(\"The button has been released.\", 10, 70);\n    }\n    break;\n  case WM_NOTIFY_PARENT:          // Catches notifications of all widgets within this window\n    Id = WM_GetId(pMsg->hWinSrc); // Get ID of source window that sent the message (button)\n    NCode = pMsg->Data.v;         // Data.v contains the notification code\n    switch (Id) {\n    case GUI_ID_BUTTON0:\n      switch (NCode) {\n      case WM_NOTIFICATION_CLICKED: // When the widget has been touched\n        Clicked = 1;\n        WM_InvalidateWindow(pMsg->hWin);\n        break;\n      case WM_NOTIFICATION_RELEASED: // When the widget has been released\n        Clicked = 0;\n        WM_InvalidateWindow(pMsg->hWin);\n        break;\n      }\n      break;\n    }\n    break;\n  default:\n    WM_DefaultProc(pMsg);\n    break;\n  }\n}\n\n/*********************************************************************\n*\n*       Public code\n*\n**********************************************************************\n*/\n/*********************************************************************\n*\n*       MainTask\n*/\nvoid MainTask(void) {\n  //\n  // Init emWin.\n  //\n  GUI_Init();\n  //\n  // Create parent window.\n  //\n  WM_CreateWindow(0, 0, LCD_GetXSize(), LCD_GetYSize(), WM_CF_SHOW, _cbWin, 0);\n\n  while (1) {\n    GUI_Delay(100);\n  }\n}\n\n/*************************** End of file ****************************/\n</source>"
                    }
                ]
            },
            "326": {
                "pageid": 326,
                "ns": 0,
                "title": "Read-Modify-Write Flash",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "This article describes how to use the '''Read-Modify-Write (RMW)''' function in the J-Link software. This article assumes that there is already a basic knowledge about flash programming in general. \nBy default the Read-Modify-Write threshold is set to 1 KiB in order to allow read-modify-write of single bytes in flash (e.g. when editing bytes in memory windows of IDEs).\nTo increase or decrease the threshold J-Link offers the following command string: [[J-Link_Command_Strings#SetFlashDLNoRMWThreshold | ''SetFlashDLNoRMWThreshold = <value>'']]\n{{Note|RMW will only be executed if the memory to be written is smaller than the RMW value. This also means:\n* Setting the RMW to <tt>0x0</tt>, will disable read modify write entirely\n* Setting it to <tt>0xFFFFFFFF</tt> will result in RMW to be always used}}\n__TOC__\n\n== Use Case 1 ==\nThis example assumes that a bootloader is already present in the sector in which the sample application is to be downloaded.\nThe memory of bootloader and application is not overlapping so the application can be added to the same sector as the bootloader, without overwriting the bootloader, assuming the correct RMW value is set.\n\n=== Assumptions ===\n{| class=\"wikitable\"\n! Description          || Location                   || Size\n|-\n| First sector         || 0x0000_0000 to 0x0000_FFFF || 0x10000 bytes\n|-\n| Bootloader location  || 0x0000_0000 to 0x0000_3FFF || 0x4000 bytes (already in flash)\n|-\n| Application location || 0x0000_4000 to 0x0000_FFFF || 0xC000 bytes (to be downloaded)\n|-\n|}\n\n=== Determining the correct value for RMW ===\nTo make sure RMW will be used when setting <tt>SetFlashDLNoRMWThreshold = <value></tt>, <value> has to be ApplicationSize + 1 '''or higher'''.\n\nTo cover the use case above <value> must be between <tt>0xC001</tt> and <tt>0xFFFFFFFF</tt>. E.g.:\n \"SetFlashDLNoRMWThreshold = 0xC001\"\nor\n \"SetFlashDLNoRMWThreshold = 0xFFFFFFFF\"\nwill both result in read modify write to be executed, and thus the bootloader and application will both be present in flash after downloading.\n\n== Use Case 2 ==\nAssumptions:\n* RMW value is set to default (0x400)\n* Flash has 2 * 1 KiB sectors\n* Debugger writes 512 bytes\nJ-Link will perform a read-modify-write on the first sector, preserving contents of 512 - 1023 bytes.\nThe Second sector is left untouched.\n\n== Use Case 3 ==\n* RMW value is set to default (0x400)\n* Flash has 2 * 1 KiB sectors\n* Debugger writes 1280 bytes\nJ-Link will erase + program 1 KiB of first sector.<br>\nJ-Link will erase + program 256 bytes of second sector.<br>\nPrevious 768 bytes from second sector are lost.<br>\nThe default makes sense for flash programming where old contents in remaining space of affected sectors are usually not needed anymore.\nWrites of < 1 KiB usually mean that the user is performing flash manipulation from within a memory window in a debugger to manipulate the application\nbehavior during runtime (e.g. by writing some constant data used by the application).\nIn such cases, it is important to preserve the remaining data in the sector to allow the application to further work correctly.<br>\n\n== RMW using J-Link Commander ==\nHow to execute a J-Link command string using the J-Link Commander is described in detail [[J-Link_Commander#Using_J-Link_Command_Strings | here]].\n=== Example ===\n exec SetFlashDLNoRMWThreshold = 0xFFFFFFFF // Always use read modify write.\n r\n loadfile App.hex\n\n== RMW using J-Link Script file ==\nHow to use J-Link script files is described in detail [[J-Link_script_files | here]].\n<source lang=\"c\">\nint HandleBeforeFlashProg(void) {\n JLINK_ExecCommand(\"SetFlashDLNoRMWThreshold = 0xFFFFFFFF\"); // Always use read modify write.\n return 0;\n}\n</source>\n\n== Sample project ==\nIn this section the RMW is explained with a couple of practical examples.\n\n=== XMC4xxx ===\nThe following project was designed for an Infineon XMC4500 MCU, but the procedure can be applied to any other MCU, too.\nIn case of the XMC4xxx MCUs, the physical memory sectors are split into smaller logical ones.\nThe .bat and .jlink file can be used as a reference for your own RMW flash projects.\n*[[Media:Wiki_J-LinkCommander_RMW_Example.zip | Wiki_J-LinkCommander_RMW_Example.zip]]\n\n=== How to ===\nFor the example project the ''SetFlashDLNoRMWThreshold'' value is set to ''0xFFFF'' (64 KiB RMW threshold).\nThis means that the J-Link DLL will perform a read-modify-write of flash memory regions <= 64 KiB.\nMake sure to adjust this value depending on the device and sector you are trying to modify.\n\nTo use the example project follow these steps:\n\n* Unzip the contents of the ''Wiki_J-LinkCommander_RMW_Example.zip'' to a example folder\n* execute StartTest.bat\n* The J-Link commander will open and you should see the following output\n[[File:Flash_Success.PNG|none|left]]\n* If your output matches the screenshot, the RMW was successful (this applies only to the example project, the output on your own project might vary)"
                    }
                ]
            }
        }
    }
}