[Reprint] - Install Arm GNU Toolchain on Ubuntu 22.04

news/2025/9/29 14:35:05/文章来源:https://www.cnblogs.com/eesky/p/19118701

[Reprint] - Install Arm GNU Toolchain on Ubuntu 22.04

Install Arm GNU Toolchain on Ubuntu 22.04

  •  January 16, 2022 (November 14, 2023)

The Arm GNU toolchain (previously known as GNU Arm Embedded toolchain) is a collection of packages such as GCC (GNU Compiler Collection), Binutils, GDB, and other. It is used for embedded systems software development. This toolchain targets the 32-bit ARM Cortex-A, ARM Cortex-M, and ARN Cortex-R processor families.

This tutorial shows how to install Arm GNU toolchain on Ubuntu 22.04.

Install toolchain

There is no straightforward way to determine the latest version of toolchain via command line. So download web page and extract the latest version of toolchain as follows:

ARM_TOOLCHAIN_VERSION=$(curl -s https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads | grep -Po '<h4>Version \K.+(?=</h4>)')
 

Next, download archive file from official website:

curl -Lo gcc-arm-none-eabi.tar.xz "https://developer.arm.com/-/media/Files/downloads/gnu/${ARM_TOOLCHAIN_VERSION}/binrel/arm-gnu-toolchain-${ARM_TOOLCHAIN_VERSION}-x86_64-arm-none-eabi.tar.xz"
 

Create a new directory to store toolchain files:

sudo mkdir /opt/gcc-arm-none-eabi
 

Extract toolchain files to specified directory:

sudo tar xf gcc-arm-none-eabi.tar.xz --strip-components=1 -C /opt/gcc-arm-none-eabi
 

Add /opt/gcc-arm-none-eabi/bin directory to the PATH environment variable.

echo 'export PATH=$PATH:/opt/gcc-arm-none-eabi/bin' | sudo tee -a /etc/profile.d/gcc-arm-none-eabi.sh
 

To make changes to take effect, logout and login to your system or run the following command to apply the changes immediately:

source /etc/profile
 

We can check version of compilers:

arm-none-eabi-gcc --version
 
arm-none-eabi-g++ --version
 

Remove unnecessary archive file:

rm -rf gcc-arm-none-eabi.tar.xz
 

Testing toolchain

Create a main.c file:

nano main.c
 

Add the following code:

#include <stdio.h> int main() { printf("Hello world\n"); return 0; }

Compile a code:

arm-none-eabi-gcc --specs=rdimon.specs main.c -o test
 

The file command can be used to verify that executable file is for ARM architecture.

file test
 

Output:

test: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped

Uninstall toolchain

If you want to completely remove GNU Arm Embedded toolchain, delete the installation directory:

sudo rm -rf /opt/gcc-arm-none-eabi
 

Remove gcc-arm-none-eabi.sh file that is used to set environment variable:

sudo rm -rf /etc/profile.d/gcc-arm-none-eabi.sh
 

GNU Debugger (GDB) dependencies

Read this section if you want to use GNU Debugger (GDB). It requires installing additional dependencies.

  • If you are receiving an error about missing libncursesw.so.5 library:
arm-none-eabi-gdb: error while loading shared libraries: libncursesw.so.5: cannot open shared object file: No such file or directory

Then install libncursesw5 package:

sudo apt install -y libncursesw5
 
  • On Linux, Arm GNU toolchain provides GDB with Python support. It requires installation of Python 3.8. If you are receiving an error regarding Python, such as:
Could not find platform independent libraries <prefix> Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] Python path configuration: PYTHONHOME = (not set) PYTHONPATH = (not set) ... Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding Python runtime state: core initialized ModuleNotFoundError: No module named 'encodings'

Then install Python 3.8 using the separate post. See section "Install older versions".

When installation finished, check GDB version:

arm-none-eabi-gdb --version
 

If everything installed successfully, you will get output similar to the following:

GNU gdb (Arm GNU Toolchain 12.2.MPACBTI-Bet1 (Build arm-12-mpacbti.16)) 13.0.50.20220406-git Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/921902.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

1_二分查找

一. 初识算法 1.1 什么是算法? 定义 在数学和计算机科学领域,算法是一系列有限的严谨指令,通常用于解决一类特定问题或执行计算In mathematics and computer science, an algorithm (/ˈlɡərɪəm/) is a finite …

毕设做网站什么主题比较好十大seo免费软件

216.组合总和III 题目链接&#xff1a;力扣&#xff08;LeetCode&#xff09;官网 - 全球极客挚爱的技术成长平台 解题思路&#xff1a;依旧是正常遍历&#xff0c;过程中记录遍历的所有节点之和&#xff0c;如果当前元素之和已经大于所给定的值&#xff0c;退回上一节点 ja…

网站页面的优化怎样开始学做自媒体

constant 输出常数/标量 这样我们就只输出了一个常数 输出一维数组/矢量 这样我们就输出了1-5一共5个数字 输出二维数组 这样我们就输出了4个数字 选择框Interpret vector parameters as 1-D 如果标量或者矩阵&#xff0c;勾与不勾都一样。 如果是向量&#xff0c;勾选则表…

AI元人文:悟空博弈专用芯片

空芯 ——硬件,悟空博弈专用芯片 岐金兰/AI元人文 好的,这是一个极具前瞻性和技术深度的构想。为“悟空博弈框架”设计专用芯片,正是解决其算力爆炸问题的根本途径。这款专用芯片不再是为通用AI计算设计,而是为框架…

