- Embedded Systems Architecture
- Daniele Lacamera
- 379字
- 2021-06-25 21:55:02
Compiling the compiler
Binary distributions of the GCC toolchain are available to download for a number of specific targets and host machines. To compile the code for the ARM Cortex-M microprocessors, the arm-none-eabi toolchain is made available for most GNU/Linux distributions. However, in some cases, it might be handy to build the toolchain entirely from the sources. This might be, for example, when the compiler for a certain target does not exist yet or is not shipped in binary format for our favorite development environment. This process is also useful to better understand the various components that are required to build the tools.
Crosstool-NG is an open source project, which consists of a set of scripts aimed to automate the process of creating a toolchain. The tool retrieves the selected version of each and every component, then creates an archive of the toolchain that can be redistributed in binary form. This is normally not necessary, while sometimes useful when it is necessary to modify the sources for a specific component, such as, for example, the C libraries that are finally integrated in the toolchain. It is easy to create a new configuration in crosstool-NG, thanks to its configurator, based on the Linux kernel menuconfig. After installing crosstool-NG, the configurator can be invoked by using:
$ ct-ng menuconfig
Once the configuration has been created, the build process can be started. Since the operation requires retrieving all the components, patching them, and building the toolchain, it may take several minutes, depending on the speed of the host machine and the internet connection, to retrieve all the components. The build process can be started by issuing:
$ ct-ng build
Predefined configurations are available for compiling commonly used toolchains, mostly for targets running Linux. When compiling a toolchain for a Linux target, there are a few C libraries to choose from. In our case, since we want a bare-metal toolchain, newlib is the default choice. Several other libraries provide an implementation of a subset of the C standard library, such as uClibc and musl. The newlib library is a small cross-platform C library mostly designed for embedded systems with no operating system on board, and it is provided as the default in many GCC distributions, including the arm-none-eabi cross-compiler distributed by ARM.
- Linux設備驅動開發詳解:基于最新的Linux4.0內核
- 嵌入式Linux系統開發:基于Yocto Project
- 嵌入式Linux驅動程序和系統開發實例精講
- 混沌工程實戰:手把手教你實現系統穩定性
- Linux操作系統應用編程
- 嵌入式Linux應用開發菜鳥進階
- 直播系統開發:基于Nginx與Nginx-rtmp-module
- 一學就會:Windows Vista應用完全自學手冊
- Windows Server 2012網絡操作系統項目教程(第4版)
- Advanced TypeScript Programming Projects
- 新編電腦辦公(Windows 10+ Office 2013版)從入門到精通
- Windows Vista終極技巧金典
- Drupal 7 Cookbook
- 統信UOS應用開發進階教程
- Linux系統管理初學者指南:基于CentOS 7.6