PEmicro's popular Multilink and Cyclone tools are supported in JetBrains' CLion IDE. CLion is a smart, cross-platform IDE for C and C++ that includes code assistance and generation, on the fly code analysis, safe refactoring, and an integrated debugger with many powerful features. PEmicro's plugin allows the user to debug a broad range of ARM devices from many silicon manufacturers. For the complete list of ARM devices that PEMicro supports, please visit the following page: http://www.pemicro.com/arm/. Below we have included a setup guide to get users up and running with PEmicro tools in CLion 2022.3.1 Build #CL-223.8214.51 running on Windows 10 Pro x64. 1. Install GNU Arm Embedded Toolchain Download and install the GNU Arm Embedded Toolchain. The default installation directory for GNU is similar to C:\Program Files (x86)\GNU Arm Embedded Toolchain\$version$\bin. In some cases, you may need to add this path to your PATH environmental variable. 2. Install PEmicro Plugin The PEmicro GDB plugin adds support for the latest PEmicro OpenSDA, Multilink, and Cyclone debug interfaces to the CLion IDE. Download the plugin and unzip the files to a folder. 3. Create Project Use STM32Cube MX to generate a project for your target device. The next step is to open the .ioc file in CLion, which automatically imports the project into the IDE. JetBrains has provided the following STM32CubeMX projects guide with directions. The target device in our guide is the ST NUCLEO-F446RE board based on STM32F446RE. Figure 1: Open the STM32CubeMX Project Click Build -> Build All In Debug. Figure 2: Build The Project 4. Create Run Configuration for PEmicro Interface The project requires a run configuration to debug with the PEmicro interface. JetBrains has provided the following Embedded GDB Server guide with directions. A) Click Run -> New Embedded Configuration and enter the path of pegdbserver_console.exe from the PEmicro plugin. The path in this example is C:\Users\Johnny\Downloads\com.pemicro.debug.gdbjtag.pne.updatesite-5.1.4-SNAPSHOT\win32\pegdbserver_console.exe. Then click Next. Figure 3: Create Run Configuration 1 Choose the correct communications mode (SWD/JTAG) and verify that the proper device is highlighted. Figure 4: Create Run Configuration 2 B) Click Run -> Edit Configuration to bring up the new configuration. The GDB Server args field contains the commands for the pegdbserver_console.exe. Modify this field to match your hardware setup and requirements. Then click OK. This example adds the following commands: Figure 5: Modify Run Configuration Commands The following is a list of available commands: -attachonly : Do not reset the device on connection (default OFF) -configfile=config.ini : Specify an ini file to read settings from. -corenum : Sets current device core. (defaults to 0) -cyclonepro_poweroffonexit=n : If n=1, the Multilink Universal FX and Cyclone will keep power on after the debug session has ended. -device=n : Specify the device name being debugged -devicelist : Displays list of valid device names -firmwareupdate=auto : Sets firmware update to: auto, force -gdbmiport=n : Enables GDB/MI interface, using port number n -interface=n : Specify PEmicro hardware interface. Valid values are USBMULTILINK, CYCLONE, or OPENSDA -kernel=OS : Enables kernel aware debugging for the specified OS (E.g., freertos). '-kernel=none' will disable kernel awareness. -osstackstructure=n : Specify a particular stack structure to use for each core. Format is [core number]:[stack structure]. For example: 1:freertos.v6m.v7m.no.vfp,2:freertos.v6m.v7m.no.vfp. Only used for operating system awareness. -port=n : Choose hardware number/ip/name/serialnumber n. For USB connections, "USB1" is the default. For Ethernet connections, the IP address should be specified. -resetdelay=n : Delay n milliseconds after reset. -serverip=n : Server TCP/IP IP address is nnn.nnn.nnn.nnn -serverport=n : Server TCP/IP port number is n (by default 7224) -showhardware : Shows list of autodetected PEmicro debug hardware/ports -showflashstatus : Show flash programming dialog during programming -singlesession : GDB Server will automatically close after GDB client disconnects -speed=n : Specifies debug shift frequency in KHz -startprogrammer=n : Launches Interactive PROG using port number n -startserver : Start the server listening for a connection from GDB -uncensorpassword=n : Attempts to uncensor processor with password n (hexadecimal) -use_cyclonepro_relays=n : If n=1, the Multilink Universal FX and Cyclone will provide power to the target. -useexternalip : Server TCP/IP IP address is the computer's IP address (instead of localhost) -usejtag : Sets the communication style to JTAG. (default OFF) -verbose : Displays messages of the debug and communications session 5. Debug Project Click Run -> Debug and then select the previously generated PEmicro Run configuration. CLion will enter Debug Mode and flash the project. The controls on the bottom left corner allow you to pause the program, step (F8), or run (F9). Figure 6: Debug the Project
-INTERFACE=USBMULTILINK -PORT=USB1
-Multilink_PowerDownDelay=250 -Multilink_PowerUpDelay=1000
-USE_CYCLONEPRO_RELAYS=1