Applying C For The IoT With Linux

0
(0)

Applying C For The IoT With Linux
 

  • Author:Harry Fairhead
  • Length: 332 pages
  • Edition: 1
  • Publisher: I/O Press
  • Publication Date: 2019-05-29
  • ISBN-10: B07SH923YX
  • Sales Rank: #488245 (See Top 100 Books)
  • Download:Register/Login to Download
  • Buy Print:Buy from amazon


    Book Description

    Applying C is the book you need if you are programming for Single Board Computers (SBCs) that run Linux, or if you do any coding in C that interacts with the hardware. As there isn’t a good name for this body of knowledge, it isn’t easy to find a single source for it. This book gathers together all of these low-level, hardware-oriented and often hardware-specific ideas. As such it is a moderately advanced book. This is not to say that it is difficult, but it does presuppose that you already know how to program in C and that you know the basic idioms of C.

    Starting off from the very simple task of making a program run automatically, we look at how your program works with user-mode Linux. If you are working with hardware, arithmetic cannot be ignored and separate chapters are devoted to integer, fixed-point and floating-point arithmetic. Equally, to handle I/O you need to have a good grasp of files and the pseudo file system. The dev/mem file coupled with memory-mapped files makes it possible to work with raw memory without leaving user mode. Sockets are general-purpose way of communicating over networks and similar infrastructure and here the focus is on sending data over the internet and for this we build a web client and a server.

    Next we consider graphics, which you might find unusual in a book on small systems, but today even small systems have GPUs and graphics comes as standard. It is common to think of adding low-cost output devices such as 7-segment displays to IoT devices, but with low cost HDMI/DVI displays available it becomes cost effective to simply use the built-in graphics hardware.

    After this we turn to the idea of multi-tasking using Pthreads. As well as looking at threads, we consider locking, using mutex and condition variables, and scheduling. Although interrupts don’t exist in user-mode Linux, we can get very close using poll and threading. Now that multiple cores are a feature of even low-cost SBC, in later chapters we cover managing cores, look at C11’s atomics and introduce its memory models and barriers. Finally we take a short look at how to mix assembler with C.

    Harry Fairhead has a hardware background and, having worked with microprocessors and electronics in general, for many years, he is an enthusiastic proponent of the IoT. He is the author of Fundamental C: Getting Closer To The Machine and his other recent titles include Raspberry Pi IoT in C and Micro:bit IoT in C.

    中文:

    书名:C语言在Linux环境下的物联网应用

    应用C如果您正在为运行Linux的单板计算机(SBC)编程,或者如果您用C语言编写与硬件交互的任何代码,这是您需要的书。由于这一知识体系没有一个好的名字,要找到一个单一的来源并不容易。这本书汇集了所有这些低级的、面向硬件的、通常是特定于硬件的想法。因此,这是一本相当高级的书。这并不是说它很难,但它的前提是您已经知道如何用C编程,并且您知道C的基本用法。

    从让程序自动运行这一非常简单的任务开始,我们来看看您的程序如何在用户模式的Linux上运行。如果你使用的是硬件,算术是不容忽视的,有专门的章节专门讲述整数、定点和浮点算术。同样,要处理I/O,您需要很好地掌握文件和伪文件系统。Dev/mem文件与内存映射文件结合使用,可以在不退出用户模式的情况下使用原始内存。套接字是通过网络和类似基础设施进行通信的通用方式,这里的重点是通过互联网发送数据,为此,我们构建了一个Web客户端和一个服务器。

    接下来我们来看看显卡,你可能会在一本关于小型系统的书中发现这一点很不寻常,但今天即使是小型系统也有GPU,而且显卡是标准的。向物联网设备添加低成本输出设备(如7段显示器)是很常见的,但随着低成本HDMI/DVI显示器的推出,只使用内置图形硬件就变得具有成本效益。

    在此之后,我们将转向使用P线程进行多任务处理的想法。除了考虑线程,我们还考虑了锁定、使用互斥和条件变量以及调度。虽然中断在用户模式的Linux中不存在,但我们可以使用轮询和线程来非常接近。既然多核是即使是低成本SBC的一个特征,在后面的章节中,我们将讨论管理核,看看C11的原子,并介绍它的内存模型和障碍。最后,我们简要介绍一下如何将汇编语言与C语言混合使用。

    Harry Fairhead他有硬件背景,多年来一直与微处理器和电子产品打交道,是物联网的热情支持者。他是《生活》的作者。基础C:更接近机器和他的机器最近的其他游戏包括。C中的覆盆子PI IoTMicro:C中的位物联网.

  • 下载电子版:下载地址
  • 购买纸质版:亚马逊商城

    点击星号评分!

    平均分 0 / 5. 投票数: 0

    还没有投票!请为他投一票。

  • 推荐阅读

    评论 抢沙发

    评论前必须登录!

     

    登录

    找回密码

    注册