使Code::Blocks适合ARM开发

本文介绍如何配置Code::Blocks IDE以支持ARM开发。包括创建新项目、配置编译设置等步骤,并提供了针对不同操作系统的详细指导。
Adapting Code::Blocks IDE for ARM Development [1]
使Code::Blocks适合ARM开发

This brief guide can be followed after the ARM-GCC toolchain is setup.
在安装过ARM-GCC工具链后,即可按照此简明指南来做。

For instructions to setup the ARM-GCC toolchain,
refer to the “Setting up the ARM-GCC Toolchain on Windows” page of this site.
对于安装ARM-GCC工具链的用法说明,参考本站的“Windows下ARM-GCC工具链的安装”[2]

I recently found perhaps the only other suitable IDE for Windows
named Code::Blocks.
我最近找到的适合IDE也许只有Windows下的Code::Blocks了。
注:Ubuntu下也可以用Code::Blocks,到我翻译这篇文章止版本为8.02。

Unlike Eclipse, it’s slim, fast and native.
不像Eclipse,它是小巧、快速、原生(不依赖其它平台运行,如Java、.net平台)。

Like Eclipse, it’s highly configurable and can be used with GCC.
像Eclipse一样,它具有高度可配置性并且可以使用GCC。

In addition,
Code::Blocks can be easily used with
GDB to debug your code (major factor in choosing another IDE).
另外,Code::Blocks 可以容易的使用GDB来调试你的代码(挑选类似IDE的主要因素)。

This is good to use later with OCDRemote/gcc to
debug your ARM code (although I haven’t configured it, yet.)
以后使用OCDRemote/gcc[3]调试你的ARM代码也会很好(虽然我还没有配置它)。

So here are the instructions for setting up the Code::Blocks to work with
the ARM GCC toolchain.
所以这里是建立Code::Blocks与ARM GCC工具链共同工作的用法说明。

To do this,
all that needs to be done is configuring Code::Blocks to
use an external Makefile,
but finding the location of these settings took a rather long time.
为了做到这点,
必须完成配置Code::Blocks使用一个外部的Makefile文件,
仅仅找这些配置的位置就花费了很长时间。

Step One – Create a New Project
第一步 - 创建一个新工程

Since none of the included project templates really fit for
ARM GCC development,
it’s easiest to start out by making a new blank project.
由于ARM GCC开发空工程模板很合适,因为一个空的新工程是最容易着手进行的。

So do this by clicking on the “Project” menu, then “New empty project”.
新建空工程通过点击“工程”菜单项,然后选择“新建空工程”。(如下图)
使Code::Blocks适合ARM开发 

注:Ubuntu下的Code::Blocks v8.02新建空工程方式有所不同,详见下图:
使Code::Blocks适合ARM开发  

使Code::Blocks适合ARM开发

由于无法在Ubuntu上调试故此只创建“Release”配置即可!(IDE要求必须创建一个Debug或Release的配置)

使Code::Blocks适合ARM开发

点击上面界面的Finish按钮后,
你就点击[Build]菜单 -> [Rebuild] 或 [Rebuild workspace]菜单项,编译空工程的话,
就会从编译日志标签“Build log”得到如下错误提示:
make: *** 没有规则可以创建目标“Release”。 停止。
Process terminated with status 2 (0 minutes, 0 seconds)
0 errors, 0 warnings

解决方法自然是添加源代码文件与其相关的头文件了!Makefile文件也可以添加,会放入 Others 分类中。
使Code::Blocks适合ARM开发

注:添加完文件后,再点击[project]菜单 -> 选择[Build options...]菜单项 ->
    删除 "Make" commands 选项卡内所有 $target


Save the project in the folder of your project,
where you plan to hold the code.
保存这个新建的空工程到你想要保存代码的目录文件里。

You will see several window panes in the IDE.
你将在这个IDE里看见几个窗格。

I will briefly describe them here:
我将这里简略地描述它们:

1)Management Pane 管理窗格
使Code::Blocks适合ARM开发

The Management Pane contains three tabs that are all somehow related to the code itself.
这个管理窗格包含三个不同方式来讲述代码的标签。

First is the “Projects” tab,
which lists the opened projects in the workspace,
and the files that are associated with the project.
第一个是“工程”标签,列举这个工作空间中的全部工程与其文件。

The files are automatically separated into three sections: Sources, Headers, and Others.
文件自动区分为三组:源代码,头文件与其它。

