tag 标签: IDA

相关博文
  • 2022-6-7 09:32
    2 次阅读|
    0 个评论
    IDA pro 是一款功能非常强大的反编译工具。对于刚接触这类软件提供同学可能对什么是“反编译”这个概念其实并不是很了解,从事程序开发的朋友都知道编程语言就是讲人们看不懂的的电脑数据转换为可视化数据,变成人们看得懂的文字,而由于程序时人设计的,每个人都有不足的地方,所有设计出来的程序一定不是完美的,一定会存在各种漏洞,如果一些有支付功能的软件设计上存在缺陷,那么后果将是非常严重的,而如果一行行代码的去检查是不切实际的,也不可能完成,所有我们在需要反编译工具辅助检测,反编译工具的作用就是根据实现的功能反向分析代码的完整性。它可以将人看不懂的机器代码转换为人能看得懂的编译语言,它可用于恶意代码分析、软件或者系统设计漏洞、对程序进行评估等等。我们推荐的是IDA Pro 7.6中文破解版,这款该软件目前的最新版本,它既是反编译器也是调试编程工具,同时也是完成的集成开发环境,拥有非常强大的类宏语言,可以轻松的应对任何复杂程度的编程设计语言,支持Windows、Linux或Mac OS X多种平台的设计语言,而且它还支持扩展,功能更加强大。我们在下文中提供了关于该软件的安装和一些使用教程,有需要的朋友下载试试吧。 IDA pro安装教程 1、从本站下载数据包后解压,运行idafree76_windows.exe,点击next 2、选择同意协议然后点击next 3、这种安装目录然后点击next 4、软件正在安装,请耐心等待 5、安装完成 IDA Pro 7.6使用技巧 1、打开软件,打开一个文件,我用的是安恒月赛的一个文件,出现; 2、首先打开option-general; 3、option在上面的一系列菜单中,选中stack pointer,就是我画红圈的地方,勾选,然后确定; 4、你会发觉代码段多了一系列东西,这就是栈指针,他告诉我们栈的高度,而postive sp value has been found ,会出现,是因为有负的栈指针; 5、红圈所示,而我们修改呢,只需在出现负数的那个地方的上一行,按alt+k,调整成跟这个数一摸一样的值就可以了 6、如图所示,然后确定,然后按F5便可以变成伪代码进行查看了。 软件功能 1、快速 该软件只需几秒钟即可分析二进制文件。 2、完全互动 无缝,快速地工作,与反编译程序一起使用,并更直观地分析代码。 3、所有标准平台的支持 该软件在所有标准平台上运行—MS Windows、Linux、Mac OS X,包括GUI和控制台模式。 4、多处理器处理 相同的接口和功能可用于数十个处理器,以加快分析过程。 5、处理多种文件格式 该软件几乎可以加载和反编译任何文件格式 。 6、强大的调试器 该软件也是多功能调试器 ,支持多个调试目标并可以处理远程应用程序。 7、可编程 通过IDC或IDAPython扩展该软件以符合您自己的要求。 8、开放式插件架构 通过使用可编程插件,可以轻松扩展该软件的功能。 9、FLIRT 快速库识别和识别技术为许多编译器识别标准函数调用。 10、制图 代码制图 一目了然,提供了代码结构的图形概述。 11、Lumina的服务器 Lumina服务器保存大量已知函数的元数据(名称、原型、操作数类型等)。 12、可自定义 该软件在所有平台上都提供了完全可定制和统一的工作环境。 软件特色 1、可编程性 IDA Pro包含了一个由非常强大的类似于宏语言组成的完全开发环境,可用于执行简单到中等复杂的自动化任务。对于一些高级任务,我们的开放式插件架构对外部开发人员是没有限制的,这样可以完善该软件的功能。比如,每个人可以用MP3播放器来扩展该软件并且发现恶意软件。 2、交互性 目前,电脑在遇到未知事物时,是无法和人类大脑相比的。而该软件拥有完全的互动性,与前者相比,该软件可以让分析师重写决策或者提供相应的线索。交互性是内置程序语言和开放式插件架构的最终要求。 3、调试器 在现实生活中,事情并不是我们想象的那样简单,恶意代码通常总与分析不一致。病毒,蠕虫和木马往往是被其他东西修饰过而造成混淆,这就要求有一个更加强大的工具来识别出来。该软件调试器补充了反汇编的静态分析功能:允许分析师通过代码一步一步来调查,调试器经常会绕过混淆,并得到一些能够对静态反汇编程序进行深入处理的数据,包括有助于得到的数据的功能更强大的静态反汇编器将能够在深度处理。远程调试器对人们想要对潜在的有害程序进行深入时起到了很大的作用。有些该软件调试器也可以运行在虚拟环境的应用上,这使得恶意软件分析更有成效。 4、反汇编 作为一个反汇编器,该软件为可用在那些源代码不总是可用的二进制程序的探索开发,创建程序执行图。一个反汇编器最大的益处就在于它可以通过符号表示,也就是汇编语言来为在执行的处理器提供说明。如果一个你刚刚安装的友好的屏幕存储器在探视你的网上银行会话或者登陆你的邮箱,反汇编器就可以将它显示出来。然而,汇编语言是很难搞懂的,这也是为什么这种先进的技术被应用在该软件上从而能确保代码的可读性,甚至在某些情况下和二进制文件产生的源代码非常相似。该程序图的代码可以为进一步的调查提供后期处理。有些人已经将它作为其根源用在病毒的基因分类上。 软件优势 1、图表视图 在图表视图中,当前函数表示为与边连接在一起的节点集合。节点表示基本块,边表示它们之间的代码交叉引用。 只有代码项在图表视图中可见,数据项被隐藏。要显示它们,请按Space键切换到文本模式。图表视图可用于属于函数的指令。如果当前项目无法以图形模式显示,该软件会自动切换到文本模式。它还会显示警告,我们建议您在熟悉该概念后立即隐藏它。 2、消息窗口 该软件在开始时打开一个特殊的不可关闭的窗口。该窗口称为“消息窗口”。在此窗口中,您可以看到各种IDA消息。 如果消息窗口隐藏在其他窗口后面,您将看不到该软件消息。 3、堆栈变量窗口 动作名称:OpenStackVariables 此命令打开当前函数的堆栈变量窗口。 堆栈变量在内部表示为结构。该结构由两部分组成:局部变量和函数参数。 您可以在此处修改堆栈变量定义:添加/删除/定义堆栈变量,为它们输入注释。 此窗口中可能有两个特殊字段:“r”和“s”。它们表示函数返回地址和已保存寄存器的大小(以字节为单位)。您无法直接修改它们。要更改它们,请使用edit function命令。 行前缀的偏移表示来自帧指针寄存器(BP)的偏移。窗口左下角的窗口指示器显示堆栈指针的偏移量。 要创建或删除堆栈变量,请使用数据定义命令(data,strlit,array,undefine,Rename)。您也可以定义常规或可重复的注释。 通过将操作数转换为堆栈变量,可以在程序中使用定义的堆栈变量。 4、功能窗口 动作名称:OpenFunctions 显示程序中所有功能的列表。您可以使用列表查看器命令添加,删除,修改功能。 IDA Pro支持的处理器 该软件专业版支持以下处理器。 一些处理器模块的源代码可从我们的免费SDK中获得 1、AMD K6-2 3D-Now! 扩展名 2、从v3到v8的32位ARM体系结构版本,包括Thumb,Thumb-2,DSP指令和NEON Advanced SIMD指令。 ARMv4 / ARMv4T:ARM7颜色(ARM7TDMI / ARM710T / ARM720T / ARM740T),ARM9颜色(ARM9TDMI / ARM920T / ARM922T / ARM940T) ARMv5 / ARMv5TE / ARMv5TEJ:ARM9内核(ARM946E-S / ARM966E-S / ARM968E-S / ARM926EJ-S / ARM996HS),ARM10E(ARM1020E / ARM1022E / ARM1026EJ-S) ARMv6 / ARMv6T2 / ARMv6Z / ARMv6K:ARM11内核(ARM1136J(F)-S / ARM1156T2(F)-S / ARM1176JZ(F)-S / ARM11 MPCore) ARMv6-M:Cortex-M0 / Cortex-M0 + / Cortex-M1(例如NXP LPC800 / LPC1xxx,Freescale Kinetis L和M系列,STM32 F0系列等) ARMv7-M:Cortex-M3(例如NXP LPC17xx / 18xx / 13xx,STM32 F1 / F2 / L1系列,TI Stellaris,东芝TX03 / TMPM3xx等) ARMv7E-M:Cortex-M4(例如NXP LPC43xx,STM32 F3 / F4系列,TI Stellaris LM4F,Freescale Kinetis K系列和W系列,Atmel AT91SAM4等) ARMv7-R:Cortex-R4(F)/ Cortex-R5 / Cortex-R7(例如TI TMS570LS等) ARMv7-A:Cortex-A5 / Cortex-A7 / Cortex-A8 / Cortex-A9 / Cortex-A12 / Cortex-A15(例如TI Sitara,TI OMAP系列,三星S5PC100和Exynos,Nvidia Tegra,飞思卡尔i.MX,Allwinner A系列和其他许多产品) ARMv7(自定义):Apple A4 / A5 / A5X / A6 / A6X(快速微体系结构,用于Apple的iPhone / iPod / iPad / AppleTV),高通Snapdragon 3、ARC(Argonaut RISC核心) 4、ATMEL AVR(随附源代码) 5、DEC PDP-11(随附源代码) 6、富士通FR(附带源代码) 7、掌上游戏机 8、日立/瑞萨 H8 / 300 , H8 / 300L , H8 / 300H , H8S / 2000 , H8S / 2600 ,H8SX(随附源代码) 9、Hitachi H8 / 500(随附源代码) 10、日立HD 6301,HD 6303,Hitachi HD 64180 11、英特尔8080 12、英特尔8085 13、INTEL 80196(随附源代码) 14、INTEL 8051(随附源代码) 15、INTEL 860XR(随附源代码) 16、INTEL 960(随附源代码) 17、英特尔80×86和80×87 18、英特尔奔腾系列产品,包括SSE,SSE2,SSE3,SSE4 19、Java虚拟机(附带源代码) 20、KR1878(随附源代码) 21、Microsoft .NET(公共语言基础结构字节码) 22、三菱MELPS740或Renesas 740(附带源代码) 23、日立/瑞萨M16C 24、MN102(仅随源代码一起提供) 25、MOS Technologies 6502(随附源代码) 26、摩托罗拉/飞思卡尔 MC680xx ,CPU32(68330),MC6301,MC6303,MC6800,MC6801,MC6803,MC6805,MC6808,HCS08,MC6809,MC6811,M68H12C,ColdFire 27、摩托罗拉MC6812 / MC68HC12 / CPU12 28、飞思卡尔HCS12,HCS12X(包括XGATE协处理器) 29、NSC CR16(仅随源代码一起提供) 30、NEC V850系列(包括V850E1,V850E1F,V850ES,V850E2,V850E2M)(随附源代码) 31、瑞萨RH850系列(RH850G3K,RH850G3M,RH850G3KH,RH850G3MH)(随附源代码) 32、EFI字节码(EBC)(随附源代码) 33、SPU(单元BE的协同处理单元)(随附源代码) 34、MSP430,MSP430X(随附源代码) 35、PIC 12XX,PIC 14XX,PIC 18XX,PIC 16XXX(随附源代码) 36、罗克韦尔C39(仅随附源代码) 37、SAM8(随附源代码) 38、SGS Thomson ST-7和ST-20(随附源代码) 39、TLCS900(仅包含源代码) 40、来自SunPlus的unSP 41、索尼SPC700 42、飞利浦XA系列(51XA G3)(随附源代码) 43、英特尔xScale 44、Z80,Zilog Z8,Zilog Z180,Zilog Z380(随附源代码) 45、x64体系结构(Intel x64和AMD64) 46、ARM64体系结构(又名AArch64) 47、ARMv8-A:Cortex-A50 / Cortex-A53 / Cortex-A57 ARMv8(自定义):Apple A7(Cyclone微体系结构,用于iPhone 5s) 48、Analog Devices AD218x系列(ADSP-2181,ADSP-2183,ADSP-2184(L / N),ADSP-2185(L / M / N),ADSP-2186(L / M / N),ADSP-2187(L / N),ADSP-2188M / N,ADSP-2189M / N) 49、Dalvik(Android字节码,DEX) 50、DEC Alpha 51、DSP563xx,DSP566xx,DSP561XX(随附源代码) 52、TI TMS320C2X,TMS320C5X,TMS320C6X,TMS320C64X,TMS 320C54xx,TMS320C55xx,TMS320C3(随附源代码) 53、TI TMS320C27x/TMS320C28x 54、惠普HP-PA(随附源代码) 55、日立/瑞萨SuperH系列:SH1,SH2,SH3,日立SH4(Dreamcast),SH-4A,SH-2A,SH2A-FPU 56、IBM / Motorola PowerPC / POWER架构,包括Power ISA扩展: 规格书E(嵌入式控制器说明) 飞思卡尔ISA扩展(isel等) SPE(信号处理引擎)说明 AltiVec(SIMD)指令 虚拟机管理程序和虚拟化说明 Power ISA 2.06规范中的所有指令(矢量,十进制浮点数,整数乘法累加,VSX等) Cell BE(宽带引擎)说明(在PlayStation 3中使用) VLE(可变长度编码)压缩指令集 Xenon(Xbox 360)指令,包括VMX128扩展 配对的单个SIMD指令(PowerPC 750CL / Gekko / Broadway / Espresso,在Nintendo Wii和WiiU中使用) 57、基于Motorola / Freescale PowerPC的内核和处理器,包括(但不限于): MPC5xx系列:MPC533 / MPC535 / MPC555 / MPC556 / MPC561 / MPC562 / MPC563 / MPC564 / MPC566 注意 :目前不支持MPC534 / MPC564 / MPC556 / MPC566(突发缓冲控制器)的代码压缩功能 MPC8xx系列(PowerQUICC):MPC821 / MPC850 / MPC860 MPC8xxx系列(PowerQUICC II,PowerQUICC II Pro,PowerQUICC III):MPC82xx / MPC83xx / MPC85xx / MPC87xx MPC5xxx系列(Qorivva):MPC55xx,MPC56xx,MPC57xx Power PC 4xx,6xx,74xx,e200(包括带有VLE的e200z0),e500(包括e500v1,e500v2和e500mc),e600,e700,e5500,e6500内核 QorIQ系列:P1,P2,P3,P4,P5和T1,T2,T4系列 Infineon Tricore架构(高达v1.6.2架构(AURIX)) 58、英特尔IA-64架构–安腾。 59、摩托罗拉DSP 56K 60、摩托罗拉MC6816 61、MIPS MIPS Mark I(R2000) MIPS Mark II(R3000) MIPS Mark III:(R4000,R4200,R4300,R4400和R4600) MIPS Mark IV:R8000,R10000,R5900(Playstation 2) MIPS32,MIPS32r2,MIPS32r3和MIPS64,MIPS64r2,MIPS64r3 Allegrex CPU(Playstation Portable),包括VFPU指令 Cavium Octeon ISA扩展 MIPS16(MIPS16e)应用程序特定扩展 MIPS-MT,MIPS-3D,smartMIPS应用特定扩展 东芝TX19 / TX19A系列应用特定扩展(MIPS16e + aka MIPS16e-TX) 62、三菱M32R(带有源代码) 63、三菱M7700(附带源代码) 64、三菱M7900(随附源代码) 65、Nec 78K0和Nec 78K0S(随附源代码) 66、STMicroelectronics ST9 +,ST-10(随附源代码) 67、SPARCII,ULTRASPARC 68、西门子C166 (流程) 69、富士通F2MC-16L,富士通F2MC-LC(随附源代码) 70、16位Microchip PIC系列(PIC24,dsPIC:PIC24XX,PIC30XX,PIC33XX) IDA PRO使用教程 1、视图区: (1)运行软件 (2)出现窗口 (3)介绍: 1)1号区:对不同代码块使用不同颜色进行区分,,点击相应的颜色块,进行不同代码块的定位。 蓝色:代码块 棕色:数据段 红色:内核 黑色:输出窗口,文件反编译过程中的信息都可以在这看到 2)2号区:表示该程序的函数表,双击后可查看详细信息 3)3号区:整体程序或某个函数的图标概述。可以大体把握功能和结构的走向 4)4号区: 主要显示6个部分信息:IDA View-A、Hex View-1、Structures、Enums、Imports、Exports IDA View-A:表示某个函数的图标架构,可以查看程序的逻辑树形图,把程序的结构更人性化地显示出来,方便分析 Hex View-A:查看16机制代码,方便定位代码后使用其他工具修改 Structures:查看程序的结构体 Enums:查看枚举信息 Imports:查看输入函数,导入表(程序中调用到的外部函数) Exports:查看输出函数 3、功能区: 菜单模块:(汉化) (1)文件: (2)编辑: (3)查找: (4)视图: (5)调试器: (6)选项: (7)窗口: (8)帮助: 4、调试步骤: (1)装入文件或程序 (2)指令断点 (3)程序运行 (4)分析堆栈 (5)添加监视 (6)进行地址分析 (7)单步跟踪 (8)找到bug (9)使用硬件断点进行bug确定 5、实例: (1)代码: (2)装入: (3)在汇编代码区输入空格键,可以切换汇编代码为流程图浏览模式: (4)在流程图模式下,绿线代表条件成立,红线代码条件不成立 (5)常量字符串窗口:通过该窗口可以看到程序中所有的常量字符串列表(PS:逆向分析一个程序,从字符串入手是一个方向) (6)字符串查找窗口:查找指定字符串 (7)地址跳转:使用该窗口可以跳转到指定地址的汇编代码段 (8)Debugger options:该窗口可以设置调试程序中一些选项,包括调试时进行的一些操作设置、日志设置等 (9)Switch debugger:选择调试器 设置好调试器后,需要设置远程调试器信息(把想要调试器的服务器调试的可执行文件拷贝到调试器客户端,使用IDA打开,设置参数文件路径、服务端主机名称、ip地址等) (10)脚本执行窗口:打开窗口后,可以选择执行脚本,在静态分析汇报代码时需要编写一些自动化脚本,通过该窗口执行,执行结果显示在前面的输出窗口。 (11)汇编代码注释编写:点击汇编窗口下的图标 (12)Xrefs graph to & Xrefs grap from:在函数名上点击右键,可以看到该函数被其他函数调用的信息或该函数调用其他函数的信息 ————————————————————————————————————————————————————————————
  • 热度 22
    2013-10-10 19:17
    2807 次阅读|
    0 个评论
    In my previous column on the Arduino , we discussed the hardware platform itself. Now it's time to consider how we create programs for this little rascal. There are several programming environments one can use with the Arduino. If you are a beginner, perhaps the best option is to use the official Arduino IDE (integrated development environment), which you can download for free from the Download page on the Arduino website. Have your Arduino board and USB cable near your computer, but don't plug them in just yet. As you will see, there are Windows, Mac OS X, and Linux versions of this IDE available. Just follow the instructions on the Arduino website. When you do come to connect your Arduino to your computer, one of the first things you must do in the Arduino IDE is use the "Tools Board" pull-down menu to select the type of Arduino platform you are using. For the purposes of these discussions we will assume an Arduino Uno, so this is the option you would select. Introducing the Arduino programming language The Arduino programming language is an implementation of the open-source electronics prototyping platform called Wiring, which itself is based on an open-source electronics prototyping platform called Processing. For our purposes here, however, the simplest way to think of this is that the Arduino programming language is a simplified version of the C and C++ programming languages. If you are already familiar with C/C++, then you will also be familiar with the concept of the "main" function. The idea here is that a standard C/C++ program consists of one or more functions, and that one of these functions must have the name "main": A standard C/C++ program is executed when the higher-level operating system hands control over to the "main" function in the program. The "main" function differs from other functions in two ways: * It may not be called from within the program. * Any parameters to "main," if they exist, are provided (passed-in) by the operating system. A program written for the Arduino is called a "sketch." The main point to note here is that sketches do not contain a "main" function. Instead, every Arduino program includes two primary functions (along with any functions you add of your own) called "setup" and "loop": Any code you write within the curly brackets associated with a function will be executed when that function is called. The "setup" function runs only one time when the Arduino is first powered-up or when it is reset. The "loop" function runs continuously after the "setup" function has finished performing its tasks. As an aside, for the C/C++ purists amongst us, my understanding is that when we initiate a compilation, the IDE slips in a "main" function while we aren't looking. The thing to remember is that the creators of the Arduino are trying to keep things as simple as possible for beginners. Learning the Arduino programming language First of all, there are a bunch of useful tutorials and other resources available for free on the main Aduino.cc website. If you are an absolute newcomer to C/C++, then one book that I would personally recommend is Programming Arduino Getting Started with Sketches by Simon Monk, which is available for a very reasonable $10.99 from Amazon.   It's worth knowing that an Arduino board typically arrives with a default program called "Blink" preinstalled. As soon as you connect the Arduino to your host computer with the USB cable, this program will cause a LED on the board to start blinking. The first half of Simon's book introduces you to various aspects of the C/C++ programming language via changes you make to this "Blink" sketch. Later experiments in the second half of the book will require you to use some very basic components and tools, like a resistor, a switch, a couple of pieces of wire, and a multi-meter. As you become more advanced, you will discover that there are all sorts of Arduino-specific resources available on the Internet to answer your questions. Also, a lot of general-purpose C/C++ resources are out there, such as this 'const' and 'static' keywords tutorial and this pointer tutorial . Next, we'll look at some Arduino kits for beginners... Arduino kits for beginners There are a couple of very useful starter kits available should you wish to avail yourself of them. The first is the Arduino Uno Ultimate Starter Kit for $54.99 from Amazon, as illustrated below:   This kit includes an Arduino Uno R3 board and a USB cable to connect it to your host computer. It also includes a small breadboard and a bunch of wires and electronic components sufficient for you to perform loads of experiments. Also included is a 72 page, full-colour instruction manual that will walk you through various experiments. What the kit doesn't include is a power supply, but you can pick one up from Amazon for $5.98 ( click here ). And, while you are at it, you might as well go for the ultrasonic distance sensor for only $4.85 ( click here ). Now, I cannot personally vouch for the above kit because I don't have one, but the fact that it has a 4.5 star rating from 242 customer reviews (at the time of this writing) says a lot. As always, I would suggest that you take a look at some of these reviews yourself to get a better feel for what's going on. Another kit that I can personally recommend is The Arduino Starter Kit for $109.95 from Amazon.   This little beauty comes with a host of tasty "stuff," including a 170-page Arduino Projects Book that walks you through building things like a "Light Theremin," a "Motorized Pinwheel," and a "Love-O-Meter." As for the other kit, one thing that isn't included is a power supply, but you can pick one up from Amazon for $5.98 ( click here ). Everything in this kit is very nicely packaged and presented. When you open the box, the first thing you see is the Arduino Projects Book , as illustrated below:   When you remove the book, you are presented with a "jigsaw puzzle" of small boxes as illustrated below:     Opening the boxes reveals all sorts of goodies, including a small liquid crystal display as illustrated below:     Now, if you are an experienced hobbyist or engineer, this kit may well be too simplistic for you. On the other hand, if you wish to introduce a younger person to the magic of microcontrollers, then this kit would be ideal. You start with really simple experiments like connecting a LED to an output pin and flashing it, and then you build up to more complicated projects in easy-to-understand steps. Also, everything is achieved by means of the breadboard; that is, no soldering is required. Two more books As you may recall, one reason for my wanting to learn that Arduino in the first place is that I sponsored a Kickstarter project for a fast and easy-to-use machine vision system called the Pixy, which can be connected directly to an Arduino. In the video shown on this project's Kickstarter webpage , we see the Pixy being used to control a small robot. Based on this, I ordered a book called Make an Arduino-Controlled Robot by Michael Margolis:   Generally speaking, this book has reasonably favourable reviews. Also, a lot of the information seems as though it would be of use for robots other than the two kits featured in the book. This is fortunate, because the kits themselves receive less than favourable reviews. However, we will leave that discussion to my next column, at which point we will consider the whole robot issue in more detail. Last but certainly not least (in the book department), I just took possession of another book called Arduino Workshop: A Hands-On Introduction with 65 Projects by John Boxall (a.k.a. Tronixstuff ):   Truth to tell, I haven't even had the chance to open the cover of this little beauty yet. Suffice it to say, for the moment, that one reviewer on Amazon said: I really think Arduino Workshop is under selling itself. It's not just a workshop manual but a tutorial on electronics, programming and Arduino, and a very good one at that... Over all this is an excellent resource and one that should be on the shopping list of everyone interested in creating their own Arduino toys and tools. Reading Arduino Workshop is high on my list of things to do, and I plan on writing full-up reviews of both Make an Arduino-Controlled Robot and Arduino Workshop in the not-so-distant future. But wait, there's more... Eeeek! I almost forgot to mention that my chum Tobias Strauch just sent me a very interesting link to a 30-minute documentary about how the Arduino came to be ( click here to see this video). And just this morning, I heard from Paul Kassebaum PhD, Maker Community Relations, MathWorks. Paul informed me that MathWork's Simulink has a relatively new capability to generate code to run on the Arduino Uno, Mega, and Nano platforms, as well as other low-cost microcontrollers like the Raspberry Pi and Beagleboard. Even better, they've built a website to introduce beginners and inspire amateurs to the cool stuff this capability enables: makerzone.mathworks.com (you can see a simple example meant to get one up and running from scratch on the Arduino Uno by clicking here ). As a more complex example of the sophistication Simulink can bring to Arduino-based projects, they used the Arduino Mega 2560 to automate sumobots in a competition last April ( click here ). Arduino-powered robots As I mentioned earlier, my next blog will be about creating Arduino-powered robots. In the meantime, do you have any questions? Alternatively, are there any Arduino books, kits, or other resources that you would recommend? If so, please share them with the rest of us in the comments below.
  • 热度 13
    2013-10-10 19:14
    1796 次阅读|
    0 个评论
    In my last column on the Arduino , we looked at the hardware platform itself. Now it's time to consider how we create programs for this little rascal. There are several programming environments one can use with the Arduino. If you are a beginner, perhaps the best option is to use the official Arduino IDE (integrated development environment), which you can download for free from the Download page on the Arduino website. Have your Arduino board and USB cable near your computer, but don't plug them in just yet. As you will see, there are Windows, Mac OS X, and Linux versions of this IDE available. Just follow the instructions on the Arduino website. When you do come to connect your Arduino to your computer, one of the first things you must do in the Arduino IDE is use the "Tools Board" pull-down menu to select the type of Arduino platform you are using. For the purposes of these discussions we will assume an Arduino Uno, so this is the option you would select. Introducing the Arduino programming language The Arduino programming language is an implementation of the open-source electronics prototyping platform called Wiring, which itself is based on an open-source electronics prototyping platform called Processing. For our purposes here, however, the simplest way to think of this is that the Arduino programming language is a simplified version of the C and C++ programming languages. If you are already familiar with C/C++, then you will also be familiar with the concept of the "main" function. The idea here is that a standard C/C++ program consists of one or more functions, and that one of these functions must have the name "main": A standard C/C++ program is executed when the higher-level operating system hands control over to the "main" function in the program. The "main" function differs from other functions in two ways: * It may not be called from within the program. * Any parameters to "main," if they exist, are provided (passed-in) by the operating system. A program written for the Arduino is called a "sketch." The main point to note here is that sketches do not contain a "main" function. Instead, every Arduino program includes two primary functions (along with any functions you add of your own) called "setup" and "loop": Any code you write within the curly brackets associated with a function will be executed when that function is called. The "setup" function runs only one time when the Arduino is first powered-up or when it is reset. The "loop" function runs continuously after the "setup" function has finished performing its tasks. As an aside, for the C/C++ purists amongst us, my understanding is that when we initiate a compilation, the IDE slips in a "main" function while we aren't looking. The thing to remember is that the creators of the Arduino are trying to keep things as simple as possible for beginners. Learning the Arduino programming language First of all, there are a bunch of useful tutorials and other resources available for free on the main Aduino.cc website. If you are an absolute newcomer to C/C++, then one book that I would personally recommend is Programming Arduino Getting Started with Sketches by Simon Monk, which is available for a very reasonable $10.99 from Amazon.   It's worth knowing that an Arduino board typically arrives with a default program called "Blink" preinstalled. As soon as you connect the Arduino to your host computer with the USB cable, this program will cause a LED on the board to start blinking. The first half of Simon's book introduces you to various aspects of the C/C++ programming language via changes you make to this "Blink" sketch. Later experiments in the second half of the book will require you to use some very basic components and tools, like a resistor, a switch, a couple of pieces of wire, and a multi-meter. As you become more advanced, you will discover that there are all sorts of Arduino-specific resources available on the Internet to answer your questions. Also, a lot of general-purpose C/C++ resources are out there, such as this 'const' and 'static' keywords tutorial and this pointer tutorial . Next, we'll look at some Arduino kits for beginners... Arduino kits for beginners There are a couple of very useful starter kits available should you wish to avail yourself of them. The first is the Arduino Uno Ultimate Starter Kit for $54.99 from Amazon, as illustrated below:   This kit includes an Arduino Uno R3 board and a USB cable to connect it to your host computer. It also includes a small breadboard and a bunch of wires and electronic components sufficient for you to perform loads of experiments. Also included is a 72 page, full-colour instruction manual that will walk you through various experiments. What the kit doesn't include is a power supply, but you can pick one up from Amazon for $5.98 ( click here ). And, while you are at it, you might as well go for the ultrasonic distance sensor for only $4.85 ( click here ). Now, I cannot personally vouch for the above kit because I don't have one, but the fact that it has a 4.5 star rating from 242 customer reviews (at the time of this writing) says a lot. As always, I would suggest that you take a look at some of these reviews yourself to get a better feel for what's going on. Another kit that I can personally recommend is The Arduino Starter Kit for $109.95 from Amazon.   This little beauty comes with a host of tasty "stuff," including a 170-page Arduino Projects Book that walks you through building things like a "Light Theremin," a "Motorized Pinwheel," and a "Love-O-Meter." As for the other kit, one thing that isn't included is a power supply, but you can pick one up from Amazon for $5.98 ( click here ). Everything in this kit is very nicely packaged and presented. When you open the box, the first thing you see is the Arduino Projects Book , as illustrated below:   When you remove the book, you are presented with a "jigsaw puzzle" of small boxes as illustrated below:     Opening the boxes reveals all sorts of goodies, including a small liquid crystal display as illustrated below:     Now, if you are an experienced hobbyist or engineer, this kit may well be too simplistic for you. On the other hand, if you wish to introduce a younger person to the magic of microcontrollers, then this kit would be ideal. You start with really simple experiments like connecting a LED to an output pin and flashing it, and then you build up to more complicated projects in easy-to-understand steps. Also, everything is achieved by means of the breadboard; that is, no soldering is required. Two more books As you may recall, one reason for my wanting to learn that Arduino in the first place is that I sponsored a Kickstarter project for a fast and easy-to-use machine vision system called the Pixy, which can be connected directly to an Arduino. In the video shown on this project's Kickstarter webpage , we see the Pixy being used to control a small robot. Based on this, I ordered a book called Make an Arduino-Controlled Robot by Michael Margolis:   Generally speaking, this book has reasonably favourable reviews. Also, a lot of the information seems as though it would be of use for robots other than the two kits featured in the book. This is fortunate, because the kits themselves receive less than favourable reviews. However, we will leave that discussion to my next column, at which point we will consider the whole robot issue in more detail. Last but certainly not least (in the book department), I just took possession of another book called Arduino Workshop: A Hands-On Introduction with 65 Projects by John Boxall (a.k.a. Tronixstuff ):   Truth to tell, I haven't even had the chance to open the cover of this little beauty yet. Suffice it to say, for the moment, that one reviewer on Amazon said: I really think Arduino Workshop is under selling itself. It's not just a workshop manual but a tutorial on electronics, programming and Arduino, and a very good one at that... Over all this is an excellent resource and one that should be on the shopping list of everyone interested in creating their own Arduino toys and tools. Reading Arduino Workshop is high on my list of things to do, and I plan on writing full-up reviews of both Make an Arduino-Controlled Robot and Arduino Workshop in the not-so-distant future. But wait, there's more... Eeeek! I almost forgot to mention that my chum Tobias Strauch just sent me a very interesting link to a 30-minute documentary about how the Arduino came to be ( click here to see this video). And just this morning, I heard from Paul Kassebaum PhD, Maker Community Relations, MathWorks. Paul informed me that MathWork's Simulink has a relatively new capability to generate code to run on the Arduino Uno, Mega, and Nano platforms, as well as other low-cost microcontrollers like the Raspberry Pi and Beagleboard. Even better, they've built a website to introduce beginners and inspire amateurs to the cool stuff this capability enables: makerzone.mathworks.com (you can see a simple example meant to get one up and running from scratch on the Arduino Uno by clicking here ). As a more complex example of the sophistication Simulink can bring to Arduino-based projects, they used the Arduino Mega 2560 to automate sumobots in a competition last April ( click here ). Arduino-powered robots As I mentioned earlier, my next blog will be about creating Arduino-powered robots. In the meantime, do you have any questions? Alternatively, are there any Arduino books, kits, or other resources that you would recommend? If so, please share them with the rest of us in the comments below.  
相关资源