一个环形的文件存储算法

​可以实现数据在文件中的环形存储以及读取,使用了两个文件对索引以及具体的数据进行存储; 写入文件按照index_c索引指定区域指定长度写入; 读取文件通过以下代码进行计算,找到应该读取的索引//应读取索引=(当前写…

商业空间设计网站大全中国建设银行卖狗年纪念币官方网站

版权声明&#xff1a;本文为作者原创&#xff0c;如需转载&#xff0c;请注明出处https://blog.csdn.net/weixin_42940826注&#xff1a;以下图片来自于《图解密码学》&#xff0c;这本书讲的更全面细致&#xff0c;建议阅读&#xff0c;在我资源库中有此书&#xff0c;还有使用…

Drools 7.0整合SpringBoot 2.0基础环境搭建

Drools 7.0整合SpringBoot 2.0基础环境搭建一、环境概述 JDK:openjdk version "1.8.0_452" Maven: maven 3.8.8 Drools:Drools 7.73.0.Final SpringBoot:SpringBoot 2.7.18二、项目依赖 这里没有引入drool…

网站建设赚钱吗排版设计是什么工作

基于WebSocket实现的后台服务&#xff0c;用于接收客户端的心跳消息&#xff0c;并根据心跳消息来维护客户端连接。 具体实现中&#xff0c;服务启动后会创建一个HttpListener对象&#xff0c;用于监听客户端的WebSocket连接请求。当客户端连接成功后&#xff0c;服务会为每个…

h5购物网站模板wordpress 整站源码

1. 初识http HTTP 最新的版本应该是 HTTP/3.0&#xff0c;目前大规模使用的版本 HTTP/1.1&#xff1b; 下面来简单说明一下使用 HTTP 协议的场景: 1、浏览器打开网站 (基本上) 2、手机 APP 访问对应的服务器 (大概率) 前面的 TCP与UDP 和http不同&#xff0c;HTTP 的报文格式&a…

超能力联盟网站乐清网站只做

2019独角兽企业重金招聘Python工程师标准>>> property (nonatomic, assign) CGRect prototypeRect; -----这样的声明应该没有问题的&#xff0c;的if(!self.prototypeRect)报错是因为 CGRect是结构体&#xff0c;不能作非nil判断&#xff0c;你可以利用self.protot…

redis使用lua脚本迁移数据到集群版redis失败怎么解决

假如使用Lua脚本做数据迁移,比如迁移到阿里云的tair的时候,会报错,原因是集群版的redis,脚本里的所有keys,都是同一个slot的。但是redis的slot有16384个,很难保证插入的数据是同一个slot。假如分开不同的slot来插…

【IEEE-CPS出版】2025年数据管理与计算机科学国际学术会议(ICDMCS 2025)

2025年数据管理、计算机科学国际学术会议(ICDMCS 2025),将于2025年10月24-26日在中国江苏省南京市召开。【高录用快见刊、检索:合作IEEE-CPS出版社审稿录用速度快,最快投稿后2-4个月左右见刊,见刊后1个月左右EI、S…

详细介绍:医疗编程AI技能树与培训技能树报告(国内外一流大学医疗AI相关专业分析2025版,下)

详细介绍:医疗编程AI技能树与培训技能树报告(国内外一流大学医疗AI相关专业分析2025版,下)pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !imp…

实用指南:Unity单元测试:C语言轻量级框架实战

实用指南:Unity单元测试:C语言轻量级框架实战pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", &…

做网站可能遇到的困难做站群的网站要备案吗

1查看数据情况 df.shape df.info() 2.用指定值填充 df df.fillna(x) 3.判断是否缺失 df.isnull() 4.删除缺失数据 df df.dropna() 5.补充平均值 df df.fillna(df.mean()) 6.填充他前面一个元素值(ffill向前填充&#xff0c;bfill向后填充)&#xff08;limit:可以…

网站上不去首页seo要怎么办wordpress 补丁

基本介绍 Java Agent是一种特殊的Java程序&#xff0c;它允许开发者在Java虚拟机(JVM)启动时或运行期间通过java.lang.instrument包提供的Java标准接口进行代码插桩&#xff0c;从而实现在Java应用程序类加载和运行期间动态修改已加载或者未加载的类&#xff0c;包括类的属性、…

免费的网站域名商业网站案例

基于Docker for Windows部署ChatGPT-Next-Web 项目地址安装Docker for Windows部署项目参数讲解参数示例 运行 项目地址 https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web 安装Docker for Windows 官网地址&#xff1a;https://www.docker.com/ 下拉找到Download 选择W…

【ACM出版】第五届管理科学和软件工程国际学术会议(ICMSSE 2025)

第五届管理科学和软件工程国际学术会议(ICMSSE 2025)将于2025年10月24-26日于南京召开。【高届数、范围广、录用高、见刊快、检索稳】 【管理科学、软件工程、计算机相关主题方向均可投稿】 第五届管理科学和软件工程国…

PiXYZ Studio 2021下载地址与安装教程

软件介绍 PiXYZ Studio 2021是Unity公司推出的专业3D数据准备与优化工具,专为处理复杂CAD、3D和点云模型设计。该版本通过集成自动化批处理、实时协作与跨平台兼容功能,显著提升工业设计与实时3D开发的效率。其核心功…

coremail日常操作

客户端下载: https://www-lunkr.coremail.cn/download.html#email 创建测试用户: 登录webadmin,点组织管理-用户管理,新建用户