Double-clicking on a file will bring it up for editing in the editor.
双击一个文件将可在编辑器中打开编辑。

Second is the “Symbols” tab, which outlines all of the functions, variables, enumerations,
preprocessor directives, and classes existing in the code of the project.
第二个是“符号”标签,概述工程代码中的全部的函数、变量、枚举、宏定义(预处理器指令)、类。

Double-clicking on any one of these elements will bring it up highlighted in the editor.
双击这些元素中的任意一个将可在编辑器中高亮显示。

The third and final tab is the “Watches” tab,
which is used to add debugging watches to variables.
这最后的第三个标签是“察看”,习惯用于调试察看变量。

2)Messages Pane 信息窗格
使Code::Blocks适合ARM开发
The Messages Pane stores the general output from several sources.
这个信息窗格汇集了若干源文件的总的信息输出。

It has tabs to easily switch between these message categories.
它有几个标签可以轻易地切换不同种类信息。

The “Code::Blocks” messages tab obviously holds the message output from
Code::Blocks itself,
which is usually irrelevant to development.
“Code::Blocks”信息标签包含显示来自Code::Blocks自身输出与开发无关的信息。

If a problem occurs with the IDE,
this would be a good place to check for troubleshooting.
如果这个IDE出现问题,这将是一个发现并修理故障的好地方。

The next tab is the “Search Results” tab,
which is pretty self-explanatory.
紧邻的标签很清楚是“搜索结果”标签。

Clicking on a search result will open the file and
highlight the line containing the search term(s) in the editor.
点击一个搜索结果将在编辑中打开文件并高亮显示包含搜索项的行。

The next tab is the “Build log”,
and holds the commands made to the compiler,
linker and other tools.
再紧邻的标签是“编译日志”,包含编译器,链接器和其它工具的命令日志。

Next is the “Build messages” tab,
which lists the errors or warnings present in the code that was caught by the compiler,
including the file and line number at which the error/warning is located.
再紧邻的是“编译信息”标签,列举编译器关于代码的错误或警告,其中文件与行号定位错误或警告。

The next tab is the “Debugger” tab,
which will contain the output of the chosen debugger.
再紧邻的标签是“调试器”标签,包含选定调试器的输出信息。

The final tab is the “To-Do List” tab,
which lists To-Do items that are present in the code.
这最后的标签是“任务列表”标签,列举代码中当前待办事项项目。

To-Do items are defined by Code::Blocks as a comment in code,
and can be added by right-clicking on
a line in the editor and clicking “Add To-Do Item…”.
待办事项是Code::Blocks在代码中定义的注释,可以点击由通过右键点击编译器中的一行弹出的菜单项“添加待办事项...”来添加。

3)Editor Window 编辑器窗口
使Code::Blocks适合ARM开发
Probably the most important part of the IDE, the text editor itself.
大概这个文本编辑器是IDE最重要的部分。

It supports syntax highlighting,
several forms of autocompletion,
collapsing code segments, and much more.
它支持语法高亮,自动完成输入,折叠代码段,等等。

It can be highly customized under the “Settings” menu, in the “Editor” settings.
可以在“设置”菜单中的“编辑器”菜单项中高度自定义。

Notably, the font, indentations, colors, and auto-completion can be configured.
显著地,字体,缩排,颜色,自动完成功能可以是配置的。

In addition,
“Default Code” can be defined to be written whenever
a new source/header file is created.
另外,“默认代码”可以在每当创建一个新源代码文件或头文件时写好已定义的文字内容。

Step Two – Configure Build Settings
第二步 - 配置编译设置

The next step is to setup Code::Blocks to
use an external Makefile instead of automatically and
directly calling GCC.
下一步是设置Code::Blocks使用一个外部的Makefile文件自动直接地调用GCC。

Click on the “Settings” menu, then “Compiler”.
点击“设置”菜单,然后“编译器”。

1. Keep your Selected Compiler as the “GNU GCC Compiler”.
1. 保持选择“GNU GCC Compiler”编译器。

2. Click on the “Other” tab.
2. 点击“其它”标签。

3. Change “Build Method” to “Work with Makefiles (GNU ‘make’ is required)”.
3. 改变“编译方式”为“按项目组成文件Makefiles工作(GNU make工具是必需的)”。

4. Click “OK” to close the window.
4. 点击“确定”关闭窗口。

使Code::Blocks适合ARM开发

Next the path of the Makefile must be defined.
在这之后Makefile的路径一定要确定。

