elmot / clion-embedded-arm Goto Github PK
View Code? Open in Web Editor NEWOpenOCD + STM32CubeMX support for CLion
Home Page: https://blog.jetbrains.com/clion/2017/12/clion-for-embedded-development-part-ii
License: Other
OpenOCD + STM32CubeMX support for CLion
Home Page: https://blog.jetbrains.com/clion/2017/12/clion-for-embedded-development-part-ii
License: Other
explaining how to handle cmake file generation
ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); if (toolWindowManager.canShowNotification(toolWindowId)) { //noinspection SSBasedInspection toolWindowManager.notifyByBalloon(toolWindowId, ...); }
where toolWindowId
can be one of com.intellij.openapi.wm.ToolWindowId
or a custom tool window
xyz.elmot.clion.openocd.OpenOcdLauncher has an anonymous class which implicitly keeps his outer class. That might be a memory leak, according to #20
TODO: Check from IntelliJ guys if it is the real memory leak.
null
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.execution.process.ProcessHandler$5.invoke(ProcessHandler.java:239)
at com.sun.proxy.$Proxy19.onTextAvailable(Unknown Source)
at com.intellij.execution.process.ProcessHandler.notifyTextAvailable(ProcessHandler.java:213)
at com.intellij.execution.process.BaseOSProcessHandler$SimpleOutputReader.onTextAvailable(BaseOSProcessHandler.java:295)
at com.intellij.util.io.BaseOutputReader.sendText(BaseOutputReader.java:202)
at com.intellij.util.io.BaseOutputReader.processInput(BaseOutputReader.java:186)
at com.intellij.util.io.BaseOutputReader.readAvailableBlocking(BaseOutputReader.java:140)
at com.intellij.util.io.BaseDataReader.readAvailable(BaseDataReader.java:85)
at com.intellij.util.io.BaseDataReader.doRun(BaseDataReader.java:163)
at com.intellij.util.io.BaseDataReader$1$1.run(BaseDataReader.java:66)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:194)
at com.intellij.util.io.BaseDataReader$1.run(BaseDataReader.java:63)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Result is already set
at com.intellij.util.concurrency.FutureResult.assertNotSet(FutureResult.java:62)
at com.intellij.util.concurrency.FutureResult.set(FutureResult.java:37)
at xyz.elmot.clion.openocd.OpenOcdComponent$DownloadFollower.onTextAvailable(OpenOcdComponent.java:192)
... 20 more
Move Board Config File
and any future OpenOCD configuration from File->Settings->Build, Execution, Deployment->OpenOCD Support
to Run/Debug Configurations->OpenOCD Download & Run
to allow fast switching between targets or interfaces or both.
The icons should be done after shape of electronic chips, or embedded devices, or small CPU, or any electric circuit. Desired format: PNG or vector.
Existing examples:
https://github.com/elmot/clion-embedded-arm/tree/master/resources/xyz/elmot/clion/openocd
use <projectConfigurable order="last" .../>
after downloading firmware
Debug normally.
Shows Firmware Download Success
, but File Format not recognized
as below:
And my gdb and openocd seems fine as below:
➜ openocd-bin-0.10.0-MacOS file /usr/local/bin/arm-none-eabi-gdb
/usr/local/bin/arm-none-eabi-gdb: Mach-O 64-bit executable x86_64
➜ openocd-bin-0.10.0-MacOS file local/bin/openocd
local/bin/openocd: Mach-O 64-bit executable x86_64
Run OpenOCD
result:
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : tcl server disabled
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : STLINK v2 JTAG v22 API v2 SWIM v5 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.266974
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
If I missed any settings ?
CMakeLists.txt
SET(CMAKE_SYSTEM_NAME Generic)
SET(CMAKE_SYSTEM_VERSION 1)
cmake_minimum_required(VERSION 3.7)
# specify the cross compiler
SET(CMAKE_C_COMPILER_WORKS 1)
SET(CMAKE_C_COMPILER arm-none-eabi-gcc)
SET(CMAKE_CXX_COMPILER arm-none-eabi-g++)
SET(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}/STM32F401RETx_FLASH.ld)
#Uncomment for hardware floating point
#SET(FPU_FLAGS "-mfloat-abi=hard -mfpu=fpv4-sp-d16")
#add_definitions(-DARM_MATH_CM4 -DARM_MATH_MATRIX_CHECK -DARM_MATH_ROUNDING -D__FPU_PRESENT=1 )
#Uncomment for software floating point
#SET(FPU_FLAGS "-mfloat-abi=soft")
SET(COMMON_FLAGS "-mcpu=cortex-m4 ${FPU_FLAGS} -mthumb -mthumb-interwork -ffunction-sections -fdata-sections -g -fno-common -fmessage-length=0 -specs=nosys.specs -specs=nano.specs")
SET(CMAKE_CXX_FLAGS_INIT "${COMMON_FLAGS} -std=c++11")
SET(CMAKE_C_FLAGS_INIT "${COMMON_FLAGS} -std=gnu99")
SET(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-gc-sections -T ${LINKER_SCRIPT}")
PROJECT(f4-blog C ASM)
set(CMAKE_CXX_STANDARD 11)
#add_definitions(-DARM_MATH_CM4 -DARM_MATH_MATRIX_CHECK -DARM_MATH_ROUNDING -D__FPU_PRESENT=1 )
add_definitions(-D__weak=__attribute__\(\(weak\)\) -D__packed=__attribute__\(\(__packed__\)\) -DUSE_HAL_DRIVER -DSTM32F401xE )
file(GLOB_RECURSE SOURCES "startup/*.*" "Drivers/*.*" "Src/*.*" "Inc/*.*")
include_directories(Inc Drivers/STM32F4xx_HAL_Driver/Inc Drivers/STM32F4xx_HAL_Driver/Inc/Legacy Drivers/CMSIS/Device/ST/STM32F4xx/Include Drivers/CMSIS/Include)
add_executable(${PROJECT_NAME}.elf ${SOURCES} ${LINKER_SCRIPT})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Map=${PROJECT_BINARY_DIR}/${PROJECT_NAME}.map")
set(HEX_FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.hex)
set(BIN_FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.bin)
add_custom_command(TARGET ${PROJECT_NAME}.elf POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${PROJECT_NAME}.elf> ${HEX_FILE}
COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${PROJECT_NAME}.elf> ${BIN_FILE}
COMMENT "Building ${HEX_FILE}
Building ${BIN_FILE}")
add_custom_target(UPLOAD
arm-none-eabi-gdb -iex "target remote tcp:127.0.0.1:3333"
-iex "monitor program $<TARGET_FILE:${PROJECT_NAME}.elf>"
-iex "monitor reset init"
-iex "disconnect" -iex "quit")
Can the plugin detect automatically the platform (Linux or Windows) and set default platform path for OpenOCD ? Don't know if a standard path exist for OpenOCD installation on Windows.
Default to Linux (/usr)
Selected configuration can be acquired via
com.jetbrains.cidr.cpp.execution.CMakeAppRunConfiguration.BuildAndRunConfigurations#getRunConfiguration
Toolchain via CMakeWorkspace.getEnvironmentFor(cmakeConfiguration).getToolchain()
Hi, I currently have a custom project made for a NRF51. I use arm-none-eabi-objcopy to create a .hex file that gets flashed to the chip.
I got everything working fine, the plugin starts OpenOCD, flashes the .hex file and starts GDB. However it appears that you also pass the same .hex file to GDB as the symbol file.
Is it possible to select a different symbol file (.out) from the executable?
Add help link and link to settings dialog to mcu communication and config error messages
User can point to OpenOCD home directory on Linux
Getting "OpenOCD Home is invalid" when pointing to OpenOCD home.
Directory content:
total 3292
lrwxrwxrwx 1 kamil kamil 17 gru 4 21:15 libftdi1.so -> libftdi1.so.2.2.0
lrwxrwxrwx 1 kamil kamil 17 gru 4 21:15 libftdi1.so.2 -> libftdi1.so.2.2.0
-rw-r--r-- 1 kamil kamil 150728 lis 10 12:31 libftdi1.so.2.2.0
lrwxrwxrwx 1 kamil kamil 25 gru 4 21:15 libhidapi-hidraw.so -> libhidapi-hidraw.so.0.0.0
lrwxrwxrwx 1 kamil kamil 25 gru 4 21:15 libhidapi-hidraw.so.0 -> libhidapi-hidraw.so.0.0.0
-rw-r--r-- 1 kamil kamil 26632 lis 10 12:31 libhidapi-hidraw.so.0.0.0
-rw-r--r-- 1 kamil kamil 31744 lis 10 12:31 librt-2.24.so
lrwxrwxrwx 1 kamil kamil 13 gru 4 21:15 librt.so -> librt-2.24.so
lrwxrwxrwx 1 kamil kamil 13 gru 4 21:15 librt.so.1 -> librt-2.24.so
lrwxrwxrwx 1 kamil kamil 16 gru 4 21:15 libudev.so -> libudev.so.1.6.5
lrwxrwxrwx 1 kamil kamil 16 gru 4 21:15 libudev.so.1 -> libudev.so.1.6.5
-rw-r--r-- 1 kamil kamil 131344 lis 10 12:31 libudev.so.1.6.5
lrwxrwxrwx 1 kamil kamil 19 gru 4 21:15 libusb-0.1.so -> libusb-0.1.so.4.4.4
lrwxrwxrwx 1 kamil kamil 19 gru 4 21:15 libusb-0.1.so.4 -> libusb-0.1.so.4.4.4
-rw-r--r-- 1 kamil kamil 28872 lis 10 12:31 libusb-0.1.so.4.4.4
lrwxrwxrwx 1 kamil kamil 19 gru 4 21:15 libusb-1.0.so -> libusb-1.0.so.0.1.0
lrwxrwxrwx 1 kamil kamil 19 gru 4 21:15 libusb-1.0.so.0 -> libusb-1.0.so.0.1.0
-rw-r--r-- 1 kamil kamil 139744 lis 10 12:31 libusb-1.0.so.0.1.0
-rwxr-xr-x 1 kamil kamil 2842912 lis 10 12:31 openocd
I generated a makefile using the plugin and a project for the STM32-L432KC. There are a lot of linker problems regarding the Drivers/CMSIS/DSP_Lib/Examples Folder, as far as i can see the examples are
all standalone programms. Is it possible to exclude this folder from the CMake by default?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.