当前位置:网站首页>Aiot application innovation competition - get better code completion and jump experience with clion
Aiot application innovation competition - get better code completion and jump experience with clion
2022-06-23 21:15:00 【Yu Hanchen】
background
stay Official website tutorial Some of them NXP RT1062 Of demo engineering , Use the recommended MCUXpresso IDE It's easy to get started after trying , But the only drawback is that the editing function is not powerful enough .
IDE It provides many necessary functions for embedded development , Such as compiling tool chain 、 Code editor 、 The debugger 、 Firmware download tool , But it is weak in the code editor , It is mainly reflected in the inability to complete automatically , That is, input the first few characters of the function , Auto complete function name (IDE Function jump can be realized , However, the auto completion function requires input . Number or :: No. triggers , For embedded c Programming is of little use ).
Usually, the coding is mostly CLion, So consider switching CLion As a code editor (vscode It's fine too , Better code completion requires clangd Support ), Other functions embedded specific functions ( compile 、 debugging ) Official use IDE.
Implementation steps
use MCUXpresso IDE Generate makefile
C/C++ There are currently two popular ways to build projects :make perhaps cmake, In embedded programming, we use make Mainly . When switching editors , There must be makefile To find the header file path 、 Source path 、 Link library path , Then do code analysis to support code jump and completion .
Open sample project , Click build project ,IDE Will generate makefile, As shown in the figure below :
Generate the compiled database
Compiling a database is a json file , The compilation steps and source code path of the project are described in detail , Accurate code completion and jump can be achieved in large projects .make Engineering and cmake Projects can generate compiled databases , And in CLion perhaps vscode Application compilation database .
First installation compiledb Tools
pip3 install compiledb
stay makefile Run the command in the same directory , It will be generated in the current directory compile_commands.json
compiledb -n make
The contents of the compiled database file are as follows :
because makefile The default with
arm-none-eabi-gccTool chain , stay CLion No support method found in , Therefore, it can be replaced bygccTo avoid loading project errors .
use CLion Open the project
Because it's time to makefile Based on the project root directory , So you can copy it directly compile_commands.json To the project root directory , And then use CLion Open the json file , Will prompt open as project, Then you can index all the symbols , And bring more perfect code completion 、 Jump function .
Q&A
Why not CLion You can use makefile
CLion It does support makefile engineering , But does not support MCUXpresso IDE Generated makfile.
Observe MCUXpresso IDE The building process of , Found to be makefile The file in Project root /Debug Under the table of contents , And the directory has only the scripts needed to build , No source code . Use CLion(2021.2 edition ) After opening the project directory , open makefile file , choice load makefile,load Successful but unable to auto jump , The automatic completion function is not complete . Copying the full amount of compiled scripts to the source directory is too heavy , Therefore, consider compiling the database .
边栏推荐
- JS five methods to judge whether a certain value exists in an array
- How to solve the problem of large traffic audio audit? What are the common approval methods?
- What is the difference between a database and a cloud disk drive? What functions can cloud disk drives achieve?
- What if there are too few jetpack compose theme colors? Design your own color system
- Process crash does not generate dump. Configure localdumps
- JS remove tabs and line breaks
- . NET Framework . Net core and Net standard
- Sharelist supports simultaneous mounting of Google drive/onedrive multiple network disks
- JS regular ignore case
- C WPF new open source control library: newbeecoder Nbtreeview of UI
猜你喜欢

How to gradually improve PMO's own ability and management level
Application of JDBC in performance test

What are the main dimensions of PMO performance appraisal?

Four aspects of PMO Department value assessment

How does PMO select and train project managers?

New SQL syntax quick manual!

I am 30 years old, no longer young, and have nothing

How to view the role of PMO in agile organizations?

Steps for formulating the project PMO strategic plan

How PMO uses two dimensions for performance appraisal
随机推荐
Pathname attribute of link a object
Global and Chinese market for hydropower plants 2022-2028: Research Report on technology, participants, trends, market size and share
How to deal with unclear pictures? How to deal with color balance?
. Net cloud native architect training camp (rgca four step architecture method) -- learning notes
Do you need a server to set up cloud on demand? What services can cloud on demand provide?
Strokeit- the joy of one handed fishing you can't imagine
Global and Chinese market of gas fire pit 2022-2028: Research Report on technology, participants, trends, market size and share
JS naming conventions
How to make a material identification sheet
[SAP ABAP] call API interface instance
Troubleshooting of black screen after easynvr is cascaded to the upper platform and played for one minute
Global and Chinese market of American football catch gloves 2022-2028: Research Report on technology, participants, trends, market size and share
What technology is used for video intelligent audit? Difficulties encountered in video audit?
How to deal with product pictures? How to select mapping software?
[redis] intersection and union of ordered sets
Encryption and decryption analysis of returned data of an e-commerce app (IV)
[hot sales at the beginning of the year] | the first special offer of popular cloud products is second to none, and the first year of 1-core 2G cloud server is 38 yuan!
Process injection
How to check whether the service is running normally after easydss cluster transcoding is set up?
【Redis】有序集合的交集与并集