Click on the “Project” menu, then “Properties”.
点击“工程”菜单,然后点“属性”。

1. Type the name of the external Makefile
     (given it is in the same directory as where the project is saved, if not,
       modify the path revelant to the project file or provide an absolute path)
     in the “Makefile:” textbox.
1. 键入外部的Makefile文件的名字(如果不是与保存工程的目录相同,则修改为相对或绝对路径)
   在“Makefile:”后的文本框中。

2. Check the “This is a Custom Makefile” checkbox.
2. “这是一个自定义Makefile”复选框选上(打上勾)。

3. Click “OK” to close the window.
3. 点击“确定”关闭窗口。

使Code::Blocks适合ARM开发

注:Code::Blocks 10.05 的以上界面中还多了一个 Execution directory 项,
  该项的值(绝对或相对路径)一定是 Makefile 文件所在的路径,
  为了在 Build messages 中双击错误信息能打开相应的源文件,
  请确保 *.cbp 文件与 Makefile 文件在同一目录下,
  所以 Execution directory 项的值应为 ./ ,
  只有这样才能让工程文件(*.cbp)中描述的文件与 Makefile 文件执行过程中产生错误提示的文件匹对上。

使Code::Blocks适合ARM开发



注:Ubuntu下Code::Blocks v8.02的使用自定义Makefile的设置如下:
一、 修改 GNU ARM GCC Compiler

1. [Settings] -> [Compiler and debugger settings]
    将Setected compiler 修改为GNU ARM GCC 编译器。
使Code::Blocks适合ARM开发 


2. 在同页面选择 [Toolchain executables]选项卡中的[program files]选项页,
    1) 先修改 Compiler's installation directory 为你的ARM GCC Compiler安装所在地址;
    2) 再选择替换C编译器(arrm-linux-gcc)、C++编译器(arm-linux-g++)、
        动态库链接器(arm-linux-g++)、静态库链接器(arm-linux-ar)、调试器(arm-linux-gdb);
    注:make程序还用/usr/bin/make,即GNU GCC 自带的即可!
使Code::Blocks适合ARM开发


二、点击[project]菜单 -> 选择[Properties...]菜单项 ->
    勾选 “This is a custom Makefile” 前的复选框
使Code::Blocks适合ARM开发

使Code::Blocks适合ARM开发

三、点击[project]菜单 -> 选择[Build options...]菜单项 ->
    删除 "Make" commands 选项卡内所有 $target

使Code::Blocks适合ARM开发 

使Code::Blocks适合ARM开发 

Here is a list of several features Code::Blocks features which
you can further configure if you please:
这里是一些你愿意进一步配置Code::Blocks的若干特征列表:

  1) Intellisense-like Completion
  1) 智能感知输入提示完成

  2) Keyword Auto-Completion
  2) 关键字自动完成

  3) User-Defined External Tools
  3) 用户定义的外部工具

  4) Project To-Do list
  4) 工程任务列表

  5) Built-In Compiler Flag Configuration
       (although obviously irrelevant if using your own Makefile)
 5) 内置编译器标志配置
    (如果使用你自己的Makefile显然无关)

  6) Very Adaptable Text Editor
 6) 非常适应性强的文本编译器

  7) Importing of Dev-C++, MS Visual Studio,
       or MS Visual C++ projects/workspaces/solutions.
 7) 导入Dev-C++, MS Visual Studio或MS Visual C++的工程、工作空间、解决方案

  8) Additional Code::Blocks Plugins
 8) 附加的Code::Blocks插件

Code::Blocks Messages Pane Thumb
Code::Blocks 信息窗格块

[1] http://www.frozeneskimo.com/electronics/arm-tutorials/adapting-codeblocks-ide-for-arm-development/
[2] http://www.frozeneskimo.com/electronics/arm-tutorials/setting-up-the-arm-gcc-toolchain-on-windows/
[3] OcdRemote程序提供了Eclipse、GDB调试器和Macraigor片上调试设备之间的接口。
  工作关系图: GDB  <-->  OcdRemote  <-->  驱动  <-->  Macraigor JTAG设备  <-->  目标CPU
<think>好的,我需要帮助用户查找与“Cod::Blocks 杰理 插件 教程 设置”相关的信息。首先注意到用户可能存在拼写错误,“Cod::Blocks”应该是“Code::Blocks”,而“杰理”可能是指某种特定的插件、工具或公司名称,但不太确定。接下来需要分析用户的需求,可能用户是想在Code::Blocks中集成杰理相关的插件,或者寻找相关的教程和设置方法。 首先,检查用户提供的引用内容。引用1提到Code::Blocks的插件开发资源和社区链接,引用2到4是关于安装和使用教程。但所有引用中都没有提到“杰理”相关的信息。因此,可能需要考虑用户是否有拼写错误,或者“杰理”是一个特定术语或品牌名称。 可能的拼写错误:“杰理”可能是“JetBrains”的误写?或者是指某个中文插件名称?需要进一步确认。假设用户确实指的是“杰理”,可能是一个公司或特定硬件/软件的集成需求,比如杰理芯片的开发环境设置。 接下来,根据现有资源,用户可能需要指导如何在Code::Blocks中添加插件、配置环境。引用1中的资源包括官方文档、论坛和GitHub仓库,这些都是查找插件的途径。如果没有直接相关的杰理插件,可能需要建议用户检查拼写,或到Code::Blocks的论坛和仓库搜索是否有相关项目。 此外,用户提到的教程和设置,引用2-4提供了安装和基础使用教程,但关于特定插件的设置可能需要更深入的指导。建议用户参考官方Wiki和论坛,或者自行开发插件。 总结用户可能的意图:寻找在Code::Blocks中使用杰理相关插件或配置的方法,但当前信息不足。需要引导用户确认术语的正确性,并提供查找插件的途径和资源链接,同时建议可能的替代方案或自行开发插件的可能性。</think>您提到的“Cod::Blocks 杰理”可能存在拼写误差,推测您可能想查询 **Code::Blocks 集成开发环境** 与 **杰理芯片开发** 相关的插件配置或教程。根据现有信息和资源,以下分方向整理: --- ### 一、关键信息梳理 1. **术语修正建议** - **Code::Blocks** (正确拼写) 是开源的 C/C++ IDE,常用于嵌入式开发和跨平台编程[^2][^3] - **杰理** 可能指珠海杰理科技(芯片设计公司),其芯片常用于蓝牙耳机、智能硬件等领域。若需在 Code::Blocks开发杰理芯片程序,通常需要安装对应的 SDK 或插件。 2. **现存资源缺口** 现有公开资料中,未发现杰理官方直接提供 Code::Blocks 专用插件,但可通过以下方式实现环境配置。 --- ### 二、配置建议步骤 #### 步骤 1:安装 Code::Blocks 并配置基础环境 - 下载安装 Code::Blocks(汉化教程见引用) - 确保安装 GNU GCC 编译器(安装时勾选 MinGW 选项)[^4] #### 步骤 2:获取杰理芯片开发工具包 1. 访问杰理科技官网或联系供应商获取: - 芯片型号对应的 SDK - 编译工具链(如 JLISP 或定制版 GCC) - 调试驱动(如 J-Link 或专用调试器驱动) 2. 在 Code::Blocks 中配置工具链: ```plaintext Settings → Compiler → Toolchain Executables → 指定杰理工具链路径(如 arm-none-eabi-gcc) ``` #### 步骤 3:创建/导入工程 - 通过杰理 SDK 提供的示例工程,在 Code::Blocks 中导入 Makefile 项目[^1] - 或手动配置编译选项(需在 `Project Build Options` 中设置芯片架构、链接脚本等) --- ### 三、插件与扩展支持 若需增强功能,可参考以下 Code::Blocks 插件开发资源[^1]: 1. **自定义插件开发** - 通过 Code::Blocks SDK 编写插件,实现杰理芯片的专用调试功能 - 参考官方 Wiki 的插件开发教程:http://wiki.codeblocks.org/ 2. **现有插件适配** - 使用 **C::B DevTools** 插件管理工程 - 使用 **DoxyBlocks** 生成代码文档 --- ### 四、调试配置建议 1. **硬件调试** - 连接杰理调试器(如 JLINK) - 在 Code::Blocks 中配置 `Debugger Settings`,指定 GDB 路径和调试器类型 2. **输出配置** - 在编译选项中添加杰理芯片的特定宏定义(如 `-DCHIP_TYPE_AC632N`) --- §§ 1. 如何在 Code::Blocks 中配置 ARM 嵌入式开发环境? 2. Code::Blocks 如何支持自定义芯片的编译调试? 3. 有哪些适合嵌入式开发Code::Blocks 插件? --- **提示**:若“杰理”指向其他内容,请补充说明具体场景。建议直接咨询杰理科技技术支持获取专属开发工具。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值