<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.emacinc.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kyoungmeyer</id>
	<title>wiki.emacinc.com - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.emacinc.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kyoungmeyer"/>
	<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/wiki/Special:Contributions/Kyoungmeyer"/>
	<updated>2026-04-30T13:57:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.6</generator>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Micropython&amp;diff=14951</id>
		<title>Micropython</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Micropython&amp;diff=14951"/>
		<updated>2021-06-10T20:52:35Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: Add Thonny section.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#seo:&lt;br /&gt;
|title=Micropython&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Micropython&lt;br /&gt;
|description=The following page can be used to get familiarized with Micropython on EMAC products.&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
Micropython is an implementation of the Python 3 programming langauge optimized to run on microcontrollers in a constrained environment.&lt;br /&gt;
&lt;br /&gt;
Micropython requires only 256k of code space and 16k RAM and aims to be as compatible as possible with normal Python 3 to allow for easy portability from desktop to microcontroller.&lt;br /&gt;
&lt;br /&gt;
For full documentation on Micropython, visit: [http://docs.micropython.org/en/latest/pyboard/ Micropython Documentation]&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=BS | title=Micropython | desc=The following page can be used to get familiarized with Micropython on EMAC products. | project=OE 5.0 }}&lt;br /&gt;
=== Tools Required ===&lt;br /&gt;
* Desktop PC&lt;br /&gt;
* USB to mini-USB cable&lt;br /&gt;
* Serial to USB converter (optional, may be required if board does not have USB)&lt;br /&gt;
* STLink programmer (optional, may be required if board does not have USB)&lt;br /&gt;
=== Setup === &lt;br /&gt;
* [[STLink | STLink]]&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=BS | title=EMAC Micropython | desc=The following page can be used to get familiarized with Micropython on EMAC products. | project=OE 5.0 }}&lt;br /&gt;
EMAC has developed multiple drivers and features for our products running Micropython.&lt;br /&gt;
&lt;br /&gt;
Documentation on specific features is listed below: &lt;br /&gt;
&lt;br /&gt;
* [[ Micropython_Bluemix | Micropython with IBM Bluemix ]]&lt;br /&gt;
* [[ Wifi_and_mqtt_on_the_rs9113 | Wifi and MQTT on the RS9113 ]]&lt;br /&gt;
* [http://wiki.emacinc.com/wiki/Cutipy_Test Test Software for CutiPy]&lt;br /&gt;
&lt;br /&gt;
=== Development Environment ===&lt;br /&gt;
EMAC has developed a plugin for the [https://thonny.org/ Thonny] IDE to make writing code for the CutiPy and MitiPy easier. Thonny can be used for editing files directly on the CutiPy/MitiPy boards as well as adding new files.&lt;br /&gt;
==== Installation ====&lt;br /&gt;
# Install Thonny with apt: &amp;lt;syntaxhighlight&amp;gt;sudo apt install thonny&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Install the &amp;lt;code&amp;gt;thonny-emac&amp;lt;/code&amp;gt; plugin from within Thonny.&lt;br /&gt;
## Open Thonny&lt;br /&gt;
## Click &amp;lt;code&amp;gt;Tools-&amp;gt;Manage Plugins...&amp;lt;/code&amp;gt;&lt;br /&gt;
## Type &amp;quot;thonny-emac&amp;quot; into the search bar, then click search&lt;br /&gt;
## Click the &amp;quot;thonny-emac&amp;quot; link&lt;br /&gt;
## Click the &amp;quot;Install&amp;quot; button&lt;br /&gt;
## Restart Thonny to complete installation&lt;br /&gt;
# Configure Thonny for EMAC boards&lt;br /&gt;
## Go to &amp;lt;code&amp;gt;Tools-&amp;gt;Options...&amp;lt;/code&amp;gt;&lt;br /&gt;
## Click the &amp;quot;Interpreter&amp;quot; tab&lt;br /&gt;
## Select &amp;quot;Micropython (EMAC CutiPy/MitiPy)&amp;quot; from the top dropdown menu&lt;br /&gt;
Developing on Thonny should now be configured for EMAC boards. General Thonny documentation can be found on [https://github.com/thonny/thonny/wiki/MicroPython the Thonny wiki].&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}&lt;br /&gt;
* [[ Industial_IoT_Boards | Boards that use Micropython ]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Getting_Started_with_MitiPy_and_FreeRTOS&amp;diff=14741</id>
		<title>Getting Started with MitiPy and FreeRTOS</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Getting_Started_with_MitiPy_and_FreeRTOS&amp;diff=14741"/>
		<updated>2020-10-07T16:37:08Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: Some typos and minor formatting changes.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#seo:&lt;br /&gt;
|title=Getting Started with MitiPy and FreeRTOS&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Mitipy Getting Started&lt;br /&gt;
|description=The following page can be used to get familiarized with the Mitipy.&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
This page outlines a basic guide to getting starting using the Mitipy.&lt;br /&gt;
{{note|The MitiPy FreeRTOS software build is currently under development and will be available for download in the near future.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=BS | title=Mitipy Getting Started | desc=The following page can be used to get familiarized with the Mitipy. | project=OE 5.0 }}&lt;br /&gt;
=== Tools Required ===&lt;br /&gt;
*Desktop PC (Windows/Linux/Mac will work)&lt;br /&gt;
*Micro-USB to USB Cable&lt;br /&gt;
*ST-LINK/V2 in-circuit debugger/programmer for STM8 and STM32 with JTAG 20 pin to SWD 10pin adaptor&lt;br /&gt;
*A MitiPy&lt;br /&gt;
*A method to power the board, either an ethernet cable with POE (Power Over Ethernet) injector, or a power supply and a wired connector for ST1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Setup === &lt;br /&gt;
1. Download and install [https://www.st.com/en/development-tools/stm32cubeide.html STM32CubeIDE] (The IDE used for MitiPy FreeRTOS development, For more information on the STM32CubeIDE click [[STM32CubeIDE | HERE]]) &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Download EMAC's MitiPy FreeRTOS project master branch [http://git.emacinc.com/FreeRTOS/MitiPy_FreeRTOS HERE]&amp;lt;/br&amp;gt; &lt;br /&gt;
3. Connect the ST-Link programmer to the MitiPy board for programming &amp;lt;/br&amp;gt;&lt;br /&gt;
*''Connect the 10 pin SWD connector (small ribbon cable) to the MitiPy Board HDR3. Ensure the the painted red wire of the cable is on the same side as the arrow.Connect the other end to the adaptor, again ensuring the arrow is aligned with painted red wire. Connect the ST-Link to the adaptor with the large ribbon cable, and connect the ST-LINK to your desktop with it's provided USB cable'' &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Connect your MitiPy to the Desktop using the micro-USB to USB cable. This will provide a menu through a serial terminal. &amp;lt;/br&amp;gt;&lt;br /&gt;
5. Apply power to the board either by POE or ST1. If using ST1 acceptable input voltages range from 8V to 32V &amp;lt;/br&amp;gt;&lt;br /&gt;
6. Open STM32CubeIDE and import the MitiPy FreeRTOS project &amp;lt;/br&amp;gt;&lt;br /&gt;
*If needed, upgrade your ST-LINK firmware by navigating to '''Help''' and selecting '''ST-LINK Upgrade'''. The ST Link upgrade window will open. Select '''refresh device list''', and then select '''Open in update mode''', and finally '''Upgrade''' &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:STLinkUpgrade.png]]&amp;lt;/br&amp;gt;&lt;br /&gt;
7. Build and upload the firmware &amp;lt;/br&amp;gt;&lt;br /&gt;
*''To build and upload select the debug symbol (To just build select the hammer symbol)''. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:DebugToolbar1.png]]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=BS | title=Developing with the Mitipy | desc=The following page can be used to get familiarized with Micropython the Mitipy. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
1.The baseline MitiPy FreeRTOS build has now been uploaded. Connect to the USB virtual com port on a serial terminal using Putty or TerraTerm. The USB virtual com port driver should install automatically after plugging the MitiPy to your PC. After successful installation of the driver '''STMMicroelectronics Virtual COM Port''' should be displayed as an available port. Connect to it as you would any normal serial port. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:USBcomPORT.png]]&amp;lt;/br&amp;gt;&lt;br /&gt;
* Using a serial terminal program like '''Putty''' or '''Tera Term''' connect to the port at a baud rate of 115200. &lt;br /&gt;
&lt;br /&gt;
[[File:serial.png]]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note|The USB virtual com port will adjust it's baud rate to that selected by the terminal. It has been tested to work with standard baud rate selections from 110 to 921600.}}&lt;br /&gt;
&lt;br /&gt;
2.After connecting the MitiPy FreeRTOS menu will be displayed. Navigate to tests for a demonstration of MitiPy functionality.&lt;br /&gt;
&lt;br /&gt;
[[File:TestMenu.png]]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:using | initials=BS | title='''EMAC MitiPy FreeRTOS Software Description''' | desc=The following page can be used to get familiarized with Micropython the Mitipy. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Layout ===&lt;br /&gt;
&lt;br /&gt;
The MitiPy_FreeRTOS project was developed using the STM32CubeIDE. It contains auto-generated program files and code along with custom files/folders provided by EMAC.&lt;br /&gt;
{{note|Editing of auto-generated code blocks and files should be avoided as these portions of the project will be overwritten if the auto-code generation feature of STM32CubeIDE is used (STM32CubeMX). Instead, we recommend the user create their own custom folders in the project or just use the EMAC provided folder, '''MitiPy_User''' for project development.}}&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
Custom EMAC folder include: &amp;lt;/br&amp;gt;&lt;br /&gt;
*'''MitiPy_Drivers''' provides custom written EMAC driver functions geared towards use with the MitiPy device. All functions are documented in their respective source files, hence the user should look here for function usage-rules and functionality. The functions written at a MitiPy module (COM A, COM B, SD_CARD, RS9116 radio, etc.) or individual driver level and were written with ease of use in mind.'''MP_FRTOS.c/h''' contains all FreeRTOS element declarations (Task handles, mutex handle, etc.) Here system level tasks and priorities can be adjusted if needed. '''MitiPy_Config.h''', contains options to turn off the menu to save memory space.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*'''MitiPy_Tasks''' contains the header and source files for the MitiPy freeRTOS for all EMAC provided system tasks. Task descriptions are provided in their respective source files &amp;lt;/br&amp;gt;&lt;br /&gt;
*'''MitiPy_User''' is an empty project folder dedicated for use by the user.&lt;br /&gt;
*'''RS9116_1_2_1''' and ''''''RS9116_1_2_1/examples/utilities''' contain driver files for the Redpine Signals RS9116 radio module.&lt;br /&gt;
&lt;br /&gt;
The only folders of real importance to the user is the MitiPy_Drivers folder. In addition to containing key driver functions it also contains MP_FRTOS.c that lists system task&lt;br /&gt;
priority, handle and size, and &lt;br /&gt;
&lt;br /&gt;
Other project folders include:&lt;br /&gt;
&lt;br /&gt;
*'''Middlewares''' - contains source files for the USB Virtual Com Port, fatfs (used mainly in conjuction with the sd card), and FreeRTOS.  &amp;lt;/br&amp;gt;&lt;br /&gt;
*'''Drivers'''     - contains STMicroelectronic's driver files. The user should look here for driver functionality not covered by the provide emac driver files&amp;lt;/br&amp;gt;&lt;br /&gt;
*'''Src'''         - contains initialization functions, and '''main.c'''&amp;lt;/br&amp;gt;&lt;br /&gt;
*'''Inc'''         - contains various include files, but the only one of primary importance  '''FreeRTOSConfig.h''' file  &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Overview ===&lt;br /&gt;
&lt;br /&gt;
MitiPy RTOS system-level tasks and synchronization have been provided by EMAC to ease user development.&lt;br /&gt;
&lt;br /&gt;
=== Feature Description ===&lt;br /&gt;
EMAC has provided custom driver functions for the MitiPy's main peripherals. These are located under '''MitiPy_Drivers'''. See the source files for function descriptions. All of EMAC's custom functions will be prefixed by '''MP_''' followed by the the '''DRIVER_NAME'''. Functions with the prefix '''MP_FRTOS''' utilize an RTOS element and should only&lt;br /&gt;
be called with the scheduler running. We recommend user files be added to the '''MitiPy_User''' or that the user add their own custom folders, and not modify the project code directly. EMAC has provide custom system tasks to ease MitiPy use and jump-start user development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''ADCs''' - The MitiPy utilizes the STM32F407's 3 internal ADCs. Thirteen ADC pins are available to the user on HDR2. '''MP_ADC.c''' MP_FRTOS functions provide thread safe functionality through mutex control of the 3 ADC's. Aside from 'external' pin sampling this driver file also provide functions for sampling the internal temp sensor, the ram back up battery voltage, and the internal reference voltage (used for calculating the voltage from a raw read)&lt;br /&gt;
&lt;br /&gt;
'''BATTERIES''' - The CuitPy has the option of being powered by an external 3.7 V 1200mah lithium ion rechargeable battery (EMAC Part#: PER-PWR0101PR0). It also has an onboard, jumper-enable 3.3V RTC-Ram Retention battery (See the MitiPy User Manual for more information. '''MP_BATTERIES.c''' contains functions for reading these battery voltages.&lt;br /&gt;
&lt;br /&gt;
''''BUTTONS''' - There are 2 buttons on the MitiPy, 1 Reset button + 1 user buttons (PB1 and PB2 respectively). PB2 is interrupt driven (rising and falling edge), hence its respective task only runs when an interrupt generated. A Callback function is provided in '''MP_BUTTONS.C'''. The user may simply edit these functions directly, to implement unique callback functionality. Button Tasks are located in '''MP_BUTTONS.c'''&lt;br /&gt;
&lt;br /&gt;
'''CAN''' - CAN communication is provided through HDR4 CAN1. The CAN1 subsystem consists of the STM32407's onboard CAN1 module an external CAN tranceiver (TCAN334GDCNT). '''MP_CAN.c''' contains easy-to-use functions for message reception/transmission, and module/tranceiver mode manipulation. An example use function is also included, as well as an internal loopback test. Note CAN1 is currently configured for baud rate of 500kHz.&lt;br /&gt;
&lt;br /&gt;
'''COM_A''' - COM_A consists of UART2 routed to an external RS-232 transceiver connected to the CN2 (The DB9 port). It is configured for baud rate of 115200. '''MP_COM_A.c''' provide driver functions for transceiver configuration and message transmission and reception. Two seperate mutexes are provided (MP_COM_A_RX_RecursiveMutexHandle and MP_COM_A_TX_RecursiveMutexHandle).    &lt;br /&gt;
&lt;br /&gt;
'''COM_B''' - COM_B consists of UART3 an RS232 transceiver and an RS422/485 transceiver. The active transceiver is user selectable, and only one can be active at a time. '''MP_COM_B.c''' provides driver functions for message transmission/receipt and transceiver selection. For thread safe usage a mutex is provided (MP_COM_B_RecursiveMutexHandle).&lt;br /&gt;
&lt;br /&gt;
'''DACs''' - The STM32F407 two digital analog converter channels are available on HDR2, pins 20 and 21. Driver functions are provided '''MP_DAC.c'''. &lt;br /&gt;
&lt;br /&gt;
'''DARLINGTON OPEN COLLECTOR DRIVERS''' - Eight gpios are connected and control 8 darlington pair open collector transistors. The Darlington pair transistors have superior current sinking capabilities when compared to the on-board GPIOs. (See the ULN2803A datasheet for more information). A pull-up resistor connects the Collector end of the Darlington transistor to V_HIDRV-This is left floating, but can be used by the user to enable digital toggling between GND and V_HIDRV. With V_HIDRV left unconnected the darlington transistor is used as a switch, that sinks current in the ON position. '''MP_DARLINGTON_OC.c''' provides functions for setting/resetting. Thread safe control is achieved through the use of mutexes(MP_DARLINGTON_OC_PGX_RecursiveMutexHandle). Eight indicator LEDs corresponding to the 8 darlington pairs will light up when the when in the ON position.&lt;br /&gt;
&lt;br /&gt;
'''LEDs''' - Two user LEDs are present on the MitiPy board (USER_LED0 and USER_LED1) located between the ethernet jack and user push button (LD11).  They are controlled through the toggling of GPIO outputs on the MCU. '''MP_LEDs.c''' contains easy to use function for the controlling the LEDs (ON, OFF, Toggle)&lt;br /&gt;
&lt;br /&gt;
'''RNG''' - The STM32F407 true random number generator (RNG) is pre-initialized. The RNG generates 32 bit random numbers. '''MP_RNG.c''' contains simple 'get value' functions. The radio utilizes the RNG for certain encrpytion purposes, for this reason MP_FRTOS_GetRandomValue() should be use for thread-safe access.&lt;br /&gt;
&lt;br /&gt;
'''RS9116 Wireless Module''' - The external RS9116 Wireless Module enables the development of Bluetooth Low Energy (BLE), Bluetooth (BT) and WLAN applications. In WLAN mode the RS9116 is able function as an access point or a client. The module also has the ability to operate in dual mode (WLAN +BLE). '''RS9116.c''' contains initialization functions for the radio, as well as basic use functions like connect/disconnect and sleep. Other functions and advanced usage is covered in the RS9116 documentation. &lt;br /&gt;
&lt;br /&gt;
'''MicroSD Card''' - The MitiPy comes with a MicroSD slot.The MitiPy_FreeRTOS build comes with FatFs for the manipulation of files (See the FatFs documentation for more information). Demos are provided in '''MP_SD_CARD.c'''&lt;br /&gt;
&lt;br /&gt;
'''Skywire Cellular (XBee form factor SOCKET)''' - Designed with the NimbleLink Skywire embedded cellular modem family in mind, the MitiPy is provisioned with an XBee socket hardware configurable to 3.3 or 3.8 Volts DC.&lt;br /&gt;
&lt;br /&gt;
'''mDot LoRa (XBee form factor SOCKET)''' - Designed with the Multitech mDot Long Range LoRa Module in mind, the MitiPy is provisioned with an XBee socket jumper configurable to 3.3 or 5.0 Volts DC. MultiTech mDot is a secure, CE/FCC/RCM/GITEKI certified,Arm® Mbed™ programmable, low-power RF module, that provideslong-range, low bit rate M2M data connectivity to sensors,industrial equipment and remote appliances.The mDot is LoRaWAN® 1.0.2 compliant, providing bi-directional data communication up to 10 miles / 15 km line-of-sight and 1-3 miles / 2 km into buildings**, using sub-GHz ISM bands inNorth America, Europe, Australia and Asia Pacific (AS923). mDots bring intelligence, reduced complexity and a lower overall bill of material cost to the very edge of the network while supporting a variety of electronic interfaces to connect just about any “Thing” for years on battery power.&lt;br /&gt;
&lt;br /&gt;
'''Ethernet''' - A POE 10-100 Base-T Ethernet interface provides both power and a wired network connectivity option.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
===Documentation===&lt;br /&gt;
&lt;br /&gt;
[[MitiPy_FreeRTOS_Documentation | MitiPy FreeRTOS Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
[[MitiPy FreeRTOS Documentation | MitiPy FreeRTOS Documentation]]&lt;br /&gt;
&lt;br /&gt;
[[ STM32CubeIDE | STM32CubeIDE ]]&lt;br /&gt;
&lt;br /&gt;
[[FreeRTOS | FreeRTOS]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=RS9116_Radio_Module&amp;diff=14047</id>
		<title>RS9116 Radio Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=RS9116_Radio_Module&amp;diff=14047"/>
		<updated>2020-05-08T14:52:29Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: Add picture and clarification&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#seo:&lt;br /&gt;
|title=RS9116 Radio Module&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Cutipy, Mitipy, Micropython, FreeRTOS, RS9116, Wifi, Bluetooth&lt;br /&gt;
|description=The following page can be used to learn more about the RS9116 in relation to EMAC products.&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
This page will show how to use the RS9116 radio module in both MicroPython and FreeRTOS. The RS9116 module currently supports both WiFi and Bluetooth 5. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=Using the RS9116 | desc=The following section shows some background information. | project=OE 5.0 }}&lt;br /&gt;
=== Hardware Required ===&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Desktop PC (Windows/Linux/Mac will work)&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;CutiPy R1 or MitiPy R1 board with RS9116 populated&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Micro USB cable&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
=== Software Required ===&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;A shell program such as [https://github.com/dhylands/rshell rshell] (MicroPython only)&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;The latest firmware for the board (MicroPython or FreeRTOS) [[CutiPy-Installing_MicroPython_Firmware | See here for details]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=KY | title=Using the RS9116 | desc=The following section shows some general information. | project=OE 5.0 }}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=Using the RS9116 | desc=The following section shows how to use the RS9116 with a couple systems. | project=OE 5.0 }}&lt;br /&gt;
=== MicroPython ===&lt;br /&gt;
EMAC provides a MicroPython driver for the RS9116 that supports both WiFi and Bluetooth. Both WiFi and Bluetooth can be used concurrently, in the right application.&lt;br /&gt;
==== WiFi ====&lt;br /&gt;
The WiFi setup is relatively straightforward. The &amp;lt;code&amp;gt;RS9116&amp;lt;/code&amp;gt; module is part of the standard MicroPython &amp;lt;code&amp;gt;network&amp;lt;/code&amp;gt; module, and is able to use the MicroPython &amp;lt;code&amp;gt;socket&amp;lt;/code&amp;gt; module.&lt;br /&gt;
===== Initialization =====&lt;br /&gt;
Use the following code to initialize the module for WiFi usage.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
import network&lt;br /&gt;
nic = network.RS9116()&lt;br /&gt;
nic.init()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== Connecting =====&lt;br /&gt;
Once the RS9116 module is initialized, it can be connected to a network. In the following example, the network is ''SSID'' and the network key is ''PASSWORD''.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
nic.connect('SSID', 'PASSWORD')&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the network name is unknown, it can be scanned for by using the ''scan'' function. The function returns a list of 5-tuples with (SSID, RSSI value, security mode, RF channel, BSSID)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
nic.scan()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Once connected, the IP address of the board can be retrieved with the following function. The function returns a 4-tuple with (ip address, subnet mask, gateway, MAC address).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
nic.ifconfig()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== Sockets =====&lt;br /&gt;
More detailed examples can be found [https://docs.micropython.org/en/latest/esp8266/tutorial/network_tcp.html here], but a simple socket example is shown below. The demo can be stopped by entering a Ctrl-C keystroke. Before running the below example, connect the board to a network as shown in the above section.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
import socket&lt;br /&gt;
addr_info = socket.getaddrinfo(&amp;quot;towel.blinkenlights.nl&amp;quot;, 23)&lt;br /&gt;
addr = addr_info[0][-1]&lt;br /&gt;
s = socket.socket()&lt;br /&gt;
s.connect(addr)&lt;br /&gt;
while True:&lt;br /&gt;
    data = s.recv(500)&lt;br /&gt;
    print(str(data, 'utf8'), end='')&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Droids.png|frame|left]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This demo will display an ASCII animation of the original Star Wars film. The data is retrieved over the internet, so it shows how well the RS9116 handles sending and receiving a lot of packets.&lt;br /&gt;
&lt;br /&gt;
==== Bluetooth ====&lt;br /&gt;
===== Initialization =====&lt;br /&gt;
Initialization for Bluetooth/BLE is exactly the same as for WiFi.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
import network&lt;br /&gt;
nic = network.RS9116()&lt;br /&gt;
nic.init()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== Setup =====&lt;br /&gt;
Unlike WiFi, Bluetooth requires more setup to get going. A service handler must be added, attributes must be added, and advertise must be enabled. The following code sets the module up to advertise a ''write'' property and two ''read'' properties, with one having ''notify'' enabled.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
handle = nic.add_service(0xaabb)&lt;br /&gt;
write_handle = nic.add_attribute(handle, 0x1aa2, nic.ATT_PROPERTY_WRITE)&lt;br /&gt;
read_sw_handle = nic.add_attribute(handle, 0x2bb1, nic.ATT_PROPERTY_NOTIFY | nic.ATT_PROPERTY_READ)&lt;br /&gt;
read_rand_handle = nic.add_attribute(handle, 0x3cc4, nic.ATT_PROPERTY_READ)&lt;br /&gt;
nic.set_antenna(nic.INTERNAL_ANTENNA)&lt;br /&gt;
nic.set_adv_data(name)&lt;br /&gt;
nic.set_scan_resp_data(name)&lt;br /&gt;
nic.set_local_name('{} Peripheral'.format(&amp;quot;ADVERT_NAME&amp;quot;))&lt;br /&gt;
### Optional&lt;br /&gt;
local_mac = nic.get_local_addr()&lt;br /&gt;
local_name = nic.get_local_name()&lt;br /&gt;
print('Local Device MAC Address = {}'.format(local_mac))&lt;br /&gt;
print('Local Device Name = {}'.format(local_name))&lt;br /&gt;
###&lt;br /&gt;
nic.advertise(True)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== Events =====&lt;br /&gt;
Once the module is setup, the board can be put into a loop to check events as they come in. The following code is very simplified. If more information is needed, please see the [[Cutipy-MicroPython_Bluetooth_LE_demo|Bluetooth LE Demo]] page (and the source code linked there),&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
while True:&lt;br /&gt;
    event = nic.get_event()&lt;br /&gt;
    if event == nic.NO_EVENT:&lt;br /&gt;
        nic.clear_event(event)&lt;br /&gt;
        continue&lt;br /&gt;
    if event == nic.CONNECT_EVENT:&lt;br /&gt;
        print('Connected')&lt;br /&gt;
        addr = nic.get_remote_addr()&lt;br /&gt;
        print('Remote Device MAC Address = {}'.format(addr))&lt;br /&gt;
        print('Remote Device RSSI  = {}'.format(nic.get_rssi(addr)))&lt;br /&gt;
        print('Remote Device State = {}'.format(nic.get_device_status()))&lt;br /&gt;
    elif event == nic.DISCONNECT_EVENT:&lt;br /&gt;
        print('Disconnected')&lt;br /&gt;
    elif event == nic.WRITE_EVENT:&lt;br /&gt;
        event_rsp = nic.get_event_data(event)&lt;br /&gt;
        # Do something with event_rsp.&lt;br /&gt;
        # event_rsp[0] contains the text or bytes sent from the client&lt;br /&gt;
    else:&lt;br /&gt;
        print('Unexpected Event {}'.format(event))&lt;br /&gt;
    nic.clear_event(event)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== FreeRTOS ===&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
{{:Templateimpl:whatnext | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
[http://git.emacinc.com/micropython-public/micropython-doc CutiPy Micropython Documentation]&lt;br /&gt;
&lt;br /&gt;
[[ Cutipy_Test | Cutipy Test Software ]]&lt;br /&gt;
&lt;br /&gt;
[[ Cutipy-MicroPython Bluetooth LE demo | Cutipy-MicroPython Bluetooth LE demo ]] &lt;br /&gt;
&lt;br /&gt;
[[ Micropython | Micropython ]]&lt;br /&gt;
&lt;br /&gt;
[[CutiPy-Installing_MicroPython_Firmware | CutiPy-Installing Micropython Firmware]]&lt;br /&gt;
&lt;br /&gt;
[https://www.redpinesignals.com/Products/Hosted_Connectivity/Multi-Protocol_Wireless_SoCs_&amp;amp;_Modules/RS9116_SoCs_&amp;amp;_Modules/RS9116N-SB00-AA1.php RS9116 resources]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=File:Droids.png&amp;diff=14026</id>
		<title>File:Droids.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=File:Droids.png&amp;diff=14026"/>
		<updated>2020-05-08T14:43:24Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If the demo is successful, this will be displayed.&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=RS9116_Radio_Module&amp;diff=14021</id>
		<title>RS9116 Radio Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=RS9116_Radio_Module&amp;diff=14021"/>
		<updated>2020-04-13T17:10:25Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: Add wifi and bluetooth info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#seo:&lt;br /&gt;
|title=RS9116 Radio Module&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Cutipy, Mitipy, Micropython, FreeRTOS, RS9116, Wifi, Bluetooth&lt;br /&gt;
|description=The following page can be used to learn more about the RS9116 in relation to EMAC products.&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
This page will show how to use the RS9116 radio module in both MicroPython and FreeRTOS. The RS9116 module currently supports both WiFi and Bluetooth 5. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=Using the RS9116 | desc=The following section shows some background information. | project=OE 5.0 }}&lt;br /&gt;
=== Hardware Required ===&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Desktop PC (Windows/Linux/Mac will work)&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;CutiPy R1 or MitiPy R1 board with RS9116 populated&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Micro USB cable&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
=== Software Required ===&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;A shell program such as [https://github.com/dhylands/rshell rshell] (MicroPython only)&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;The latest firmware for the board (MicroPython or FreeRTOS) [[CutiPy-Installing_MicroPython_Firmware | See here for details]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=KY | title=Using the RS9116 | desc=The following section shows some general information. | project=OE 5.0 }}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=Using the RS9116 | desc=The following section shows how to use the RS9116 with a couple systems. | project=OE 5.0 }}&lt;br /&gt;
=== MicroPython ===&lt;br /&gt;
EMAC provides a MicroPython driver for the RS9116 that supports both WiFi and Bluetooth. Both WiFi and Bluetooth can be used concurrently, in the right application.&lt;br /&gt;
==== WiFi ====&lt;br /&gt;
The WiFi setup is relatively straightforward. The &amp;lt;code&amp;gt;RS9116&amp;lt;/code&amp;gt; module is part of the standard MicroPython &amp;lt;code&amp;gt;network&amp;lt;/code&amp;gt; module, and is able to use the MicroPython &amp;lt;code&amp;gt;socket&amp;lt;/code&amp;gt; module.&lt;br /&gt;
===== Initialization =====&lt;br /&gt;
Use the following code to initialize the module for WiFi usage.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
import network&lt;br /&gt;
nic = network.RS9116()&lt;br /&gt;
nic.init()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== Connecting =====&lt;br /&gt;
Once the RS9116 module is initialized, it can be connected to a network. In the following example, the network is ''SSID'' and the network key is ''PASSWORD''.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
nic.connect('SSID', 'PASSWORD')&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the network name is unknown, it can be scanned for by using the ''scan'' function. The function returns a list of 5-tuples with (SSID, RSSI value, security mode, RF channel, BSSID)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
nic.scan()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Once connected, the IP address of the board can be retrieved with the following function. The function returns a 4-tuple with (ip address, subnet mask, gateway, MAC address).&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
nic.ifconfig()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== Sockets =====&lt;br /&gt;
More detailed examples can be found [https://docs.micropython.org/en/latest/esp8266/tutorial/network_tcp.html here], but a simple socket example is shown below. The demo can be stopped by entering a Ctrl-C keystroke.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
import socket&lt;br /&gt;
addr_info = socket.getaddrinfo(&amp;quot;towel.blinkenlights.nl&amp;quot;, 23)&lt;br /&gt;
addr = addr_info[0][-1]&lt;br /&gt;
s = socket.socket()&lt;br /&gt;
s.connect(addr)&lt;br /&gt;
while True:&lt;br /&gt;
    data = s.recv(500)&lt;br /&gt;
    print(str(data, 'utf8'), end='')&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This demo will display an ASCII animation of the original Star Wars film. The data is retrieved over the internet, so it shows how well the RS9116 handles sending and receiving a lot of packets. &lt;br /&gt;
&lt;br /&gt;
==== Bluetooth ====&lt;br /&gt;
===== Initialization =====&lt;br /&gt;
Initialization for Bluetooth/BLE is exactly the same as for WiFi.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
import network&lt;br /&gt;
nic = network.RS9116()&lt;br /&gt;
nic.init()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== Setup =====&lt;br /&gt;
Unlike WiFi, Bluetooth requires more setup to get going. A service handler must be added, attributes must be added, and advertise must be enabled. The following code sets the module up to advertise a ''write'' property and two ''read'' properties, with one having ''notify'' enabled.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
handle = nic.add_service(0xaabb)&lt;br /&gt;
write_handle = nic.add_attribute(handle, 0x1aa2, nic.ATT_PROPERTY_WRITE)&lt;br /&gt;
read_sw_handle = nic.add_attribute(handle, 0x2bb1, nic.ATT_PROPERTY_NOTIFY | nic.ATT_PROPERTY_READ)&lt;br /&gt;
read_rand_handle = nic.add_attribute(handle, 0x3cc4, nic.ATT_PROPERTY_READ)&lt;br /&gt;
nic.set_antenna(nic.INTERNAL_ANTENNA)&lt;br /&gt;
nic.set_adv_data(name)&lt;br /&gt;
nic.set_scan_resp_data(name)&lt;br /&gt;
nic.set_local_name('{} Peripheral'.format(&amp;quot;ADVERT_NAME&amp;quot;))&lt;br /&gt;
### Optional&lt;br /&gt;
local_mac = nic.get_local_addr()&lt;br /&gt;
local_name = nic.get_local_name()&lt;br /&gt;
print('Local Device MAC Address = {}'.format(local_mac))&lt;br /&gt;
print('Local Device Name = {}'.format(local_name))&lt;br /&gt;
###&lt;br /&gt;
nic.advertise(True)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== Events =====&lt;br /&gt;
Once the module is setup, the board can be put into a loop to check events as they come in. The following code is very simplified. If more information is needed, please see the [[Cutipy-MicroPython_Bluetooth_LE_demo|Bluetooth LE Demo]] page (and the source code linked there),&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
while True:&lt;br /&gt;
    event = nic.get_event()&lt;br /&gt;
    if event == nic.NO_EVENT:&lt;br /&gt;
        nic.clear_event(event)&lt;br /&gt;
        continue&lt;br /&gt;
    if event == nic.CONNECT_EVENT:&lt;br /&gt;
        print('Connected')&lt;br /&gt;
        addr = nic.get_remote_addr()&lt;br /&gt;
        print('Remote Device MAC Address = {}'.format(addr))&lt;br /&gt;
        print('Remote Device RSSI  = {}'.format(nic.get_rssi(addr)))&lt;br /&gt;
        print('Remote Device State = {}'.format(nic.get_device_status()))&lt;br /&gt;
    elif event == nic.DISCONNECT_EVENT:&lt;br /&gt;
        print('Disconnected')&lt;br /&gt;
    elif event == nic.WRITE_EVENT:&lt;br /&gt;
        event_rsp = nic.get_event_data(event)&lt;br /&gt;
        # Do something with event_rsp.&lt;br /&gt;
        # event_rsp[0] contains the text or bytes sent from the client&lt;br /&gt;
    else:&lt;br /&gt;
        print('Unexpected Event {}'.format(event))&lt;br /&gt;
    nic.clear_event(event)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== FreeRTOS ===&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
{{:Templateimpl:whatnext | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
[http://git.emacinc.com/micropython-public/micropython-doc CutiPy Micropython Documentation]&lt;br /&gt;
&lt;br /&gt;
[[ Cutipy_Test | Cutipy Test Software ]]&lt;br /&gt;
&lt;br /&gt;
[[ Cutipy-MicroPython Bluetooth LE demo | Cutipy-MicroPython Bluetooth LE demo ]] &lt;br /&gt;
&lt;br /&gt;
[[ Micropython | Micropython ]]&lt;br /&gt;
&lt;br /&gt;
[[CutiPy-Installing_MicroPython_Firmware | CutiPy-Installing Micropython Firmware]]&lt;br /&gt;
&lt;br /&gt;
[https://www.redpinesignals.com/Products/Hosted_Connectivity/Multi-Protocol_Wireless_SoCs_&amp;amp;_Modules/RS9116_SoCs_&amp;amp;_Modules/RS9116N-SB00-AA1.php RS9116 resources]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=RS9116_Radio_Module&amp;diff=13998</id>
		<title>RS9116 Radio Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=RS9116_Radio_Module&amp;diff=13998"/>
		<updated>2020-04-02T20:05:41Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#seo:&lt;br /&gt;
|title=RS9116 Radio Module&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Cutipy, Mitipy, Micropython, FreeRTOS, RS9116, Wifi, Bluetooth&lt;br /&gt;
|description=The following page can be used to learn more about the RS9116 in relation to EMAC products.&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
This page will show how to use the RS9116 radio module in both MicroPython and FreeRTOS. The RS9116 module currently supports both WiFi and Bluetooth 5. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=Using the RS9116 | desc=The following section shows some background information. | project=OE 5.0 }}&lt;br /&gt;
=== Hardware Required ===&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Desktop PC (Windows/Linux/Mac will work)&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;CutiPy R1 or MitiPy R1 board with RS9116 populated&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Micro USB cable&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
=== Software Required ===&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;A shell program such as [https://github.com/dhylands/rshell rshell] (MicroPython only)&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;The latest firmware for the board (MicroPython or FreeRTOS) [[CutiPy-Installing_MicroPython_Firmware | See here for details]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=KY | title=Using the RS9116 | desc=The following section shows some general information. | project=OE 5.0 }}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=Using the RS9116 | desc=The following section shows how to use the RS9116 with a couple systems. | project=OE 5.0 }}&lt;br /&gt;
=== MicroPython ===&lt;br /&gt;
EMAC provides a MicroPython driver for the RS9116 that supports both WiFi and Bluetooth. Both WiFi and Bluetooth can be used concurrently, in the right application.&lt;br /&gt;
==== WiFi ====&lt;br /&gt;
&lt;br /&gt;
==== Bluetooth ====&lt;br /&gt;
&lt;br /&gt;
=== FreeRTOS ===&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
{{:Templateimpl:whatnext | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
[http://git.emacinc.com/micropython-public/micropython-doc CutiPy Micropython Documentation]&lt;br /&gt;
&lt;br /&gt;
[[ Cutipy_Test | Cutipy Test Software ]]&lt;br /&gt;
&lt;br /&gt;
[[ Cutipy-MicroPython Bluetooth LE demo | Cutipy-MicroPython Bluetooth LE demo ]] &lt;br /&gt;
&lt;br /&gt;
[[ Micropython | Micropython ]]&lt;br /&gt;
&lt;br /&gt;
[[CutiPy-Installing_MicroPython_Firmware | CutiPy-Installing Micropython Firmware]]&lt;br /&gt;
&lt;br /&gt;
[https://www.redpinesignals.com/Products/Hosted_Connectivity/Multi-Protocol_Wireless_SoCs_&amp;amp;_Modules/RS9116_SoCs_&amp;amp;_Modules/RS9116N-SB00-AA1.php RS9116 resources]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=RS9116_Radio_Module&amp;diff=13989</id>
		<title>RS9116 Radio Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=RS9116_Radio_Module&amp;diff=13989"/>
		<updated>2020-04-02T15:46:05Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#seo:&lt;br /&gt;
|title=RS9116 Radio Module&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Cutipy, Mitipy, Micropython, FreeRTOS, RS9116, Wifi, Bluetooth&lt;br /&gt;
|description=The following page can be used to learn more about the RS9116 in relation to EMAC products.&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
This page will show how to use the RS9116 radio module in both MicroPython and FreeRTOS. The RS9116 module currently supports both WiFi and Bluetooth 5. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=Using the RS9116 | desc=The following section shows some background information. | project=OE 5.0 }}&lt;br /&gt;
=== Hardware Required ===&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Desktop PC (Windows/Linux/Mac will work)&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;CutiPy R1 or MitiPy R1 board with RS9116 populated&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Micro USB cable&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
=== Software Required ===&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;A shell program such as [https://github.com/dhylands/rshell rshell] (MicroPython only)&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;The latest firmware for the board (MicroPython or FreeRTOS) [[CutiPy-Installing_MicroPython_Firmware | See here for details]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=KY | title=Using the RS9116 | desc=The following section shows some general information. | project=OE 5.0 }}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=Using the RS9116 | desc=The following section shows how to use the RS9116 with a couple systems. | project=OE 5.0 }}&lt;br /&gt;
=== MicroPython ===&lt;br /&gt;
EMAC provides a MicroPython driver for the RS9116 that supports both WiFi and Bluetooth. Both WiFi and Bluetooth can be used concurrently, in the right application.&lt;br /&gt;
==== WiFi ====&lt;br /&gt;
&lt;br /&gt;
==== Bluetooth ====&lt;br /&gt;
&lt;br /&gt;
=== FreeRTOS ===&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
[http://git.emacinc.com/micropython-public/micropython-doc CutiPy Micropython Documentation]&lt;br /&gt;
&lt;br /&gt;
[[ Cutipy_Test | Cutipy Test Software ]]&lt;br /&gt;
&lt;br /&gt;
[[ Cutipy-MicroPython Bluetooth LE demo | Cutipy-MicroPython Bluetooth LE demo ]] &lt;br /&gt;
&lt;br /&gt;
[[ Micropython | Micropython ]]&lt;br /&gt;
&lt;br /&gt;
[[CutiPy-Installing_MicroPython_Firmware | CutiPy-Installing Micropython Firmware]]&lt;br /&gt;
&lt;br /&gt;
[https://www.redpinesignals.com/Products/Hosted_Connectivity/Multi-Protocol_Wireless_SoCs_&amp;amp;_Modules/RS9116_SoCs_&amp;amp;_Modules/RS9116N-SB00-AA1.php RS9116 resources]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=RS9116_Radio_Module&amp;diff=13980</id>
		<title>RS9116 Radio Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=RS9116_Radio_Module&amp;diff=13980"/>
		<updated>2020-04-02T15:29:23Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#seo:&lt;br /&gt;
|title=RS9116 Radio Module&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Cutipy, Mitipy, Micropython, FreeRTOS, RS9116, Wifi, Bluetooth&lt;br /&gt;
|description=The following page can be used to learn more about the RS9116 in relation to EMAC products.&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=Using the RS9116 | desc=The following section shows some background information. | project=OE 5.0 }}&lt;br /&gt;
=== Hardware Required ===&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Desktop PC (Windows/Linux/Mac will work)&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;CutiPy R1 or MitiPy R1 board with RS9116 populated&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Micro USB cable&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
=== Software Required ===&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;A shell program such as [https://github.com/dhylands/rshell rshell] (MicroPython only)&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;The latest firmware for the board (MicroPython or FreeRTOS) [[CutiPy-Installing_MicroPython_Firmware | See here for details]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=KY | title=Using the RS9116 | desc=The following section shows some general information. | project=OE 5.0 }}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=Using the RS9116 | desc=The following section shows how to use the RS9116 with a couple systems. | project=OE 5.0 }}&lt;br /&gt;
=== MicroPython ===&lt;br /&gt;
EMAC provides a MicroPython driver for the RS9116 that supports both WiFi and Bluetooth. Both WiFi and Bluetooth can be used concurrently, in the right application.&lt;br /&gt;
==== WiFi ====&lt;br /&gt;
&lt;br /&gt;
==== Bluetooth ====&lt;br /&gt;
&lt;br /&gt;
=== FreeRTOS ===&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
[http://git.emacinc.com/micropython-public/micropython-doc CutiPy Micropython Documentation]&lt;br /&gt;
&lt;br /&gt;
[[ Cutipy_Test | Cutipy Test Software ]]&lt;br /&gt;
&lt;br /&gt;
[[ Cutipy-MicroPython Bluetooth LE demo | Cutipy-MicroPython Bluetooth LE demo ]] &lt;br /&gt;
&lt;br /&gt;
[[ Micropython | Micropython ]]&lt;br /&gt;
&lt;br /&gt;
[[CutiPy-Installing_MicroPython_Firmware | CutiPy-Installing Micropython Firmware]]&lt;br /&gt;
&lt;br /&gt;
[https://www.redpinesignals.com/Products/Hosted_Connectivity/Multi-Protocol_Wireless_SoCs_&amp;amp;_Modules/RS9116_SoCs_&amp;amp;_Modules/RS9116N-SB00-AA1.php RS9116 resources]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=RS9116_Radio_Module&amp;diff=13963</id>
		<title>RS9116 Radio Module</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=RS9116_Radio_Module&amp;diff=13963"/>
		<updated>2020-04-02T15:11:05Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: Created page with &amp;quot;{{#seo: |title=RS9116 Radio Module |titlemode=append |keywords=Cutipy, Mitipy, Micropython, FreeRTOS, RS9116, Wifi, Bluetooth |description=The following page can be used to le...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#seo:&lt;br /&gt;
|title=RS9116 Radio Module&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Cutipy, Mitipy, Micropython, FreeRTOS, RS9116, Wifi, Bluetooth&lt;br /&gt;
|description=The following page can be used to learn more about the RS9116 in relation to EMAC products.&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=CutiPy-Installing_MicroPython_Firmware&amp;diff=5903</id>
		<title>CutiPy-Installing MicroPython Firmware</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=CutiPy-Installing_MicroPython_Firmware&amp;diff=5903"/>
		<updated>2020-02-13T17:18:32Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: Added link to EMAC public MicroPython releases&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This tutorial will walk you through installing/updating MicroPython on your CutiPy device. Instuctions are given for both Windows and Linux users.&lt;br /&gt;
=== Necessary equipment ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. CutiPy&lt;br /&gt;
* 1 Micro-USB cable&lt;br /&gt;
* A pair of needle nose pliers for wire jumper re-positioning &lt;br /&gt;
* A personal computer (Windows or Linux)&lt;br /&gt;
* [http://git.emacinc.com/micropython-public/micropython/-/releases EMAC's latest MicroPython firmware release]&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:using | initials=BS | title=Windows Users | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }} &lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. With the USB disconnected and power removed, carefully use a pair of needle nose pliers to shift jumper JB2 upwards from FLS to to RXM (The BT0 and RXM pins will now be linked). The device is now in bootloader mode.&lt;br /&gt;
&lt;br /&gt;
{{note|If a version of Micropython is already installed on your device, '''&amp;gt;&amp;gt;&amp;gt;pyb.bootloader()''' can be inputted into the REPL console, to put the board into bootloader mode ''without'' having to move the jumper. &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Connect your CutiPy to your PC using the Micro-USB cable. &lt;br /&gt;
&lt;br /&gt;
* Download and install [https://zadig.akeo.ie  Zadig]&lt;br /&gt;
&lt;br /&gt;
* Open Zadig  and select '''STM32 BOOTLOADER''' and '''WinUSB'''&lt;br /&gt;
&lt;br /&gt;
[[File:Zadig.png]]&lt;br /&gt;
&lt;br /&gt;
{{note|The '''STM32 BOOTLOADER''' option is only available when the microUSB is connected and the device is in bootloader mode.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Click '''Replace Driver''' &lt;br /&gt;
&lt;br /&gt;
{{note|Upon clicking “Replace Driver” the app may read “Not Responding” for a short duration and then recover. This is normal.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* After successfully installing the WinUSB driver, download the latest dfu-util application zip file [http://dfu-util.sourceforge.net/ here]. &lt;br /&gt;
&lt;br /&gt;
* Extract the zip file. &lt;br /&gt;
&lt;br /&gt;
* For convenience, save the CutiPy firmware dfu file to the dfu-util folder.&lt;br /&gt;
&lt;br /&gt;
* Open the Windows Command Prompt by searching and selecting &amp;quot;Command Prompt&amp;quot; from the Windows start menu.&lt;br /&gt;
&lt;br /&gt;
* From the Command Prompt navigate to the dfu-util directory. If necessary switch drives by entering ''''drive_name:'''. For example to switch to the C drive enter&lt;br /&gt;
'''c:'''. Use '''dir''' to list sub-directories and use '''cd directory_name''' to navigate to a subdirectory. &lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
Microsof Windows [Version 6.1.7601] &amp;lt;br /&amp;gt;&lt;br /&gt;
Copyright (c)  2009 Microsoft Corporation. All rights reserved.&lt;br /&gt;
&lt;br /&gt;
O:\&amp;gt;C:&lt;br /&gt;
&lt;br /&gt;
C:\Users&amp;gt;cd MyUser&lt;br /&gt;
&lt;br /&gt;
C:\Users\MyUser&amp;gt;cd Desktop&lt;br /&gt;
&lt;br /&gt;
C:\Users\MyUser\Desktop&amp;gt;cd dfu-util-0.9-win64&lt;br /&gt;
&lt;br /&gt;
C:\Users\MyUser\Desktop\dfu-util-0.9-win64&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Once in the dfu-util directory enter '''dfu-util -l'''. Something similar to the following should be displayed:&lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
C:\Users\MyUser\Desktop\dfu-util-0.9-win64&amp;gt;dfu-util -l&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. &amp;lt;br /&amp;gt;&lt;br /&gt;
Copyright 2010-2016 Tormod Volden and Stefan Schmidt&amp;lt;br /&amp;gt;&lt;br /&gt;
This program is Free Softwasre and has ABSOLUTELY NO WARRANTY&amp;lt;br /&amp;gt;&lt;br /&gt;
Please report bugs to http: // sourceforge.net / p / dfu-util / tickets /&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Found DFU: [0483:df11] ver 2200, dvenum=7, cfg =1, intf=0, path=&amp;quot;2-1.3&amp;quot;, alt=3, n &amp;lt;br /&amp;gt;&lt;br /&gt;
ame=&amp;quot;@Device Feature/0xFFFF0000/01*004 e&amp;quot;, serial=&amp;quot;336445653437&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
Found DFU: [0483:df11] ver 2200, dvenum=7, cfg =1, intf=0, path=&amp;quot;2-1.3&amp;quot;, alt=2, n &amp;lt;br /&amp;gt;&lt;br /&gt;
ame =&amp;quot;@OTP Memory /0x1FFF7900/01*412 e, 01*016 e&amp;quot;, serial=&amp;quot;336445653437&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
Found DFU: [0483:df11] ver 2200, dvenum=7, cfg =1, intf=0, path=&amp;quot;2-1.3&amp;quot;, alt=1, n &amp;lt;br /&amp;gt;&lt;br /&gt;
ame=&amp;quot;@Option Bytes/0xFFFF0000/01*016 e&amp;quot;, serial=&amp;quot;336445653437&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
Found DFU: [0483:df11] ver 2200, dvenum=7, cfg =1, intf=0, path=&amp;quot;2-1.3&amp;quot;, alt=0, n &amp;lt;br /&amp;gt;&lt;br /&gt;
ame=&amp;quot;@Internal Flash /0x08000000/04*016Kg, 01*064Kg, 07*128Kg&amp;quot;, serial=&amp;quot;336445653 &amp;lt;br /&amp;gt;&lt;br /&gt;
437&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
C:\Users\MyUser\Desktop\dfu-util-0.9-win64&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
* From this directory install the firmware to the device by entering the following into the Command Prompt, where '''firmware.dfu''' is just the name of the firmware dfu file:&lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
&lt;br /&gt;
C:\Users\MyUser\Desktop\dfu-util-0.9-win64&amp;gt;dfu-util --alt 0 -D firmware.dfu&lt;br /&gt;
&lt;br /&gt;
{{clos}}&lt;br /&gt;
{{note|If the firmware dfu file is saved anywhere other than the dfu-util folder, the full path location will need to be entered. E.g. '''dfu-util --alt 0 -D ...\firmware.dfu''', where &amp;quot;...&amp;quot; should be filled in with the directory path.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Something similar to the following should be displayed. &lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
C:\Users\MyUser\Desktop\dfu-util-0.9-win64&amp;gt;duf-util --alt 0 -D firmware.dfu&lt;br /&gt;
&lt;br /&gt;
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. &amp;lt;br /&amp;gt;&lt;br /&gt;
Copyright 2010-2016 Tormod Volden and Stefan Schmidt         &amp;lt;br /&amp;gt;&lt;br /&gt;
This program is Free Softwasre and has ABSOLUTELY NO WARRANTY  &amp;lt;br /&amp;gt;&lt;br /&gt;
Please report bugs to http: // sourceforge.net / p / dfu-util / tickets /  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Match vendor ID from file: 0483  &amp;lt;br /&amp;gt;&lt;br /&gt;
Match product ID from file: df11 &amp;lt;br /&amp;gt;&lt;br /&gt;
Opening DFU capable USB device...&amp;lt;br /&amp;gt;&lt;br /&gt;
ID 0483:df11&amp;lt;br /&amp;gt;&lt;br /&gt;
Run-time device DFU version 011a&amp;lt;br /&amp;gt;&lt;br /&gt;
Claiming USB DFU Interface...&amp;lt;br /&amp;gt;&lt;br /&gt;
Setting Alternate Setting #0 ...&amp;lt;br /&amp;gt;&lt;br /&gt;
Determining device status: state = dfuERROR, satus = 10&amp;lt;br /&amp;gt;&lt;br /&gt;
dfuERROR, clearing status&amp;lt;br /&amp;gt;&lt;br /&gt;
Determining device status: state = dfuIDLE, status = 0&amp;lt;br /&amp;gt;&lt;br /&gt;
dfuIDLE, continuing &amp;lt;br /&amp;gt;&lt;br /&gt;
DFU mode device DFU version 011a&amp;lt;br /&amp;gt;&lt;br /&gt;
Device returned tranfer size 2048&amp;lt;br /&amp;gt;&lt;br /&gt;
DfuSe interface name: &amp;quot;Internal Flash &amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
file contains 1 DFU images&amp;lt;br /&amp;gt;&lt;br /&gt;
parsing DFU image 1&amp;lt;br /&amp;gt;&lt;br /&gt;
image for alternate setting 0, &amp;lt;2 elements, total size = 386288&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
parsing element1, address = 0x08000000, size =15000&amp;lt;br /&amp;gt;&lt;br /&gt;
Download     [=========================] 100%      15000 bytes&amp;lt;br /&amp;gt;&lt;br /&gt;
Download done.&amp;lt;br /&amp;gt;&lt;br /&gt;
pasing element 2, address = 0x8020000, size =371272&amp;lt;br /&amp;gt;&lt;br /&gt;
Download     [=========================] 100%     371272 bytes&amp;lt;br /&amp;gt;&lt;br /&gt;
Download done.&amp;lt;br /&amp;gt;&lt;br /&gt;
done parsing DfuSe file&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
C:\Users\MyUser\Desktop\dfu-util-0.9-win64&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
      &lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The firmware is now installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Safely eject and disconnect the USB (Remove power), shift the JB2 pin jumper back to the original location (BT0 and FLS should now be joined). Now reconnnect the MicroUSB cable.&lt;br /&gt;
&lt;br /&gt;
Installation is now complete complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:using | initials=BS | title=Linux Users | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Follow the EMAC DFU instructions given [http://git.emacinc.com/micropython-public/micropython-doc/blob/master/Micropython_firmware_installation.md#dfu-usb-instructions-linux here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:using | initials=BS | title=After Firmware Installation | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }} &lt;br /&gt;
&lt;br /&gt;
After installing the firmware you can open a MicroPython REPL(read evaluate print loop) console (covered [http://wiki.emacinc.com/wiki/Cutipy_Getting_Started here ]), and verify the firmware version by entering the following into the REPL console&lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; import os &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; os.uname()&amp;lt;br /&amp;gt;&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
Output should look similar to the following:&lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
(sysname='pyboard', nodename='pyboard', rlease='0.0.1', version='394ae277 as IOT-F40&amp;lt;br /&amp;gt;&lt;br /&gt;
7C-XXXRX on 2019-06-07', machine = 'EMAC-CutiPy with STM32F407')&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
After installing the firmware perform a factory reset. This clears the file system, and adds/replaces boot.py and main.py&lt;br /&gt;
&lt;br /&gt;
{{note|The factory reset will delete all files present on the board. For this reason we recommend backing up your files if you have made any changes.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Perform a factory reset as follows (Note these instructions are a slight modification of the PyBoard factory reset instruction given [https://docs.micropython.org/en/latest/pyboard/tutorial/reset.html#factory-reset-the-filesystem here]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. Connect your CutiPy to your PC using the MicroUSB cable.&lt;br /&gt;
* Hold down PB1.&lt;br /&gt;
* While still holding down PB1, press and release the reset button PB5.&lt;br /&gt;
* The LD2 and LD3 will then flash, cycling through various lighting combinations corresponding to different options. Both lit corresponds to the factory reset option.&lt;br /&gt;
* Keep holding down PB1, when both LEDs are lit, release PB1 to select the factory reset option.&lt;br /&gt;
* Both LEDs should quickly flash 4 times, a third LED (LD1) will turn on.&lt;br /&gt;
* The file system is now being reset.&lt;br /&gt;
* After the file system is reset, all LEDs will turn off and the device will enter safe mode.&lt;br /&gt;
* Press and release the reset button, PB5 to boot normally.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:using | initials=BS | title=References | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }} &lt;br /&gt;
https://github.com/micropython/micropython/wiki/Pyboard-Firmware-Update&amp;lt;br /&amp;gt;&lt;br /&gt;
https://docs.micropython.org/en/latest/pyboard/tutorial/reset.html#factory-reset-the-filesystem&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:using | initials=BS | title=Pages with Related Content| desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }} &lt;br /&gt;
[[ Cutipy_Test | Cutipy Test Software ]]&lt;br /&gt;
&lt;br /&gt;
[[ Micropython | Micropython ]]&lt;br /&gt;
&lt;br /&gt;
[[Cutipy_Getting_Started| CutiPy Getting Started]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Cutipy-MicroPython_Bluetooth_LE_demo&amp;diff=5902</id>
		<title>Cutipy-MicroPython Bluetooth LE demo</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Cutipy-MicroPython_Bluetooth_LE_demo&amp;diff=5902"/>
		<updated>2020-02-13T15:56:45Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: Add instructions for some new features to the script&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Intro==&lt;br /&gt;
Here we will demonstrate basic Bluetooth LE (low energy) connectivity between an android device and a CutiPy running MicroPython. The application will connect to the CutiPy via the onboard RS9116 radio module, once connected the user can 'wirelessly' toggle an led and send text messages to the LCD.&lt;br /&gt;
&lt;br /&gt;
===Required Materials===&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. Android device (Smartphone)&lt;br /&gt;
* CutiPy device running MicroPython&lt;br /&gt;
* A personal computer &lt;br /&gt;
* [http://git.emacinc.com/micropython-public/micropython-helper-scripts/blob/master/blechat.py  blechat.py script]&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Steps===&lt;br /&gt;
&lt;br /&gt;
'''ON YOUR PC:''' &lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. Connect your CutiPy to your personal computer using a microUSB cable ([[ Cutipy_Getting_Started | Steps Covered Here ]])&lt;br /&gt;
* Copy blechat.py into the CutiPy drive&lt;br /&gt;
* Reset your CutiPy board to update the file system&lt;br /&gt;
* Establish a REPL terminal connection ([[ Cutipy_Getting_Started | Steps Covered Here ]])&lt;br /&gt;
* Enter the following commands into the REPL terminal to launch the ''CutiPy's'' bluetooth application&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
import blechat&lt;br /&gt;
ble = blechat.BleChat('EMAC Demo')  # 'EMAC Demo' can be any string less than about 16 chars&lt;br /&gt;
ble.start(demo=True)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The CutiPy bluetooth connection should now be discoverable.&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
'''ON YOUR ANDROID DEVICE:''' &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. Download the BLE Scanner App from the Google '''Play Store'''&lt;br /&gt;
* Open the app&lt;br /&gt;
* Find the '''EMAC Demo''' entry. It will have the Alias ''cutipy'' &amp;lt;br/&amp;gt;&lt;br /&gt;
[[File:BLE_SCANNER_1.jpg|300px|left|thumb|Figure 1: BLE SCANNER APP]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Click '''CONNECT''' &lt;br /&gt;
* On the next screen, click the arrow next to '''Custom Service'''&lt;br /&gt;
* Clicking on the ‘W’ button (Indicated by red arrow in Figure 2) will bring up a text entry box that will send text to the CutiPy LCD screen&lt;br /&gt;
[[File:BT_SCANNER_2.PNG|300px|left|thumb|Figure 2: BLE SCANNER APP]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Selecting ''Byte Array'' and sending 0001 will turn on LED1, while sending 0000 will turn it off.&lt;br /&gt;
* The text 'clear' can be sent to the clear the LCD, 'exit' can be sent to stop the app.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:BT_SCANNER_3.jpg|300px|left|thumb|Figure 3: BLE SCANNER APP]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Clicking on the 'R' button next to the 'N' button will read the status of Switch 1.&lt;br /&gt;
* Clicking on the bottom 'R' button will read a random number generated by the CutiPy's hardware RNG.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Cutipy_Web_Browser&amp;diff=5900</id>
		<title>Cutipy Web Browser</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Cutipy_Web_Browser&amp;diff=5900"/>
		<updated>2020-01-10T16:23:07Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#seo:&lt;br /&gt;
|title=Cutipy Web Browser&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Cutipy Web Browser&lt;br /&gt;
|description=The following page can be used to start serving web pages from a Cutipy.&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
This page outlines a basic guide to getting starting serving web pages from a Cutipy.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
=== Required Equipment ===&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. One CutiPy Board&lt;br /&gt;
* One microUSB cable&lt;br /&gt;
* One MicroSD Card &lt;br /&gt;
* A Desktop/Laptop running Linux or Windows&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:geninfo | initials=KY | title=Cutipy Web Browser | desc=The following page can be used to start serving web pages from a Cutipy. | project=OE 5.0 }}&lt;br /&gt;
Running a web browser on the Cutipy is fairly simple, and can be accomplished by using the PicoWebSrv project. This project is primarily aimed at the EMAC CutiPy board with the RS9116 module onboard. PicoWebSrv allows serving of standard webpages (html, css, javascript), as well as hosting a simple REST API implementation.&lt;br /&gt;
&lt;br /&gt;
With only one required file, it is very easy to integrate with new or existing projects.&lt;br /&gt;
* ''picoWebSrv.py'' - The Actual Web server&lt;br /&gt;
* ''picoMimetypes.py'' - (Optional) Full list of mimetypes for the Content-Type: header line&lt;br /&gt;
Currently the server only has support for GET and POST requests.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=Developing with the Cutipy Web Server | desc=The following page can be used to start serving web pages from a Cutipy. | project=OE 5.0 }}&lt;br /&gt;
PicoWebSrv has just one external MicroPython library requirement:&lt;br /&gt;
* [https://github.com/micropython/micropython-lib/blob/master/logging/logging.py logging.py] - '''Note:''' This will be included in all standard EMAC MicroPython builds, starting with the next major release.&lt;br /&gt;
=== Basic Web Server ===&lt;br /&gt;
To run a basic web server from the Cutipy, use the following instructions. These instructions assume that you are storing your webpage files on an SD card attached to the Cutipy.&lt;br /&gt;
&amp;lt;cl&amp;gt;1. Remove the SD card from the Cutipy, if already inserted.&lt;br /&gt;
* Connect the SD card to the host PC.&lt;br /&gt;
* Place web page files on the SD card in the '''www''' directory (The can be downloade HERE.)&lt;br /&gt;
* Connect the Cutipy to the host PC via a USB cable. See [[Cutipy_Getting_Started | The getting started page]].&lt;br /&gt;
* Create an empty file (NO FILE EXTENSION) called ''SKIPSD'' CutiPy's flash memory (appears as flash drive device '''PYBFLASH''' on your PC)&lt;br /&gt;
* Edit boot.py in the flash memory and add the following lines.&lt;br /&gt;
{{note|To prevent file corruption, it is recommended that all edits occur outside of the CutiPy's flash memory. For example when editing boot.py, first copy the file to your desktop, make the edits to the desktop copy and then copy the file back to CutiPy flash memory}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
import uos&lt;br /&gt;
try:&lt;br /&gt;
    uos.mount(pyb.SDCard(), '/sd')&lt;br /&gt;
except Exception:&lt;br /&gt;
    pass&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* Place the PicoWebSrv files (''picoWebSrv.py'' and '''Optionally''' ''picoMimetypes.py'') flash memory as well as ''logging.py''  . &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When it's all said and done, you CutiPy's drive contents ('''PYBFLASH''') should look similar to the following (note logging.py may not be required in future CutiPy firmware releases): &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:PYBFLASH.PNG]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your SD cards contents should only contain the the www directory:&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:MicroSD.PNG]]&amp;lt;br&amp;gt;&lt;br /&gt;
* Disconnect the Cutipy, insert the SD card, then reconnect the Cutipy.&lt;br /&gt;
* Run the following commands to start the server. &lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
import network&lt;br /&gt;
import picoWebSrv&lt;br /&gt;
&lt;br /&gt;
nic = network.RS9116()&lt;br /&gt;
nic.init()&lt;br /&gt;
nic.connect('SSID', 'PASSWORD')&lt;br /&gt;
&lt;br /&gt;
host_ip = nic.ifconfig()[0]&lt;br /&gt;
pws = picoWebSrv.PicoWebSrv(host_ip, 80, file_location='/sd/www/')&lt;br /&gt;
pws.start()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
The web pages placed on the SD card will now be served at the IP of the Cutipy. The IP will be displayed on the Cutipy LCD if populated, it will also be printed on the REPL as follows&lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; INFO:picoWebSrv:Simple Webserver Running at: 10.0.6.153:80&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
Where in this case 10.0.6.153 is the IP address ('''Your IP address may be different'''). Copy and paste this IP address into your web-browser's address bar to view the webpage.&lt;br /&gt;
=== REST (Representational State Transfer) Server ===&lt;br /&gt;
To start a server with some REST API calls, preform the same steps as with the Basic Web Server, but stop before the last step. You will need to register some functions and endpoints for the API calls before starting the server. This process is illustrated below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
import network&lt;br /&gt;
import picoWebServer&lt;br /&gt;
import pyb&lt;br /&gt;
import ujson&lt;br /&gt;
&lt;br /&gt;
def get_switch(var_list):&lt;br /&gt;
    if var_list:&lt;br /&gt;
        switch_num = var_list[0]  # (e.g. '/get_switch/1')&lt;br /&gt;
    else:&lt;br /&gt;
        switch_num = 1  &lt;br /&gt;
&lt;br /&gt;
    sw = pyb.Switch(switch_num)&lt;br /&gt;
&lt;br /&gt;
    if sw():&lt;br /&gt;
        response_data = ujson.dumps({'status': 'pressed'})&lt;br /&gt;
    else:&lt;br /&gt;
        response_data = ujson.dumps({'status': 'not_pressed'})&lt;br /&gt;
&lt;br /&gt;
    return response_data.encode('utf-8')&lt;br /&gt;
&lt;br /&gt;
def led_control(json_dict):&lt;br /&gt;
    try:&lt;br /&gt;
        led_num = json_dict['number']&lt;br /&gt;
    except KeyError:&lt;br /&gt;
        led_num = 1&lt;br /&gt;
    led = pyb.LED(led_num)&lt;br /&gt;
    try:&lt;br /&gt;
        led_action = json_dict['action']&lt;br /&gt;
    except KeyError:&lt;br /&gt;
        led.toggle()&lt;br /&gt;
    else:&lt;br /&gt;
        if led_action == 'on':&lt;br /&gt;
            led.on()&lt;br /&gt;
        elif led_action == 'off':&lt;br /&gt;
            led.off()&lt;br /&gt;
        elif led_action == 'toggle':&lt;br /&gt;
            led.toggle()&lt;br /&gt;
        else:&lt;br /&gt;
            raise ValueError&lt;br /&gt;
    if led.intensity() == 255:  # CutiPy reports 255 as off. LED pins sink current, instead of source.&lt;br /&gt;
        response_data = ujson.dumps({'status': 'off'})&lt;br /&gt;
    else:&lt;br /&gt;
        response_data = ujson.dumps({'status': 'on'})&lt;br /&gt;
&lt;br /&gt;
    return response_data.encode('utf-8')&lt;br /&gt;
&lt;br /&gt;
nic = network.RS9116()&lt;br /&gt;
nic.init()&lt;br /&gt;
nic.connect('SSID', 'PASSWORD')&lt;br /&gt;
&lt;br /&gt;
host_ip = nic.ifconfig()[0]&lt;br /&gt;
pws = picoWebSrv(host_ip, 80, file_location='/sd/www/')&lt;br /&gt;
pws.add_rest_function('GET', '/get_sw', get_switch)&lt;br /&gt;
pws.add_rest_function('POST', 'led_ctrl', led_control)&lt;br /&gt;
pws.start()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This will start a server with an API call listening for GET at ''/get_sw'' and a call listening for POST at ''led_ctrl''. For more information about these calls, see the library documentation [http://git.emacinc.com/Micropython/PicoWebSrv here].&lt;br /&gt;
&lt;br /&gt;
You can find a file with the above REST function definitions (plus additional functions), [http://git.emacinc.com/kyoungmeyer/PicoTestSite/raw/master/restAPIFuncts.py here]. This file just needs to be imported, then the included functions can be set as REST API calls.&lt;br /&gt;
&lt;br /&gt;
==== Integration with Existing Project ====&lt;br /&gt;
&lt;br /&gt;
This webserver can easily be integrated with existing projects, that need a REST API endpoint. The only extra code that would need written is some wrapper functions (that call existing functions) that take and return the correct parameters expected by the webserver's REST parsing. The [http://git.emacinc.com/kyoungmeyer/PicoTestSite/raw/master/restAPIFuncts.py restAPIFuncts.py] file should provide a good example of this, the functions wrap calls to the various 'pyb.' functions.&lt;br /&gt;
&lt;br /&gt;
=== Real World Example ===&lt;br /&gt;
&lt;br /&gt;
The following is an example of how to set up a webserver instance on a CutiPy, that will restart itself if someone manages to crash the server. Pressing &amp;lt;Ctrl-C&amp;gt; on the REPL terminal will stop the server (you may need to press it more than once). The following is two separate files, the names are indicated by the comment at the top of the block. In ''webserver.py'', replace 'SSID' and 'PASSWORD' with the SSID and PASSWORD of your WiFi network, respectively.&lt;br /&gt;
&lt;br /&gt;
Place these two files, the PicoWebSrv files, and the [http://git.emacinc.com/kyoungmeyer/PicoTestSite/raw/master/restAPIFuncts.py restAPIFuncts.py] file on the CutiPy's flash memory (appears as flash drive device '''PYBFLASH''' on your PC). Download and place the ''www/'' directory from [http://git.emacinc.com/kyoungmeyer/PicoTestSite/repository/archive.zip?ref=master this zip file] onto the SD card (as show in the above sections). After editing the ''main.py'' file, reset the CutiPy, and the websever will be running. The IP address will be printed on the REPL.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
# webserver.py&lt;br /&gt;
&lt;br /&gt;
import pyb&lt;br /&gt;
import network&lt;br /&gt;
import logging&lt;br /&gt;
import picoWebSrv&lt;br /&gt;
import restAPIFuncts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def webserver():&lt;br /&gt;
    nic = network.RS9116()&lt;br /&gt;
    nic.init()&lt;br /&gt;
    nic.connect('SSID', 'PASSWORD')&lt;br /&gt;
&lt;br /&gt;
    host_ip = nic.ifconfig()[0]&lt;br /&gt;
    pws = picoWebSrv.PicoWebSrv(host_ip, 80, file_location='/sd/www/')&lt;br /&gt;
    pws.add_rest_function('POST', 'led_control', restAPIFuncts.led_control)&lt;br /&gt;
    pws.add_rest_function('GET', 'get_switch', restAPIFuncts.get_switch)&lt;br /&gt;
    pws.add_rest_function('GET', 'get_led', restAPIFuncts.get_led)&lt;br /&gt;
    pws.start()&lt;br /&gt;
&lt;br /&gt;
def run():&lt;br /&gt;
    while True:&lt;br /&gt;
        try:&lt;br /&gt;
            webserver()&lt;br /&gt;
        except KeyboardInterrupt:&lt;br /&gt;
            break&lt;br /&gt;
        except Exception as e:&lt;br /&gt;
            print(e)&lt;br /&gt;
            continue&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
# main.py&lt;br /&gt;
&lt;br /&gt;
import webserver&lt;br /&gt;
&lt;br /&gt;
webserver.run()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ''restAPIFuncts.py'' file can be edited to include additional functions of your choosing, and additional REST endpoints can be added with more calls to ''.add_rest_function()''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
[http://git.emacinc.com/micropython-public/micropython-doc CutiPy Micropython Documentation]&lt;br /&gt;
&lt;br /&gt;
[[ Cutipy_Test | Cutipy Test Software ]]&lt;br /&gt;
&lt;br /&gt;
[[ Cutipy-MicroPython Bluetooth LE demo | Cutipy-MicroPython Bluetooth LE demo ]] &lt;br /&gt;
&lt;br /&gt;
[[ Micropython | Micropython ]]&lt;br /&gt;
&lt;br /&gt;
[[CutiPy-Installing_MicroPython_Firmware | CutiPy-Installing Micropython Firmware]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Cutipy_Web_Browser&amp;diff=5869</id>
		<title>Cutipy Web Browser</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Cutipy_Web_Browser&amp;diff=5869"/>
		<updated>2019-12-16T18:55:18Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: New page for Cutipy web server.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#seo:&lt;br /&gt;
|title=Cutipy Web Browser&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Cutipy Web Browser&lt;br /&gt;
|description=The following page can be used to start serving web pages from a Cutipy.&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
This page outlines a basic guide to getting starting serving web pages from a Cutipy.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=KY | title=Cutipy Web Browser | desc=The following page can be used to start serving web pages from a Cutipy. | project=OE 5.0 }}&lt;br /&gt;
Running a web browser on the Cutipy is fairly simple, and can be accomplished by using the PicoWebSrv project. This project is primarily aimed at the EMAC CutiPy board with the RS9116 module onboard. PicoWebSrv allows serving of standard webpages (html, css, javascript), as well as hosting a simple REST API implementation.&lt;br /&gt;
&lt;br /&gt;
With only one required file, it is very easy to integrate with new or existing projects.&lt;br /&gt;
* ''picoWebSrv.py'' - The Actual Web server&lt;br /&gt;
* ''picoMimetypes.py'' - (Optional) Full list of mimetypes for the Content-Type: header line&lt;br /&gt;
Currently the server only has support for GET and POST requests.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=Developing with the Cutipy Web Server | desc=The following page can be used to start serving web pages from a Cutipy. | project=OE 5.0 }}&lt;br /&gt;
PicoWebSrv has just one external MicroPython library requirement:&lt;br /&gt;
* [https://github.com/micropython/micropython-lib/blob/master/logging/logging.py logging.py] - '''Note:''' This will be included in all standard EMAC MicroPython builds, starting with the next major release.&lt;br /&gt;
=== Basic Web Server ===&lt;br /&gt;
To run a basic web server from the Cutipy, use the following instructions. These instructions assume that you are storing your webpage files on an SD cart attached to the Cutipy.&lt;br /&gt;
&amp;lt;cl&amp;gt;1. Remove the SD card from the Cutipy, if already inserted.&lt;br /&gt;
* Connect the SD card to the host PC.&lt;br /&gt;
* Place web page files on the SD card in the ''www/'' directory&lt;br /&gt;
* Connect the Cutipy to the host PC via a USB cable. See [[Cutipy_Getting_Started | The getting started page]].&lt;br /&gt;
* Create an empty file called ''SKIPSD'' in the base of the flash memory.&lt;br /&gt;
* Edit boot.py in the flash memory and add the following lines.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
try:&lt;br /&gt;
    uos.mount(pyb.SDCard(), &amp;quot;/sd&amp;quot;)&lt;br /&gt;
except Exception:&lt;br /&gt;
    pass&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* Place the PicoWebSrv files in the base of the flash memory as well.&lt;br /&gt;
* Disconnect the Cutipy, insert the SD card, then reconnect the Cutipy.&lt;br /&gt;
* Run the following commands to start the server. &lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
import network&lt;br /&gt;
import picoWebSrv&lt;br /&gt;
&lt;br /&gt;
nic = network.RS9116()&lt;br /&gt;
nic.init()&lt;br /&gt;
nic.connect('SSID', 'PASSWORD')&lt;br /&gt;
&lt;br /&gt;
host_ip = nic.ifconfig()[0]&lt;br /&gt;
pws = picoWebSrv(host_ip, 80, file_location='/sd/www/')&lt;br /&gt;
pws.start()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
The web pages placed on the SD card will now be served at the IP of the Cutipy. The IP will be displayed on the Cutipy LCD if populated, it will also be printed on the REPL.&lt;br /&gt;
&lt;br /&gt;
=== REST Server ===&lt;br /&gt;
To start a server with some REST API calls, preform the same steps as with the Basic Web Server, but stop before the last step. You will need to register some functions and endpoints for the API calls before starting the server. This process is illustrated below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
import network&lt;br /&gt;
import picoWebServer&lt;br /&gt;
import pyb&lt;br /&gt;
import ujson&lt;br /&gt;
&lt;br /&gt;
def get_switch(var_list):&lt;br /&gt;
    if var_list:&lt;br /&gt;
        switch_num = var_list[0]  # (e.g. '/get_switch/1')&lt;br /&gt;
    else:&lt;br /&gt;
        switch_num = 1  &lt;br /&gt;
&lt;br /&gt;
    sw = pyb.Switch(switch_num)&lt;br /&gt;
&lt;br /&gt;
    if sw():&lt;br /&gt;
        response_data = ujson.dumps({'status': 'pressed'})&lt;br /&gt;
    else:&lt;br /&gt;
        response_data = ujson.dumps({'status': 'not_pressed'})&lt;br /&gt;
&lt;br /&gt;
    return response_data.encode('utf-8')&lt;br /&gt;
&lt;br /&gt;
def led_control(json_dict):&lt;br /&gt;
    try:&lt;br /&gt;
        led_num = json_dict['number']&lt;br /&gt;
    except KeyError:&lt;br /&gt;
        led_num = 1&lt;br /&gt;
    led = pyb.LED(led_num)&lt;br /&gt;
    try:&lt;br /&gt;
        led_action = json_dict['action']&lt;br /&gt;
    except KeyError:&lt;br /&gt;
        led.toggle()&lt;br /&gt;
    else:&lt;br /&gt;
        if led_action == 'on':&lt;br /&gt;
            led.on()&lt;br /&gt;
        elif led_action == 'off':&lt;br /&gt;
            led.off()&lt;br /&gt;
        elif led_action == 'toggle':&lt;br /&gt;
            led.toggle()&lt;br /&gt;
        else:&lt;br /&gt;
            raise ValueError&lt;br /&gt;
    if led.intensity() == 255:  # CutiPy reports 255 as off. LED pins sink current, instead of source.&lt;br /&gt;
        response_data = ujson.dumps({'status': 'off'})&lt;br /&gt;
    else:&lt;br /&gt;
        response_data = ujson.dumps({'status': 'on'})&lt;br /&gt;
&lt;br /&gt;
    return response_data.encode('utf-8')&lt;br /&gt;
&lt;br /&gt;
nic = network.RS9116()&lt;br /&gt;
nic.init()&lt;br /&gt;
nic.connect('SSID', 'PASSWORD')&lt;br /&gt;
&lt;br /&gt;
host_ip = nic.ifconfig()[0]&lt;br /&gt;
pws = picoWebSrv(host_ip, 80, file_location='/sd/www/')&lt;br /&gt;
pws.add_rest_function('GET', '/get_sw', get_switch)&lt;br /&gt;
pws.add_rest_function('POST', 'led_ctrl', led_control)&lt;br /&gt;
pws.start()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This will start a server with an API call listening for GET at ''/get_sw'' and a call listening for POST at ''led_ctrl''. For more information about these calls, see the library documentation [http://git.emacinc.com/Micropython/PicoWebSrv here].&lt;br /&gt;
{{:Templateimpl:whatnext | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
[http://git.emacinc.com/micropython-public/micropython-doc CutiPy Micropython Documentation]&lt;br /&gt;
&lt;br /&gt;
[[ Cutipy_Test | Cutipy Test Software ]]&lt;br /&gt;
&lt;br /&gt;
[[ Cutipy-MicroPython Bluetooth LE demo | Cutipy-MicroPython Bluetooth LE demo ]] &lt;br /&gt;
&lt;br /&gt;
[[ Micropython | Micropython ]]&lt;br /&gt;
&lt;br /&gt;
[[CutiPy-Installing_MicroPython_Firmware | CutiPy-Installing Micropython Firmware]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=CutiPy-Installing_MicroPython_Firmware&amp;diff=5833</id>
		<title>CutiPy-Installing MicroPython Firmware</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=CutiPy-Installing_MicroPython_Firmware&amp;diff=5833"/>
		<updated>2019-09-04T18:05:04Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: Fixed a couple typos. Removed a couple blank lines. Changed &amp;quot;After References&amp;quot; to &amp;quot;References&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===THIS PAGE IS CURRENTLY UNDER CONSTRUCTION===&lt;br /&gt;
=== Necessary equipment ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. CutiPy&lt;br /&gt;
* 1 Micro-USB cable&lt;br /&gt;
* A pair of needle nose pliers for wire jumper re-positioning &lt;br /&gt;
* A personal computer (Windows or Linux)&lt;br /&gt;
* EMAC's latest MicroPython firmware release&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:using | initials=BS | title=Windows Users | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }} &lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. With the USB disconnected and power removed, carefully use a pair of needle nose pliers to shift jumper JB2 upwards from FLS to to RXM (The BT0 and RXM pins will now be linked). The device is now in bootloader mode.&lt;br /&gt;
&lt;br /&gt;
{{note|If a version of Micropython is already installed on your device, '''&amp;gt;&amp;gt;&amp;gt;pyb.bootloader()''' can be inputted into the REPL console, to put the board into bootloader mode ''without'' having to move the jumper. &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Connect your CutiPy to your PC using the Micro-USB cable. &lt;br /&gt;
&lt;br /&gt;
* Download and install [https://zadig.akeo.ie  Zadig]&lt;br /&gt;
&lt;br /&gt;
* Open Zadig  and select '''STM32 BOOTLOADER''' and '''WinUSB'''&lt;br /&gt;
&lt;br /&gt;
[[File:Zadig.png]]&lt;br /&gt;
&lt;br /&gt;
{{note|The '''STM32 BOOTLOADER''' option is only available when the microUSB is connected and the device is in bootloader mode.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Click '''Replace Driver''' &lt;br /&gt;
&lt;br /&gt;
{{note|Upon clicking “Replace Driver” the app may read “Not Responding” for a short duration and then recover. This is normal.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* After successfully installing the WinUSB driver, download the latest dfu-util application zip file [http://dfu-util.sourceforge.net/ here]. &lt;br /&gt;
&lt;br /&gt;
* Extract the zip file. &lt;br /&gt;
&lt;br /&gt;
* For convenience, save the CutiPy firmware dfu file to the dfu-util folder.&lt;br /&gt;
&lt;br /&gt;
* Open the Windows Command Prompt by searching and selecting &amp;quot;Command Prompt&amp;quot; from the Windows start menu.&lt;br /&gt;
&lt;br /&gt;
* From the Command Prompt navigate to the dfu-util directory. If necessary switch drives by entering ''''drive_name:'''. For example to switch to the C drive enter&lt;br /&gt;
'''c:'''. Use '''dir''' to list sub-directories and use '''cd directory_name''' to navigate to a subdirectory. &lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
Microsof Windows [Version 6.1.7601] &amp;lt;br /&amp;gt;&lt;br /&gt;
Copyright (c)  2009 Microsoft Corporation. All rights reserved.&lt;br /&gt;
&lt;br /&gt;
O:\&amp;gt;C:&lt;br /&gt;
&lt;br /&gt;
C:\Users&amp;gt;cd MyUser&lt;br /&gt;
&lt;br /&gt;
C:\Users\MyUser&amp;gt;cd Desktop&lt;br /&gt;
&lt;br /&gt;
C:\Users\MyUser\Desktop&amp;gt;cd dfu-util-0.9-win64&lt;br /&gt;
&lt;br /&gt;
C:\Users\MyUser\Desktop\dfu-util-0.9-win64&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Once in the dfu-util directory enter '''dfu-util -l'''. Something similar to the following should be displayed:&lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
C:\Users\MyUser\Desktop\dfu-util-0.9-win64&amp;gt;dfu-util -l&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.&lt;br /&gt;
Copyright 2010-2016 Tormod Volden and Stefan Schmidt&lt;br /&gt;
This program is Free Softwasre and has ABSOLUTELY NO WARRANTY&lt;br /&gt;
Please report bugs to http: // sourceforge.net / p / dfu-util / tickets /&lt;br /&gt;
&lt;br /&gt;
Found DFU: [0483:df11] ver 2200, dvenum=7, cfg =1, intf=0, path=&amp;quot;2-1.3&amp;quot;, alt=3, n &amp;lt;br /&amp;gt;&lt;br /&gt;
ame=&amp;quot;@Device Feature/0xFFFF0000/01*004 e&amp;quot;, serial=&amp;quot;336445653437&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
Found DFU: [0483:df11] ver 2200, dvenum=7, cfg =1, intf=0, path=&amp;quot;2-1.3&amp;quot;, alt=2, n &amp;lt;br /&amp;gt;&lt;br /&gt;
ame =&amp;quot;@OTP Memory /0x1FFF7900/01*412 e, 01*016 e&amp;quot;, serial=&amp;quot;336445653437&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
Found DFU: [0483:df11] ver 2200, dvenum=7, cfg =1, intf=0, path=&amp;quot;2-1.3&amp;quot;, alt=1, n &amp;lt;br /&amp;gt;&lt;br /&gt;
ame=&amp;quot;@Option Bytes/0xFFFF0000/01*016 e&amp;quot;, serial=&amp;quot;336445653437&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
Found DFU: [0483:df11] ver 2200, dvenum=7, cfg =1, intf=0, path=&amp;quot;2-1.3&amp;quot;, alt=0, n &amp;lt;br /&amp;gt;&lt;br /&gt;
ame=&amp;quot;@Internal Flash /0x08000000/04*016Kg, 01*064Kg, 07*128Kg&amp;quot;, serial=&amp;quot;336445653 &amp;lt;br /&amp;gt;&lt;br /&gt;
437&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
C:\Users\MyUser\Desktop\dfu-util-0.9-win64&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
* From this directory install the firmware to the device by entering the following into the Command Prompt, where '''firmware.dfu''' is just the name of the firmware dfu file:&lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
&lt;br /&gt;
C:\Users\MyUser\Desktop\dfu-util-0.9-win64&amp;gt;duf-util --alt 0 -D firmware.dfu&lt;br /&gt;
&lt;br /&gt;
{{clos}}&lt;br /&gt;
{{note|If the firmware dfu file is saved anywhere other than the dfu-util folder, the full path location will need to be entered. E.g. '''dfu-util --alt 0 -D ...\firmware.dfu''', where &amp;quot;...&amp;quot; should be filled in with the directory path.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Something similar to the following should be displayed. &lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
C:\Users\MyUser\Desktop\dfu-util-0.9-win64&amp;gt;duf-util --alt 0 -D firmware.dfu&lt;br /&gt;
&lt;br /&gt;
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. &amp;lt;br /&amp;gt;&lt;br /&gt;
Copyright 2010-2016 Tormod Volden and Stefan Schmidt         &amp;lt;br /&amp;gt;&lt;br /&gt;
This program is Free Softwasre and has ABSOLUTELY NO WARRANTY  &amp;lt;br /&amp;gt;&lt;br /&gt;
Please report bugs to http: // sourceforge.net / p / dfu-util / tickets /  &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Match vendor ID from file: 0483  &amp;lt;br /&amp;gt;&lt;br /&gt;
Match product ID from file: df11 &amp;lt;br /&amp;gt;&lt;br /&gt;
Opening DFU capable USB device...&amp;lt;br /&amp;gt;&lt;br /&gt;
ID 0483:df11&amp;lt;br /&amp;gt;&lt;br /&gt;
Run-time device DFU version 011a&amp;lt;br /&amp;gt;&lt;br /&gt;
Claiming USB DFU Interface...&amp;lt;br /&amp;gt;&lt;br /&gt;
Setting Alternate Setting #0 ...&amp;lt;br /&amp;gt;&lt;br /&gt;
Determining device status: state = dfuERROR, satus = 10&amp;lt;br /&amp;gt;&lt;br /&gt;
dfuERROR, clearing status&amp;lt;br /&amp;gt;&lt;br /&gt;
Determining device status: state = dfuIDLE, status = 0&amp;lt;br /&amp;gt;&lt;br /&gt;
dfuIDLE, continuing &amp;lt;br /&amp;gt;&lt;br /&gt;
DFU mode device DFU version 011a&amp;lt;br /&amp;gt;&lt;br /&gt;
Device returned tranfer size 2048&amp;lt;br /&amp;gt;&lt;br /&gt;
DfuSe interface name: &amp;quot;Internal Flash &amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
file contains 1 DFU images&amp;lt;br /&amp;gt;&lt;br /&gt;
parsing DFU image 1&amp;lt;br /&amp;gt;&lt;br /&gt;
image for alternate setting 0, &amp;lt;2 elements, total size = 386288&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
parsing element1, address = 0x08000000, size =15000&amp;lt;br /&amp;gt;&lt;br /&gt;
Download     [=========================] 100%      15000 bytes&amp;lt;br /&amp;gt;&lt;br /&gt;
Download done.&amp;lt;br /&amp;gt;&lt;br /&gt;
pasing element 2, address = 0x8020000, size =371272&amp;lt;br /&amp;gt;&lt;br /&gt;
Download     [=========================] 100%     371272 bytes&amp;lt;br /&amp;gt;&lt;br /&gt;
Download done.&amp;lt;br /&amp;gt;&lt;br /&gt;
done parsing DfuSe file&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
C:\Users\MyUser\Desktop\dfu-util-0.9-win64&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
      &lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The firmware is now installed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Safely eject and disconnect the USB, shift the JB2 pin jumper back to the original location (BT0 and FLS should now be joined). Now reconnnect the MicroUSB cable.&lt;br /&gt;
&lt;br /&gt;
Installation is now complete complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:using | initials=BS | title=Linux Users | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Follow the EMAC DFU instructions given [http://git.emacinc.com/micropython-public/micropython-doc/blob/master/Micropython_firmware_installation.md#dfu-usb-instructions-linux here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:using | initials=BS | title=After Firmware Installation | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }} &lt;br /&gt;
&lt;br /&gt;
After installing the firmware you can open a MicroPython REPL(read evaluate print loop) console (covered [http://wiki.emacinc.com/wiki/Cutipy_Getting_Started here ]), and verify the firmware version by entering the following into the REPL console&lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; import os &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; os.uname()&amp;lt;br /&amp;gt;&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
Output should look similar to the following:&lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
(sysname='pyboard', nodename='pyboard', rlease='0.0.1', version='394ae277 as IOT-F40&amp;lt;br /&amp;gt;&lt;br /&gt;
7C-XXXRX on 2019-06-07', machine = 'EMAC-CutiPy with STM32F407')&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
After installing the firmware perform a factory reset. This clears the file system, and adds/replaces boot.py and main.py&lt;br /&gt;
&lt;br /&gt;
{{note|The factory reset will delete all files present on the board. For this reason we recommend backing up your files if you have made any changes.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Perform a factory reset as follows (Note these instructions are a slight modification of the PyBoard factory reset instruction given [https://docs.micropython.org/en/latest/pyboard/tutorial/reset.html#factory-reset-the-filesystem here]):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. Connect your CutiPy to your PC using the MicroUSB cable.&lt;br /&gt;
* Hold down PB1.&lt;br /&gt;
* While still holding down PB1, press and release the reset button PB5.&lt;br /&gt;
* The LD2 and LD3 will then flash, cycling through various lighting combinations corresponding to different options. Both lit corresponds to factory reset.&lt;br /&gt;
* Keep holding down PB1, when both LEDs are lit, release PB1 to select the factory reset option.&lt;br /&gt;
* Both LEDs should quickly flash 4 times, a third LED (LD1) will turn on.&lt;br /&gt;
* The file system is now being reset.&lt;br /&gt;
* After the file system is reset, all LEDs will turn off and the device will enter safe mode.&lt;br /&gt;
* Press and release the reset button, PB5 to boot normally.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:using | initials=BS | title=References | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }} &lt;br /&gt;
https://github.com/micropython/micropython/wiki/Pyboard-Firmware-Update&amp;lt;br /&amp;gt;&lt;br /&gt;
https://docs.micropython.org/en/latest/pyboard/tutorial/reset.html#factory-reset-the-filesystem&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Creating_a_New_EMAC_OE_SDK_Project_with_qmake_in_Qt_Creator&amp;diff=5384</id>
		<title>Creating a New EMAC OE SDK Project with qmake in Qt Creator</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Creating_a_New_EMAC_OE_SDK_Project_with_qmake_in_Qt_Creator&amp;diff=5384"/>
		<updated>2016-05-27T20:04:55Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| Complete (11.10.2015-12:42-&amp;gt;JJ+);(11.11.2015-16:05-&amp;gt;JJ+);(11.12.2015-12:30-&amp;gt;JJ+);(11.12.2015-14:30-&amp;gt;MG+);(11.12.2015-14:50-&amp;gt;JJ+);(11.12.2015-15:00-&amp;gt;MG+);(11.12.2015-15:15-&amp;gt;KY+)|Jeffrey Jung| project=OE 5.0,JJ,Complete,MG,KY }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Creating the Project&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=qmake, Qt Creator, Qt applications&lt;br /&gt;
|description=Creating a New EMAC OE SDK Project with qmake in Qt Creator&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--&amp;lt;span style=&amp;quot;background:#00FF00;color:#FF0000;font-size:300%&amp;quot;&amp;gt;'''''Put the page description text here.'''''&amp;lt;/span&amp;gt;--&amp;gt;&lt;br /&gt;
Alongside the EMAC OE 5.0 SDK, EMAC provides the Qt Creator IDE(Interactive Development Environment). A great feature of this IDE is its UI design tool that will allow developers to produce applications with a GUI for EMAC devices equipped with LCD displays. The UI is constructed by dragging and dropping objects to the application UI. Using slots and signals, developers can easily program a functional, interactive, and visually pleasing interface. These project requires Qt Creator's tool &amp;lt;code&amp;gt;qmake&amp;lt;/code&amp;gt; to build these applications. &lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=JJ | title=Creating the Project | desc=Creating a New EMAC OE SDK Project with qmake in Qt Creator | project=OE 5.0 }}&lt;br /&gt;
The user interface (UI) designer tool in Qt Creator can be used to develop applications reliant on a UI. Written in C++, these applications built using the EMAC OE SDK and the &amp;lt;code&amp;gt;qmake&amp;lt;/code&amp;gt; tool can be deployed to EMAC carriers equipped with touch screen displays. Developers will be able to create software that is much more interactive with the user. For more information about Qt Creator, go to the [http://wiki.qt.io/Qt_Creator_Guidance Qt Creator Guidance] page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=JJ | title=Creating the Project | desc=Creating a New EMAC OE SDK Project with qmake in Qt Creator | project=OE 5.0 }}&lt;br /&gt;
This page will present a guide to create a basic application using Qt Creator. You'll not only write the source code, but also design a UI for the application. Once that is done, you'll compile the project and deploy it to run on a remote target machine. A &amp;quot;Hello World&amp;quot; project is used as an example to demonstrate how to use the UI designer and receive output from the IDE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=JJ | title=Creating the Project | desc=Creating a New EMAC OE SDK Project with qmake in Qt Creator | project=OE 5.0 }}&lt;br /&gt;
&amp;lt;cl&amp;gt;1. Launch the EMAC Qt Creator. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:EMAC_Qt_Creator_Icon.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Click on &amp;quot;New Project&amp;quot;.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Qtcreator_gui.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A new window will pop up to specify the type of project you will be coding for. Select '''Application''' under the Projects column.&lt;br /&gt;
&lt;br /&gt;
* Select '''Qt Widgets Application'''. &amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:SelectQtWidgetApplication.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Click '''Choose'''. You'll be brought to another page requesting you to give the project a name and choose the location of the project. &amp;lt;br &amp;gt;&amp;lt;br /&amp;gt; [[File:QtAppName_Location.png| 800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Once you've given your project a name and have determined the path to store the project, click '''Next'''.&lt;br /&gt;
&lt;br /&gt;
* Select the kit required for the device(s) on which you wish to run the application. In this example, all kits are selected, but this project will be deployed to an OE 5.0 ARM device. Click '''Next'''. &amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:QtKitSelection.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Give the class a name and leave the base class as '''QMainWindow'''. The header, source, and form files will have the same name as the class name, but different extensions. These files may be modified if desired. Click '''Next''' to continue to the project summary.&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt;[[File:ClassInfo.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In the summary window, click '''Finish''' to be begin developing the project.&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example application, Qt will open &amp;lt;code&amp;gt;helloworld.cpp&amp;lt;/code&amp;gt; in the editor. This is where the functionality of the application is implemented. Within &amp;lt;code&amp;gt;main.cpp&amp;lt;/code&amp;gt;, a new object of the class will be created and launched. Almost all of the C++ code will be written in the class definition. The class definition is also capable of creating an managing UI elements, such as a push button. This example is designed to provide a quick start and won't demonstrate management of UI elements. More information on management of UI elements can be found at http://doc.qt.io/qtcreator/creator-using-qt-designer.html. &lt;br /&gt;
&lt;br /&gt;
===Modify deployment configurations===&lt;br /&gt;
Before developing the project, you will need to make some modifications to allow the project to be displayed and run on the desired device.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;1. Start by double clicking on &amp;lt;code&amp;gt;HelloWorld.pro&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Add the lines &amp;quot;&amp;lt;code&amp;gt;target.path = /tmp&amp;lt;/code&amp;gt;&amp;quot; and &amp;quot;&amp;lt;code&amp;gt;INSTALLS += target&amp;lt;/code&amp;gt;&amp;quot; at the bottom of the file. This will set the location of the object file of the project to the &amp;quot;&amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt;&amp;quot; directory. The full path to the project will be &amp;quot;&amp;lt;code&amp;gt;/tmp/HelloWorld&amp;lt;/code&amp;gt;&amp;quot; on the target device. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:DotProPathConfig.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use &amp;lt;code&amp;gt;'''Ctrl + S'''&amp;lt;/code&amp;gt; to save the file.&lt;br /&gt;
&lt;br /&gt;
* The run configurations can be modified in the '''Project''' tab at the left of the window. At the top of the '''Project''' page, click on '''Run''' under the desired kit.&lt;br /&gt;
&lt;br /&gt;
* Click on '''Details''' for '''Upload files via SFTP''' and make sure the '''Incremental deployment''' box is unchecked. &lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;'''-qws'''&amp;lt;/code&amp;gt; argument is required under the '''Run''' configuration to run the application as a Qt  server application. &amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:QtProjectRunConfig.png|800px]]&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Create a Device Profile===&lt;br /&gt;
A profile will need to be created for  your device in order for Qt Creator to deploy the application to it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;1. Under the '''Tools''' drop down box, select '''Options'''.&lt;br /&gt;
&lt;br /&gt;
* Select '''Devices''' from the scroll area to the left of the '''Options''' window. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Options_devices.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
* Look to the top right of the window and click '''Add'''.&lt;br /&gt;
&lt;br /&gt;
* You'll be brought to the '''Wizard Selection''' window to identify the type of device your target is. Select '''Generic Linux Device'''. &amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Generic_linux.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Click '''Start Wizard''' and set up the configuration for the device profile. Give the profile a name, set the device's IP Address, enter the username, and specify the authentication type. Provide a password if the authentication type requires it.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:9G45NewDeviceConnection.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Click '''Next''' when all the proper information of the device is provided. &lt;br /&gt;
&lt;br /&gt;
* At the summary window, click '''Finish''' and a connection be tween the target device and the developer's desktop will be tested. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; [[File:Device_test.png]].&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* When the test has completed successfully, click '''Close'''.&lt;br /&gt;
* Click '''Apply''' in the '''Options''' window to save the profile.&lt;br /&gt;
* Click on the '''Build &amp;amp; Run''' section from the list box. Go to the '''Kits''' tab and click on the kit for the device. Under the '''Devices''' drop down menu, select the device profile that was just created. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:SelectDeviceToRun.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Save the device profile by clicking '''Apply'''. The profile has been completed and the options can be closed by clicking '''Ok''' at the bottom right of the window.&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:examples | initials=JJ | title=Creating the Project | desc=Creating a New EMAC OE SDK Project with qmake in Qt Creator | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
===Coding Hello World and Designing the User Interface===&lt;br /&gt;
Qt Creator is now able to deploy the project to the target device. The application definition needs to be completed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;1. Double click the class &amp;lt;code&amp;gt;cpp&amp;lt;/code&amp;gt; file in the '''Edit''' tab.&lt;br /&gt;
&lt;br /&gt;
* In the constructor, use the &amp;lt;code&amp;gt;qDebug()&amp;lt;/code&amp;gt; function to print the string &amp;quot;&amp;lt;code&amp;gt;Hello World&amp;lt;/code&amp;gt;&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* In the destructor, use the &amp;lt;code&amp;gt;qDebug()&amp;lt;/code&amp;gt; function to print the string &amp;quot;&amp;lt;code&amp;gt;Goodbye World&amp;lt;/code&amp;gt;&amp;quot;. &lt;br /&gt;
Here's what your &amp;lt;code&amp;gt;helloworld.cpp&amp;lt;/code&amp;gt; should look like:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;helloworld.h&amp;quot;&lt;br /&gt;
#include &amp;quot;ui_helloworld.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
HelloWorld::HelloWorld(QWidget *parent) :&lt;br /&gt;
    QMainWindow(parent),&lt;br /&gt;
    ui(new Ui::HelloWorld)&lt;br /&gt;
{&lt;br /&gt;
    ui-&amp;gt;setupUi(this);&lt;br /&gt;
    qDebug(&amp;quot;Hello World&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HelloWorld::~HelloWorld()&lt;br /&gt;
{&lt;br /&gt;
    qDebug(&amp;quot;Goodbye World&amp;quot;);&lt;br /&gt;
    delete ui;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Double click &amp;lt;code&amp;gt;helloworld.ui&amp;lt;/code&amp;gt; under the '''Forms''' folder in the '''Edit''' tabe to the left of the screen. This displays an interface that will allow objects to be dragged on to the UI of the application. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:QtUIDesign.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Drag and drop a label to the UI.&lt;br /&gt;
&lt;br /&gt;
* Double click on the label to change the text to &amp;quot;&amp;lt;code&amp;gt;Hello World&amp;lt;/code&amp;gt;&amp;quot;. You may need to resize the label so the text can be seen. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; [[File:HelloUI.png|800px]]&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Building and Running the Project===&lt;br /&gt;
&amp;lt;cl&amp;gt;1. Click on the icon of a monitor at the bottom left of the window. &lt;br /&gt;
&lt;br /&gt;
* Select the proper kit for your device, '''Build-&amp;gt;Debug''', and the project name under '''Run'''. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:BuildDebugRun.png| 800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Build the project by clicking the hammer icon at the bottom left of the window. A little window will momentarily pop up at the bottom right of the screen. The project has been successfully built if the green progress bar is full and now error messages have appeared.      &lt;br /&gt;
&lt;br /&gt;
{{note| If the build command complains of missing or unknown modules, a Qt version mismatch is likely the reason. Sometimes, the host PC and the EMAC target board will use different versions of Qt. Generally, this doesn't cause any problems, but occasionally, some Qt modules have been deprecated in the newer versions.}}&lt;br /&gt;
&lt;br /&gt;
* Once the project has successfully built, the project may be run. Click the green triangle icon at the bottom left of the window, below the monitor icon. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:HelloWorldRun.png| 800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Application Output terminal will pop up and display any error messages, the termination message, and any string output by &amp;lt;code&amp;gt;qDebug()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=JJ | title=Creating the Project | desc=Creating a New EMAC OE SDK Project with qmake in Qt Creator | project=OE 5.0 }}&lt;br /&gt;
Although very similar to [[Getting_Started_With_Qt_Creator | Getting Started with Qt Creator]], this guide differs by introducing the reader to the process of developing a Qt application with a graphical user interface using Qt's qmake build system. Developing a new application generally follows these steps: create a new project, configure a new device profile if needed, modify the build and run conditions to allow deployment on the remote device, drag and drop the visual elements to the GUI using the UI designer, write the code needed to respond to interactions with the UI, build the application, and run the application upon a successful build.&lt;br /&gt;
&lt;br /&gt;
More information about running Qt applications on EMAC systems (Open Embedded Linux modules) can be found at http://doc.qt.io/qt-4.8/qt-embedded-running.html. While the UI designer is a great way to visually plan out how the GUI will turn out, the entire application may be coded within the project C++ class file, including the UI elements. Qt provides a couple of example applications with a GUI for Linux Embedded systems coded in such a way. These example can be viewed at http://doc.qt.io/qt-4.8/examples-embeddedlinux.html. A larger set of Qt example applications can be found at http://doc.qt.io/qt-4.8/all-examples.html; not all of these examples will work for Embedded Linux or the EMAC OE SDK. Qt pre-compiled examples and source code can also be found on EMAC systems with Qt in &amp;lt;code&amp;gt;/usr/bin/qtopia&amp;lt;/code&amp;gt; and in the EMAC OE SDK in  &amp;lt;code&amp;gt;/opt/emac/5.0/sysroots/target_arch/usr/bin/qtopia &amp;lt;/code&amp;gt;. These examples are applicable to Qt version 4.8 which is the newest version supported by EMAC OE 5.0. &lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- {{:Templateimpl:moreinfo | initials=JJ | title=Creating the Project | desc=Creating a New EMAC OE SDK Project with qmake in Qt Creator | project=OE 5.0 }}&lt;br /&gt;
* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=JJ | title=Creating the Project | desc=Creating a New EMAC OE SDK Project with qmake in Qt Creator | project=OE 5.0 }}&lt;br /&gt;
* [[Getting_Started_With_Qt_Creator | Getting Started With Qt Creator]]&lt;br /&gt;
* [[Getting_Started_with_the_EMAC_OE_SDK| Getting Started with the EMAC OE SDK]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Example_keypad_simple_matrix&amp;diff=5383</id>
		<title>Example keypad simple matrix</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Example_keypad_simple_matrix&amp;diff=5383"/>
		<updated>2016-04-12T17:19:14Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| In Progress (04.12.2016-11:43-&amp;gt;KY+)|Klint Youngmeyer| project=OE 5.0,KY,InProgress }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Example keypad simple matrix&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=&lt;br /&gt;
|description=Keypad example for EMAC OE5 on Som 150&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
This is a guide to the &amp;lt;code&amp;gt;keypad_simple_matrix&amp;lt;/code&amp;gt; C example project included in the EMAC OE SDK.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;keypad_simple_matrix&amp;lt;/code&amp;gt; example C project demonstrates how to use a keypad with a SoM150ES carrier board. It provides examples of how to specify, inspect and test associations between character-data and keypad-keys.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;keypad_simple_matrix&amp;lt;/code&amp;gt; C example project creates one executable: &amp;lt;code&amp;gt;keypad_matrix&amp;lt;/code&amp;gt;. The project also uses one configuration file: &amp;lt;code&amp;gt;keypad_matrix.conf&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}&lt;br /&gt;
In order to use this example with Qt Creator, select the &amp;lt;code&amp;gt;keypad_simple_matrix&amp;lt;/code&amp;gt; project from the list of EMAC examples. Choose a build directory outside of the  EMAC SDK, run CMake, and build the project. The project can now be deployed to a target SoM-150 based system.&lt;br /&gt;
&lt;br /&gt;
If Qt Creator is not being used, please refer to [[Getting_Started_with_the_EMAC_OE_SDK|Getting Started with the EMAC OE SDK]].&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}&lt;br /&gt;
To use the &amp;lt;code&amp;gt;keypad_simple_matrix&amp;lt;/code&amp;gt; program requires the following hardware.&lt;br /&gt;
* A [http://www.emacinc.com/som/som150es.htm SOM-150ES carrier board] (Available from EMAC).&amp;lt;br /&amp;gt;&lt;br /&gt;
* A compatible SoM for that carrier board ([http://www.emacinc.com/som/som9G20.htm SOM-9G20M], [http://www.emacinc.com/products/system_on_module/SoM-9G25M SoM-9g25], [http://www.emacinc.com/products/system_on_module/SoM-9X25M SOM-9X25], and [http://www.emacinc.com/products/system_on_module/SoM-A5D35 SoM-A5D35] are all compatible and available from EMAC).&amp;lt;br /&amp;gt;&lt;br /&gt;
* A compatible keypad ([http://www.emacinc.com/sbc_microcontroller_addons.htm Available from EMAC], refer to item# E20-21 or E020-25. [https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CCsQFjAA&amp;amp;url=http%3A%2F%2Fwww.in2tec.com%2Flib%2Fdownloadfile.php%3Ffilename%3D4000_series_keypads_datasheet.pdf%26loc%3Ddocuments%2F%26ct%3Dpdf&amp;amp;ei=Wf-MUrGxO-nEyQGggoGgCg&amp;amp;usg=AFQjCNEQxIaiH6-gx6uTq4O66o1YVDunZw&amp;amp;bvm=bv.56643336,d.aWc Datasheet]). &lt;br /&gt;
&lt;br /&gt;
[[File:Som150 with keypad.JPG | 500px ]]&amp;lt;br /&amp;gt;&lt;br /&gt;
SOM-150ES carrier board with keypad&lt;br /&gt;
&lt;br /&gt;
===Plugging the Keypad into the SOM-150ES Carrier Board===&lt;br /&gt;
&lt;br /&gt;
Plug the keypad into the HDR5 KEYPAD header of the SOM-150ES Carrier Board.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Example getkey howtopluginthekeypad 0.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Ensure that '''pin 0''' of the keypad's ribbon cable is lined up with '''pin 2''' on the header.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Example getkey howtopluginthekeypad 1.png|500px]]&lt;br /&gt;
===The Keypad Matrix File===&lt;br /&gt;
&lt;br /&gt;
The keypad matrix file specifies associations between keypad-keys and characters. An example is shown below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;console&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# INPUT_CODE|OUTPUT_CHARACTER|&lt;br /&gt;
0x02|1|&lt;br /&gt;
0x03|2|&lt;br /&gt;
0x04|3|&lt;br /&gt;
0x05|4|&lt;br /&gt;
0x06|5|&lt;br /&gt;
0x07|6|&lt;br /&gt;
0x08|7|&lt;br /&gt;
0x09|8|&lt;br /&gt;
0x0a|9|&lt;br /&gt;
0x0b|0|&lt;br /&gt;
0x1e|*|&lt;br /&gt;
0x30|\n|&lt;br /&gt;
0x2e|A|&lt;br /&gt;
0x20|B|&lt;br /&gt;
0x12|C|&lt;br /&gt;
0x21|D|&lt;br /&gt;
# Keycode translation that comes &lt;br /&gt;
# from the default keypad mapping&lt;br /&gt;
# in the EMAC  driver.&lt;br /&gt;
#    ---------------------------------&lt;br /&gt;
#    |  0,0  |  0,1  |  0,2  |  0,3  |&lt;br /&gt;
#    | KEY_1 | KEY_2 | KEY_3 | KEY_C |&lt;br /&gt;
#    | 0x02  | 0x03  | 0x04  | 0x2e  |&lt;br /&gt;
#    ---------------------------------&lt;br /&gt;
#    |  1,0  |  1,1  |  1,2  |  1,3  |&lt;br /&gt;
#    | KEY_4 | KEY_5 | KEY_6 | KEY_D |&lt;br /&gt;
#    | 0x05  | 0x06  | 0x07  | 0x20  |&lt;br /&gt;
#    ---------------------------------&lt;br /&gt;
#    |  2,0  |  2,1  |  2,2  |  2,3  |&lt;br /&gt;
#    | KEY_7 | KEY_8 | KEY_9 | KEY_E |&lt;br /&gt;
#    | 0x08  | 0x09  | 0x0a  | 0x12  |&lt;br /&gt;
#    ---------------------------------&lt;br /&gt;
#    |  3,0  |  3,1  |  3,2  |  3,3  |&lt;br /&gt;
#    | KEY_A | KEY_0 | KEY_B | KEY_F |&lt;br /&gt;
#    | 0x1e  | 0x0b  | 0x30  | 0x21  |&lt;br /&gt;
#    ---------------------------------&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The default location for this file is the same directory as the executable.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:using | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:examples | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}&lt;br /&gt;
An example of the &amp;lt;code&amp;gt;keypad_simple_matrix&amp;lt;/code&amp;gt; program being used is shown below:&lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio |./keypad_matrix| hostname=soma5d35}}&lt;br /&gt;
1234567890*ABCD&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{clio || hostname=soma5d35}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
The program will continue until a key with the value of '\n' is pressed. If no key has that value, the program will not exit.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}&lt;br /&gt;
The &amp;lt;code&amp;gt;keypad_simple_matrix&amp;lt;/code&amp;gt; example C project demonstrates how to use a keypad with a SoM150ES carrier board.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:moreinfo | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}--&amp;gt;&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}&lt;br /&gt;
*[[ARM_SOM|EMAC ARM Soms]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Example_keypad_simple_matrix&amp;diff=5382</id>
		<title>Example keypad simple matrix</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Example_keypad_simple_matrix&amp;diff=5382"/>
		<updated>2016-04-12T16:43:26Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: Created page with &amp;quot;{{ subst:Pgtempl | initials={{subst::Templateimpl:getinitials}} | project=OE 5.0 | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 }}&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| NotStarted (04.12.2016-11:43-&amp;gt;KY+)| Kyoungmeyer | project=OE 5.0,KY,NotStarted }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Example keypad simple matrix&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=&lt;br /&gt;
|description=Keypad example for EMAC OE5 on Som 150&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;background:#00FF00;color:#FF0000;font-size:300%&amp;quot;&amp;gt;'''''Put the page description text here.'''''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:examples | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}&lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=Example keypad simple matrix | desc=Keypad example for EMAC OE5 on Som 150 | project=OE 5.0 }}&lt;br /&gt;
*&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Xenomai_RTNet&amp;diff=5378</id>
		<title>Xenomai RTNet</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Xenomai_RTNet&amp;diff=5378"/>
		<updated>2016-03-09T15:51:51Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| Complete (03.03.2016-13:06-&amp;gt;MW+)(03.09.2016-09:50-&amp;gt;KY+)|Michael Welling| project=OE 5.0,MW,MG,KY,Complete }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Xenomai RTNet&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=&lt;br /&gt;
|description=Xenomai RTNet&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=MW | title=Xenomai RTNet | desc=Xenomai RTNet | project=OE 5.0 }}&lt;br /&gt;
Xenomai uses the RTNet stack to provide real-time Ethernet. RTNet provides deterministic versions of various protocols (UDP/IP, IMCP, ARP).&lt;br /&gt;
Xenomai provides several real-time Ethernet drivers, the stack, and various tools.&lt;br /&gt;
This document explains how to load a real-time Ethernet driver and perform basic tests. The links below will help augment this information&lt;br /&gt;
as well as discuss programming using the RTnet stack.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=MW | title=Xenomai RTNet | desc=Xenomai RTNet | project=OE 5.0 }}&lt;br /&gt;
=== Loading a RTNet driver ===&lt;br /&gt;
As with the other real-time drivers, the Linux driver must be detached from the interface before loading the real-time driver.&lt;br /&gt;
&lt;br /&gt;
For example on IMX6 target, the &amp;lt;code&amp;gt;fec&amp;lt;/code&amp;gt; device must be unbound from the Linux driver and attached to the real-time driver.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;console&amp;quot;&amp;gt;&lt;br /&gt;
root@somimx6-xenomai:~# echo 2188000.ethernet &amp;gt; /sys/bus/platform/drivers/fec/unbind &lt;br /&gt;
root@somimx6-xenomai:~# echo 2188000.ethernet &amp;gt; /sys/bus/platform/drivers/rt_fec/bind&lt;br /&gt;
[   86.762295] libphy: fec_enet_mii_bus: probed&lt;br /&gt;
[   86.766586] RTnet: registered rteth0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{mbox | type= | text='''Note:''' The warning posted about the clock when unbinding the Linux fec driver can be ignored. }}&lt;br /&gt;
&lt;br /&gt;
Xenomai provides a script make launching &amp;lt;code&amp;gt;rtnet&amp;lt;/code&amp;gt; easier. This will load the appropriate modules and bring up the interface.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;console&amp;quot;&amp;gt;&lt;br /&gt;
root@somimx6-xenomai:~# rtnet -cf /etc/rtnet.conf start&lt;br /&gt;
[  645.330848] initializing loopback...&lt;br /&gt;
[  645.334487] RTnet: registered rtlo[  645.355662] RTcfg: init real-time configuration distribution protocol&lt;br /&gt;
[  645.375986] RTmac: init realtime media access control[  645.400419] RTmac/TDMA: init time division multiple access control mechanism&lt;br /&gt;
[  645.499423] rteth0: Freescale FEC PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=2188000.ethernet:01, irq=-1)&lt;br /&gt;
[  645.551954] rteth0: tx link down!.&lt;br /&gt;
...&lt;br /&gt;
[  652.497075] rt_fec 2188000.ethernet (unnamed net_device) (uninitialized): Link is Up - 1Gbps/Full - flow control rx/tx&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{mbox | type= | text='''Note:''' The rtnet start will wait for slaves to connect. Press ctrl+c if slaves are not connected. }}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;rtnet&amp;lt;/code&amp;gt; helper script is configured with &amp;lt;code&amp;gt;/etc/rtnet.conf&amp;lt;/code&amp;gt; which determines the IP address of the interface and the slave devices.&lt;br /&gt;
The real-time driver is also specified in the configuration file so that it does not need to be loaded before starting the script, but the Linux driver still must be disassociated with the interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Accessing RTNet driver ===&lt;br /&gt;
&lt;br /&gt;
Xenomai provides real-time versions of the basic networking utilities including &amp;lt;code&amp;gt;rtifconfig&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rtping&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rtroute&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;rtiwconfig&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;console&amp;quot;&amp;gt;&lt;br /&gt;
root@somimx6-xenomai:~# rtifconfig&lt;br /&gt;
 rteth0    Medium: Ethernet  Hardware address: 00:00:00:00:00:00&lt;br /&gt;
          IP address: 127.0.0.2  Broadcast address: 127.255.255.255&lt;br /&gt;
          UP BROADCAST RUNNING  MTU: 1500&lt;br /&gt;
          RX packets:14 errors:0 dropped:0 overruns:0 frame:0&lt;br /&gt;
          TX packets:164476 errors:0 dropped:0 overruns:0 carrier:0&lt;br /&gt;
          collisions:0 &lt;br /&gt;
          RX bytes:896 (896.0 b)  TX bytes:7031954 (6.7 Mb)&lt;br /&gt;
&lt;br /&gt;
rtlo      Medium: Local Loopback&lt;br /&gt;
          IP address: 127.0.0.1  &lt;br /&gt;
          UP LOOPBACK RUNNING  MTU: 1500&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;console&amp;quot;&amp;gt;&lt;br /&gt;
root@somimx6-xenomai:~# rtroute&lt;br /&gt;
Host Routing Table&lt;br /&gt;
Hash    Destination     HW Address              Device&lt;br /&gt;
00      0.0.0.0         00:00:00:00:00:00       rtlo&lt;br /&gt;
01      127.0.0.1       00:00:00:00:00:00       rtlo&lt;br /&gt;
02      127.0.0.2       00:00:00:00:00:00       rtlo&lt;br /&gt;
3F      127.255.255.255 FF:FF:FF:FF:FF:FF       rteth0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;console&amp;quot;&amp;gt;&lt;br /&gt;
root@somimx6-xenomai:~# rtping 127.0.0.1&lt;br /&gt;
Real-time PING 127.0.0.1 56(84) bytes of data.&lt;br /&gt;
64 bytes from 127.0.0.1: icmp_seq=1 time=25.7 us&lt;br /&gt;
64 bytes from 127.0.0.1: icmp_seq=2 time=20.3 us&lt;br /&gt;
64 bytes from 127.0.0.1: icmp_seq=3 time=17.3 us&lt;br /&gt;
64 bytes from 127.0.0.1: icmp_seq=4 time=17.0 us&lt;br /&gt;
64 bytes from 127.0.0.1: icmp_seq=5 time=17.3 us&lt;br /&gt;
64 bytes from 127.0.0.1: icmp_seq=6 time=18.7 us&lt;br /&gt;
64 bytes from 127.0.0.1: icmp_seq=7 time=17.0 us&lt;br /&gt;
^C&lt;br /&gt;
--- 127.0.0.1 rtping statistics ---&lt;br /&gt;
7 packets transmitted, 7 received, 0% packet loss&lt;br /&gt;
worst case rtt = 25.7 us&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
* http://www.rtnet.org/&lt;br /&gt;
* https://xenomai.org/rtnet/&lt;br /&gt;
* https://xenomai.org//rtnet-howto/&lt;br /&gt;
* https://xenomai.org/rtnet-installation/&lt;br /&gt;
* https://xenomai.org/rtnet-programming/&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5257</id>
		<title>EMAC CAN Interface</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5257"/>
		<updated>2016-01-20T20:25:00Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| Review (01.18.2016-10:45-&amp;gt;KY+);(01.20.2016-13:50-&amp;gt;MD-)(01.20.2016-14:23-&amp;gt;KY+)|Klint Youngmeyer| project=OE 5.0,KY,MG,MD,Review }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=EMAC CAN Interface&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=can,socketcan,canbus,cansend,candump,linux&lt;br /&gt;
|description=This page describes how to use the CAN interface on EMAC boards.&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
The CAN interface is a vehicle bus standard that allows communication between a controller and various sensors. EMAC produces several boards capable of communicating on a CAN bus. For more information about which products support the CAN bus, see the [[EMAC_HW|hardware]] page.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
CAN (controller area network) is a multi-master serial bus for communicating between &amp;quot;nodes&amp;quot; over a two-wire interface. The wires are generally a 120 ohm twisted pair. Each CAN node has the ability to communicate with every other node, one at a time. &lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:geninfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
The CAN bus is able to be accessed from the command line, or using a C library on EMAC products (with CAN support).&lt;br /&gt;
===CAN Bus Setup===&lt;br /&gt;
Before using the CAN interface on an EMAC device, two commands must be run. These commands could be scripted to be run at startup; see [[EMAC_OE_Boot_Process_Customization|this page]] for details.&lt;br /&gt;
{{note|The settings in the first command may need to be changed according to the application in question.}}&lt;br /&gt;
&lt;br /&gt;
{{cli | ip link set can0 type can bitrate 125000 triple-sampling on | hostname=ipac9x25}}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
{{cli | ip link set can0 up | hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
===Command Line CAN===&lt;br /&gt;
The command line tools included with EMAC OE 5 are part of the &amp;lt;code&amp;gt;canutils&amp;lt;/code&amp;gt; package. The tools included in this package are:&lt;br /&gt;
* &amp;lt;code&amp;gt;canconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;canecho&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansequence&amp;lt;/code&amp;gt;&lt;br /&gt;
Of these five, the most easily used are &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;.&lt;br /&gt;
====cansend====&lt;br /&gt;
&amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, as the name implies, is used for sending CAN messages over the bus. Up to eight bytes at a time can be sent using &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, these bytes are formatted at a space separated list of hexadecimal octets e.g. &amp;quot;&amp;lt;code&amp;gt;0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt;.&amp;quot; The command for sending the previously mentioned hexadecimal digits on the &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; device is:&lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; uses, by default, an identifier of &amp;lt;code&amp;gt;0x01&amp;lt;/code&amp;gt;. If an identifier other than default is desired, the &amp;lt;code&amp;gt;-i 0x&amp;lt;IDENT&amp;gt;&amp;lt;/code&amp;gt; option must be passed on the command line. In the following example, the identity &amp;lt;code&amp;gt;0x89&amp;lt;/code&amp;gt; is used. &lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 -i 0x89 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x089&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
Using the standard identity, the length of the identity is limited to a maximum hexadecimal value of &amp;lt;code&amp;gt;0x7FF&amp;lt;/code&amp;gt;. If a larger identity is needed, the &amp;lt;code&amp;gt;-e&amp;lt;/code&amp;gt; option can be passed, which allows an extended CAN frame with a maximum hexadecimal value of &amp;lt;code&amp;gt;0x1FFFFFFF&amp;lt;/code&amp;gt;. The following example shows a message with an extended frame.&lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 -e -i 0x8008 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x00008008&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
====candump====&lt;br /&gt;
&amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; is used to receive messages over CAN. These messages can be output to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt; or directly to a file. &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; will run until it is killed, either with &amp;lt;code&amp;gt;Ctrl-C&amp;lt;/code&amp;gt; or a &amp;lt;code&amp;gt;kill&amp;lt;/code&amp;gt; command. The following command shows how to receive any message over CAN and output it to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt;. A command of &amp;lt;code&amp;gt;cansend can0 0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt; was given on a connected board.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | candump can0 | hostname=ipac9x25}}&lt;br /&gt;
interface = can0, family = 29, type = 3, proto = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
To receive any message over CAN and output it to a file, the following command is used. A command of &amp;lt;code&amp;gt;cansend can0 0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt; was given on a connected board.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | candump can0 -o /tmp/candump.txt | hostname=ipac9x25}}&lt;br /&gt;
interface = can0, family = 29, type = 3, proto = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{clos}}&lt;br /&gt;
Since &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; will continue running, a &amp;lt;code&amp;gt;Ctrl-C&amp;lt;/code&amp;gt; should be given before viewing the contents of the file. To view the file, &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; can be used.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | cat /tmp/candump.txt | hostname=ipac9x25}}&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; can also filter its output according to two values: filter and mask. The filter &amp;lt;code&amp;gt;[can_id]:[can_mask]&amp;lt;/code&amp;gt; matches when &amp;lt;code&amp;gt;[received_can_id] &amp;amp; [can_mask] == [can_id] &amp;amp; [mask]&amp;lt;/code&amp;gt;. For example, to only receive messages from the identity &amp;lt;code&amp;gt;0x088&amp;lt;/code&amp;gt;, use the following command.&lt;br /&gt;
{{cli|candump can0 --filter 0x088:0x7FF|hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
===C Programming CAN===&lt;br /&gt;
Using CAN with C programming on an EMAC Linux board involves using the SocketCAN implementation.&lt;br /&gt;
====CAN Sockets====&lt;br /&gt;
To open a CAN connection, first a socket must be opened. CAN sockets can be either &amp;lt;code&amp;gt;raw&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;broadcast manager&amp;lt;/code&amp;gt;; for this document, &amp;lt;code&amp;gt;raw&amp;lt;/code&amp;gt; will be used. After creation of a &amp;lt;code&amp;gt;raw&amp;lt;/code&amp;gt; CAN socket, it must be bound to an address with the &amp;lt;code&amp;gt;bind()&amp;lt;/code&amp;gt; system call. This address is specified by a &amp;lt;code&amp;gt;sockaddr_can&amp;lt;/code&amp;gt; struct cast to a &amp;lt;code&amp;gt;sockaddr&amp;lt;/code&amp;gt; struct. The following code snippet demonstrates how to open a CAN socket on &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; with no error checking.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
int s;&lt;br /&gt;
struct sockaddr_can addr;&lt;br /&gt;
struct ifreq ifr;&lt;br /&gt;
&lt;br /&gt;
s = socket(PF_CAN, SOCK_RAW, CAN_RAW);&lt;br /&gt;
strcpy(ifr.ifr_name, &amp;quot;can0&amp;quot; );&lt;br /&gt;
ioctl(s, SIOCGIFINDEX, &amp;amp;ifr);&lt;br /&gt;
&lt;br /&gt;
addr.can_family = AF_CAN;&lt;br /&gt;
addr.can_ifindex = ifr.ifr_ifindex;&lt;br /&gt;
&lt;br /&gt;
bind(s, (struct sockaddr *)&amp;amp;addr, sizeof(addr));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====CAN Frames====&lt;br /&gt;
In order to transmit data over this CAN socket, the data must be in a &amp;quot;CAN frame.&amp;quot; This frame struct has three important member variables: &amp;lt;code&amp;gt;can_id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;can_dlc&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;data[8]&amp;lt;/code&amp;gt;. All of these variables are of type &amp;lt;code&amp;gt;__u8&amp;lt;/code&amp;gt;, which is a Linux unsigned 8-bit integer. &amp;lt;code&amp;gt;can_id&amp;lt;/code&amp;gt; contains the identifier for the message sender, &amp;lt;code&amp;gt;can_dlc&amp;lt;/code&amp;gt; contains the frame payload in bytes, and &amp;lt;code&amp;gt;data[8]&amp;lt;/code&amp;gt; is an array that holds up to the 8 bytes of payload. The following snippet of code shows how to create a frame with 8 random hex values as its payload without error checking.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
struct can_frame frame;&lt;br /&gt;
int j;&lt;br /&gt;
int id = 0x1;&lt;br /&gt;
int dlc = 8; // Frame payload length in bytes&lt;br /&gt;
&lt;br /&gt;
srand(time(NULL)); // Randomize seed&lt;br /&gt;
&lt;br /&gt;
frame.can_id = id;&lt;br /&gt;
for(j = 0; j &amp;lt; dlc; j++){&lt;br /&gt;
    frame.data[j] = rand() % 0x100; // Assign 8 random hex bytes to the payload&lt;br /&gt;
}&lt;br /&gt;
frame.can_dlc = dlc;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====CAN Write====&lt;br /&gt;
Sending a CAN frame is accomplished by simply using the &amp;lt;code&amp;gt;write()&amp;lt;/code&amp;gt; system call. &amp;lt;code&amp;gt;write()&amp;lt;/code&amp;gt; takes 3 arguments: a file descriptor, a buffer(data) to write, and the size of data to write. In this case, the file descriptor is the CAN socket that was opened previously, the buffer will will be the address to the frame struct, and the size of data is the size of the CAN frame struct. The return value of &amp;lt;code&amp;gt;write()&amp;lt;/code&amp;gt; is the number of bytes written and is valuable for error checking. The following code snippet illustrates how to write a frame to the socket that was set up in the previous sections.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
int wbytes;&lt;br /&gt;
&lt;br /&gt;
wbytes = write(s, &amp;amp;frame, sizeof(struct can_frame));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====CAN Read====&lt;br /&gt;
Reading from a CAN frame is very similar to writing to one. Reading is accomplished with the &amp;lt;code&amp;gt;read()&amp;lt;/code&amp;gt; system call. &amp;lt;code&amp;gt;read()&amp;lt;/code&amp;gt; takes 3 arguments: a file descriptor, a buffer(data) to put the read data in, and the size of data to read. In this case, the file descriptor is the CAN socket that was opened previously, the buffer will will be the address to a new frame struct, and the size of data is the size of the CAN frame struct. The return value of &amp;lt;code&amp;gt;read()&amp;lt;/code&amp;gt; is the number of bytes read and is valuable for error checking. When write is called, it will block the program from continuing until data is read. The following code snippet illustrates how to read from the CAN bus to a frame and print that frame to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt; in a similar format to &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; without error checking.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
struct can_frame frame2;&lt;br /&gt;
int rbytes, k;&lt;br /&gt;
&lt;br /&gt;
rbytes = read(s, &amp;amp;frame2, sizeof(struct can_frame));&lt;br /&gt;
&lt;br /&gt;
printf(&amp;quot;&amp;lt;0x%03x&amp;gt; [%d] &amp;quot;, frame2.can_id, frame2.can_dlc);&lt;br /&gt;
&lt;br /&gt;
for(k = 0; k &amp;lt; frame2.can_dlc; k++){&lt;br /&gt;
    printf(&amp;quot;%02x &amp;quot;, frame2.data[k]);&lt;br /&gt;
}&lt;br /&gt;
printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====CAN Example Program====&lt;br /&gt;
Using all of the information in the above sections, a small program can be made to emulate some of the features of &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;. To build this example, see [[Getting_Started_with_the_EMAC_OE_SDK#CMake_Compiling|this section]] of the getting started guide. To run this program, enter the name of the program followed by either &amp;quot;send&amp;quot; or &amp;quot;receive.&amp;quot; Send will send 8 bytes of random hex over &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt;, while receive will read one message from &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; and print it out.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;sys/types.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/socket.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/ioctl.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/uio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;linux/can.h&amp;gt;&lt;br /&gt;
#include &amp;lt;net/if.h&amp;gt;&lt;br /&gt;
#include &amp;lt;linux/can/raw.h&amp;gt;&lt;br /&gt;
#include &amp;lt;time.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int can_write(int socket);&lt;br /&gt;
int can_read(int socket);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char* argv[])&lt;br /&gt;
{&lt;br /&gt;
    if(argc != 2){&lt;br /&gt;
        printf(&amp;quot;%s requires either the argument \&amp;quot;send\&amp;quot; or \&amp;quot;receive\&amp;quot;\n&amp;quot;, argv[0]);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // Create and Bind Socket&lt;br /&gt;
    int s, ret;&lt;br /&gt;
    struct sockaddr_can addr;&lt;br /&gt;
    struct ifreq ifr;&lt;br /&gt;
    if(s = socket(PF_CAN, SOCK_RAW, CAN_RAW) &amp;lt; 0){&lt;br /&gt;
        perror(&amp;quot;socket&amp;quot;);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
    strcpy(ifr.ifr_name, &amp;quot;can0&amp;quot; );&lt;br /&gt;
    ioctl(s, SIOCGIFINDEX, &amp;amp;ifr);&lt;br /&gt;
    addr.can_family = AF_CAN;&lt;br /&gt;
    addr.can_ifindex = ifr.ifr_ifindex;&lt;br /&gt;
        if(bind(s, (struct sockaddr *)&amp;amp;addr, sizeof(addr)) &amp;lt; 0){&lt;br /&gt;
        perror(&amp;quot;bind&amp;quot;);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
    ////&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    if(strcmp(argv[1], &amp;quot;send&amp;quot;) == 0){&lt;br /&gt;
        ret = can_write(s);&lt;br /&gt;
    }else if(strcmp(argv[1], &amp;quot;receive&amp;quot;) == 0){&lt;br /&gt;
        ret = can_read(s);&lt;br /&gt;
    }else{&lt;br /&gt;
        printf(&amp;quot;%s requires either the argument \&amp;quot;send\&amp;quot; or \&amp;quot;receive\&amp;quot;\n&amp;quot;, argv[0]);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    if(ret == 0) {&lt;br /&gt;
        exit(EXIT_SUCCESS);&lt;br /&gt;
    }else {&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
int can_write(int socket)&lt;br /&gt;
{&lt;br /&gt;
    // Build frame from random digits&lt;br /&gt;
    struct can_frame frame;&lt;br /&gt;
    int j;&lt;br /&gt;
    int id = 0x1;&lt;br /&gt;
    int dlc = 8; // Frame payload length in bytes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    srand(time(NULL)); // Randomize seed&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    frame.can_id = id;&lt;br /&gt;
    for(j = 0; j &amp;lt; dlc; j++){&lt;br /&gt;
        frame.data[j] = rand() % 0x100; // Assign 8 random hex bytes to the payload&lt;br /&gt;
    }&lt;br /&gt;
    frame.can_dlc = dlc;&lt;br /&gt;
    ////&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // Write frame to CAN socket&lt;br /&gt;
    int wbytes;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    wbytes = write(socket, &amp;amp;frame, sizeof(struct can_frame));&lt;br /&gt;
    if(wbytes &amp;lt; 0) {&lt;br /&gt;
        perror(&amp;quot;can raw socket write&amp;quot;);&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
    ////&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
int can_read(int socket){&lt;br /&gt;
    // Read from CAN socket and print message&lt;br /&gt;
    struct can_frame frame2;&lt;br /&gt;
    int rbytes, k;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    rbytes = read(socket, &amp;amp;frame2, sizeof(struct can_frame));&lt;br /&gt;
    if(rbytes &amp;lt; 0) {&lt;br /&gt;
        perror(&amp;quot;can raw socket read&amp;quot;);&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    printf(&amp;quot;&amp;lt;0x%03x&amp;gt; [%d] &amp;quot;, frame2.can_id, frame2.can_dlc);&lt;br /&gt;
    for(k = 0; k &amp;lt; frame2.can_dlc; k++){&lt;br /&gt;
        printf(&amp;quot;%02x &amp;quot;, frame2.data[k]);&lt;br /&gt;
    }&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    ////&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This information can be found in much grater detail, along with much more, in the [https://www.kernel.org/doc/Documentation/networking/can.txt Linux Kernel Documentation].&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:examples | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
CAN is a useful protocol for communicating quickly with sensors and other controllers. EMAC boards with CAN should be able to quickly integrate with existing CAN networks with little trouble.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* [[Getting_Started_with_the_EMAC_OE_SDK|Getting started with the EMAC SDK]]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* [[EMAC_HW|EMAC Hardware]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5255</id>
		<title>EMAC CAN Interface</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5255"/>
		<updated>2016-01-20T17:35:17Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| Review (01.18.2016-10:45-&amp;gt;KY+)|Klint Youngmeyer| project=OE 5.0,KY,MG,Review }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=EMAC CAN Interface&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=&lt;br /&gt;
|description=This page describes how to use the CAN interface on EMAC boards.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
The CAN interface is a vehicle bus standard that allows communication between a controller and various sensors. EMAC produces several boards capable of communicating on a CAN bus. For more information about which products support the CAN bus, see the [[EMAC_HW|hardware]] page.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
CAN (controller area network) is a multi-master serial bus for communicating between &amp;quot;nodes&amp;quot; over a two-wire interface. The wires are generally a 120 ohm twisted pair. Each CAN node has the ability to communicate with every other node, one at a time. &lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:geninfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
The CAN bus is able to be accessed from the command line, or using a C library on EMAC products (with CAN support).&lt;br /&gt;
===CAN Bus Setup===&lt;br /&gt;
Before using the CAN interface on an EMAC device, two commands must be run. These commands could be scripted to be run at startup, see [[EMAC_OE_Boot_Process_Customization|this page]] for details.&lt;br /&gt;
{{note|The settings in the first command may need to be changed according to the application in question.}}&lt;br /&gt;
&lt;br /&gt;
{{cli | ip link set can0 type can bitrate 125000 triple-sampling on | hostname=ipac9x25}}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
{{cli | ip link set can0 up | hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
===Command Line CAN===&lt;br /&gt;
The command line tools included with EMAC OE 5 are part of the &amp;lt;code&amp;gt;canutils&amp;lt;/code&amp;gt; package. The tools included in this package are:&lt;br /&gt;
* &amp;lt;code&amp;gt;canconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;canecho&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansequence&amp;lt;/code&amp;gt;&lt;br /&gt;
Of these five, the most easily used are &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;.&lt;br /&gt;
====cansend====&lt;br /&gt;
&amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, as the name implies, is used for sending CAN messages over the bus. Up to eight bytes at a time can be sent using &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, these bytes are formatted at a space separated list of hexadecimal octets e.g. &amp;quot;&amp;lt;code&amp;gt;0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt;.&amp;quot; The command for sending the previously mentioned hexadecimal digits on the &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; device is:&lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; uses, by default, an identifier of &amp;lt;code&amp;gt;0x01&amp;lt;/code&amp;gt;. If an identifier other than default is desired, the &amp;lt;code&amp;gt;-i 0x&amp;lt;IDENT&amp;gt;&amp;lt;/code&amp;gt; option must be passed on the command line. In the following example, the identity &amp;lt;code&amp;gt;0x89&amp;lt;/code&amp;gt; is used. &lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 -i 0x89 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x089&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
Using the standard identity, the length of the identity is limited to a maximum hexadecimal value of &amp;lt;code&amp;gt;0x7FF&amp;lt;/code&amp;gt;. If a larger identity is needed, the &amp;lt;code&amp;gt;-e&amp;lt;/code&amp;gt; option can be passed, which allows an extended CAN frame with a maximum hexadecimal value of &amp;lt;code&amp;gt;0x1FFFFFFF&amp;lt;/code&amp;gt;. The following example shows a message with an extended frame.&lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 -e -i 0x8008 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x00008008&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
====candump====&lt;br /&gt;
&amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; is used to receive messages over CAN. These messages can be output to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt; or directly to a file. &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; will run until it is killed, either with &amp;lt;code&amp;gt;Ctrl-C&amp;lt;/code&amp;gt; or a &amp;lt;code&amp;gt;kill&amp;lt;/code&amp;gt; command. The following command shows how to receive any message over CAN and output it to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt;. A command of &amp;lt;code&amp;gt;cansend can0 0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt; was given on a connected board.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | candump can0 | hostname=ipac9x25}}&lt;br /&gt;
interface = can0, family = 29, type = 3, proto = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
To receive any message over CAN and output it to a file, the following command is used. A command of &amp;lt;code&amp;gt;cansend can0 0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt; was given on a connected board.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | candump can0 -o /tmp/candump.txt | hostname=ipac9x25}}&lt;br /&gt;
interface = can0, family = 29, type = 3, proto = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{clos}}&lt;br /&gt;
Since &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; will continue running, a &amp;lt;code&amp;gt;Ctrl-C&amp;lt;/code&amp;gt; should be given before viewing the contents of the file. To view the file, &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; can be used.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | cat /tmp/candump.txt | hostname=ipac9x25}}&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; can also filter its output according to two values: filter and mask. The filter &amp;lt;code&amp;gt;[can_id]:[can_mask]&amp;lt;/code&amp;gt; matches when &amp;lt;code&amp;gt;[received_can_id] &amp;amp; [can_mask] == [can_id] &amp;amp; [mask]&amp;lt;/code&amp;gt;. For example, to only receive messages from the identity &amp;lt;code&amp;gt;0x088&amp;lt;/code&amp;gt;, use the following command.&lt;br /&gt;
{{cli|candump can0 --filter 0x088:0x7FF|hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
===C Programming CAN===&lt;br /&gt;
Using CAN with C programming on an EMAC Linux board involves using the SocketCAN implementation.&lt;br /&gt;
====CAN Sockets====&lt;br /&gt;
To open a CAN connection, first a socket must be opened. CAN sockets can be either &amp;lt;code&amp;gt;raw&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;broadcast manager&amp;lt;/code&amp;gt;, for this document &amp;lt;code&amp;gt;raw&amp;lt;/code&amp;gt; will be used. After creation of a &amp;lt;code&amp;gt;raw&amp;lt;/code&amp;gt; CAN socket, it must be bound to an address with the &amp;lt;code&amp;gt;bind()&amp;lt;/code&amp;gt; system call. This address is specified by a &amp;lt;code&amp;gt;sockaddr_can&amp;lt;/code&amp;gt; struct cast to a &amp;lt;code&amp;gt;sockaddr&amp;lt;/code&amp;gt; struct. The following code snippet demonstrates how to open a CAN socket on &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; with no error checking.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
int s;&lt;br /&gt;
struct sockaddr_can addr;&lt;br /&gt;
struct ifreq ifr;&lt;br /&gt;
&lt;br /&gt;
s = socket(PF_CAN, SOCK_RAW, CAN_RAW);&lt;br /&gt;
strcpy(ifr.ifr_name, &amp;quot;can0&amp;quot; );&lt;br /&gt;
ioctl(s, SIOCGIFINDEX, &amp;amp;ifr);&lt;br /&gt;
&lt;br /&gt;
addr.can_family = AF_CAN;&lt;br /&gt;
addr.can_ifindex = ifr.ifr_ifindex;&lt;br /&gt;
&lt;br /&gt;
bind(s, (struct sockaddr *)&amp;amp;addr, sizeof(addr));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====CAN Frames====&lt;br /&gt;
In order to transmit data over this CAN socket, the data must be in a &amp;quot;CAN frame.&amp;quot; This frame struct has three important member variables: &amp;lt;code&amp;gt;can_id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;can_dlc&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;data[8]&amp;lt;/code&amp;gt;. All of these variables are of type &amp;lt;code&amp;gt;__u8&amp;lt;/code&amp;gt;, which is a Linux unsigned 8-bit integer. &amp;lt;code&amp;gt;can_id&amp;lt;/code&amp;gt; contains the identifier for the message sender, &amp;lt;code&amp;gt;can_dlc&amp;lt;/code&amp;gt; contains the frame payload in bytes, and &amp;lt;code&amp;gt;data[8]&amp;lt;/code&amp;gt; is an array that holds up to the 8 bytes of payload. The following snippet of code shows how to create a frame with 8 random hex values as its payload without error checking.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
struct can_frame frame;&lt;br /&gt;
int j;&lt;br /&gt;
int id = 0x1;&lt;br /&gt;
int dlc = 8; // Frame payload length in bytes&lt;br /&gt;
&lt;br /&gt;
srand(time(NULL)); // Randomize seed&lt;br /&gt;
&lt;br /&gt;
frame.can_id = id;&lt;br /&gt;
for(j = 0; j &amp;lt; dlc; j++){&lt;br /&gt;
    frame.data[j] = 0x1 * (rand()%99); // Assign 8 random hex bytes to the payload&lt;br /&gt;
}&lt;br /&gt;
frame.can_dlc = dlc;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====CAN Write====&lt;br /&gt;
Sending a CAN frame is accomplished by simply using the &amp;lt;code&amp;gt;write()&amp;lt;/code&amp;gt; system call. &amp;lt;code&amp;gt;write()&amp;lt;/code&amp;gt; takes 3 arguments: a file descriptor, a buffer(data) to write, and the size of data to write. In this case, the file descriptor is the CAN socket that was opened previously, the buffer will will be the address to the frame struct, and the size of data is the size of the CAN frame struct. The return value of &amp;lt;code&amp;gt;write()&amp;lt;/code&amp;gt; is the number of bytes written, and is valuable for error checking. The following code snippet illustrates how to write the frame to the socket that were setup in the previous sections.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
int wbytes;&lt;br /&gt;
&lt;br /&gt;
wbytes = write(s, &amp;amp;frame, sizeof(struct can_frame));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====CAN Read====&lt;br /&gt;
Reading from a CAN frame is very similar to writing to one. Reading is accomplished with the &amp;lt;code&amp;gt;read()&amp;lt;/code&amp;gt; system call. &amp;lt;code&amp;gt;read()&amp;lt;/code&amp;gt; takes 3 arguments: a file descriptor, a buffer(data) to put the read data in, and the size of data to read. In this case, the file descriptor is the CAN socket that was opened previously, the buffer will will be the address to a new frame struct, and the size of data is the size of the CAN frame struct. The return value of &amp;lt;code&amp;gt;read()&amp;lt;/code&amp;gt; is the number of bytes read, and is valuable for error checking. When write is called, it will block the program from continuing until data is read. The following code snippet illustrates how to read from the CAN bus to a frame and print that frame to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt; in a similar format to &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; without error checking.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
struct can_frame frame2;&lt;br /&gt;
int rbytes, k;&lt;br /&gt;
&lt;br /&gt;
rbytes = read(s, &amp;amp;frame2, sizeof(struct can_frame));&lt;br /&gt;
&lt;br /&gt;
printf(&amp;quot;&amp;lt;0x%03x&amp;gt; [%d] &amp;quot;, frame2.can_id, frame2.can_dlc);&lt;br /&gt;
&lt;br /&gt;
for(k = 0; k &amp;lt; frame2.can_dlc; k++){&lt;br /&gt;
    printf(&amp;quot;%02x &amp;quot;, frame2.data[k]);&lt;br /&gt;
}&lt;br /&gt;
printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====CAN Example Program====&lt;br /&gt;
Using all of the information in the above sections, a small program can be made to emulate some of the features of &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;. To build this example, see [[Getting_Started_with_the_EMAC_OE_SDK#CMake_Compiling|this section]] of the getting started guide. To run this program, enter the name of the program followed by either &amp;quot;send&amp;quot; or &amp;quot;receive.&amp;quot; Send will send 8 bytes of random hex over &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt;, while receive will read one message from &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; and print it out.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;sys/types.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/socket.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/ioctl.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/uio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;linux/can.h&amp;gt;&lt;br /&gt;
#include &amp;lt;net/if.h&amp;gt;&lt;br /&gt;
#include &amp;lt;linux/can/raw.h&amp;gt;&lt;br /&gt;
#include &amp;lt;time.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int can_write(int socket);&lt;br /&gt;
int can_read(int socket);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char* argv[])&lt;br /&gt;
{&lt;br /&gt;
    if(argc != 2){&lt;br /&gt;
        printf(&amp;quot;%s requires either the argument \&amp;quot;send\&amp;quot; or \&amp;quot;receive\&amp;quot;\n&amp;quot;, argv[0]);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // Create and Bind Socket&lt;br /&gt;
    int s, ret;&lt;br /&gt;
    struct sockaddr_can addr;&lt;br /&gt;
    struct ifreq ifr;&lt;br /&gt;
    if(s = socket(PF_CAN, SOCK_RAW, CAN_RAW) &amp;lt; 0){&lt;br /&gt;
        perror(&amp;quot;socket&amp;quot;);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
    strcpy(ifr.ifr_name, &amp;quot;can0&amp;quot; );&lt;br /&gt;
    ioctl(s, SIOCGIFINDEX, &amp;amp;ifr);&lt;br /&gt;
    addr.can_family = AF_CAN;&lt;br /&gt;
    addr.can_ifindex = ifr.ifr_ifindex;&lt;br /&gt;
        if(bind(s, (struct sockaddr *)&amp;amp;addr, sizeof(addr)) &amp;lt; 0){&lt;br /&gt;
        perror(&amp;quot;bind&amp;quot;);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
    ////&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    if(strcmp(argv[1], &amp;quot;send&amp;quot;) == 0){&lt;br /&gt;
        ret = can_write(s);&lt;br /&gt;
    }else if(strcmp(argv[1], &amp;quot;receive&amp;quot;) == 0){&lt;br /&gt;
        ret = can_read(s);&lt;br /&gt;
    }else{&lt;br /&gt;
        printf(&amp;quot;%s requires either the argument \&amp;quot;send\&amp;quot; or \&amp;quot;receive\&amp;quot;\n&amp;quot;, argv[0]);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    if(ret == 0) {&lt;br /&gt;
        exit(EXIT_SUCCESS);&lt;br /&gt;
    }else {&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
int can_write(int socket)&lt;br /&gt;
{&lt;br /&gt;
    // Build frame from random digits&lt;br /&gt;
    struct can_frame frame;&lt;br /&gt;
    int j;&lt;br /&gt;
    int id = 0x1;&lt;br /&gt;
    int dlc = 8; // Frame payload length in bytes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    srand(time(NULL)); // Randomize seed&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    frame.can_id = id;&lt;br /&gt;
    for(j = 0; j &amp;lt; dlc; j++){&lt;br /&gt;
        frame.data[j] = 0x1 * (rand()%99); // Assign 8 random hex bytes to the payload&lt;br /&gt;
    }&lt;br /&gt;
    frame.can_dlc = dlc;&lt;br /&gt;
    ////&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // Write frame to CAN socket&lt;br /&gt;
    int wbytes;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    wbytes = write(socket, &amp;amp;frame, sizeof(struct can_frame));&lt;br /&gt;
    if(wbytes &amp;lt; 0) {&lt;br /&gt;
        perror(&amp;quot;can raw socket write&amp;quot;);&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
    ////&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
int can_read(int socket){&lt;br /&gt;
    // Read from CAN socket and print message&lt;br /&gt;
    struct can_frame frame2;&lt;br /&gt;
    int rbytes, k;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    rbytes = read(socket, &amp;amp;frame2, sizeof(struct can_frame));&lt;br /&gt;
    if(rbytes &amp;lt; 0) {&lt;br /&gt;
        perror(&amp;quot;can raw socket read&amp;quot;);&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    printf(&amp;quot;&amp;lt;0x%03x&amp;gt; [%d] &amp;quot;, frame2.can_id, frame2.can_dlc);&lt;br /&gt;
    for(k = 0; k &amp;lt; frame2.can_dlc; k++){&lt;br /&gt;
        printf(&amp;quot;%02x &amp;quot;, frame2.data[k]);&lt;br /&gt;
    }&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    ////&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This information can be found in much grater detail, along with much more, in the [https://www.kernel.org/doc/Documentation/networking/can.txt Linux Kernel Documentation].&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:examples | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
CAN is a useful protocol for communicating quickly with sensors and other controllers. EMAC boards with CAN should be able to quickly integrate with existing CAN networks with little trouble.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* [[Getting_Started_with_the_EMAC_OE_SDK|Getting started with the EMAC SDK]]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* [[EMAC_HW|EMAC Hardware]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5254</id>
		<title>EMAC CAN Interface</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5254"/>
		<updated>2016-01-20T17:34:35Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| InProgress (01.18.2016-10:45-&amp;gt;KY+)|Klint Youngmeyer| project=OE 5.0,KY,InProgress }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=EMAC CAN Interface&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=&lt;br /&gt;
|description=This page describes how to use the CAN interface on EMAC boards.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
The CAN interface is a vehicle bus standard that allows communication between a controller and various sensors. EMAC produces several boards capable of communicating on a CAN bus. For more information about which products support the CAN bus, see the [[EMAC_HW|hardware]] page.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
CAN (controller area network) is a multi-master serial bus for communicating between &amp;quot;nodes&amp;quot; over a two-wire interface. The wires are generally a 120 ohm twisted pair. Each CAN node has the ability to communicate with every other node, one at a time. &lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:geninfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
The CAN bus is able to be accessed from the command line, or using a C library on EMAC products (with CAN support).&lt;br /&gt;
===CAN Bus Setup===&lt;br /&gt;
Before using the CAN interface on an EMAC device, two commands must be run. These commands could be scripted to be run at startup, see [[EMAC_OE_Boot_Process_Customization|this page]] for details.&lt;br /&gt;
{{note|The settings in the first command may need to be changed according to the application in question.}}&lt;br /&gt;
&lt;br /&gt;
{{cli | ip link set can0 type can bitrate 125000 triple-sampling on | hostname=ipac9x25}}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
{{cli | ip link set can0 up | hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
===Command Line CAN===&lt;br /&gt;
The command line tools included with EMAC OE 5 are part of the &amp;lt;code&amp;gt;canutils&amp;lt;/code&amp;gt; package. The tools included in this package are:&lt;br /&gt;
* &amp;lt;code&amp;gt;canconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;canecho&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansequence&amp;lt;/code&amp;gt;&lt;br /&gt;
Of these five, the most easily used are &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;.&lt;br /&gt;
====cansend====&lt;br /&gt;
&amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, as the name implies, is used for sending CAN messages over the bus. Up to eight bytes at a time can be sent using &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, these bytes are formatted at a space separated list of hexadecimal octets e.g. &amp;quot;&amp;lt;code&amp;gt;0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt;.&amp;quot; The command for sending the previously mentioned hexadecimal digits on the &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; device is:&lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; uses, by default, an identifier of &amp;lt;code&amp;gt;0x01&amp;lt;/code&amp;gt;. If an identifier other than default is desired, the &amp;lt;code&amp;gt;-i 0x&amp;lt;IDENT&amp;gt;&amp;lt;/code&amp;gt; option must be passed on the command line. In the following example, the identity &amp;lt;code&amp;gt;0x89&amp;lt;/code&amp;gt; is used. &lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 -i 0x89 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x089&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
Using the standard identity, the length of the identity is limited to a maximum hexadecimal value of &amp;lt;code&amp;gt;0x7FF&amp;lt;/code&amp;gt;. If a larger identity is needed, the &amp;lt;code&amp;gt;-e&amp;lt;/code&amp;gt; option can be passed, which allows an extended CAN frame with a maximum hexadecimal value of &amp;lt;code&amp;gt;0x1FFFFFFF&amp;lt;/code&amp;gt;. The following example shows a message with an extended frame.&lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 -e -i 0x8008 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x00008008&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
====candump====&lt;br /&gt;
&amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; is used to receive messages over CAN. These messages can be output to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt; or directly to a file. &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; will run until it is killed, either with &amp;lt;code&amp;gt;Ctrl-C&amp;lt;/code&amp;gt; or a &amp;lt;code&amp;gt;kill&amp;lt;/code&amp;gt; command. The following command shows how to receive any message over CAN and output it to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt;. A command of &amp;lt;code&amp;gt;cansend can0 0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt; was given on a connected board.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | candump can0 | hostname=ipac9x25}}&lt;br /&gt;
interface = can0, family = 29, type = 3, proto = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
To receive any message over CAN and output it to a file, the following command is used. A command of &amp;lt;code&amp;gt;cansend can0 0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt; was given on a connected board.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | candump can0 -o /tmp/candump.txt | hostname=ipac9x25}}&lt;br /&gt;
interface = can0, family = 29, type = 3, proto = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{clos}}&lt;br /&gt;
Since &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; will continue running, a &amp;lt;code&amp;gt;Ctrl-C&amp;lt;/code&amp;gt; should be given before viewing the contents of the file. To view the file, &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; can be used.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | cat /tmp/candump.txt | hostname=ipac9x25}}&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; can also filter its output according to two values: filter and mask. The filter &amp;lt;code&amp;gt;[can_id]:[can_mask]&amp;lt;/code&amp;gt; matches when &amp;lt;code&amp;gt;[received_can_id] &amp;amp; [can_mask] == [can_id] &amp;amp; [mask]&amp;lt;/code&amp;gt;. For example, to only receive messages from the identity &amp;lt;code&amp;gt;0x088&amp;lt;/code&amp;gt;, use the following command.&lt;br /&gt;
{{cli|candump can0 --filter 0x088:0x7FF|hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
===C Programming CAN===&lt;br /&gt;
Using CAN with C programming on an EMAC Linux board involves using the SocketCAN implementation.&lt;br /&gt;
====CAN Sockets====&lt;br /&gt;
To open a CAN connection, first a socket must be opened. CAN sockets can be either &amp;lt;code&amp;gt;raw&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;broadcast manager&amp;lt;/code&amp;gt;, for this document &amp;lt;code&amp;gt;raw&amp;lt;/code&amp;gt; will be used. After creation of a &amp;lt;code&amp;gt;raw&amp;lt;/code&amp;gt; CAN socket, it must be bound to an address with the &amp;lt;code&amp;gt;bind()&amp;lt;/code&amp;gt; system call. This address is specified by a &amp;lt;code&amp;gt;sockaddr_can&amp;lt;/code&amp;gt; struct cast to a &amp;lt;code&amp;gt;sockaddr&amp;lt;/code&amp;gt; struct. The following code snippet demonstrates how to open a CAN socket on &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; with no error checking.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
int s;&lt;br /&gt;
struct sockaddr_can addr;&lt;br /&gt;
struct ifreq ifr;&lt;br /&gt;
&lt;br /&gt;
s = socket(PF_CAN, SOCK_RAW, CAN_RAW);&lt;br /&gt;
strcpy(ifr.ifr_name, &amp;quot;can0&amp;quot; );&lt;br /&gt;
ioctl(s, SIOCGIFINDEX, &amp;amp;ifr);&lt;br /&gt;
&lt;br /&gt;
addr.can_family = AF_CAN;&lt;br /&gt;
addr.can_ifindex = ifr.ifr_ifindex;&lt;br /&gt;
&lt;br /&gt;
bind(s, (struct sockaddr *)&amp;amp;addr, sizeof(addr));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====CAN Frames====&lt;br /&gt;
In order to transmit data over this CAN socket, the data must be in a &amp;quot;CAN frame.&amp;quot; This frame struct has three important member variables: &amp;lt;code&amp;gt;can_id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;can_dlc&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;data[8]&amp;lt;/code&amp;gt;. All of these variables are of type &amp;lt;code&amp;gt;__u8&amp;lt;/code&amp;gt;, which is a Linux unsigned 8-bit integer. &amp;lt;code&amp;gt;can_id&amp;lt;/code&amp;gt; contains the identifier for the message sender, &amp;lt;code&amp;gt;can_dlc&amp;lt;/code&amp;gt; contains the frame payload in bytes, and &amp;lt;code&amp;gt;data[8]&amp;lt;/code&amp;gt; is an array that holds up to the 8 bytes of payload. The following snippet of code shows how to create a frame with 8 random hex values as its payload without error checking.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
struct can_frame frame;&lt;br /&gt;
int j;&lt;br /&gt;
int id = 0x1;&lt;br /&gt;
int dlc = 8; // Frame payload length in bytes&lt;br /&gt;
&lt;br /&gt;
srand(time(NULL)); // Randomize seed&lt;br /&gt;
&lt;br /&gt;
frame.can_id = id;&lt;br /&gt;
for(j = 0; j &amp;lt; dlc; j++){&lt;br /&gt;
    frame.data[j] = 0x1 * (rand()%99); // Assign 8 random hex bytes to the payload&lt;br /&gt;
}&lt;br /&gt;
frame.can_dlc = dlc;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====CAN Write====&lt;br /&gt;
Sending a CAN frame is accomplished by simply using the &amp;lt;code&amp;gt;write()&amp;lt;/code&amp;gt; system call. &amp;lt;code&amp;gt;write()&amp;lt;/code&amp;gt; takes 3 arguments: a file descriptor, a buffer(data) to write, and the size of data to write. In this case, the file descriptor is the CAN socket that was opened previously, the buffer will will be the address to the frame struct, and the size of data is the size of the CAN frame struct. The return value of &amp;lt;code&amp;gt;write()&amp;lt;/code&amp;gt; is the number of bytes written, and is valuable for error checking. The following code snippet illustrates how to write the frame to the socket that were setup in the previous sections.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
int wbytes;&lt;br /&gt;
&lt;br /&gt;
wbytes = write(s, &amp;amp;frame, sizeof(struct can_frame));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====CAN Read====&lt;br /&gt;
Reading from a CAN frame is very similar to writing to one. Reading is accomplished with the &amp;lt;code&amp;gt;read()&amp;lt;/code&amp;gt; system call. &amp;lt;code&amp;gt;read()&amp;lt;/code&amp;gt; takes 3 arguments: a file descriptor, a buffer(data) to put the read data in, and the size of data to read. In this case, the file descriptor is the CAN socket that was opened previously, the buffer will will be the address to a new frame struct, and the size of data is the size of the CAN frame struct. The return value of &amp;lt;code&amp;gt;read()&amp;lt;/code&amp;gt; is the number of bytes read, and is valuable for error checking. When write is called, it will block the program from continuing until data is read. The following code snippet illustrates how to read from the CAN bus to a frame and print that frame to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt; in a similar format to &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; without error checking.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
struct can_frame frame2;&lt;br /&gt;
int rbytes, k;&lt;br /&gt;
&lt;br /&gt;
rbytes = read(s, &amp;amp;frame2, sizeof(struct can_frame));&lt;br /&gt;
&lt;br /&gt;
printf(&amp;quot;&amp;lt;0x%03x&amp;gt; [%d] &amp;quot;, frame2.can_id, frame2.can_dlc);&lt;br /&gt;
&lt;br /&gt;
for(k = 0; k &amp;lt; frame2.can_dlc; k++){&lt;br /&gt;
    printf(&amp;quot;%02x &amp;quot;, frame2.data[k]);&lt;br /&gt;
}&lt;br /&gt;
printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====CAN Example Program====&lt;br /&gt;
Using all of the information in the above sections, a small program can be made to emulate some of the features of &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;. To build this example, see [[Getting_Started_with_the_EMAC_OE_SDK#CMake_Compiling|this section]] of the getting started guide. To run this program, enter the name of the program followed by either &amp;quot;send&amp;quot; or &amp;quot;receive.&amp;quot; Send will send 8 bytes of random hex over &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt;, while receive will read one message from &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; and print it out.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;sys/types.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/socket.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/ioctl.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/uio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;linux/can.h&amp;gt;&lt;br /&gt;
#include &amp;lt;net/if.h&amp;gt;&lt;br /&gt;
#include &amp;lt;linux/can/raw.h&amp;gt;&lt;br /&gt;
#include &amp;lt;time.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int can_write(int socket);&lt;br /&gt;
int can_read(int socket);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char* argv[])&lt;br /&gt;
{&lt;br /&gt;
    if(argc != 2){&lt;br /&gt;
        printf(&amp;quot;%s requires either the argument \&amp;quot;send\&amp;quot; or \&amp;quot;receive\&amp;quot;\n&amp;quot;, argv[0]);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // Create and Bind Socket&lt;br /&gt;
    int s, ret;&lt;br /&gt;
    struct sockaddr_can addr;&lt;br /&gt;
    struct ifreq ifr;&lt;br /&gt;
    if(s = socket(PF_CAN, SOCK_RAW, CAN_RAW) &amp;lt; 0){&lt;br /&gt;
        perror(&amp;quot;socket&amp;quot;);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
    strcpy(ifr.ifr_name, &amp;quot;can0&amp;quot; );&lt;br /&gt;
    ioctl(s, SIOCGIFINDEX, &amp;amp;ifr);&lt;br /&gt;
    addr.can_family = AF_CAN;&lt;br /&gt;
    addr.can_ifindex = ifr.ifr_ifindex;&lt;br /&gt;
        if(bind(s, (struct sockaddr *)&amp;amp;addr, sizeof(addr)) &amp;lt; 0){&lt;br /&gt;
        perror(&amp;quot;bind&amp;quot;);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
    ////&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    if(strcmp(argv[1], &amp;quot;send&amp;quot;) == 0){&lt;br /&gt;
        ret = can_write(s);&lt;br /&gt;
    }else if(strcmp(argv[1], &amp;quot;receive&amp;quot;) == 0){&lt;br /&gt;
        ret = can_read(s);&lt;br /&gt;
    }else{&lt;br /&gt;
        printf(&amp;quot;%s requires either the argument \&amp;quot;send\&amp;quot; or \&amp;quot;receive\&amp;quot;\n&amp;quot;, argv[0]);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    if(ret == 0) {&lt;br /&gt;
        exit(EXIT_SUCCESS);&lt;br /&gt;
    }else {&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
int can_write(int socket)&lt;br /&gt;
{&lt;br /&gt;
    // Build frame from random digits&lt;br /&gt;
    struct can_frame frame;&lt;br /&gt;
    int j;&lt;br /&gt;
    int id = 0x1;&lt;br /&gt;
    int dlc = 8; // Frame payload length in bytes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    srand(time(NULL)); // Randomize seed&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    frame.can_id = id;&lt;br /&gt;
    for(j = 0; j &amp;lt; dlc; j++){&lt;br /&gt;
        frame.data[j] = 0x1 * (rand()%99); // Assign 8 random hex bytes to the payload&lt;br /&gt;
    }&lt;br /&gt;
    frame.can_dlc = dlc;&lt;br /&gt;
    ////&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // Write frame to CAN socket&lt;br /&gt;
    int wbytes;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    wbytes = write(socket, &amp;amp;frame, sizeof(struct can_frame));&lt;br /&gt;
    if(wbytes &amp;lt; 0) {&lt;br /&gt;
        perror(&amp;quot;can raw socket write&amp;quot;);&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
    ////&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
int can_read(int socket){&lt;br /&gt;
    // Read from CAN socket and print message&lt;br /&gt;
    struct can_frame frame2;&lt;br /&gt;
    int rbytes, k;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    rbytes = read(socket, &amp;amp;frame2, sizeof(struct can_frame));&lt;br /&gt;
    if(rbytes &amp;lt; 0) {&lt;br /&gt;
        perror(&amp;quot;can raw socket read&amp;quot;);&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    printf(&amp;quot;&amp;lt;0x%03x&amp;gt; [%d] &amp;quot;, frame2.can_id, frame2.can_dlc);&lt;br /&gt;
    for(k = 0; k &amp;lt; frame2.can_dlc; k++){&lt;br /&gt;
        printf(&amp;quot;%02x &amp;quot;, frame2.data[k]);&lt;br /&gt;
    }&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    ////&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This information can be found in much grater detail, along with much more, in the [https://www.kernel.org/doc/Documentation/networking/can.txt Linux Kernel Documentation].&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:examples | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
CAN is a useful protocol for communicating quickly with sensors and other controllers. EMAC boards with CAN should be able to quickly integrate with existing CAN networks with little trouble.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* [[Getting_Started_with_the_EMAC_OE_SDK|Getting started with the EMAC SDK]]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* [[EMAC_HW|EMAC Hardware]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5253</id>
		<title>EMAC CAN Interface</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5253"/>
		<updated>2016-01-19T20:32:14Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| InProgress (01.18.2016-10:45-&amp;gt;KY+)|Klint Youngmeyer| project=OE 5.0,KY,InProgress }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=EMAC CAN Interface&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=&lt;br /&gt;
|description=This page describes how to use the CAN interface on EMAC boards.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
The CAN interface is a vehicle bus standard that allows communication between a controller and various sensors. EMAC produces several boards capable of communicating on a CAN bus. For more information about which products support the CAN bus, see the [[EMAC_HW|hardware]] page.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
CAN (controller area network) is a multi-master serial bus for communicating between &amp;quot;nodes&amp;quot; over a two-wire interface. The wires are generally a 120 ohm twisted pair. Each CAN node has the ability to communicate with every other node, one at a time. &lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:geninfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
The CAN bus is able to be accessed from the command line, or using a C library on EMAC products (with CAN support).&lt;br /&gt;
===CAN Bus Setup===&lt;br /&gt;
Before using the CAN interface on an EMAC device, two commands must be run. These commands could be scripted to be run at startup, see [[EMAC_OE_Boot_Process_Customization|this page]] for details.&lt;br /&gt;
{{note|The settings in the first command may need to be changed according to the application in question.}}&lt;br /&gt;
&lt;br /&gt;
{{cli | ip link set can0 type can bitrate 125000 triple-sampling on | hostname=ipac9x25}}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
{{cli | ip link set can0 up | hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
===Command Line CAN===&lt;br /&gt;
The command line tools included with EMAC OE 5 are part of the &amp;lt;code&amp;gt;canutils&amp;lt;/code&amp;gt; package. The tools included in this package are:&lt;br /&gt;
* &amp;lt;code&amp;gt;canconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;canecho&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansequence&amp;lt;/code&amp;gt;&lt;br /&gt;
Of these five, the most easily used are &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;.&lt;br /&gt;
====cansend====&lt;br /&gt;
&amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, as the name implies, is used for sending CAN messages over the bus. Up to eight bytes at a time can be sent using &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, these bytes are formatted at a space separated list of hexadecimal octets e.g. &amp;quot;&amp;lt;code&amp;gt;0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt;.&amp;quot; The command for sending the previous hexadecimal digits on the &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; device is:&lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; uses, by default, an identifier of &amp;lt;code&amp;gt;0x01&amp;lt;/code&amp;gt;. If an identifier other than default, the &amp;lt;code&amp;gt;-i 0x&amp;lt;IDENT&amp;gt;&amp;lt;/code&amp;gt; option must be passed on the command line. In the following example, the identity &amp;lt;code&amp;gt;0x89&amp;lt;/code&amp;gt; is used. &lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 -i 0x89 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x089&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
Using the standard identity, the length of the identity is limited to a maximum hexadecimal value of &amp;lt;code&amp;gt;0x7FF&amp;lt;/code&amp;gt;. If a larger identity is needed, the &amp;lt;code&amp;gt;-e&amp;lt;/code&amp;gt; option can be passed, which allows an extended CAN frame with a maximum hexadecimal value of &amp;lt;code&amp;gt;0x1FFFFFFF&amp;lt;/code&amp;gt;. The following example shows a message with an extended frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 -e -i 0x8008 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x00008008&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
====candump====&lt;br /&gt;
&amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; is used to receive messages over CAN. These messages can be output to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt; or directly to a file. &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; will run until it is killed, either with &amp;lt;code&amp;gt;Ctrl-C&amp;lt;/code&amp;gt; or a &amp;lt;code&amp;gt;kill&amp;lt;/code&amp;gt; command. The following command shows how to receive any message over CAN and output it to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt;. A command of &amp;lt;code&amp;gt;cansend can0 0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt; was given on a connected board.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | candump can0 | hostname=ipac9x25}}&lt;br /&gt;
interface = can0, family = 29, type = 3, proto = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
To receive any message over CAN and output it to a file, the following command is used. A command of &amp;lt;code&amp;gt;cansend can0 0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt; was given on a connected board.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | candump can0 -o /tmp/candump.txt | hostname=ipac9x25}}&lt;br /&gt;
interface = can0, family = 29, type = 3, proto = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{clos}}&lt;br /&gt;
Since &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; will continue running, a &amp;lt;code&amp;gt;Ctrl-C&amp;lt;/code&amp;gt; should be given before viewing the contents of the file. To view the file, &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; can be used.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | cat /tmp/candump.txt | hostname=ipac9x25}}&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; can also filter its output according to two values: filter and mask. The filter &amp;lt;code&amp;gt;[can_id]:[can_mask]&amp;lt;/code&amp;gt; matches when &amp;lt;code&amp;gt;[received_can_id] &amp;amp; [can_mask] == [can_id] &amp;amp; [mask]&amp;lt;/code&amp;gt;. For example, to only receive messages from the identity &amp;lt;code&amp;gt;0x088&amp;lt;/code&amp;gt;, use the following command.&lt;br /&gt;
{{cli|candump can0 --filter 0x088:0x7FF|hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
===C Programming CAN===&lt;br /&gt;
Using CAN with C programming on an EMAC Linux board involves using the SocketCAN implementation.&lt;br /&gt;
====CAN Sockets====&lt;br /&gt;
To open a CAN connection, first a socket must be opened. CAN sockets can be either ''raw'' or ''broadcast manager'', for this document ''raw'' will be used. After creation of a ''raw'' CAN socket, it must be bound to an address with the &amp;lt;code&amp;gt;bind()&amp;lt;/code&amp;gt; system call. This address is specified by a &amp;lt;code&amp;gt;sockaddr_can&amp;lt;/code&amp;gt; struct cast to a &amp;lt;code&amp;gt;sockaddr&amp;lt;/code&amp;gt; struct. The following code snippet demonstrates how to open a CAN socket on &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; with no error checking.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
int s;&lt;br /&gt;
struct sockaddr_can addr;&lt;br /&gt;
struct ifreq ifr;&lt;br /&gt;
&lt;br /&gt;
s = socket(PF_CAN, SOCK_RAW, CAN_RAW);&lt;br /&gt;
strcpy(ifr.ifr_name, &amp;quot;can0&amp;quot; );&lt;br /&gt;
ioctl(s, SIOCGIFINDEX, &amp;amp;ifr);&lt;br /&gt;
&lt;br /&gt;
addr.can_family = AF_CAN;&lt;br /&gt;
addr.can_ifindex = ifr.ifr_ifindex;&lt;br /&gt;
&lt;br /&gt;
bind(s, (struct sockaddr *)&amp;amp;addr, sizeof(addr));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====CAN Frames====&lt;br /&gt;
In order to transmit data over this CAN socket, the data must be in a &amp;quot;CAN frame.&amp;quot; This frame struct has three important member variables: &amp;lt;code&amp;gt;can_id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;can_dlc&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;data[8]&amp;lt;/code&amp;gt;. All of these variables are of type &amp;lt;code&amp;gt;__u8&amp;lt;/code&amp;gt;, which is a Linux unsigned 8-bit integer. &amp;lt;code&amp;gt;can_id&amp;lt;/code&amp;gt; contains the identifier for the message sender, &amp;lt;code&amp;gt;can_dlc&amp;lt;/code&amp;gt; contains the frame payload in bytes, and &amp;lt;code&amp;gt;data[8]&amp;lt;/code&amp;gt; is an array that holds up to the 8 bytes of payload. The following snippet of code shows how to create a frame with 8 random hex values as its payload without error checking.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
struct can_frame frame;&lt;br /&gt;
int j;&lt;br /&gt;
int id = 0x1;&lt;br /&gt;
int dlc = 8; // Frame payload length in bytes&lt;br /&gt;
&lt;br /&gt;
srand(time(NULL)); // Randomize seed&lt;br /&gt;
&lt;br /&gt;
frame.can_id = id;&lt;br /&gt;
for(j = 0; j &amp;lt; dlc; j++){&lt;br /&gt;
    frame.data[j] = 0x1 * (rand()%99); // Assign 8 random hex bytes to the payload&lt;br /&gt;
}&lt;br /&gt;
frame.can_dlc = dlc;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====CAN Write====&lt;br /&gt;
Sending a CAN frame is accomplished by simply using the &amp;lt;code&amp;gt;write()&amp;lt;/code&amp;gt; system call. &amp;lt;code&amp;gt;write()&amp;lt;/code&amp;gt; takes 3 arguments: a file descriptor, a buffer(data) to write, and the size of data to write. In this case, the file descriptor is the CAN socket that was opened previously, the buffer will will be the address to the frame struct, and the size of data is the size of the CAN frame struct. The return value of &amp;lt;code&amp;gt;write()&amp;lt;/code&amp;gt; is the number of bytes written, and is valuable for error checking. The following code snippet illustrates how to write the frame to the socket that were setup in the previous sections.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
int wbytes;&lt;br /&gt;
&lt;br /&gt;
wbytes = write(s, &amp;amp;frame, sizeof(struct can_frame));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====CAN Read====&lt;br /&gt;
Reading from a CAN frame is very similar to writing to one. Reading is accomplished with the &amp;lt;code&amp;gt;read()&amp;lt;/code&amp;gt; system call. &amp;lt;code&amp;gt;read()&amp;lt;/code&amp;gt; takes 3 arguments: a file descriptor, a buffer(data) to put the read data in, and the size of data to read. In this case, the file descriptor is the CAN socket that was opened previously, the buffer will will be the address to a new frame struct, and the size of data is the size of the CAN frame struct. The return value of &amp;lt;code&amp;gt;read()&amp;lt;/code&amp;gt; is the number of bytes read, and is valuable for error checking. When write is called, it will block the program from continuing until data is read. The following code snippet illustrates how to read from the CAN bus to a frame and print that frame to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt; in a similar format to &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; without error checking.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
struct can_frame frame2;&lt;br /&gt;
int rbytes, k;&lt;br /&gt;
&lt;br /&gt;
rbytes = read(s, &amp;amp;frame2, sizeof(struct can_frame));&lt;br /&gt;
&lt;br /&gt;
printf(&amp;quot;&amp;lt;0x%03x&amp;gt; [%d] &amp;quot;, frame2.can_id, frame2.can_dlc);&lt;br /&gt;
&lt;br /&gt;
for(k = 0; k &amp;lt; frame2.can_dlc; k++){&lt;br /&gt;
    printf(&amp;quot;%02x &amp;quot;, frame2.data[k]);&lt;br /&gt;
}&lt;br /&gt;
printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====CAN Example Program====&lt;br /&gt;
Using all of the information in the above sections, a small program can be made to emulate some of the features of &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;. To build this example, see [[Getting_Started_with_the_EMAC_OE_SDK#CMake_Compiling|this section]] of the getting started guide. To run this program, enter the name of the program followed by either &amp;quot;send&amp;quot; or &amp;quot;receive.&amp;quot; Send will send 8 bytes of random hex over &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt;, while receive will read one message from &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; and print it out.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;sys/types.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/socket.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/ioctl.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/uio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;linux/can.h&amp;gt;&lt;br /&gt;
#include &amp;lt;net/if.h&amp;gt;&lt;br /&gt;
#include &amp;lt;linux/can/raw.h&amp;gt;&lt;br /&gt;
#include &amp;lt;time.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int can_write(int socket);&lt;br /&gt;
int can_read(int socket);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char* argv[])&lt;br /&gt;
{&lt;br /&gt;
    if(argc != 2){&lt;br /&gt;
        printf(&amp;quot;%s requires either the argument \&amp;quot;send\&amp;quot; or \&amp;quot;receive\&amp;quot;\n&amp;quot;, argv[0]);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // Create and Bind Socket&lt;br /&gt;
    int s, ret;&lt;br /&gt;
    struct sockaddr_can addr;&lt;br /&gt;
    struct ifreq ifr;&lt;br /&gt;
    if(s = socket(PF_CAN, SOCK_RAW, CAN_RAW) &amp;lt; 0){&lt;br /&gt;
        perror(&amp;quot;socket&amp;quot;);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
    strcpy(ifr.ifr_name, &amp;quot;can0&amp;quot; );&lt;br /&gt;
    ioctl(s, SIOCGIFINDEX, &amp;amp;ifr);&lt;br /&gt;
    addr.can_family = AF_CAN;&lt;br /&gt;
    addr.can_ifindex = ifr.ifr_ifindex;&lt;br /&gt;
        if(bind(s, (struct sockaddr *)&amp;amp;addr, sizeof(addr)) &amp;lt; 0){&lt;br /&gt;
        perror(&amp;quot;bind&amp;quot;);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
    ////&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    if(strcmp(argv[1], &amp;quot;send&amp;quot;) == 0){&lt;br /&gt;
        ret = can_write(s);&lt;br /&gt;
    }else if(strcmp(argv[1], &amp;quot;receive&amp;quot;) == 0){&lt;br /&gt;
        ret = can_read(s);&lt;br /&gt;
    }else{&lt;br /&gt;
        printf(&amp;quot;%s requires either the argument \&amp;quot;send\&amp;quot; or \&amp;quot;receive\&amp;quot;\n&amp;quot;, argv[0]);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    if(ret == 0) {&lt;br /&gt;
        exit(EXIT_SUCCESS);&lt;br /&gt;
    }else {&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
int can_write(int socket)&lt;br /&gt;
{&lt;br /&gt;
    // Build frame from random digits&lt;br /&gt;
    struct can_frame frame;&lt;br /&gt;
    int j;&lt;br /&gt;
    int id = 0x1;&lt;br /&gt;
    int dlc = 8; // Frame payload length in bytes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    srand(time(NULL)); // Randomize seed&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    frame.can_id = id;&lt;br /&gt;
    for(j = 0; j &amp;lt; dlc; j++){&lt;br /&gt;
        frame.data[j] = 0x1 * (rand()%99); // Assign 8 random hex bytes to the payload&lt;br /&gt;
    }&lt;br /&gt;
    frame.can_dlc = dlc;&lt;br /&gt;
    ////&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // Write frame to CAN socket&lt;br /&gt;
    int wbytes;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    wbytes = write(socket, &amp;amp;frame, sizeof(struct can_frame));&lt;br /&gt;
    if(wbytes &amp;lt; 0) {&lt;br /&gt;
        perror(&amp;quot;can raw socket write&amp;quot;);&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
    ////&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
int can_read(int socket){&lt;br /&gt;
    // Read from CAN socket and print message&lt;br /&gt;
    struct can_frame frame2;&lt;br /&gt;
    int rbytes, k;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    rbytes = read(socket, &amp;amp;frame2, sizeof(struct can_frame));&lt;br /&gt;
    if(rbytes &amp;lt; 0) {&lt;br /&gt;
        perror(&amp;quot;can raw socket read&amp;quot;);&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    printf(&amp;quot;&amp;lt;0x%03x&amp;gt; [%d] &amp;quot;, frame2.can_id, frame2.can_dlc);&lt;br /&gt;
    for(k = 0; k &amp;lt; frame2.can_dlc; k++){&lt;br /&gt;
        printf(&amp;quot;%02x &amp;quot;, frame2.data[k]);&lt;br /&gt;
    }&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    ////&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This information can be found in much grater detail, along with much more, in the [https://www.kernel.org/doc/Documentation/networking/can.txt Linux Kernel Documentation].&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:examples | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
CAN is a useful protocol for communicating quickly with sensors and other controllers. EMAC boards with CAN should be able to quickly integrate with existing CAN networks with little trouble.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* [[Getting_Started_with_the_EMAC_OE_SDK|Getting started with the EMAC SDK]]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* [[EMAC_HW|EMAC Hardware]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5252</id>
		<title>EMAC CAN Interface</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5252"/>
		<updated>2016-01-19T19:33:21Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| InProgress (01.18.2016-10:45-&amp;gt;KY+)|Klint Youngmeyer| project=OE 5.0,KY,InProgress }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=EMAC CAN Interface&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=&lt;br /&gt;
|description=This page describes how to use the CAN interface on EMAC boards.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
The CAN interface is a vehicle bus standard that allows communication between a controller and various sensors. EMAC produces several boards capable of communicating on a CAN bus. For more information about which products support the CAN bus, see the [[EMAC_HW|hardware]] page.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
CAN (controller area network) is a multi-master serial bus for communicating between &amp;quot;nodes&amp;quot; over a two-wire interface. The wires are generally a 120 ohm twisted pair. Each CAN node has the ability to communicate with every other node, one at a time. &lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:geninfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
The CAN bus is able to be accessed from the command line, or using a C library on EMAC products (with CAN support).&lt;br /&gt;
===CAN Bus Setup===&lt;br /&gt;
Before using the CAN interface on an EMAC device, two commands must be run. These commands could be scripted to be run at startup, see [[EMAC_OE_Boot_Process_Customization|this page]] for details.&lt;br /&gt;
{{note|The settings in the first command may need to be changed according to the application in question.}}&lt;br /&gt;
&lt;br /&gt;
{{cli | ip link set can0 type can bitrate 125000 triple-sampling on | hostname=ipac9x25}}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
{{cli | ip link set can0 up | hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
===Command Line CAN===&lt;br /&gt;
The command line tools included with EMAC OE 5 are part of the &amp;lt;code&amp;gt;canutils&amp;lt;/code&amp;gt; package. The tools included in this package are:&lt;br /&gt;
* &amp;lt;code&amp;gt;canconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;canecho&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansequence&amp;lt;/code&amp;gt;&lt;br /&gt;
Of these five, the most easily used are &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;.&lt;br /&gt;
====cansend====&lt;br /&gt;
&amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, as the name implies, is used for sending CAN messages over the bus. Up to eight bytes at a time can be sent using &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, these bytes are formatted at a space separated list of hexadecimal octets e.g. &amp;quot;&amp;lt;code&amp;gt;0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt;.&amp;quot; The command for sending the previous hexadecimal digits on the &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; device is:&lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; uses, by default, an identifier of &amp;lt;code&amp;gt;0x01&amp;lt;/code&amp;gt;. If an identifier other than default, the &amp;lt;code&amp;gt;-i 0x&amp;lt;IDENT&amp;gt;&amp;lt;/code&amp;gt; option must be passed on the command line. In the following example, the identity &amp;lt;code&amp;gt;0x89&amp;lt;/code&amp;gt; is used. &lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 -i 0x89 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x089&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
Using the standard identity, the length of the identity is limited to a maximum hexadecimal value of &amp;lt;code&amp;gt;0x7FF&amp;lt;/code&amp;gt;. If a larger identity is needed, the &amp;lt;code&amp;gt;-e&amp;lt;/code&amp;gt; option can be passed, which allows an extended CAN frame with a maximum hexadecimal value of &amp;lt;code&amp;gt;0x1FFFFFFF&amp;lt;/code&amp;gt;. The following example shows a message with an extended frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 -e -i 0x8008 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x00008008&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
====candump====&lt;br /&gt;
&amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; is used to receive messages over CAN. These messages can be output to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt; or directly to a file. &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; will run until it is killed, either with &amp;lt;code&amp;gt;Ctrl-C&amp;lt;/code&amp;gt; or a &amp;lt;code&amp;gt;kill&amp;lt;/code&amp;gt; command. The following command shows how to receive any message over CAN and output it to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt;. A command of &amp;lt;code&amp;gt;cansend can0 0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt; was given on a connected board.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | candump can0 | hostname=ipac9x25}}&lt;br /&gt;
interface = can0, family = 29, type = 3, proto = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
To receive any message over CAN and output it to a file, the following command is used. A command of &amp;lt;code&amp;gt;cansend can0 0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt; was given on a connected board.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | candump can0 -o /tmp/candump.txt | hostname=ipac9x25}}&lt;br /&gt;
interface = can0, family = 29, type = 3, proto = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{clos}}&lt;br /&gt;
Since &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; will continue running, a &amp;lt;code&amp;gt;Ctrl-C&amp;lt;/code&amp;gt; should be given before viewing the contents of the file. To view the file, &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; can be used.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | cat /tmp/candump.txt | hostname=ipac9x25}}&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; can also filter its output according to two values: filter and mask. The filter &amp;lt;code&amp;gt;[can_id]:[can_mask]&amp;lt;/code&amp;gt; matches when &amp;lt;code&amp;gt;[received_can_id] &amp;amp; [can_mask] == [can_id] &amp;amp; [mask]&amp;lt;/code&amp;gt;. For example, to only receive messages from the identity &amp;lt;code&amp;gt;0x088&amp;lt;/code&amp;gt;, use the following command.&lt;br /&gt;
{{cli|candump can0 --filter 0x088:0x7FF|hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
===C Programming CAN===&lt;br /&gt;
Using CAN with C programming on an EMAC Linux board involves using the SocketCAN implementation.&lt;br /&gt;
====CAN Sockets====&lt;br /&gt;
To open a CAN connection, first a socket must be opened. CAN sockets can be either ''raw'' or ''broadcast manager'', for this document ''raw'' will be used. After creation of a ''raw'' CAN socket, it must be bound to an address with the &amp;lt;code&amp;gt;bind()&amp;lt;/code&amp;gt; system call. This address is specified by a &amp;lt;code&amp;gt;sockaddr_can&amp;lt;/code&amp;gt; struct cast to a &amp;lt;code&amp;gt;sockaddr&amp;lt;/code&amp;gt; struct. The following code snippet demonstrates how to open a CAN socket on &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; with no error checking.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
int s;&lt;br /&gt;
struct sockaddr_can addr;&lt;br /&gt;
struct ifreq ifr;&lt;br /&gt;
&lt;br /&gt;
s = socket(PF_CAN, SOCK_RAW, CAN_RAW);&lt;br /&gt;
strcpy(ifr.ifr_name, &amp;quot;can0&amp;quot; );&lt;br /&gt;
ioctl(s, SIOCGIFINDEX, &amp;amp;ifr);&lt;br /&gt;
&lt;br /&gt;
addr.can_family = AF_CAN;&lt;br /&gt;
addr.can_ifindex = ifr.ifr_ifindex;&lt;br /&gt;
&lt;br /&gt;
bind(s, (struct sockaddr *)&amp;amp;addr, sizeof(addr));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====CAN Frames====&lt;br /&gt;
In order to transmit data over this CAN socket, the data must be in a &amp;quot;CAN frame.&amp;quot; This frame struct has three important member variables: &amp;lt;code&amp;gt;can_id&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;can_dlc&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;data[8]&amp;lt;/code&amp;gt;. All of these variables are of type &amp;lt;code&amp;gt;__u8&amp;lt;/code&amp;gt;, which is a Linux unsigned 8-bit integer. &amp;lt;code&amp;gt;can_id&amp;lt;/code&amp;gt; contains the identifier for the message sender, &amp;lt;code&amp;gt;can_dlc&amp;lt;/code&amp;gt; contains the frame payload in bytes, and &amp;lt;code&amp;gt;data[8]&amp;lt;/code&amp;gt; is an array that holds up to the 8 bytes of payload. The following snippet of code shows how to create a frame with 8 random hex values as its payload without error checking.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
struct can_frame frame;&lt;br /&gt;
int j;&lt;br /&gt;
int id = 0x1;&lt;br /&gt;
int dlc = 8; // Frame payload length in bytes&lt;br /&gt;
&lt;br /&gt;
srand(time(NULL)); // Randomize seed&lt;br /&gt;
&lt;br /&gt;
frame.can_id = id;&lt;br /&gt;
for(j = 0; j &amp;lt; dlc; j++){&lt;br /&gt;
    frame.data[j] = 0x1 * (rand()%99); // Assign 8 random hex bytes to the payload&lt;br /&gt;
}&lt;br /&gt;
frame.can_dlc = dlc;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====CAN Write====&lt;br /&gt;
Sending a CAN frame is accomplished by simply using the &amp;lt;code&amp;gt;write()&amp;lt;/code&amp;gt; system call. &amp;lt;code&amp;gt;write()&amp;lt;/code&amp;gt; takes 3 arguments: a file descriptor, a buffer(data) to write, and the size of data to write. In this case, the file descriptor is the CAN socket that was opened previously, the buffer will will be the address to the frame struct, and the size of data is the size of the CAN frame struct. The return value of &amp;lt;code&amp;gt;write()&amp;lt;/code&amp;gt; is the number of bytes written, and is valuable for error checking. The following code snippet illustrates how to write the frame to the socket that were setup in the previous sections.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
int nbytes;&lt;br /&gt;
&lt;br /&gt;
nbytes = write(s, &amp;amp;frame, sizeof(struct can_frame));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====CAN Read====&lt;br /&gt;
&lt;br /&gt;
====CAN Example Program====&lt;br /&gt;
&lt;br /&gt;
This information can be found in much grater detail, along with much more, in the [https://www.kernel.org/doc/Documentation/networking/can.txt Linux Kernel Documentation].&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:examples | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
CAN is a useful protocol for communicating quickly with sensors and other controllers. EMAC boards with CAN should be able to quickly integrate with existing CAN networks with little trouble.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* [[Getting_Started_with_the_EMAC_OE_SDK|Getting started with the EMAC SDK]]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* [[EMAC_HW|EMAC Hardware]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5251</id>
		<title>EMAC CAN Interface</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5251"/>
		<updated>2016-01-19T18:01:42Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| InProgress (01.18.2016-10:45-&amp;gt;KY+)|Klint Youngmeyer| project=OE 5.0,KY,InProgress }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=EMAC CAN Interface&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=&lt;br /&gt;
|description=This page describes how to use the CAN interface on EMAC boards.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
The CAN interface is a vehicle bus standard that allows communication between a controller and various sensors. EMAC produces several boards capable of communicating on a CAN bus. For more information about which products support the CAN bus, see the [[EMAC_HW|hardware]] page.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
CAN (controller area network) is a multi-master serial bus for communicating between &amp;quot;nodes&amp;quot; over a two-wire interface. The wires are generally a 120 ohm twisted pair. Each CAN node has the ability to communicate with every other node, one at a time. &lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:geninfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
The CAN bus is able to be accessed from the command line, or using a C library on EMAC products (with CAN support).&lt;br /&gt;
===CAN Bus Setup===&lt;br /&gt;
Before using the CAN interface on an EMAC device, two commands must be run. These commands could be scripted to be run at startup, see [[EMAC_OE_Boot_Process_Customization|this page]] for details.&lt;br /&gt;
{{note|The settings in the first command may need to be changed according to the application in question.}}&lt;br /&gt;
&lt;br /&gt;
{{cli | ip link set can0 type can bitrate 125000 triple-sampling on | hostname=ipac9x25}}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
{{cli | ip link set can0 up | hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
===Command Line CAN===&lt;br /&gt;
The command line tools included with EMAC OE 5 are part of the &amp;lt;code&amp;gt;canutils&amp;lt;/code&amp;gt; package. The tools included in this package are:&lt;br /&gt;
* &amp;lt;code&amp;gt;canconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;canecho&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansequence&amp;lt;/code&amp;gt;&lt;br /&gt;
Of these five, the most easily used are &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;.&lt;br /&gt;
====cansend====&lt;br /&gt;
&amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, as the name implies, is used for sending CAN messages over the bus. Up to eight bytes at a time can be sent using &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, these bytes are formatted at a space separated list of hexadecimal octets e.g. &amp;quot;&amp;lt;code&amp;gt;0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt;.&amp;quot; The command for sending the previous hexadecimal digits on the &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; device is:&lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; uses, by default, an identifier of &amp;lt;code&amp;gt;0x01&amp;lt;/code&amp;gt;. If an identifier other than default, the &amp;lt;code&amp;gt;-i 0x&amp;lt;IDENT&amp;gt;&amp;lt;/code&amp;gt; option must be passed on the command line. In the following example, the identity &amp;lt;code&amp;gt;0x89&amp;lt;/code&amp;gt; is used. &lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 -i 0x89 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x089&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
Using the standard identity, the length of the identity is limited to a maximum hexadecimal value of &amp;lt;code&amp;gt;0x7FF&amp;lt;/code&amp;gt;. If a larger identity is needed, the &amp;lt;code&amp;gt;-e&amp;lt;/code&amp;gt; option can be passed, which allows an extended CAN frame with a maximum hexadecimal value of &amp;lt;code&amp;gt;0x1FFFFFFF&amp;lt;/code&amp;gt;. The following example shows a message with an extended frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 -e -i 0x8008 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clo}}&lt;br /&gt;
&amp;lt;0x00008008&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
====candump====&lt;br /&gt;
&amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; is used to receive messages over CAN. These messages can be output to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt; or directly to a file. &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; will run until it is killed, either with &amp;lt;code&amp;gt;Ctrl-C&amp;lt;/code&amp;gt; or a &amp;lt;code&amp;gt;kill&amp;lt;/code&amp;gt; command. The following command shows how to receive any message over CAN and output it to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt;. A command of &amp;lt;code&amp;gt;cansend can0 0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt; was given on a connected board.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | candump can0 | hostname=ipac9x25}}&lt;br /&gt;
interface = can0, family = 29, type = 3, proto = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
To receive any message over CAN and output it to a file, the following command is used. A command of &amp;lt;code&amp;gt;cansend can0 0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt; was given on a connected board.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | candump can0 -o /tmp/candump.txt | hostname=ipac9x25}}&lt;br /&gt;
interface = can0, family = 29, type = 3, proto = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{clos}}&lt;br /&gt;
Since &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; will continue running, a &amp;lt;code&amp;gt;Ctrl-C&amp;lt;/code&amp;gt; should be given before viewing the contents of the file. To view the file, &amp;lt;code&amp;gt;cat&amp;lt;/code&amp;gt; can be used.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | cat /tmp/candump.txt | hostname=ipac9x25}}&lt;br /&gt;
&amp;lt;0x001&amp;gt; [4] be 42 ef 9a&lt;br /&gt;
{{clos}}&lt;br /&gt;
&amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt; can also filter its output according to two values: filter and mask. The filter &amp;lt;code&amp;gt;[can_id]:[can_mask]&amp;lt;/code&amp;gt; matches when &amp;lt;code&amp;gt;[received_can_id] &amp;amp; [can_mask] == [can_id] &amp;amp; [mask]&amp;lt;/code&amp;gt;. For example, to only receive messages from the identity &amp;lt;code&amp;gt;0x088&amp;lt;/code&amp;gt;, use the following command.&lt;br /&gt;
{{cli|candump can0 --filter 0x088:0x7FF|hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
===C Programming CAN===&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:examples | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
CAN is a useful protocol for communicating quickly with sensors and other controllers. EMAC boards with CAN should be able to quickly integrate with existing CAN networks with little trouble.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* [[Getting_Started_with_the_EMAC_OE_SDK|Getting started with the EMAC SDK]]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* [[EMAC_HW|EMAC Hardware]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5250</id>
		<title>EMAC CAN Interface</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5250"/>
		<updated>2016-01-18T23:34:02Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| InProgress (01.18.2016-10:45-&amp;gt;KY+)|Klint Youngmeyer| project=OE 5.0,KY,InProgress }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=EMAC CAN Interface&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=&lt;br /&gt;
|description=This page describes how to use the CAN interface on EMAC boards.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
The CAN interface is a vehicle bus standard that allows communication between a controller and various sensors. EMAC produces several boards capable of communicating on a CAN bus. For more information about which products support the CAN bus, see the [[EMAC_HW|hardware]] page.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
CAN (controller area network) is a multi-master serial bus for communicating between &amp;quot;nodes&amp;quot; over a two-wire interface. The wires are generally a 120 ohm twisted pair. Each CAN node has the ability to communicate with every other node, one at a time. &lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:geninfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
The CAN bus is able to be accessed from the command line, or using a C API on EMAC products (with CAN support).&lt;br /&gt;
===CAN Bus Setup===&lt;br /&gt;
Before using the CAN interface on an EMAC device, two commands must be run. These commands could be scripted to be run at startup.&lt;br /&gt;
{{note|The settings in the first command may need to be changed according to the application in question.}}&lt;br /&gt;
&lt;br /&gt;
{{cli | ip link set can0 type can bitrate 125000 triple-sampling on | hostname=ipac9x25}}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
{{cli | ip link set can0 up | hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
===Command Line CAN===&lt;br /&gt;
The command line tools included with EMAC OE 5 are part of the &amp;lt;code&amp;gt;canutils&amp;lt;/code&amp;gt; package. The tools included in this package are:&lt;br /&gt;
* &amp;lt;code&amp;gt;canconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;canecho&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansequence&amp;lt;/code&amp;gt;&lt;br /&gt;
Of these five, the most easily used are &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;.&lt;br /&gt;
====cansend====&lt;br /&gt;
&amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, as the name implies, is used for sending CAN messages over the bus. Up to eight bytes at a time can be sent using &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, these bytes are formatted at a space separated list of hexadecimal octets e.g. &amp;quot;&amp;lt;code&amp;gt;0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt;.&amp;quot; The command for sending the previous hexadecimal digits on the &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; device is:&lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clop}}&amp;lt;0x001&amp;gt; [4] be 42 ef 9a {{closp}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; uses, by default, an identifier of &amp;lt;code&amp;gt;0x01&amp;lt;/code&amp;gt;. If an identifier other than default, the &amp;lt;code&amp;gt;-i 0x&amp;lt;IDENT&amp;gt;&amp;lt;/code&amp;gt; option must be passed on the command line. In the following example, the identity &amp;lt;code&amp;gt;0x89&amp;lt;/code&amp;gt; is used. &lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 -i 0x89 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clop}}&amp;lt;0x089&amp;gt; [4] be 42 ef 9a {{closp}}&lt;br /&gt;
&lt;br /&gt;
Using the standard identity, the length of the identity is limited to a maximum hexadecimal value of &amp;lt;code&amp;gt;0x7FF&amp;lt;/code&amp;gt;. If a larger identity is needed, the &amp;lt;code&amp;gt;-e&amp;lt;/code&amp;gt; option can be passed, which allows an extended CAN frame with a maximum hexadecimal value of &amp;lt;code&amp;gt;0x1FFFFFFF&amp;lt;/code&amp;gt;. The following example shows a message with an extended frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 -e -i 0x8008 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
The received message, on a board running &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;, will look like the following:&lt;br /&gt;
{{clop}}&amp;lt;0x00008008&amp;gt; [4] be 42 ef 9a{{closp}}&lt;br /&gt;
====candump====&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:examples | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
*&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5249</id>
		<title>EMAC CAN Interface</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5249"/>
		<updated>2016-01-18T21:31:07Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| InProgress (01.18.2016-10:45-&amp;gt;KY+)|Klint Youngmeyer| project=OE 5.0,KY,InProgress }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=EMAC CAN Interface&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=&lt;br /&gt;
|description=This page describes how to use the CAN interface on EMAC boards.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
The CAN interface is a vehicle bus standard that allows communication between a controller and various sensors. EMAC produces several boards capable of communicating on a CAN bus. For more information about which products support the CAN bus, see the [[EMAC_HW|hardware]] page.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
CAN (controller area network) is a multi-master serial bus for communicating between &amp;quot;nodes&amp;quot; over a two-wire interface. The wires are generally a 120 ohm twisted pair. Each CAN node has the ability to communicate with every other node, one at a time. &lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:geninfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
The CAN bus is able to be accessed from the command line, or using a C API on EMAC products (with CAN support).&lt;br /&gt;
===CAN Bus Setup===&lt;br /&gt;
Before using the CAN interface on an EMAC device, two commands must be run. These commands could be scripted to be run at startup.&lt;br /&gt;
{{note|The settings in the first command may need to be changed according to the application in question.}}&lt;br /&gt;
&lt;br /&gt;
{{cli | ip link set can0 type can bitrate 125000 triple-sampling on | hostname=ipac9x25}}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
{{cli | ip link set can0 up | hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
===Command Line CAN===&lt;br /&gt;
The command line tools included with EMAC OE 5 are part of the &amp;lt;code&amp;gt;canutils&amp;lt;/code&amp;gt; package. The tools included in this package are:&lt;br /&gt;
* &amp;lt;code&amp;gt;canconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;canecho&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansequence&amp;lt;/code&amp;gt;&lt;br /&gt;
Of these five, the most easily used are &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;.&lt;br /&gt;
====cansend====&lt;br /&gt;
&amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, as the name implies, is used for sending CAN messages over the bus. Up to eight bytes at a time can be sent using &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;, these bytes are formatted at a space separated list of hexadecimal octets e.g. &amp;quot;&amp;lt;code&amp;gt;0xBE 0x42 0xEF 0x9A&amp;lt;/code&amp;gt;.&amp;quot; The command for sending the previous hexadecimal digits on the &amp;lt;code&amp;gt;can0&amp;lt;/code&amp;gt; device is:&lt;br /&gt;
&lt;br /&gt;
{{cli | cansend can0 0xBE 0x42 0xEF 0x9A | hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
Identity&lt;br /&gt;
====candump====&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:examples | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
*&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5248</id>
		<title>EMAC CAN Interface</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5248"/>
		<updated>2016-01-18T20:03:03Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| InProgress (01.18.2016-10:45-&amp;gt;KY+)|Klint Youngmeyer| project=OE 5.0,KY,InProgress }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=EMAC CAN Interface&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=&lt;br /&gt;
|description=This page describes how to use the CAN interface on EMAC boards.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
The CAN interface is a vehicle bus standard that allows communication between a controller and various sensors. EMAC produces several boards capable of communicating on a CAN bus. For more information about which products support the CAN bus, see the [[EMAC_HW|hardware]] page.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
CAN (controller area network) is a multi-master serial bus for communicating between &amp;quot;nodes&amp;quot; over a two-wire interface. The wires are generally a 120 ohm twisted pair. Each CAN node has the ability to communicate with every other node, one at a time. &lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:geninfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
The CAN bus is able to be accessed from the command line, or using a C API on EMAC products (with CAN support).&lt;br /&gt;
===CAN Bus Setup===&lt;br /&gt;
Before using the CAN interface on an EMAC device, two commands must be run. These commands could be scripted to be run at startup.&lt;br /&gt;
{{note|The settings in the first command may need to be changed according to the application in question.}}&lt;br /&gt;
&lt;br /&gt;
{{cli | ip link set can0 type can bitrate 125000 triple-sampling on | hostname=ipac9x25}}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
{{cli | ip link set can0 up | hostname=ipac9x25}}&lt;br /&gt;
&lt;br /&gt;
===Command Line CAN===&lt;br /&gt;
The command line tools included with EMAC OE 5 are part of the &amp;lt;code&amp;gt;canutils&amp;lt;/code&amp;gt; package. The tools included in this package are:&lt;br /&gt;
* &amp;lt;code&amp;gt;canconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;canecho&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;cansequence&amp;lt;/code&amp;gt;&lt;br /&gt;
Of these five, the most used are &amp;lt;code&amp;gt;cansend&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;candump&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:examples | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
*&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5247</id>
		<title>EMAC CAN Interface</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=EMAC_CAN_Interface&amp;diff=5247"/>
		<updated>2016-01-18T16:45:20Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: Created page with &amp;quot;{{ subst:Pgtempl | initials={{subst::Templateimpl:getinitials}} | project=OE 5.0 | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boa...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| NotStarted (01.18.2016-10:45-&amp;gt;KY+)| Kyoungmeyer | project=OE 5.0,KY,NotStarted }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=EMAC CAN Interface&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=&lt;br /&gt;
|description=This page describes how to use the CAN interface on EMAC boards.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;background:#00FF00;color:#FF0000;font-size:300%&amp;quot;&amp;gt;'''''Put the page description text here.'''''&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:examples | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=EMAC CAN Interface | desc=This page describes how to use the CAN interface on EMAC boards. | project=OE 5.0 }}&lt;br /&gt;
*&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=System_Logging&amp;diff=5192</id>
		<title>System Logging</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=System_Logging&amp;diff=5192"/>
		<updated>2015-11-18T21:11:40Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| FinalDraft (04.13.2015-14:44-&amp;gt;BS+)(11.10.2015-18:00-&amp;gt;MD+)(11.11.2015-10:30-&amp;gt;MD+)(11.17.2015-18:10-&amp;gt;MD+);(11.18.2015-12:55-&amp;gt;MD+)(11.18.2015-14:50-&amp;gt;MD+)(11.18.2015-15:10-&amp;gt;KY+)|Mike Dean| project=OE 5.0,MD,FinalDraft }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=System Logging&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=syslogd,syslog-ng,busybox&lt;br /&gt;
|description=The page describes how to work with syslog.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
This document provides an overview of how system logging works in Linux, and provides guidance on how to work with and configure system logging so that it meets your needs.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=MD | title=System Logging | desc=The page describes how to system log. | project=OE 5.0 }}&lt;br /&gt;
System Logging services exist on Linux systems to provide a central logging facility.  This central logging service can store logged messages in files on the local machine, can forward the log messages to a remote machine for remote storage and display, and can output the log messages as they arrive to a terminal.  &lt;br /&gt;
&lt;br /&gt;
The syslog facility is standardized by POSIX and, as a result, there is a great deal of support for the syslog facility.  There are APIs for logging to the syslog facility from C, C++, Python, Java, PHP, Perl, Bash, the commandline, and many other languages.  Using the commandline tool, it is even possible to write to the syslog facility from the commandline.&lt;br /&gt;
&lt;br /&gt;
==== Facilities ====&lt;br /&gt;
&lt;br /&gt;
In syslog terminology, a facility is a category for log messages.  There are generally at least seven standard syslog facilities on any Linux syslog system.  The following list shows the standard seven, as well as some which are rarely used anymore (especially in embedded systems).  The name of the facility is followed, in parenthesis, by the integer facility code associated with the facility, which is then followed by a description of the facility.  The ones you should not expect to find on an embedded system are demarcated with an asterisk (*):&lt;br /&gt;
&lt;br /&gt;
;kern(0)&lt;br /&gt;
: Kernel messages&lt;br /&gt;
;user(1)&lt;br /&gt;
: User Level Messages&lt;br /&gt;
;mail(2)*&lt;br /&gt;
: Mail System Messages&lt;br /&gt;
;daemon(3)&lt;br /&gt;
: System Daemon Messages&lt;br /&gt;
;auth(4)&lt;br /&gt;
: Security/Authentication Messages&lt;br /&gt;
;syslog(5)&lt;br /&gt;
: Internally Generated Syslog Messages&lt;br /&gt;
;lpr(6)*&lt;br /&gt;
: Line Printer Subsystem Messages&lt;br /&gt;
;news(7)*&lt;br /&gt;
: Network News Subsystem Messages&lt;br /&gt;
;uucp(8)*&lt;br /&gt;
: UUCP Subsystem Messages&lt;br /&gt;
;cron(15)&lt;br /&gt;
: Cron Scheduling Daemon Messages&lt;br /&gt;
;local(16-23)&lt;br /&gt;
: Locally Defined Usage, Messages&lt;br /&gt;
&lt;br /&gt;
==== Severity ====&lt;br /&gt;
&lt;br /&gt;
Each of these facilities accepts messages which will have an associated severity level.  The severity level is important for filtering messages.  The following list shows the eight available severity levels:&lt;br /&gt;
&lt;br /&gt;
;emerg(0)&lt;br /&gt;
: Emergency - System is now unusable&lt;br /&gt;
;alert(1)&lt;br /&gt;
: Alert - Immediate Attention is Required&lt;br /&gt;
;crit(2)&lt;br /&gt;
: Critical - The System is in a Critical Condition, which may be caused by a failure in the primary appliction.&lt;br /&gt;
;err(3)&lt;br /&gt;
: Error - An Error has occurred.&lt;br /&gt;
;warning(4)&lt;br /&gt;
: Warning - An unusual, but not erroneous, event has occurred.  For example: &amp;quot;Warning: Could not check for updates.&amp;quot;&lt;br /&gt;
;notice(5)&lt;br /&gt;
: Notice - Uncommon but generally expected messages.  For example: &amp;quot;Network Interface eth0 received IP address of 192.168.0.100 from DHCP server.&amp;quot;&lt;br /&gt;
;info(6)&lt;br /&gt;
: Informational - Common, expected events generate these messages.  For example: &amp;quot;Application XYZ started successfully.&amp;quot;&lt;br /&gt;
;debug(7)&lt;br /&gt;
: Debug - Debugging messages belong at this level.&lt;br /&gt;
&lt;br /&gt;
==== Storage ====&lt;br /&gt;
&lt;br /&gt;
By default, the log messages on an EMAC OE Linux machine are stored in a local ramdisk.  This type of storage prevents excessive wear of the flash, and works when all of the flash partitions are mounted read-only.  However, by storing the messages in a ramdisk, all messages in the ramdisk will be lost as soon as the machine resets, powers off, or reboots for any reason.&lt;br /&gt;
&lt;br /&gt;
===== Alternate Logging Locations =====&lt;br /&gt;
&lt;br /&gt;
The syslog server can be configured to log to alternate locations.  This is useful for configuring the server to log to persistent storage, such as a writable partition on the local flash or a partition on an SD card.  The alternate logging locations can even be remote machines.&lt;br /&gt;
&lt;br /&gt;
===== Remote Logging =====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;/var/log&amp;lt;/code&amp;gt; directory is the standard location for holding local log messages.  This directory usually contains either one file per facility or one directory per facility.  If a facility has a directory, it may contain different files which all belong to the facility.  The system logging facility directs messages to these files based on rules set in its configuration.  The configured rules use the facility level and the severity level to direct the syslogger's filters regarding to which file to send any particular message.  There are several different implementations of the syslogger facility, each with its own configuration mechanisms and level of flexibility.&lt;br /&gt;
&lt;br /&gt;
The system logger is also able to send messages to a remote syslog server over a network.  The remote syslog server will be able to filter the messages using all of the same criteria as above, but also by source.  A remote syslog server configuration can be very useful for remotely debugging deployed machines.  While an embedded machine stores its logs on a ramdisk, the remote machine may store them to a traditional hard disk or SSD, allowing them to be preserved through power cycles.&lt;br /&gt;
&lt;br /&gt;
The remote syslog server can be on any normal server, it can be on a developer's desktop, or it can be on another embedded machine.  Sending debug messages to a central syslog server ensures the debug messages will be available even if the machine of interest freezes or resets.  The use of a remote syslog server can also assist with looking for trends and outliers among a group of deployed machines since the log messages for the entire group of machines can be located in one place.&lt;br /&gt;
&lt;br /&gt;
===== Log Rotation =====&lt;br /&gt;
&lt;br /&gt;
Syslog servers incorporate a feature called log rotation.  Log rotation is a process which prevents log files from growing beyond a certain size while preserving log messages for later reference.  The syslog server (or logrotate system) can be configured with a maximum file size and a maximum number of rotated logs to keep.  When the maximum file size is reached, the file will be &amp;quot;rotated.&amp;quot;  When the maximum number of logs to keep is exceeded, the oldest one will be deleted.  There is more information on how this process works below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=MD | title=System Logging | desc=The page describes how to system log. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
====Your Daemons====&lt;br /&gt;
&lt;br /&gt;
When developing a software daemon, syslog is a very useful tool for monitoring and debugging your software.  The syslog daemon is highly configurable, allowing filters to be altered to suit the current needs of a developer without recompiling software.  This capability allows developers to deploy software which sends ample debugging messages to the syslog server without fear of overwhelming the system with debug messages.  Using the eight &amp;lt;code&amp;gt;local&amp;lt;/code&amp;gt; facilities syslog recognizes, these debug messages can be categorized by developers to allow them to selectively choose the amount of log information they store from each of up to eight different subsystems.  This is extremely useful when a system in the field is experiencing intermittent issues.  By enabling maximum debugging output for only the subsystem responsible for the feature which is misbehaving, the developers have the greatest chance of seeing the messages they need to diagnose the source of the problem without overwhelming the system (or the storage) with messages.  If eight facilities is not enough, the developers can always repurpose dedicated facilities which aren't in use by their intended systems.  For instance, the line printing facility is rarely used on an embedded system, and may be safely repurposed by developers.&lt;br /&gt;
&lt;br /&gt;
====Web Development====&lt;br /&gt;
&lt;br /&gt;
When providing a web interface for an embedded system, the syslog daemon is often the only way to debug a variety of issues with the web server.  When links don't work, certain browsers have issues, pages load slowly, or any of a myriad of other issues crop up, the logs are generally the first place people turn for answers.  This is just as true on embedded systems as it is on any large scale web server or server farm.  On embedded systems, however, the configuration for the logging system may need to be altered due to the volatile nature of the logs in the default configuration.  This document provides information on how to solve the issues which may be encountered as a result of this.&lt;br /&gt;
&lt;br /&gt;
====Machine Startup====&lt;br /&gt;
&lt;br /&gt;
When configuring a machine to start up all the necessary services in the correct sequential order, when the machine is powered on, the syslog server is very helpful in performing the following tasks:&lt;br /&gt;
* Ensuring that process X really did start before process Y.&lt;br /&gt;
* Checking to see if any errors or warnings were reported by processes starting up.&lt;br /&gt;
* Ensuring that processes really did start, at all.&lt;br /&gt;
* Checking to see what configuration was chosen by a process which is capable of choosing its configuration dynamically.&lt;br /&gt;
* Checking the messages reported by device drivers as they start up.&lt;br /&gt;
* Determining the IP address used by a system which gets its network configuration via DHCP.&lt;br /&gt;
Startup scripts log their activity to the syslog daemon.  Any daemon process launched by these startup scripts should also log startup messages to indicate that they're starting, how they're configured, and that they've finished the startup sequence and are now running.  The system logs enable the engineer to assure that a machine has started as intended.&lt;br /&gt;
&lt;br /&gt;
====Malfunctioning Systems====&lt;br /&gt;
&lt;br /&gt;
When a proven system is malfunctioning, the system logs can be essential in determining the cause of the malfunction.  In cases such as this, the system logs are helpful for:&lt;br /&gt;
* Looking to see who logged into a machine, and when.&lt;br /&gt;
* Looking for signs of attacks directed at the machine.&lt;br /&gt;
* Looking for signs of failing hardware.&lt;br /&gt;
* Looking for error and warning messages coming from system processes, daemons, and/or your custom application.&lt;br /&gt;
Without these logs, it may be nearly impossible to diagnose these malfunctions.&lt;br /&gt;
&lt;br /&gt;
====In Brief====&lt;br /&gt;
&lt;br /&gt;
This guide provides enough background information to enable you to handle any of the situations described above.  Using the information contain herein, you will be able to approach any of the above listed problems with the tools you need to solve the problems you are facing.&lt;br /&gt;
&lt;br /&gt;
{{note | To make best use of the log files, a working knowledge of &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; is highly beneficial.  Experience with crafting and using regular expressions with &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; prior to writing system logging messages in your application and init scripts can make the diagnosis process simpler, since a little forethought into a syntax for the messages can make filtering the messages through &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; much easier to accomplish correctly.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=MD | title=System Logging | desc=The page describes how to system log. | project=OE 5.0 }}&lt;br /&gt;
EMAC OE Linux 5.0 uses Busybox's syslog daemon, &amp;lt;code&amp;gt;syslogd&amp;lt;/code&amp;gt;, by default.  However, the &amp;lt;code&amp;gt;syslog-ng&amp;lt;/code&amp;gt; package can be installed to provide a much more capable system logging daemon, when needed.&lt;br /&gt;
&lt;br /&gt;
===Default Syslog Daemon===&lt;br /&gt;
&lt;br /&gt;
The Busybox syslog daemon is used by default.&lt;br /&gt;
&lt;br /&gt;
====About====&lt;br /&gt;
&lt;br /&gt;
The standard syslog daemon supports the following configuration capabilities:&lt;br /&gt;
* Maximum size limit for log files.&lt;br /&gt;
* Maximum number of log files to keep, when rotated.&lt;br /&gt;
* Minimum priority level for messages to log.&lt;br /&gt;
* Duplicate dropping (not usually recommended).&lt;br /&gt;
* Log to remote and local files simultaneously, just to local files, or to a memory buffer which needs to be read by a special utility.&lt;br /&gt;
&lt;br /&gt;
====Working With====&lt;br /&gt;
&lt;br /&gt;
The Busybox syslog daemon is configured, by default, to log to files in the RAMDISK mounted on &amp;lt;code&amp;gt;/var/log/&amp;lt;/code&amp;gt;.  The files contained in this directory will be capped in size and rotated according to the configuration of the syslog daemon.&lt;br /&gt;
&lt;br /&gt;
The Busybox syslog daemon is configured with the file, &amp;lt;code&amp;gt;/etc/syslog-startup.conf&amp;lt;/code&amp;gt;.  This file is used for backwards compatibility, because the Busybox syslog daemon recently began reading the &amp;lt;code&amp;gt;/etc/syslog.conf&amp;lt;/code&amp;gt; file.  The &amp;lt;code&amp;gt;/etc/syslog-startup.conf&amp;lt;/code&amp;gt; comes from OE rather than from Busybox.&lt;br /&gt;
&lt;br /&gt;
The standard &amp;lt;code&amp;gt;/etc/syslog-startup.conf&amp;lt;/code&amp;gt; configuration is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=bash&amp;gt;&lt;br /&gt;
# This configuration file is used by the busybox syslog init script,&lt;br /&gt;
# /etc/init.d/syslog[.busybox] to set syslog configuration at start time.&lt;br /&gt;
&lt;br /&gt;
DESTINATION=file                # log destinations (buffer file remote)&lt;br /&gt;
LOGFILE=/var/log/messages       # where to log (file)&lt;br /&gt;
REMOTE=loghost:514              # where to log (syslog remote)&lt;br /&gt;
REDUCE=no                       # reduce-size logging&lt;br /&gt;
DROPDUPLICATES=no               # whether to drop duplicate log entries&lt;br /&gt;
#ROTATESIZE=0                   # rotate log if grown beyond X [kByte]&lt;br /&gt;
#ROTATEGENS=3                   # keep X generations of rotated logs&lt;br /&gt;
BUFFERSIZE=64                   # size of circular buffer [kByte]&lt;br /&gt;
FOREGROUND=no                   # run in foreground (don't use!)&lt;br /&gt;
#LOGLEVEL=5                     # local log level (between 1 and 8)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;DESTINATION&lt;br /&gt;
: This configures where the syslog messages will be sent.  &lt;br /&gt;
:;buffer&lt;br /&gt;
:: The &amp;lt;code&amp;gt;buffer&amp;lt;/code&amp;gt; option will cause the messages to be stored in an internal circular buffer, in RAM.  This buffer must be read with &amp;lt;code&amp;gt;logread&amp;lt;/code&amp;gt;.&lt;br /&gt;
:;file&lt;br /&gt;
:: The &amp;lt;code&amp;gt;file&amp;lt;/code&amp;gt; option will cause the messages to be stored in a file in the location specified by the &amp;lt;code&amp;gt;LOGFILE&amp;lt;/code&amp;gt; parameter, listed below.&lt;br /&gt;
:;remote&lt;br /&gt;
:: The &amp;lt;code&amp;gt;remote&amp;lt;/code&amp;gt; option will cause syslog messages to be sent to a remote syslog daemon.&lt;br /&gt;
;LOGFILE&lt;br /&gt;
: The &amp;lt;code&amp;gt;LOGFILE&amp;lt;/code&amp;gt; parameter specifies the location of the logfile which should be used with the &amp;lt;code&amp;gt;file&amp;lt;/code&amp;gt; destination.&lt;br /&gt;
;REMOTE&lt;br /&gt;
: The &amp;lt;code&amp;gt;REMOTE&amp;lt;/code&amp;gt; parameter specifies the host and port to which to send remote log messages.  The two part format for this variable provides the destination host followed by the destination port number, with a colon as the delimiter between the two.  The destination may be specified as a hostname, or as an IP address.  The destination port number should be the port on which the remote syslog server listens.&lt;br /&gt;
&lt;br /&gt;
{{note | If the destination is specified as a hostname, it is best to create an entry in &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt; for the hostname so that it will resolve to an IP address even if there is a problem with the DNS servers.}}&lt;br /&gt;
&lt;br /&gt;
;REDUCE&lt;br /&gt;
: The &amp;lt;code&amp;gt;REDUCE&amp;lt;/code&amp;gt; option takes a &amp;lt;code&amp;gt;yes&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;no&amp;lt;/code&amp;gt; argument.  When set to &amp;lt;code&amp;gt;yes&amp;lt;/code&amp;gt;, the syslog server will neglect to log the hostname, facility, and severity level with each log message.  This is only recommended for severely resource constrained systems, since the facility and severity level are often used for filtering messages through &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt;.&lt;br /&gt;
;DROPDUPLICATES&lt;br /&gt;
: The &amp;lt;code&amp;gt;DROPDUPLICATES&amp;lt;/code&amp;gt; option takes a &amp;lt;code&amp;gt;yes&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;no&amp;lt;/code&amp;gt; argument.  When set to &amp;lt;code&amp;gt;yes&amp;lt;/code&amp;gt;, the syslog server will ignore messages which duplicate the preceeding message.  This can be useful when an errant process keeps sending the same message over and over again, and swamps out the other messages as a result (due to the maximum size setting for the log files).  It is best to keep this option off unless it is absolutely needed for a situation like the one just described, because having it turned on can cause other problems to be hidden (generally leading to frustration and/or embarrassment).&lt;br /&gt;
;ROTATESIZE&lt;br /&gt;
: The &amp;lt;code&amp;gt;ROTATESIZE&amp;lt;/code&amp;gt; option takes a numeric argument.  This argument is the maximum desired size for a log file, specified in kibibytes.  When a log file has grown to the point where it exceeds this high water mark, it will be rotated.&lt;br /&gt;
;ROTATEGENS&lt;br /&gt;
: The &amp;lt;code&amp;gt;ROTATEGENS&amp;lt;/code&amp;gt; option takes a numeric argument.  This argument specifies the number of older generations of log files to keep in existence.  By generations, it means the number of log files which have already been renamed with a sequencing number as a postfix.  See the note below for more information.&lt;br /&gt;
{{note | Logfile rotation is a process which renames log files sequentially, to preserve older log messages while keeping incoming messages writing to the same location.  For instance, for the &amp;lt;code&amp;gt;/var/log/messages&amp;lt;/code&amp;gt; file, this might look like:&amp;lt;code&amp;gt;&lt;br /&gt;
messages -&amp;gt; messages.0&lt;br /&gt;
+messages&amp;lt;/code&amp;gt;&lt;br /&gt;
Or, if one were to perform this rotation manually at a terminal, it may look like:&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | pwd=/var/log |mv messages messages.0}}&lt;br /&gt;
{{clio | pwd=/var/log |touch messages}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
If there already is a &amp;lt;code&amp;gt;messages.0&amp;lt;/code&amp;gt; file, and the number of generations to keep is set to 2, then a manual version of the rotation might look something like this:&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | pwd=/var/log |rm -f messages.2}}&lt;br /&gt;
{{clio | pwd=/var/log |mv messages.1 messages.2}}&lt;br /&gt;
{{clio | pwd=/var/log |mv messages.0 messages.1}}&lt;br /&gt;
{{clio | pwd=/var/log |mv messages messages.0}}&lt;br /&gt;
{{clio | pwd=/var/log |touch messages}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
;BUFFERSIZE&lt;br /&gt;
: The &amp;lt;code&amp;gt;BUFFERSIZE&amp;lt;/code&amp;gt; option takes a numeric argument.  This argument specifies the size of the internal circular buffer to use for holding log messages in an internal RAM buffer.  This argument only matters when the &amp;lt;code&amp;gt;DESTINATION&amp;lt;/code&amp;gt; is set to &amp;lt;code&amp;gt;buffer&amp;lt;/code&amp;gt;.  The size is specified in kibibytes.&lt;br /&gt;
;FOREGROUND&lt;br /&gt;
: The &amp;lt;code&amp;gt;FOREGROUND&amp;lt;/code&amp;gt; option takes a &amp;lt;code&amp;gt;yes&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;no&amp;lt;/code&amp;gt; argument.  This argument specifies whether the &amp;lt;code&amp;gt;syslogd&amp;lt;/code&amp;gt; process should run in the foreground or as a daemon.  It is strongly recommended for this option to always be set to, &amp;lt;code&amp;gt;no&amp;lt;/code&amp;gt;, to run &amp;lt;code&amp;gt;syslogd&amp;lt;/code&amp;gt; as a daemon.  This option mostly exists for the developers of Busybox to debug their &amp;lt;code&amp;gt;syslogd&amp;lt;/code&amp;gt; implementation.&lt;br /&gt;
;LOGLEVEL&lt;br /&gt;
: The &amp;lt;code&amp;gt;LOGLEVEL&amp;lt;/code&amp;gt; option takes a numeric argument.  This argument specifies the highest numbered severity level which should be logged (see [[System_Logging#Severity | severity]] above).  By default, this is set such that messages with a severity of '''notice''', or more severe, will be logged.&lt;br /&gt;
&lt;br /&gt;
===Optional &amp;lt;code&amp;gt;syslog-ng&amp;lt;/code&amp;gt; With &amp;lt;code&amp;gt;logrotate&amp;lt;/code&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The optional &amp;lt;code&amp;gt;syslog-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;logrotate&amp;lt;/code&amp;gt; option provides everything that's provided by the Busybox syslog daemon, plus:&lt;br /&gt;
* Sophisticated filters for directing log traffic.&lt;br /&gt;
* The ability to act as a central syslog server which receives log messages from remote syslog machines.&lt;br /&gt;
* Enhanced control over the destination(s) for log messages, allowing (for example) messages to be logged to a local RAMDISK, a local SD card (if available), and to a remote syslog server (if available) simultaneously.&lt;br /&gt;
* The ability to configure logrotate to automatically e-mail log files when they're rotated.&lt;br /&gt;
&lt;br /&gt;
* Same syslog server software is readily available for Linux desktops and servers.&lt;br /&gt;
As can be expected, the potential drawback of &amp;lt;code&amp;gt;syslog-ng&amp;lt;/code&amp;gt; is the steeper learning curve required to make use of its more sophisticated features.  However, those already familiar with &amp;lt;code&amp;gt;syslog-ng&amp;lt;/code&amp;gt; will be able to benefit from its extra sophistication immediately.&lt;br /&gt;
&lt;br /&gt;
The official manual page for &amp;lt;code&amp;gt;syslog-ng&amp;lt;/code&amp;gt; has more details: http://www.syslog.org/syslog-ng/v1/&lt;br /&gt;
&lt;br /&gt;
Please contact EMAC for details on how to install &amp;lt;code&amp;gt;syslog-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;logrotate&amp;lt;/code&amp;gt; if you have trouble finding and installing them with &amp;lt;code&amp;gt;opkg&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:examples | initials=MD | title=System Logging | desc=The page describes how to system log. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
===Evaluating Log Messages===&lt;br /&gt;
&lt;br /&gt;
Log messages are stored in &amp;lt;code&amp;gt;/var/log/&amp;lt;/code&amp;gt; by default.  This directory contains at least one log file, &amp;lt;code&amp;gt;messages&amp;lt;/code&amp;gt;.  There are usually (at least) a few other small log files which where generated by the kernel before &amp;lt;code&amp;gt;syslogd&amp;lt;/code&amp;gt; started.  When &amp;lt;code&amp;gt;syslog-ng&amp;lt;/code&amp;gt; is used, you may have several log files which are continually growing, depending on how you configured it.&lt;br /&gt;
&lt;br /&gt;
====Showing All the Messages====&lt;br /&gt;
&lt;br /&gt;
When the log is rotated, a sequence of additional files will be generated from it, such as &amp;lt;code&amp;gt;messages.0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;messages.1&amp;lt;/code&amp;gt;, etc.  The highest numbered file is the oldest.  If you wish to look for messages through as much of the log history as possible, you will need to look through all of the available log files.  Fortunately, this is simple.  Say you have two rotated versions of the &amp;lt;code&amp;gt;messages&amp;lt;/code&amp;gt; file, &amp;lt;code&amp;gt;messages.0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;messages.1&amp;lt;/code&amp;gt;.  You can output all of the messages from these three files, in order, with the following command:&lt;br /&gt;
&lt;br /&gt;
{{clop}}&lt;br /&gt;
{{cliop | pwd=/var/log |cat messages.1 messages.0 messages}}&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.notice kernel: klogd started: BusyBox v1.23.1 (2015-07-02 12:53:54 CDT)&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.notice kernel: Linux version 3.10.0-emac-standard+23f12b107c (developer@OEBuilder) (gcc &lt;br /&gt;
ersion 4.9.2 (GCC) ) #1 Tue Jul 21 21:46:40 CDT 2015&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.warn kernel: CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.warn kernel: CPU: VIVT data cache, VIVT instruction cache&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.warn kernel: Memory policy: ECC disabled, Data cache writeback&lt;br /&gt;
''etc.''&lt;br /&gt;
{{cliop | pwd=/var/log |}}&lt;br /&gt;
{{closp}}&lt;br /&gt;
&lt;br /&gt;
You can combine this with &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; to see only what you're interested in:&lt;br /&gt;
&lt;br /&gt;
{{clop}}&lt;br /&gt;
{{cliop | pwd=/var/log |cat messages.1 messages.0 messages {{!}} grep authpriv}}&lt;br /&gt;
Nov 17 19:01:11 ipac9x25 authpriv.notice login[1046]: ROOT LOGIN  on '/dev/ttyS5'&lt;br /&gt;
{{cliop | pwd=/var/log |}}&lt;br /&gt;
{{closp}}&lt;br /&gt;
&lt;br /&gt;
Here, we can see that someone logged into the machine as the &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; user on November 17 at 7:01pm, on the serial console (&amp;lt;code&amp;gt;/dev/ttyS5&amp;lt;/code&amp;gt;).  This is the only login on the machine since it booted.  Had there been other logins, they would also have been shown.&lt;br /&gt;
&lt;br /&gt;
Say you want to see a certain type of message, but there are a lot of results.  You can add &amp;lt;code&amp;gt;less&amp;lt;/code&amp;gt; to make it easier to read through them:&lt;br /&gt;
&lt;br /&gt;
{{clop}}&lt;br /&gt;
{{cliop | pwd=/var/log |cat messages.1 messages.0 messages {{!}} grep user.notice {{!}} less}}&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.notice kernel: klogd started: BusyBox v1.23.1 (2015-07-02 12:53:54 CDT)&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.notice kernel: Linux version 3.10.0-emac-standard+23f12b107c (developer@OEBuilder) (gcc version 4.9.2 (GCC) ) #1 Tue Jul 21 21:46:40 CDT 2015&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.warn kernel: CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.warn kernel: CPU: VIVT data cache, VIVT instruction cache&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.warn kernel: Memory policy: ECC disabled, Data cache writeback&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.warn kernel: Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.warn kernel: Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.notice kernel: Kernel command line: console=ttyS5,115200 root=/dev/mmcblk0p1 rootfstype=ext4 &lt;br /&gt;
w rootwait&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.notice kernel: Memory: 124820k/124820k available, 6252k reserved, 0K highmem&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.notice kernel: klogd started: BusyBox v1.23.1 (2015-07-02 12:53:54 CDT)&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.notice kernel: Linux version 3.10.0-emac-standard+23f12b107c (developer@OEBuilder) (gcc &lt;br /&gt;
ersion 4.9.2 (GCC) ) #1 Tue Jul 21 21:46:40 CDT 2015&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.notice kernel: Kernel command line: console=ttyS5,115200 root=/dev/mmcblk0p1 rootfstype=ext4 rw rootwait&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.notice kernel: Memory: 124820k/124820k available, 6252k reserved, 0K highmem&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.notice kernel: Virtual kernel memory layout:&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.notice kernel:     vector  : 0xffff0000 - 0xffff1000   (   4 kB)&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.notice kernel:     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.notice kernel:     vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)&lt;br /&gt;
Nov 17 19:00:21 ipac9x25 user.notice kernel:     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
{{closp}}&lt;br /&gt;
&lt;br /&gt;
====Helper Functions====&lt;br /&gt;
&lt;br /&gt;
When it gets to the point where there are several rotated log files, the command to cat them all can be a lot to type.  Let's create a couple of helper functions to make our lives easier.  We can enter these at the shell, as shown here.  To save them permanently, put them in your &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;/etc/profile&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
{{clop}}&lt;br /&gt;
{{cliop | pwd=/var/log |&amp;lt;nowiki&amp;gt;function genseq() { logfn=$1; max=$2; for i in $(seq $max -1 0); do printf &amp;quot;${logfn}.${i} &amp;quot;; done;&amp;lt;/nowiki&amp;gt;}}&amp;lt;nowiki&amp;gt;&lt;br /&gt;
printf &amp;quot;$logfn\n&amp;quot;; }&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
{{closp}}&lt;br /&gt;
&lt;br /&gt;
This function generates a sequence of log file names for us to use, like this:&lt;br /&gt;
&lt;br /&gt;
{{clop}}&lt;br /&gt;
{{cliop | pwd=/var/log |genseq messages 5}}&lt;br /&gt;
messages.5 messages.4 messages.3 messages.2 messages.1 messages.0 messages&lt;br /&gt;
{{cliop | pwd=/var/log |}}&lt;br /&gt;
{{closp}}&lt;br /&gt;
&lt;br /&gt;
While we could use this list directly, it's still a bit awkward to type:&lt;br /&gt;
&lt;br /&gt;
{{cli | pwd=/var/log |cat $(genseq messages 5)}}&lt;br /&gt;
&lt;br /&gt;
Especially when piping to &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; and maybe &amp;lt;code&amp;gt;less&amp;lt;/code&amp;gt;, so let's make a helper function:&lt;br /&gt;
&lt;br /&gt;
{{cli | pwd=/var/log |&amp;lt;nowiki&amp;gt;function catseq() { cat $(genseq $1 $2); }&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Okay, now we can just type:&lt;br /&gt;
&lt;br /&gt;
{{cli | pwd=/var/log |catseq messages 5}}&lt;br /&gt;
&lt;br /&gt;
Much easier to type.  We'll use this function from here on.&lt;br /&gt;
&lt;br /&gt;
====Sifting Through Messages====&lt;br /&gt;
&lt;br /&gt;
Here are a few ways you may wish to sift through messages.&lt;br /&gt;
&lt;br /&gt;
=====Checking for Errors, Only=====&lt;br /&gt;
&lt;br /&gt;
If you only want to look for error messages, you might type something like:&lt;br /&gt;
&lt;br /&gt;
{{cli | pwd=/var/log |catseq messages 3 {{!}} grep '\.err '}}&lt;br /&gt;
&lt;br /&gt;
The regular expression used here is to avoid false positives.  Note the trailing space in the regular expression.&lt;br /&gt;
&lt;br /&gt;
=====Checking for Errors and Worse=====&lt;br /&gt;
&lt;br /&gt;
If you want to scan for messages which are of these categories (only):&lt;br /&gt;
* Emergency&lt;br /&gt;
* Alert&lt;br /&gt;
* Critical&lt;br /&gt;
* Error&lt;br /&gt;
You might do the following:&lt;br /&gt;
&lt;br /&gt;
{{cli | pwd=/var/log |catseq messages 3 {{!}} egrep '\.(emerg{{!}}alert{{!}}crit{{!}}err) '}}&lt;br /&gt;
&lt;br /&gt;
Note the use of &amp;lt;code&amp;gt;egrep&amp;lt;/code&amp;gt; here; it is required for this extended regular expression to work.&lt;br /&gt;
&lt;br /&gt;
=====Looking for Certain &amp;lt;code&amp;gt;local&amp;lt;/code&amp;gt; Facility Messages=====&lt;br /&gt;
&lt;br /&gt;
Perhaps you're making use of several of the &amp;lt;code&amp;gt;local&amp;lt;/code&amp;gt; log facilities, and you wish to see all of the messages from just a few of them.  In this example, we'll filter out all but two local facilities: &amp;lt;code&amp;gt;local3&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;local5&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cli | pwd=/var/log |catseq messages 3 {{!}} grep ' local[35]\.'}}&lt;br /&gt;
&lt;br /&gt;
Note the leading space in the regular expression.  The 3 and 5 are listed in between square brackets.  You can list numbers you're interested in individually and/or use ranges.  If you wanted to list all &amp;lt;code&amp;gt;local&amp;lt;/code&amp;gt; facility messages except for &amp;lt;code&amp;gt;local4&amp;lt;/code&amp;gt;, you could write:&lt;br /&gt;
&lt;br /&gt;
{{cli | pwd=/var/log |catseq messages 3 {{!}} grep ' local[0-35-7]\.}}&lt;br /&gt;
&lt;br /&gt;
=====Looking for &amp;lt;code&amp;gt;local&amp;lt;/code&amp;gt; Facility Messages of a Certain Priority=====&lt;br /&gt;
&lt;br /&gt;
While you're debugging your application, you find that you need to see all events from certain &amp;lt;code&amp;gt;local&amp;lt;/code&amp;gt; facilities which are of a subset of priority levels, because you're sure you'll figure out what's going wrong if you can get these specific messages.  So, you ignore the mumblings of your coworkers about, &amp;quot;famous last words,&amp;quot; and such, and you type:&lt;br /&gt;
&lt;br /&gt;
{{cli | pwd=/var/log |catseq messages 3 {{!}} egrep ' local([0-246]\.(err{{!}}notice{{!}}warn){{!}}[357]\.(emerg{{!}}alert)) '}}&lt;br /&gt;
&lt;br /&gt;
By cleverly crafting this complex regular expression, you were able to filter out exactly the right messages you needed to see the sequence of events leading up to the catastrophic failure you were experiencing and save the day.  Your coworkers cheer and hoist you on their shoulders, singing your praises.  &lt;br /&gt;
&lt;br /&gt;
Okay, so in reality, nobody notices and you go to lunch happily, knowing that you're not going to get yelled at for a major fault.  You treat yourself to some dessert (because, hey, why should Fido be the only one who gets a treat for doing something right?), and everyone's happy.&lt;br /&gt;
&lt;br /&gt;
Of course, you wouldn't have been able to properly diagnose what went wrong without having generated good log messages from your software in the first place.  The next section shows you how to generate the messages; you'll have to figure out how to make them good messages on your own, though.&lt;br /&gt;
&lt;br /&gt;
===Writing to Syslog from Programs and Scripts===&lt;br /&gt;
As mentioned previously, many languages support writing to the Linux system logging daemon.  There are many handy libraries and functions which provide this capability.  Some of the most commonly used ones are shown here.&lt;br /&gt;
&lt;br /&gt;
====Shell Utility: &amp;lt;code&amp;gt;logger&amp;lt;/code&amp;gt;====&lt;br /&gt;
Whether you are writing a shell script, or simply wishing to enter something into the system logs from the commandline, the &amp;lt;code&amp;gt;logger&amp;lt;/code&amp;gt; utility will give you the capability you need.  This simple command takes a few options, but it can also be run with the only argument being the message to log.&lt;br /&gt;
&lt;br /&gt;
=====Arguments to &amp;lt;code&amp;gt;logger&amp;lt;/code&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
The following options are available for &amp;lt;code&amp;gt;logger&amp;lt;/code&amp;gt;:&lt;br /&gt;
;&amp;lt;code&amp;gt;-t&amp;lt;/code&amp;gt; ''TAG''&lt;br /&gt;
: Takes a ''TAG'' as an argument.  This option specifies a tag to use for labeling the message.  Tags are useful for sorting through logs later on.&lt;br /&gt;
;&amp;lt;code&amp;gt;-p&amp;lt;/code&amp;gt; ''Priority''&lt;br /&gt;
: Takes a ''Priority'' as an argument.  The priority may be specified as just a numeric priority level, identifying the severity of the message, or it can be specified as a tuple containing a facility name and a priority level, delimited by a dot (&amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt;).  If no facility is specified, the facility defaults to, &amp;lt;code&amp;gt;user&amp;lt;/code&amp;gt;.  The severity levels are specified in [[System_Logging#Severity | severity]] above.  The facility names are specified in [[System_Logging#Facilities | facilities]] above.&lt;br /&gt;
;&amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;&lt;br /&gt;
: This option sets a boolean which enables logging messages to &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt; as well as to the system logger.  This is especially useful in interactive shell scripts, since it allows the developer to use one function to output a message to the screen and to the system logs simultaneously.&lt;br /&gt;
&lt;br /&gt;
=====Examples of Using &amp;lt;code&amp;gt;logger&amp;lt;/code&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
To send a message to the system log as simply as possible:&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio |logger &amp;quot;Default settings message example&amp;quot;}}&lt;br /&gt;
{{clio |tail -n 1 /var/log/messages}}&lt;br /&gt;
Nov 17 19:20:23 ipac9x25 user.notice root: Default settings message example{{clos}}&lt;br /&gt;
&lt;br /&gt;
To send a message to the system log with severity 3 (err):&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio |logger -p 3 &amp;quot;This is an example error message&amp;quot;}}&lt;br /&gt;
{{clio |tail -n 1 /var/log/messages}}&lt;br /&gt;
Nov 17 19:22:06 ipac9x25 user.err root: This is an example error message&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
To send a message with the facility, &amp;lt;code&amp;gt;local5&amp;lt;/code&amp;gt;, and the severity 4 (warn):&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio |logger -p local5.4 &amp;quot;This is a local5 facility warning message example.&amp;quot;}}&lt;br /&gt;
{{clio |tail -n 1 /var/log/messages}}&lt;br /&gt;
Nov 17 19:23:51 ipac9x25 local5.warn root: This is a local5 facility warning message example.{{clos}}&lt;br /&gt;
To add a tag (highly recommended) to the above, use &amp;lt;code&amp;gt;-t&amp;lt;/code&amp;gt;.  Here, we use the tag, &amp;lt;code&amp;gt;EXAMPLE&amp;lt;/code&amp;gt;:&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio |logger -t EXAMPLE -p local5.4 &amp;quot;This is a local5 facility warning message example.&amp;quot;}}&lt;br /&gt;
{{clio |tail -n 1 /var/log/messages}}&lt;br /&gt;
Nov 17 19:25:19 ipac9x25 local5.warn EXAMPLE: This is a local5 facility warning message example.&lt;br /&gt;
{{clos}}&lt;br /&gt;
Notice that the username (&amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt;) was replaced by the tag (&amp;lt;code&amp;gt;EXAMPLE&amp;lt;/code&amp;gt;).  When using tags in a script or program, it is best to come up with a unique tag and create a function for sending messages to the system log with this tag.  That way, you can easily find all messages from just your program/script.  If you have a complex program or set of scripts to debug, you could use multiple tags, but this will be more difficult to search for unless you use the optional &amp;lt;code&amp;gt;syslog-ng&amp;lt;/code&amp;gt; to redirect the messages from your software to distinct files.&lt;br /&gt;
In an interactive script, you might use &amp;lt;code&amp;gt;logger&amp;lt;/code&amp;gt; like this:&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio|logger -t EXAMPLE -p local3.6 -s &amp;quot;Successfully wrote new configuration file.&amp;quot;}}&lt;br /&gt;
EXAMPLE: Successfully wrote new configuration file.&lt;br /&gt;
{{clio |tail -n 1 /var/log/messages}}&lt;br /&gt;
Nov 17 19:25:19 ipac9x25 local5.warn EXAMPLE: This is a local5 facility warning message example.&lt;br /&gt;
{{clos}}&lt;br /&gt;
Notice that the message isn't visible in the system log?  This is because the &amp;lt;code&amp;gt;syslogd&amp;lt;/code&amp;gt; daemon on this machine is only configured to log messages which have a severity of 5 or lower.  We might modify the example so that it will be logged, like this:&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio|logger -t EXAMPLE -p local3.5 -s &amp;quot;Successfully wrote new configuration file.&amp;quot;}}&lt;br /&gt;
EXAMPLE: Successfully wrote new configuration file.&lt;br /&gt;
{{clio |tail -n 1 /var/log/messages}}&lt;br /&gt;
Nov 17 19:31:37 ipac9x25 local3.notice EXAMPLE: Successfully wrote new configuration file.&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
Now the message has been saved to the system logs as well as displayed on &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Writing to Syslog from a C Program====&lt;br /&gt;
There is a standard C function call on Linux for writing to the system logger.  This function, &amp;lt;code&amp;gt;syslog()&amp;lt;/code&amp;gt;, uses a persistent connection to the log facility which can be opened and closed using the associated &amp;lt;code&amp;gt;openlog()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;closelog()&amp;lt;/code&amp;gt; functions.  However, if the &amp;lt;code&amp;gt;syslog()&amp;lt;/code&amp;gt; function is called without first calling &amp;lt;code&amp;gt;openlog()&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;syslog()&amp;lt;/code&amp;gt; function will open the connection implicitly.&lt;br /&gt;
&lt;br /&gt;
=====Essential Elements=====&lt;br /&gt;
The header file required for these functions is &amp;lt;code&amp;gt;syslog.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The relevant functions are:&lt;br /&gt;
&lt;br /&gt;
{{function | name=openlog |&lt;br /&gt;
&amp;lt;code&amp;gt;'''void openlog( const char * ident, int option, int facility )'''&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;The &amp;lt;code&amp;gt;openlog()&amp;lt;/code&amp;gt; function is used to (optionally) open a connection to the log daemon before writing log messages.  If the &amp;lt;code&amp;gt;openlog()&amp;lt;/code&amp;gt; function is called, the &amp;lt;code&amp;gt;closelog()&amp;lt;/code&amp;gt; function must also be called before exiting.  &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;The following parameters are accepted by this function:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
:;&amp;lt;code&amp;gt;'''ident'''&amp;lt;/code&amp;gt;&lt;br /&gt;
:: The &amp;lt;code&amp;gt;ident&amp;lt;/code&amp;gt; parameter is an identification string to use for log messages.  This is just like the tag option to the &amp;lt;code&amp;gt;logger&amp;lt;/code&amp;gt; command available from the shell.  If this parameter is &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;, the identification string defaults to the name of the process sending the messages.&lt;br /&gt;
:;&amp;lt;code&amp;gt;'''option'''&amp;lt;/code&amp;gt;&lt;br /&gt;
:: The &amp;lt;code&amp;gt;option&amp;lt;/code&amp;gt; parameter is a bit string which accepts the following single bit masks:&lt;br /&gt;
::;&amp;lt;code&amp;gt;'''LOG_PERROR'''&amp;lt;/code&amp;gt;&lt;br /&gt;
::: If on, any log messages sent will also go to the &amp;lt;code&amp;gt;stderr&amp;lt;/code&amp;gt; stream associated with the current process.&lt;br /&gt;
::;&amp;lt;code&amp;gt;'''LOG_CONS'''&amp;lt;/code&amp;gt;&lt;br /&gt;
::: This useful flag causes any messages which were unable to be sent to the system logger (due to any kind of failure) will be sent to the system console instead.&lt;br /&gt;
::;&amp;lt;code&amp;gt;'''LOG_PID'''&amp;lt;/code&amp;gt;&lt;br /&gt;
::: When on, the process ID of the current process will be printed with each log message.  This is especially useful for programs which call &amp;lt;code&amp;gt;fork()&amp;lt;/code&amp;gt; at some point in their lifetime.&lt;br /&gt;
::;&amp;lt;code&amp;gt;'''LOG_NDELAY'''&amp;lt;/code&amp;gt;&lt;br /&gt;
::: This option forces the connection to be established immediately, rather than deferred to a later point (such as at the beginning of the first call to the &amp;lt;code&amp;gt;syslog()&amp;lt;/code&amp;gt; function.)&lt;br /&gt;
:;&amp;lt;code&amp;gt;'''facility'''&amp;lt;/code&amp;gt;&lt;br /&gt;
:: This is the facility to which the log messages should be directed.  The available facilities were described earlier in this document; see [[System_Logging#Facilities | facilities]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{function | name=syslog | &lt;br /&gt;
&amp;lt;code&amp;gt;'''void syslog( int facility_priority, const char * format, ... )'''&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;The &amp;lt;code&amp;gt;syslog()&amp;lt;/code&amp;gt; function is the core function for writing messages to the system log.  This function may be called in between calls to &amp;lt;code&amp;gt;openlog()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;closelog()&amp;lt;/code&amp;gt;, or standalone.  Using this function is very similar to using the standard &amp;lt;code&amp;gt;printf()&amp;lt;/code&amp;gt; function, or is (perhaps) even more similar to the standard &amp;lt;code&amp;gt;fprintf()&amp;lt;/code&amp;gt; function.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;The following parameters are accepted by this function:&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
:;&amp;lt;code&amp;gt;'''facility_priority'''&amp;lt;/code&amp;gt;&lt;br /&gt;
:: The &amp;lt;code&amp;gt;facility_priority&amp;lt;/code&amp;gt; argument is an integer which will accept any of the following predefined macros: &lt;br /&gt;
::* LOG_USER&lt;br /&gt;
::* LOG_MAIL&lt;br /&gt;
::* LOG_DAEMON&lt;br /&gt;
::* LOG_AUTH&lt;br /&gt;
::* LOG_SYSLOG&lt;br /&gt;
::* LOG_LPR&lt;br /&gt;
::* LOG_NEWS&lt;br /&gt;
::* LOG_UUCP&lt;br /&gt;
::* LOG_CRON&lt;br /&gt;
::* LOG_AUTHPRIV&lt;br /&gt;
::* LOG_FTP&lt;br /&gt;
::* LOG_LOCAL0&lt;br /&gt;
::* LOG_LOCAL1&lt;br /&gt;
::* LOG_LOCAL''2 through 7''...&lt;br /&gt;
:: These facility priorities correspond to the facilities discussed earlier in [[System_Logging#Facilities | facilities]].&lt;br /&gt;
:;&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;'''format'''&amp;lt;/code&amp;gt;&lt;br /&gt;
:: The &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt; parameter accepts a string with formatting parameters identical to the kind used for the standard &amp;lt;code&amp;gt;printf()&amp;lt;/code&amp;gt; function.  For information on how to craft such formatting strings, see the &amp;lt;code&amp;gt;printf()&amp;lt;/code&amp;gt; documentation.&lt;br /&gt;
:;&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;'''...'''&amp;lt;/code&amp;gt; ''(ellipsis operator)''&lt;br /&gt;
:: Any arguments needed for the formatting string are passed here, just like with the standard &amp;lt;code&amp;gt;printf()&amp;lt;/code&amp;gt; function.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{function | name=closelog |&lt;br /&gt;
&amp;lt;code&amp;gt;'''void closelog( void )'''&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;The &amp;lt;code&amp;gt;closelog()&amp;lt;/code&amp;gt; function must be called before exiting the program, but only if the &amp;lt;code&amp;gt;openlog()&amp;lt;/code&amp;gt; function was called earlier.  The &amp;lt;code&amp;gt;openlog()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;closelog()&amp;lt;/code&amp;gt; functions should be treated the same as &amp;lt;code&amp;gt;fopen()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;fclose()&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;malloc()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;free()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
This function takes no arguments.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{function | name=setlogmask |&lt;br /&gt;
&amp;lt;code&amp;gt;'''int setlogmask( int mask )'''&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;The &amp;lt;code&amp;gt;setlogmask()&amp;lt;/code&amp;gt; function controls what messages get sent to the &amp;lt;code&amp;gt;syslog&amp;lt;/code&amp;gt; server.  While the &amp;lt;code&amp;gt;syslog&amp;lt;/code&amp;gt; server does message filtering of its own, this function prevents the messages from ever reaching the &amp;lt;code&amp;gt;syslog&amp;lt;/code&amp;gt; server.  This type of filtering is good to use in conjunction with debug macros in order to reduce the overhead caused by having ample log messages spread throughout your software.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Each bit set in the &amp;lt;code&amp;gt;mask&amp;lt;/code&amp;gt; represents a priority level.  If the bit is set, a message of the corresponding priority level will be sent to syslog; otherwise, it won't.  The &amp;lt;code&amp;gt;LOG_MASK&amp;lt;/code&amp;gt; macro is used to translate priority levels into appropriate bits, such as &amp;lt;code&amp;gt;LOG_MASK( LOG_ERROR )&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Using the &amp;lt;code&amp;gt;LOG_UPTO&amp;lt;/code&amp;gt; macro is the easiest way to set the mask.  Since the most critical error message has a value of zero, and every less critical message has a value greater than zero, the &amp;lt;code&amp;gt;LOG_UPTO&amp;lt;/code&amp;gt; macro will create a mask which passes the given priority level and anything more severe.  For example, to pass messages which have a severity of Warning or worse, you may use: &amp;lt;code&amp;gt;LOG_UPTO( LOG_WARN )&amp;lt;/code&amp;gt;.&lt;br /&gt;
:;&amp;lt;code&amp;gt;mask&amp;lt;/code&amp;gt;&lt;br /&gt;
:: The &amp;lt;code&amp;gt;mask&amp;lt;/code&amp;gt; parameter is used to determine what messages to pass to &amp;lt;code&amp;gt;syslog&amp;lt;/code&amp;gt;, as described above.&lt;br /&gt;
:;''Returns'': &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;&lt;br /&gt;
:: The previously set log mask is returned by the function.  You may safely discard it if you don't intend to restore it later.&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=C&amp;gt;&lt;br /&gt;
#include &amp;lt;syslog.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main( int argc, char ** argv )&lt;br /&gt;
{&lt;br /&gt;
    setlogmask( LOG_UPTO( LOG_WARN ) );&lt;br /&gt;
    syslog( LOG_INFO, &amp;quot;You'll never see me!&amp;quot; );&lt;br /&gt;
    syslog( LOG_WARN, &amp;quot;Now you see me.&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=====Examples of Using the C &amp;lt;code&amp;gt;syslog()&amp;lt;/code&amp;gt; Function (and Friends)=====&lt;br /&gt;
&lt;br /&gt;
The most simple use of this function is found in the following &amp;lt;code&amp;gt;Hello, World&amp;lt;/code&amp;gt; style program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=C&amp;gt;&lt;br /&gt;
#include &amp;lt;syslog.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main( int argc, char ** argv )&lt;br /&gt;
{&lt;br /&gt;
    syslog( LOG_INFO, &amp;quot;Hello, World from syslog()!&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the lack of a newline character.  You should not pass newlines to syslog.  If you do, they will be stripped off.&lt;br /&gt;
&lt;br /&gt;
A slightly more sophisticated use of syslog follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=C&amp;gt;&lt;br /&gt;
#include &amp;lt;syslog.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main( int argc, char ** argv )&lt;br /&gt;
{&lt;br /&gt;
    int i;&lt;br /&gt;
    // Use &amp;quot;MyEXAMPLE&amp;quot; as the &amp;quot;tag&amp;quot; for messages.  Log output to stderr and to the system log, and include my PID.&lt;br /&gt;
    openlog( &amp;quot;MyEXAMPLE&amp;quot;, LOG_PERROR | LOG_PID );&lt;br /&gt;
    // Let's generate some output.&lt;br /&gt;
    syslog( LOG_WARN, &amp;quot;You have until the count of ten, Mr...&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    for( i = 10; i &amp;gt; 0; --i )&lt;br /&gt;
    {&lt;br /&gt;
        syslog( LOG_WARN, &amp;quot;%d&amp;quot;, i );&lt;br /&gt;
        sleep( 1 );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    syslog( LOG_ERR, &amp;quot;I warned you, sir and/or madam.  You almost made an error.  If you'd broken out of this with&amp;quot; );&lt;br /&gt;
    syslog( LOG_ERR, &amp;quot;Control-C, the closelog() call never would have been made.  Whew.  That was a close one.  Next&amp;quot; );&lt;br /&gt;
    syslog( LOG_ERR, &amp;quot;time make sure to catch the SIGINT signal (at the least) and call the closelog() function in&amp;quot; );&lt;br /&gt;
    syslog( LOG_ERR, &amp;quot;your signal handler to such avoid wasteful behavior.&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    closelog();&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=MD | title=System Logging | desc=The page describes how to system log. | project=OE 5.0 }}&lt;br /&gt;
This article covered quite a bit of territory.  You were given an overview of how logging works on Linux systems.  We then talked about a variety of ways in which people make use of these logs to solve real world problems.  We covered the basics of the standard &amp;lt;code&amp;gt;syslog&amp;lt;/code&amp;gt; system for EMAC OE Linux as well as the alternative, &amp;lt;code&amp;gt;syslog-ng&amp;lt;/code&amp;gt;, and gave an overview of what extras you can gain by installing &amp;lt;code&amp;gt;syslog-ng&amp;lt;/code&amp;gt;.  Next, we went through several examples of searching through messages to find the ones which are relevant to your current needs.  Finally, we covered ways to send messages to the syslog service from software, and from the commandline as well.  We didn't cover all programming languages, but the information presented here should provide a solid enough foundation for you to perform a search on the Internet for a syslog client library for other programming languages, and to make use of what you find quickly and easily.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=MD | title=System Logging | desc=The page describes how to system log. | project=OE 5.0 }}&lt;br /&gt;
* [[Install_the_EMAC_SDK | Installing the EMAC SDK]]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=MD | title=System Logging | desc=The page describes how to system log. | project=OE 5.0 }}&lt;br /&gt;
* [[Opkg | Working With the OPKG Package Manager]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Building_the_Linux_Kernel&amp;diff=5169</id>
		<title>Building the Linux Kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Building_the_Linux_Kernel&amp;diff=5169"/>
		<updated>2015-11-17T20:52:56Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: Complete&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo|Complete (11.26.13-22:10-&amp;gt;MD+)(12.10.13-14:45-&amp;gt;MG+);(12.17.13-12:10-&amp;gt;KY+);(03.04.14-16:30-&amp;gt;BS-);(03.26.14-17:10-&amp;gt;BS+);(11.06.15-16:30-&amp;gt;MG+);(11.06.15-17:15-&amp;gt;MD-);(11.16.15-13:30-&amp;gt;MG+);(11.16.15-18:30-&amp;gt;MD+)(11.17.15-14:50-&amp;gt;KY+)|Mike Dean|project=md,oe 4,oe 5,Complete,MG,ky,bs}}&lt;br /&gt;
&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Building the Linux Kernel &lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Building Linux Kernel,Configuring Kernel,Loading Kernel Modules&lt;br /&gt;
|description=Process of configuring and compiling the Linux kernel using the EMAC kernel build script.&lt;br /&gt;
}}&lt;br /&gt;
This page covers the process of configuring and compiling the Linux kernel using the EMAC kernel build script. This process assumes that you have already acquired the following software: &lt;br /&gt;
&lt;br /&gt;
# EMAC Software Development Kit [[ Installing_EMAC_OE_4.0_SDK | OE 4 ]] or [[ Install_the_EMAC_SDK | OE 5 ]]&lt;br /&gt;
# Linux kernel source for target hardware (provided via EMAC public [http://git.emacinc.com/ GIT server] )&lt;br /&gt;
# [ftp://ftp.emacinc.com/EMAC_Linux/EMAC_OE_Linux/Common_Items/kernel-build-cross.tar.gz Kernel build script]&lt;br /&gt;
&lt;br /&gt;
The example below will assume that a kernel image for the SoM-9x25 module will be created, although the instructions apply to other hardware as well assuming that the correct SDK, kernel tree, and build script is used.&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
&lt;br /&gt;
The steps below assume that the &amp;lt;code&amp;gt;kernel-build-cross.sh&amp;lt;/code&amp;gt; script is&lt;br /&gt;
located in the same directory as the kernel tree. Be sure to modify the &amp;lt;code&amp;gt;environment.cfg.sh&amp;lt;/code&amp;gt; script for the correct &lt;br /&gt;
architecture and EMAC OE version.&lt;br /&gt;
&lt;br /&gt;
==Configuring the Kernel==&lt;br /&gt;
&lt;br /&gt;
The first step for building the kernel is to configure it as desired. It is recommended to start with the kernel configuration file used by EMAC to build the kernel for the target device. Starting with EMAC OE 5, the kernel configuration can be &lt;br /&gt;
obtained on a running board from /proc/config.gz. Please contact [http://www.emacinc.com/support EMAC support] &lt;br /&gt;
for earlier EMAC OE versions. &lt;br /&gt;
&amp;lt;br &amp;gt;&lt;br /&gt;
The following are steps to configure the kernel:&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. Copy the default configuration file to the same directory as the kernel source tree and kernel-build-cross.sh and rename it defconfig. &lt;br /&gt;
&lt;br /&gt;
* The kernel-build-cross script accepts the SOURCE_TREE as the first argument and either config or build as the second argument. Optionally, a third argument, BUILD_SUFFIX may be supplied as a suffix to add to the build directory. BUILD_SUFFIX is commonly used to add a date tag or machine name to a build.&lt;br /&gt;
&lt;br /&gt;
{{cli | username=developer | hostname=ldc |./kernel-build-cross.sh linux-at91 config som9x25}}&lt;br /&gt;
&lt;br /&gt;
* The kernel menu-driven configuration utility will be displayed. Features can be selected/deselected to be built into the kernel. Some features can be built as a loadable module, denoted by &amp;lt; &amp;gt;, and not built directly into the kernel. &lt;br /&gt;
{{ warning | Disabling  or modularizing some kernel features may prevent the kernel from starting correctly or at all. }}&lt;br /&gt;
&lt;br /&gt;
Use the space bar to select an option or the 'm' key to configure the selected option as a module. Select &amp;lt;code&amp;gt;Exit&amp;lt;/code&amp;gt; to close the kernel configuration menu and save the configuration to the newly created build directory. When the same build-suffix is used for subsequent builds, this configuration will be used. &lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Building the Kernel==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. Run the kernel-build-cross script again with the build option, this time using the same build-suffix used in the configuration step. &lt;br /&gt;
&lt;br /&gt;
{{cli | username=developer | hostname=ldc |./kernel-build-cross.sh linux-at91 build som9x25}}&lt;br /&gt;
&lt;br /&gt;
* The kernel will begin compiling now. This will take several minutes to complete depending on the kernel configuration and the speed of the development machine. Only move on to the next step if the build completes with no errors.&lt;br /&gt;
&lt;br /&gt;
* The new kernel image will be in the &amp;lt;code&amp;gt;build-3.10.0-som9x25/Install/boot&amp;lt;/code&amp;gt; directory called zImage. For the 3.10 and later device tree enabled kernels, the desired device tree blob needs to be appended to the kernel. &lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | username=developer | hostname=ldc |cd build-3.10.0-som9x25/Install/boot}}&lt;br /&gt;
{{clio | username=developer | hostname=ldc |cat zImage-3.10.0 som-9x25-150es.dtb &amp;gt; zImage-boot}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
This is the image that will get loaded onto the board and executed by the bootloader. To load the new kernel onto the target machine, see the [[Loading Linux Kernels Onto a Board]] page.&lt;br /&gt;
&lt;br /&gt;
The build script will also create an archive of all of the modules created during the build process and place it in the &amp;lt;code&amp;gt;build-3.10.0-som9x25/Install/&amp;lt;/code&amp;gt; directory. The archive will be called &amp;lt;code&amp;gt;modules.tar.gz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Loading Kernel Modules==&lt;br /&gt;
&lt;br /&gt;
If the kernel is recompiled without changing the configuration or source code for any modules, it is not necessary to reload the modules archive. Alternatively, if a module was modified or added, it is only necessary to reload the modules archive.&lt;br /&gt;
To reload the modules:&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. Copy the archive to the root of the filesystem of the target machine&lt;br /&gt;
&lt;br /&gt;
{{cli | username=developer | hostname=ldc |scp build-3.10.0-som9x25/Install/modules.tar.gz root@1IP_ADDRESS:/ }}&lt;br /&gt;
&lt;br /&gt;
* Log onto the target machine&lt;br /&gt;
&lt;br /&gt;
{{cli | username=developer | hostname=ldc |ssh root@IP_ADDRESS}}&lt;br /&gt;
&lt;br /&gt;
* Extract the kernel modules archive and force the kernel to reload the modules. Make sure that the root flash is mounted read/write before extracting.&lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio |cd /}}&lt;br /&gt;
{{clio |tar xzvf modules.tar.gz}}&lt;br /&gt;
{{clio |depmod -a}}&lt;br /&gt;
{{clio |reboot}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:conclusion | initials=MG | title=System Logging | desc=The page describes how to build the linux kernel. | project=OE 5.0 }}&lt;br /&gt;
Using EMAC's kernel build script along with the EMAC SDK allows one to simply configure and build a customized Linux kernel.&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=MG | title=System Logging | desc=The page describes how to build the linux kernel. | project=OE 5.0 }}&lt;br /&gt;
* [[Loading_Linux_Kernels_Onto_a_Board | Loading Linux Kernels Onto a Board]]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=MG | title=Installing the EMAC SDK | desc=The page describes how to build the linux kernel. | project=OE 5.0 }}&lt;br /&gt;
* [[Install_the_EMAC_SDK | Install the EMAC SDK]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Category:Custom Development]]&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=OE_50_EMAC_Linux&amp;diff=5168</id>
		<title>OE 50 EMAC Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=OE_50_EMAC_Linux&amp;diff=5168"/>
		<updated>2015-11-17T20:42:01Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| InProgress (10.06.2015-12:18-&amp;gt;MG+)|Michael Gloff| project=OE 5.0,MG }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=OE EMAC Linux&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords= OE embedded linux EMAC&lt;br /&gt;
|description=Main landing page for OE EMAC Linux&lt;br /&gt;
}}&lt;br /&gt;
{{:Template:Navpgtable | initials={{{initials}}} | title=EMAC OpenEmbedded Linux | desc={{{desc}}} | project=OE 5 }}&lt;br /&gt;
{{:Templateimpl:navtableentry | title=EMAC OpenEmbedded }}&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:Navti | [[About_EMAC_OpenEmbedded | About EMAC OpenEmbedded]] }}&lt;br /&gt;
{{:Templateimpl:Navti | [[OE50:Packages | EMAC OE 5.X Release Information]] }}&lt;br /&gt;
{{:Templateimpl:Navti | [[Software_Overview | EMAC OE 5.X Software Overview]] }}&lt;br /&gt;
{{:Templateimpl:Navti | [[EMAC_OpenEmbedded_Fact_Sheet | EMAC OpenEmbedded Fact Sheet]] }}&lt;br /&gt;
{{:Templateimpl:Navti | [[EMAC_OE_50_Add-on_Packages | EMAC OE 5.X Add-on Packages]] }}&lt;br /&gt;
{{:Templateimpl:Navti | [[Open_Source_Community | Open Source Community]] }}&lt;br /&gt;
{{:Templateimpl:Navti | [[Wifi | Configuring a wireless client]] }}&lt;br /&gt;
{{:Templateimpl:Navti | [[Xenomai | Xenomai real time extensions]] }}&lt;br /&gt;
{{:Templateimpl:Navti | [[OE_Audio_Progs | Audio Programs]] }}&lt;br /&gt;
{{:Templateimpl:navtend}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:navtableentry | title=General Linux }}&lt;br /&gt;
{{:Templateimpl:Navti | [[Linux_FAQ | Linux FAQ]] }}&lt;br /&gt;
{{:Templateimpl:Navti | [[Linux_Filesystem_Organization | Linux Filesystem Organization]] }}&lt;br /&gt;
{{:Templateimpl:Navti | [[Editing_a_File | Editing a File]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:navtend}}&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=OE_Audio_Progs&amp;diff=5167</id>
		<title>OE Audio Progs</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=OE_Audio_Progs&amp;diff=5167"/>
		<updated>2015-11-17T20:40:56Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| Review (11.12.2015-11:13-&amp;gt;KY+);(11.16.2015-15:05-&amp;gt;MD-)(11.17.2015-14:38-&amp;gt;KY+)|Klint Youngmeyer| project=OE 5.0,KY,Review,MG,MD }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Audio Programs&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=&lt;br /&gt;
|description=Audio programs included with EMAC OE5.X&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE: Audio Programs}}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
By default, EMAC OE 5.X comes with two audio packages: ALSA and mpg123. More packages and applications are available from EMAC at a customer's request.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==ALSA==&lt;br /&gt;
ALSA, or the Advanced Linux Sound Architecture, is a part of the Linux Kernel and is a software framework that provides an API for sound devices. The ALSA framework includes several applications for working with sound.&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
  * &amp;lt;code&amp;gt;alsamixer&amp;lt;/code&amp;gt; is an ncurses mixer program for use with the ALSA soundcard drivers. It supports multiple soundcards with multiple devices. The &amp;lt;code&amp;gt;alsamixer&amp;lt;/code&amp;gt; menu displays a volume bar for each audio device present on the system. Adjusting these volume bars (with the arrow keys and 'm' for mute) allows changing of the output or input device volume corresponding to the given bar. An example of the &amp;lt;code&amp;gt;alsamixer&amp;lt;/code&amp;gt; interface is shown in Figure 1.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
::[[File:Alsamixer_screen.jpg|600px|thumb|left|Figure 1: Example of &amp;lt;code&amp;gt;alsamixer&amp;lt;/code&amp;gt;]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
  * &amp;lt;code&amp;gt;alsactl&amp;lt;/code&amp;gt; is used to control advanced settings for the ALSA soundcard drivers. It supports multiple soundcards. Also, the &amp;lt;code&amp;gt;alsactl store&amp;lt;/code&amp;gt; command is used to store driver setup and changes made in &amp;lt;code&amp;gt;alsamixer&amp;lt;/code&amp;gt; to the static configuration file. The following example demonstrates changing the settings for the default sound card by remounting the filesystem read-write, changing the settings, storing them, then remounting the filesystem read-only.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio | hostname=emac-oe | oemntrw }}&lt;br /&gt;
{{clio | hostname=emac-oe | alsamixer }}&lt;br /&gt;
&amp;amp;#35;make necessary changes...&lt;br /&gt;
&lt;br /&gt;
{{clio | hostname=emac-oe | alsactl store }}&lt;br /&gt;
{{clio | hostname=emac-oe | oemntrw -r}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
:Aside from the store function, &amp;lt;code&amp;gt;alsactl&amp;lt;/code&amp;gt; has a few other commands available. The &amp;lt;code&amp;gt;restore&amp;lt;/code&amp;gt; command is used to load current driver setup for one or each soundcards from configuration file, the &amp;lt;code&amp;gt;init&amp;lt;/code&amp;gt; command initialize driver and settings to a default state, and the &amp;lt;code&amp;gt;names&amp;lt;/code&amp;gt; command dumps information about all the known present (sub-)devices into configuration file (&amp;lt;code&amp;gt;names&amp;lt;/code&amp;gt; command is deprecated)&lt;br /&gt;
  * &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; is a command-line soundfile player for the ALSA soundcard driver. It supports several file formats and multiple soundcards with multiple devices. For supported soundfile formats, the sampling rate, bit depth, and so forth can be  automatically  determined from the soundfile header.&lt;br /&gt;
  * &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; is a command-line soundfile recorder for the ALSA soundcard driver. It supports several file formats and multiple soundcards with multiple devices. If recording with interleaved mode samples the file is automatically split before the 2GB filesize.&lt;br /&gt;
  * &amp;lt;code&amp;gt;speaker-test&amp;lt;/code&amp;gt; generates a series of sounds from the different channels of the default (or user specified) audio device. Some example tests are as follows:&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
:Outputting a voice identifying each channel&lt;br /&gt;
{{cli | hostname=emac-oe | speaker-test -t wav -l 1 -c 2}}&lt;br /&gt;
:Outputting a sine wave tone to each channel&lt;br /&gt;
{{cli | hostname=emac-oe | speaker-test -t sine -l 1 -c 2 -f 550}}&lt;br /&gt;
&lt;br /&gt;
==mpg123==&lt;br /&gt;
mpg123 is a simple and lightweight command line mp3 player. It is designed for use in front ends, in shell scripts, as an mp3 player, and as an mp3 to wave file decoder (primarily for use with CD-recording software).&lt;br /&gt;
&lt;br /&gt;
To play an audio file from the command line, &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; must be passed the name of the file to be played.&lt;br /&gt;
&lt;br /&gt;
{{cli | hostname=emac-oe | mpg123 sound_file.mp3}}&lt;br /&gt;
&lt;br /&gt;
This method, while great for shell scripts (but see below), does not support any control of the output after the file has begun output by a human operator. To enable manual controls, the &amp;lt;code&amp;gt;-C&amp;lt;/code&amp;gt; flag must be used.&lt;br /&gt;
&lt;br /&gt;
{{cli | hostname=emac-oe | mpg123 -C sound_file.mp3}}&lt;br /&gt;
&lt;br /&gt;
A few of the supported command keys are:&lt;br /&gt;
* '''q''' = Quit&lt;br /&gt;
* '''s''' = Stop/Start&lt;br /&gt;
* '''+''' = Volume Up&lt;br /&gt;
* '''-''' = Volume Down&lt;br /&gt;
* '''h''' = Display all terminal control keys&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; needs to be run from a script, or run in the background, the &amp;lt;code&amp;gt;-q&amp;lt;/code&amp;gt; flag should be used to enable quiet output so that nothing is printed to the screen when a the file is played.&lt;br /&gt;
&lt;br /&gt;
{{cli | hostname=emac-oe | mpg123 -q sound_file.mp3}}&lt;br /&gt;
&lt;br /&gt;
There are a large number of other options that are available when using &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;; too many to list in this document. These options can be viewed by passing the &amp;lt;code&amp;gt;--help&amp;lt;/code&amp;gt; flag to the program.&lt;br /&gt;
&lt;br /&gt;
{{cli | hostname=emac-oe | mpg123 --help}}&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=KY | title=Audio Programs | desc=Audio programs included with EMAC OE5.X | project=OE 5.0 }}&lt;br /&gt;
This page demonstrates some of the basic audio functionality that is included with EMAC OE. The combination of ALSA and mpg123 should solve most standard audio needs. If any further audio features are required, EMAC can add them. Please contact [[EMAC_Support_Services|EMAC Support]] for details.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:moreinfo | initials=KY | title=Audio Programs | desc=Audio programs included with EMAC OE5.X | project=OE 5.0 }}&lt;br /&gt;
* --&amp;gt;&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=Audio Programs | desc=Audio programs included with EMAC OE5.X | project=OE 5.0 }}&lt;br /&gt;
* [http://www.alsa-project.org/main/index.php/Documentation ALSA Official Documentation]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:bg | initials=KY | title=Audio Programs | desc=Audio programs included with EMAC OE5.X | project=OE 5.0 }}--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:geninfo | initials=KY | title=Audio Programs | desc=Audio programs included with EMAC OE5.X | project=OE 5.0 }}--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:using | initials=KY | title=Audio Programs | desc=Audio programs included with EMAC OE5.X | project=OE 5.0 }}--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:examples | initials=KY | title=Audio Programs | desc=Audio programs included with EMAC OE5.X | project=OE 5.0 }}--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Loading_Images_with_U-Boot&amp;diff=5164</id>
		<title>Loading Images with U-Boot</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Loading_Images_with_U-Boot&amp;diff=5164"/>
		<updated>2015-11-17T19:53:32Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: One addition made. Final Draft.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo|FinalDraft (12.16.13-01:25-&amp;gt;MD-);(12.31.13-11:02-&amp;gt;MW+);(12.31.13-11:30-&amp;gt;KY+);(12.31.13-11:35-&amp;gt;MG+);(03.06.14-15:30-&amp;gt;BS-);(04.11.14-15:55-&amp;gt;BS+)(11.06.15-12:45-&amp;gt;MG+)(11.13.2015-13:25-&amp;gt;MD-);(11.13.2015-16:39-&amp;gt;ER+);(11.13.2015-17:30-&amp;gt;MD+);(11.17.2015-13:50-&amp;gt;KY+)|Michael Welling|project=oe 4,oe 5,mw,md,ky,mg,bs,er,FinalDraft}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- NOTE: WE ARE STILL MISSING THE FOLLOWING CONTENT:&lt;br /&gt;
&lt;br /&gt;
* How to configure a machine to load a kernel/filesystem from flash&lt;br /&gt;
* How to save a kernel from flash&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Loading Images with U-Boot&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=U-Boot,OS Image,TFTP Server&lt;br /&gt;
|description=This page describes the process of using U-Boot to load Linux kernel and filesystem images from a TFTP server and save them to the local flash for use during the boot process. &lt;br /&gt;
}}&lt;br /&gt;
While U-Boot is used to load and execute the OS after initial programming, it can also be used to program the OS images to the local flash. This page describes the process of using U-Boot to load Linux kernel and filesystem images from a TFTP server and save them to the local flash for use during the boot process. Review the [[U-Boot Overview]] page for an introduction to U-Boot before continuing.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
A TFTP server must be accessible on the local network. The specific details of TFTP server setup and configuration can be found on the [[Installing TFTP server]] page. Alternatively, NFS can be used in place of TFTP but will require an NFS server.  Information on how to set up an NFS server [[Setting_up_an_NFS_File_Server | can be found here]].  Please contact EMAC if you need details on how to use NFS instead of TFTP to load images.&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
In order to load a file using TFTP, U-Boot must be configured to access the local network. Static networking configuration or DHCP can be used on some systems (requires DHCP server). Typically, the IP address of the board and the IP address of the TFTP server are the only settings that need to be defined. The network mask and broadcast address will be determined automatically from these settings, and no default gateway setting is required if the server is on the same subnetwork as the board. Before continuing, determine a valid static network address for your local network; contact your IT department for more information on what address to use if required. The example below shows how to set the IP address of the board to 192.168.2.2 and the TFTP server IP address to 192.168.2.1:&lt;br /&gt;
{{clop}}&amp;lt;nowiki&amp;gt;U-Boot&amp;gt; setenv ipaddr 192.168.2.2&lt;br /&gt;
U-Boot&amp;gt; setenv serverip 192.168.2.1&lt;br /&gt;
U-Boot&amp;gt; saveenv&lt;br /&gt;
Saving Environment to dataflash...&lt;br /&gt;
U-Boot&amp;gt; reset&amp;lt;/nowiki&amp;gt;{{closp}}&lt;br /&gt;
&lt;br /&gt;
Once the network settings have been configured, attempt to ping the TFTP server to test the network connection as illustrated below:&lt;br /&gt;
{{clop}}&amp;lt;nowiki&amp;gt;U-Boot&amp;gt; ping 192.168.2.1&lt;br /&gt;
macb0: link up, 100Mbps full-duplex (lpa: 0x45e1)&lt;br /&gt;
Using macb0 device&lt;br /&gt;
host 192.168.2.1 is alive&amp;lt;/nowiki&amp;gt;{{closp}}&lt;br /&gt;
&lt;br /&gt;
== Loading Images to RAM ==&lt;br /&gt;
Files are loaded directly into RAM through TFTP. In order to load the image, you must know the physical address of the RAM device on the system. Refer to the documentation for your target board if you are unsure what value to use. The standard addresses for some common EMAC systems are shown in Table 1 below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot;|Table 1: Physical RAM Addresses&lt;br /&gt;
|-&lt;br /&gt;
! Product !! RAM Start Address&lt;br /&gt;
|-&lt;br /&gt;
| SoM-9260M || 0x20000000&lt;br /&gt;
|-&lt;br /&gt;
| SoM-9G20M || 0x20000000&lt;br /&gt;
|-&lt;br /&gt;
| SoM-9G45M || 0x70000000&lt;br /&gt;
|-&lt;br /&gt;
| SoM-3517M || 0x82000000&lt;br /&gt;
|-&lt;br /&gt;
| SoM-9x25M || 0x22000000&lt;br /&gt;
|-&lt;br /&gt;
| Ipac-9x25M || 0x22000000&lt;br /&gt;
|-&lt;br /&gt;
| SoM-9G25M || 0x22000000&lt;br /&gt;
|-&lt;br /&gt;
| SoM-A5D35M || 0x22000000&lt;br /&gt;
|-&lt;br /&gt;
| SoM-A5D36M || 0x22000000&lt;br /&gt;
|-&lt;br /&gt;
| SoM-3354M || 0x82000000&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{ warning | Before transferring a file to the system, make sure that it does not exceed the size of the available RAM. }}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;tftp&amp;lt;/code&amp;gt; U-Boot command is used to transfer files to the system. The command requires two arguments: the address to load the file into and the filename of the image on the TFTP server. The example below demonstrates loading a kernel image named &amp;lt;code&amp;gt;uImage-2.6.30&amp;lt;/code&amp;gt; to RAM on an SoM-9G45M.&lt;br /&gt;
{{clop}}&amp;lt;nowiki&amp;gt;U-Boot&amp;gt; tftp 0x70000000 uImage-2.6.30&lt;br /&gt;
macb0: link up, 100Mbps full-duplex (lpa: 0x45e1)&lt;br /&gt;
Using macb0 device&lt;br /&gt;
TFTP from server 192.168.2.1; our IP address is 192.168.2.2&lt;br /&gt;
Filename 'uImage-2.6.30'.&lt;br /&gt;
Load address: 0x70000000&lt;br /&gt;
Loading: #################################################################&lt;br /&gt;
         #################################################################&lt;br /&gt;
         #################################################################&lt;br /&gt;
         #################################################################&lt;br /&gt;
         ############################&lt;br /&gt;
done&lt;br /&gt;
Bytes transferred = 1472456 (1677c8 hex)&lt;br /&gt;
U-Boot&amp;gt; printenv filesize&lt;br /&gt;
filesize=1677C8&amp;lt;/nowiki&amp;gt;{{closp}}&lt;br /&gt;
&lt;br /&gt;
{{ note | Note that the &amp;lt;code&amp;gt;filesize&amp;lt;/code&amp;gt; variable has been automatically updated to the size of the file that was loaded.}}&lt;br /&gt;
&lt;br /&gt;
== Executing kernel from RAM ==&lt;br /&gt;
In some situations, it is advantageous to execute the image directly from RAM after loading with TFTP rather than saving to flash. This is especially helpful when testing new Linux kernel images. Furthermore, the boot command can be set such that the image is automatically downloaded and executed on each boot, making testing more efficient.&lt;br /&gt;
&lt;br /&gt;
After loading a bootable image to RAM, you can execute it directly using the &amp;lt;code&amp;gt;bootm&amp;lt;/code&amp;gt; command. For example, after loading the kernel image above, running &amp;lt;code&amp;gt;bootm 0x70000000&amp;lt;/code&amp;gt; would boot the board using the new image without making any changes to the images stored on the flash.&lt;br /&gt;
&lt;br /&gt;
To update the &amp;lt;code&amp;gt;bootcmd&amp;lt;/code&amp;gt; variable to download the image on each boot, simply replace the command used to load the image from flash with the TFTP download command. The following example illustrates this process on an SoM-9G45M module.&lt;br /&gt;
{{clop}}&amp;lt;nowiki&amp;gt;U-Boot&amp;gt; printenv bootcmd&lt;br /&gt;
bootcmd=cp.b 0xC0042000 0x70000000 0x210000; bootm 0x70000000&lt;br /&gt;
U-Boot&amp;gt; setenv bootcmd 'tftp 0x70000000 uImage-2.6.30; bootm 0x70000000'&lt;br /&gt;
U-Boot&amp;gt; saveenv&lt;br /&gt;
Saving Environment to dataflash...&amp;lt;/nowiki&amp;gt;{{closp}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- ***************************************************************************************************&lt;br /&gt;
{{ warning | All these hard coded addresses don't contribute much to the reader's understanding of what each address is for...  especially 0xC0042000, since it's not mentioned elsewhere, and ones that may happen to be the same number for different reasons.}}&lt;br /&gt;
********************************************************************************************************* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Copying to Flash ==&lt;br /&gt;
The process of copying an image from RAM to flash memory differs depending on what type of flash storage devices are available on the system. Many systems have more than one device, such as serial DataFlash and NAND flash. This section explains the process of storing an image to non-volatile storage.&lt;br /&gt;
&lt;br /&gt;
=== NOR Flash ===&lt;br /&gt;
A combination of the &amp;lt;code&amp;gt;erase&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cp&amp;lt;/code&amp;gt; commands are used to program an image to a NOR flash device. NOR flash is directly memory-mapped to the system at a physical address. Also, each image (U-Boot, bootstrap, kernel, filesystem) must be stored at the correct offset for the system to operate correctly. Refer to the documentation for your hardware for more information on the correct address ranges to use. The &amp;lt;code&amp;gt;flinfo&amp;lt;/code&amp;gt; command can be used to display the addressing of available flash devices on the system.&lt;br /&gt;
&lt;br /&gt;
After loading the image to RAM, the flash device should be erased followed by copying the image to the appropriate offset in the flash. The example below illustrates the commands used to program a new kernel image to a SoM-9260M module. Note the use of the &amp;lt;code&amp;gt;protect off all&amp;lt;/code&amp;gt; command, which is required to unlock the flash on some systems.&lt;br /&gt;
{{clop}}&amp;lt;nowiki&amp;gt;U-Boot&amp;gt; protect off all&lt;br /&gt;
U-Boot&amp;gt; tftp 0x20000000 ${kernel_name}&lt;br /&gt;
U-Boot&amp;gt; erase 0x10100000 0x103fffff&lt;br /&gt;
U-Boot&amp;gt; cp.b 0x20000000 0x10100000 ${filesize}&amp;lt;/nowiki&amp;gt;{{closp}}&lt;br /&gt;
&lt;br /&gt;
{{ note | Note that NOR flash can take a significant amount of time to program if the image size is large.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial DataFlash ===&lt;br /&gt;
Serial DataFlash is an SPI-based NOR flash device that is used on many systems that employ NAND flash as the primary storage device. On these systems, low-level boot code such as the bootstrap, U-Boot, and OS kernel are typically stored on the DataFlash device. As with NOR flash, the &amp;lt;code&amp;gt;flinfo&amp;lt;/code&amp;gt; command can be used to determine the memory addressing layout of the DataFlash device. The &amp;lt;code&amp;gt;erase&amp;lt;/code&amp;gt; command does not support the DataFlash devices and should not be used before programming an image. The &amp;lt;code&amp;gt;cp&amp;lt;/code&amp;gt; command is capable of copying an image from RAM to DataFlash.&lt;br /&gt;
&lt;br /&gt;
The example below illustrates the commands used to copy a kernel image to the DataFlash device on a SoM-9G45M module.&lt;br /&gt;
{{clop}}&amp;lt;nowiki&amp;gt;U-Boot&amp;gt; tftpboot 0x70000000 ${kernel_name}&lt;br /&gt;
U-Boot&amp;gt; cp.b 0x70000000 0xC0042000 ${filesize}&amp;lt;/nowiki&amp;gt;{{closp}}&lt;br /&gt;
&lt;br /&gt;
=== NAND Flash ===&lt;br /&gt;
Generally, NAND flash is used to store only the root filesystem and auxiliary storage partitions of the OS. Storing an image to NAND flash under U-Boot uses a different set of commands than NOR or DataFlash devices. See &amp;lt;code&amp;gt;help nand&amp;lt;/code&amp;gt; for more information on the available commands for examining and manipulating NAND flash devices. To gain information on what NAND devices are available on the system, use the command &amp;lt;code&amp;gt;nand info&amp;lt;/code&amp;gt;. In general, programming a NAND flash device is much faster than programming NOR or DataFlash devices.&lt;br /&gt;
&lt;br /&gt;
The example below illustrates the process of loading the root JFFS2 filesystem onto an SoM-9G45M device. Note that the device is erased prior to programming it.&lt;br /&gt;
{{clop}}&amp;lt;nowiki&amp;gt;U-Boot&amp;gt; nand erase&lt;br /&gt;
U-Boot&amp;gt; tftp 0x70000000 ${rootfs_name}&lt;br /&gt;
U-Boot&amp;gt; nand write.jffs2 0x70000000 0x0 ${filesize}&amp;lt;/nowiki&amp;gt;{{closp}}&lt;br /&gt;
&lt;br /&gt;
=== SPI NOR/eMMC Flash ===&lt;br /&gt;
Most of EMAC's newer SoM offerings utilize an eMMC flash for filesystem and auxiliary storage partitions of the OS and an SPI flash to store the bootloader and kernel. To reprogram the eMMC, see [[Loading_Images_onto_eMMC_Devices|Loading Images onto eMMC Devices]]. Be sure that the &amp;lt;code&amp;gt;loadaddr&amp;lt;/code&amp;gt; variable is set and matches the table above. The example below illustrates the commands used to program a new kernel image to a SoM-9x25M module. &lt;br /&gt;
{{clop}}&amp;lt;nowiki&amp;gt;U-Boot&amp;gt; pri loadaddr&lt;br /&gt;
U-Boot&amp;gt; tftp ${loadaddr} zImage&lt;br /&gt;
U-Boot&amp;gt; sf probe;sf erase 0x100000 +${filesize};sf write ${loadaddr} 0x100000 ${filesize}&lt;br /&gt;
U-Boot&amp;gt; set kernelsize ${filesize};saveenv&amp;lt;/nowiki&amp;gt;{{closp}}&lt;br /&gt;
&lt;br /&gt;
Note: the &amp;quot;pri loadaddr&amp;quot; step above is not required it is just entered to make sure the variable is set.&lt;br /&gt;
&lt;br /&gt;
== Scripting ==&lt;br /&gt;
U-Boot also includes a scripting feature that allows a script file with U-Boot commands to be loaded and executed. This can make the task of programming multiple systems much more efficient. The &amp;lt;code&amp;gt;mkimage&amp;lt;/code&amp;gt; utility is required on a Linux development system in order to create a valid U-Boot image from a script. This section gives a brief example of a U-Boot script for programming a Linux kernel and filesystem.&lt;br /&gt;
&lt;br /&gt;
Creating a text file with all of the desired commands is the first step in creating a U-Boot script. The example below is a script file used by EMAC to program SoM-9260M modules:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=php&amp;gt;&lt;br /&gt;
echo ===== Setting Environment =====&lt;br /&gt;
setenv bootdelay 1&lt;br /&gt;
setenv rev sl013-aon-30010&lt;br /&gt;
setenv bootargs 'console=ttyS3,115200 root=/dev/mtdblock3 rootfstype=jffs2'&lt;br /&gt;
setenv kernel_name ${rev}-uImage&lt;br /&gt;
setenv rootfs_name sl013-aon-emac-image-SOM9260M.jffs2&lt;br /&gt;
saveenv&lt;br /&gt;
echo ===== Loading Kernel =====&lt;br /&gt;
protect off all&lt;br /&gt;
tftpboot 0x20000000 ${kernel_name}&lt;br /&gt;
erase 0x10100000 0x103fffff&lt;br /&gt;
cp.b 0x20000000 0x10100000 ${filesize}&lt;br /&gt;
setenv kernelsize ${filesize}&lt;br /&gt;
echo ===== Loading Root Filesystem =====&lt;br /&gt;
tftpboot 0x20000000 ${rootfs_name}&lt;br /&gt;
erase 0x10400000 0x11ffffff&lt;br /&gt;
cp.b 0x20000000 0x10400000 ${filesize}&lt;br /&gt;
setenv bootcmd 'protect off all;cp.b 0x10100000 0x20000000 ${kernelsize};bootm 0x20000000'&lt;br /&gt;
saveenv&lt;br /&gt;
echo ===== DONE! =====&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the file has been created and saved, the &amp;lt;code&amp;gt;mkimage&amp;lt;/code&amp;gt; utility must be used to create a U-Boot script image. A shell script such as the one shown below may be used to aid in this process:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
if [ ! -f &amp;quot;$1&amp;quot; ] || [ $# -lt 2 ]&lt;br /&gt;
then&lt;br /&gt;
        echo &amp;quot;Usage: $0 SCRIPTNAME OUTPUTNAME&amp;quot;&lt;br /&gt;
        exit 1&lt;br /&gt;
fi&lt;br /&gt;
 &lt;br /&gt;
mkimage -T script -C none -A arm -n 'SoM9260 Load Script' -d $1 $2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the script assumes that &amp;lt;code&amp;gt;mkimage&amp;lt;/code&amp;gt; is installed in the user's PATH. The script should be run with the name of the existing file as the first argument and the desired output filename as the second argument:&lt;br /&gt;
{{cli|username=developer|hostname=ldc|./script_mkimage.sh sl013-aon-30010-flash-script sl013-aon-30010-flash-script.img}}&lt;br /&gt;
&lt;br /&gt;
Once an image file has been created, it should be copied to the TFTP server root directory, in this example &amp;lt;code&amp;gt;/srv/tftp&amp;lt;/code&amp;gt; is used.&lt;br /&gt;
{{cli|username=developer|hostname=ldc|sudo cp sl013-aon-30010-flash-script.img /srv/tftp/}}&lt;br /&gt;
&lt;br /&gt;
The image file can now be transferred to the board and executed as illustrated below:&lt;br /&gt;
{{clo}}&amp;lt;nowiki&amp;gt;U-Boot&amp;gt; tftp 0x20000000 sl013-aon-30010-flash-script.img&lt;br /&gt;
U-Boot&amp;gt; source 0x20000000&amp;lt;/nowiki&amp;gt;{{closp}}&lt;br /&gt;
&lt;br /&gt;
{{ note | Note that the U-Boot command &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt; was not available on older versions of U-Boot. If the command is not recognized, use &amp;lt;code&amp;gt;autoscr&amp;lt;/code&amp;gt; instead.}}&lt;br /&gt;
&lt;br /&gt;
U-Boot will execute all commands in the script line-by-line until the script has finished, at which point the U-boot prompt will be returned to the user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=MD | title=System Logging | desc=The page describes how to system log. | project=OE 5.0 }}&lt;br /&gt;
In this article, you have seen how to load an image into RAM using U-Boot.  You have seen how to execute an image from RAM.  You have also seen how to copy an image from RAM to flash; how to configure your system to boot from an image once it has been saved to flash is documented elsewhere (see Related Information, below).  You have also seen a brief description of how to create scripts for U-Boot.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the information provided by this document, you are set to begin loading alternate kernels and filesystems onto EMAC hardware.  These kernels and filesystems could be alternatives provided to you by EMAC, or they could be ones you create yourself.  This provides you with a great deal of flexibility for your development work.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=MD | title=System Logging | desc=The page describes how to system log. | project=OE 5.0 }}&lt;br /&gt;
* [[Loading_Linux_Kernels_Onto_a_Board | Loading Linux Kernels Onto a Board]]&lt;br /&gt;
* [[Loading_JFFS2_Images_Onto_a_Board | Loading JFFS2 Images Onto a Board]]&lt;br /&gt;
* [[Archiving_JFFS2_Images | Archiving JFFS2 Images]]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=MD | title=System Logging | desc=The page describes how to system log. | project=OE 5.0 }}&lt;br /&gt;
* [[U-Boot_Overview | U-Boot Overview]]&lt;br /&gt;
* [[Creating_JFFS2_Images | Creating JFFS2 Images]]&lt;br /&gt;
* [[Mounting_JFFS2_Images_on_a_Linux_PC | Mounting JFFS2 Images on a Linux PC]]&lt;br /&gt;
* [[Repartitioning_NAND_Flash_with_JFFS2_for_Linux | Repartitioning NAND Flash with JFFS2 for Linux]]&lt;br /&gt;
* [[Loading_Images_onto_eMMC_Devices | Loading Images onto eMMC Devices]]&lt;br /&gt;
* [[Booting_with_an_NFS_Root_Filesystem | Booting with an NFS Root Filesystem]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--[[Category:Bootloaders]]--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Advanced_CMake_Features&amp;diff=5162</id>
		<title>Advanced CMake Features</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Advanced_CMake_Features&amp;diff=5162"/>
		<updated>2015-11-17T19:24:41Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| Review (09.14.2015-11:59-&amp;gt;KY+)(09.21.2015-11:08-&amp;gt;KY+)(09.24.2015-18:15-&amp;gt;MD-);(11.16.2015-12:10-&amp;gt;MD-);(11.16.2015-13:22-&amp;gt;KY+)|Klint Youngmeyer| project=OE 5.0,KY,MD,Review }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Advanced CMake Features&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=CMakeLists.txt, CMake cross-compiling, CMake, CMake ARM, CMake include&lt;br /&gt;
|description=Advanced features of the CMake build system for use with the EMAC SDK.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
There are several advanced features of the CMake build system that may be of use on projects as they get larger. This is far from a comprehensive list, and information related to unlisted tasks may be found on official [http://www.cmake.org/documentation/ CMake documentation].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=Advanced CMake Features | desc=Advanced features of the CMake build system for use with the EMAC SDK. | project=OE 5.0 }}&lt;br /&gt;
This page is written with the assumption that the project being worked on has been created using the [[Creating_a_New_EMAC_OE_SDK_Project_with_CMake | oe_init_project]] script or using the EMAC New C/C++ Project in Qt Creator. This page will explain the following CMake tasks:&lt;br /&gt;
*Adding a version number&lt;br /&gt;
*Adding external library files&lt;br /&gt;
*Adding C/C++ sources as libraries&lt;br /&gt;
*Cross platform building&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:geninfo | initials=KY | title=Advanced CMake Features | desc=Advanced features of the CMake build system for use with the EMAC SDK. | project=OE 5.0 }}--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=Advanced CMake Features | desc=Advanced features of the CMake build system for use with the EMAC SDK. | project=OE 5.0 }}&lt;br /&gt;
===Adding a Version Number and Configured Header File===&lt;br /&gt;
It is generally a good practice to put a version number in a project, but maintaining several variables containing the version number can be time consuming. It is possible to provide the executable and project with a version number through CMake. While you can do this exclusively in the source code, doing it in the CMakeLists file provides more flexibility. To add a version number we modify the CMakeLists file as follows:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
# The version number.&lt;br /&gt;
set (Example_VERSION_MAJOR 1)&lt;br /&gt;
set (Example_VERSION_MINOR 0) &lt;br /&gt;
&lt;br /&gt;
# configure a header file to pass some of the CMake settings&lt;br /&gt;
# to the source code&lt;br /&gt;
configure_file (&lt;br /&gt;
  &amp;quot;${PROJECT_SOURCE_DIR}/ExampleConfig.h.in&amp;quot;&lt;br /&gt;
  &amp;quot;${PROJECT_BINARY_DIR}/ExampleConfig.h&amp;quot;  ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# add the binary tree to the search path for include files&lt;br /&gt;
# so that we will find ExampleConfig.h&lt;br /&gt;
include_directories(&amp;quot;${PROJECT_BINARY_DIR}&amp;quot;) &lt;br /&gt;
# add the executable&lt;br /&gt;
add_executable(example main.c)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Since the configured file will be written into the binary tree we must add that directory to the list of paths to search for include files. We then create an &amp;lt;code&amp;gt;ExampleConfig.h.in&amp;lt;/code&amp;gt; file in the source tree with the following contents:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
// the configured options and settings for Tutorial&lt;br /&gt;
#define Example_VERSION_MAJOR @Example_VERSION_MAJOR@&lt;br /&gt;
#define Example_VERSION_MINOR @Example_VERSION_MINOR@&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
When CMake configures this header file the values for &amp;lt;code&amp;gt;@Example_VERSION_MAJOR@&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;@Example_VERSION_MINOR@&amp;lt;/code&amp;gt; will be replaced by the values from the CMakeLists file. Next we modify main.c to include the configured header file and to make use of the version numbers. The resulting source code is listed below.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
// A simple program that computes the square root of a number&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;math.h&amp;gt;&lt;br /&gt;
#include &amp;quot;ExampleConfig.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
int main (int argc, char *argv[]) {&lt;br /&gt;
    &lt;br /&gt;
    if (argc &amp;lt; 2) {&lt;br /&gt;
        fprintf(stdout,&amp;quot;%s Version %d.%d\n&amp;quot;, argv[0], Example_VERSION_MAJOR, Example_VERSION_MINOR);&lt;br /&gt;
        fprintf(stdout,&amp;quot;Usage: %s number\n&amp;quot;,argv[0]);&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    double inputValue = atof(argv[1]);&lt;br /&gt;
    double outputValue = sqrt(inputValue);&lt;br /&gt;
    fprintf(stdout,&amp;quot;The square root of %g is %g\n&amp;quot;,inputValue, outputValue);&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The main points of note are the inclusion of the &amp;lt;code&amp;gt;ExampleConfig.h&amp;lt;/code&amp;gt; header file and printing out a version number as part of the usage message.&lt;br /&gt;
===Adding External Library Files===&lt;br /&gt;
A library is a collection of precompiled object files which can be linked into programs. The most common use of libraries is to provide system functions, such as the image resize function, &amp;lt;code&amp;gt;MagickResizeImage&amp;lt;/code&amp;gt;, found in the ImageMagick library. The linker needs to know where to find these objects; CMake can accomplish this with the &amp;lt;code&amp;gt;INCLUDE_DIRECTORIES&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;TARGET_LINK_LIBRARIES&amp;lt;/code&amp;gt; functions.&lt;br /&gt;
To add an external library to the CMake project, more changes will need to be made to the &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt; file. Please refer to the code sample below. In this example, the ''ImageMagick'' library will be linked into the project.&lt;br /&gt;
#The library directory must be included using the &amp;lt;code&amp;gt;INCLUDE_DIRECTORIES()&amp;lt;/code&amp;gt; function. This function must be before the &amp;lt;code&amp;gt;ADD_EXECUTABLE()&amp;lt;/code&amp;gt; function.&lt;br /&gt;
#Use the &amp;lt;code&amp;gt;TARGET_LINK_LIBRARIES()&amp;lt;/code&amp;gt; function to link the desired library to the target binary. This function must be after the &amp;lt;code&amp;gt;ADD_EXECUTABLE()&amp;lt;/code&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} &amp;quot;/usr/include/ImageMagick&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ADD_EXECUTABLE(example main.cpp) # This should be here by default&lt;br /&gt;
&lt;br /&gt;
TARGET_LINK_LIBRARIES(example MagickWand)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====Boost Library Support====&lt;br /&gt;
To use the Boost libraries with CMake and EMAC OE, change the &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt; file to reflect the following example code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
### Boost Library Support&lt;br /&gt;
SET(Boost_USE_STATIC_LIBS OFF)&lt;br /&gt;
SET(Boost_USE_MULTITHREADED ON)&lt;br /&gt;
SET(Boost_USE_STATIC_RUNTIME OFF)&lt;br /&gt;
FIND_PACKAGE(Boost 1.40 COMPONENTS iostreams REQUIRED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Here is how to include some other popular Boost packages&lt;br /&gt;
#FIND_PACKAGE(Boost 1.40 COMPONENTS regex iostreams filesystem system REQUIRED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if(Boost_FOUND)&lt;br /&gt;
    MESSAGE(STATUS &amp;quot;Boost libs found&amp;quot;)&lt;br /&gt;
    INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})&lt;br /&gt;
    # AUX_SOURCE_DIRECTORY(. SRC_LIST)# (OPTIONAL) This will grab every source file name and put it in the variable SRC_LIST.&lt;br /&gt;
    # To use this option, change the ${SRC_FILE} variable in add_executable to ${SRC_LIST}&lt;br /&gt;
    ADD_EXECUTABLE(${PROJECT_NAME} ${SRC_FILE})&lt;br /&gt;
    TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES})&lt;br /&gt;
else()&lt;br /&gt;
    MESSAGE(FATAL_ERROR &amp;quot;ERROR: Boost libraries not found.&amp;quot;)&lt;br /&gt;
endif()&lt;br /&gt;
###&lt;br /&gt;
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/bin)&lt;br /&gt;
# This allows the use of 'make install'. By default, the binary will be installed&lt;br /&gt;
# into the bin directory inside the project directory. The destination can be changed&lt;br /&gt;
# to the directory of your choice (using absolute path).&lt;br /&gt;
# Libraries and headers can be installed in similar ways:&lt;br /&gt;
# INSTALL(TARGETS test DESTINATION lib)&lt;br /&gt;
# INSTALL(FILES test.h DESTINATION include)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
An example &amp;quot;Hello World&amp;quot; program using the Boost libraries is shown in the following example code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;
#include &amp;lt;fstream&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using std::ostream;&lt;br /&gt;
using std::ofstream;&lt;br /&gt;
using std::cout;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;boost/iostreams/tee.hpp&amp;gt;&lt;br /&gt;
#include &amp;lt;boost/iostreams/stream.hpp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
namespace bio = boost::iostreams;&lt;br /&gt;
using bio::tee_device;&lt;br /&gt;
using bio::stream;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char* argv[])&lt;br /&gt;
{&lt;br /&gt;
    typedef tee_device&amp;lt;ostream, ofstream&amp;gt; TeeDevice;&lt;br /&gt;
    typedef stream&amp;lt;TeeDevice&amp;gt; TeeStream;&lt;br /&gt;
    &lt;br /&gt;
    ofstream ofs(&amp;quot;sample.txt&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    // Define an ostream tee which sends output to both cout and ofs&lt;br /&gt;
    TeeDevice my_tee(cout, ofs);&lt;br /&gt;
&lt;br /&gt;
    // Assign the tee to an ostream object.&lt;br /&gt;
    TeeStream my_split(my_tee);&lt;br /&gt;
&lt;br /&gt;
    my_split &amp;lt;&amp;lt; &amp;quot;Hello, World!\\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    my_split.flush();&lt;br /&gt;
    my_split.close();&lt;br /&gt;
&lt;br /&gt;
    exit(EXIT_SUCCESS);&lt;br /&gt;
}                 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Adding Additional C/C++ Source Files as Libraries===&lt;br /&gt;
Adding additional source files is accomplished similarly to adding external library files. See [[#Adding_External_Library_Files | above]].&lt;br /&gt;
# All included files must be included in the &amp;lt;code&amp;gt;SOURCES&amp;lt;/code&amp;gt; list.&lt;br /&gt;
# All header files must be included in the &amp;lt;code&amp;gt;HEADER_FILES&amp;lt;/code&amp;gt; list.&lt;br /&gt;
# Each C/C++ source file must be added as a library before adding the executable.&lt;br /&gt;
# Add the executable, including the &amp;lt;code&amp;gt;${HEADER_FILES}&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Link the target libraries to the executable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
SET(SOURCES &lt;br /&gt;
    ${PROJECT_SOURCE_DIR}/include/tools.cpp&lt;br /&gt;
    ${PROJECT_SOURCE_DIR}/include/funcs.cpp &lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
SET(HEADER_FILES&lt;br /&gt;
    ${PROJECT_SOURCE_DIR}/include/tools.h&lt;br /&gt;
    ${PROJECT_SOURCE_DIR}/include/funcs.h&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
ADD_LIBRARY(tools include/tools.cpp ${HEADER_FILES})&lt;br /&gt;
ADD_LIBRARY(funcs include/funcs.cpp ${HEADER_FILES})&lt;br /&gt;
ADD_EXECUTABLE(example main.cpp ${HEADER_FILES})&lt;br /&gt;
&lt;br /&gt;
TARGET_LINK_LIBRARIES(main tools funcs)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cross-Platform Building===&lt;br /&gt;
If a project is meant to be used on multiple different platforms, it is sometimes necessary to have different options for each platform. These options could be additional C flags, variables to &amp;lt;code&amp;gt;#define&amp;lt;/code&amp;gt; what code is to be run, or various other tasks. The following example shows how to &amp;lt;code&amp;gt;#define&amp;lt;/code&amp;gt; which architecture is being built based on the &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; variable that is set by the EMAC toolchain:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
if(${ARCH} STREQUAL &amp;quot;x86&amp;quot;)&lt;br /&gt;
    ADD_DEFINITIONS(-DARCH_X86) # The define name will be ARCH_X86&lt;br /&gt;
elseif(${ARCH} STREQUAL &amp;quot;arm&amp;quot;)&lt;br /&gt;
    ADD_DEFINITIONS(-DARCH_ARM) # The define name will be ARCH_ARM&lt;br /&gt;
elseif(${ARCH} STREQUAL &amp;quot;def&amp;quot;)  &lt;br /&gt;
    ADD_DEFINITIONS(-DARCH_DESKTOP) # The define name will be ARCH_DESKTOP&lt;br /&gt;
else()&lt;br /&gt;
    MESSAGE(FATAL_ERROR &amp;quot;ERROR: Not a valid cross-platform option.&amp;quot;)&lt;br /&gt;
endif()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
In the project source code, it is now possible to make some code architecture dependent, as shown in the following example code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#ifdef ARCH_X86&lt;br /&gt;
    //Run x86 specific code&lt;br /&gt;
#elif defined ARCH_ARM&lt;br /&gt;
    //Run arm specific code&lt;br /&gt;
#elif defined ARCH_DESKTOP&lt;br /&gt;
    //Run desktop specific code&lt;br /&gt;
#else&lt;br /&gt;
#error &amp;quot;Unknown platform&amp;quot;&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;!--{{warning | How to set up a project so that the user may build both a desktop and a target version simultaneously should be described, for cases where both exist.  For example, the md5 tool I'm working on now is just such a project.  The desktop tool will add a few features which won't be in the board-only tool, so the build system will have to set #defines I'll be able to use to selectively compile portions of the code. }}--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:examples | initials=KY | title=Advanced CMake Features | desc=Advanced features of the CMake build system for use with the EMAC SDK. | project=OE 5.0 }}--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=KY | title=Advanced CMake Features | desc=Advanced features of the CMake build system for use with the EMAC SDK. | project=OE 5.0 }}&lt;br /&gt;
In this guide, several relatively common, advanced CMake topics were covered. It was demonstrated how to: Add different types of library files, add a version number in a config file, and build with cross-platform support.&lt;br /&gt;
&lt;br /&gt;
With the information provided on this page, you are well on your way to having the tools needed for building a large project with CMake. While EMAC fully supports CMake, we are not able to provide the full documentation. Please refer to official or other third-party documentation for more information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=KY | title=Advanced CMake Features | desc=Advanced features of the CMake build system for use with the EMAC SDK. | project=OE 5.0 }}&lt;br /&gt;
* [https://cmake.org/cmake/help/v3.4/ CMake Official Documentation]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=Advanced CMake Features | desc=Advanced features of the CMake build system for use with the EMAC SDK. | project=OE 5.0 }}&lt;br /&gt;
*[[Creating_a_New_EMAC_OE_SDK_Project_with_CMake | Creating a New EMAC OE SDK Project with CMake]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Some information on this page was provided by the official [http://www.cmake.org/cmake-tutorial/ CMake Tutorial].&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Configuring_Qt_Creator&amp;diff=5158</id>
		<title>Configuring Qt Creator</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Configuring_Qt_Creator&amp;diff=5158"/>
		<updated>2015-11-17T17:42:02Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| Review (11.09.2015-13:55-&amp;gt;KY+)(11.13.2015-13:00-&amp;gt;MG+)(11.17.2015-11:25-&amp;gt;KY+)|Brian Serrano|project=oe 5,bs,KY,MG,MD,Review}}&lt;br /&gt;
&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Configuring Qt Creator&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Qt Creator&lt;br /&gt;
|description=&lt;br /&gt;
}}&lt;br /&gt;
{{caution| This page is written for customers that have installed Qt Creator using the installer directly from the Qt website, as described on  [[Installing_QtCreator | this page]]. This method is not recommended, unless a Linux distribution other than Ubuntu is being used.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The recommended method is to use Ubuntu 14.04 and install using apt, as described on [[Install_the_EMAC_SDK | this page]].}}&lt;br /&gt;
&lt;br /&gt;
==Configure Kits in Qt Creator==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. [[Installing_QtCreator | Install Qt Creator]], which by default is installed in the user's home directory.&lt;br /&gt;
* Open Qt Creator&lt;br /&gt;
{{cli | username=developer | hostname=ldc |/home/developer/qtcreator-3.1.0/bin/qtcreator}}&lt;br /&gt;
&lt;br /&gt;
* Click Tools-&amp;gt;Options...&lt;br /&gt;
* Select '''Devices''' from the left pane&lt;br /&gt;
 i. Press the '''Add...''' button&lt;br /&gt;
 * Select Generic Linux Device then press '''Start Wizard'''&lt;br /&gt;
 * Type in a name, the IP address, user name and password for the device&lt;br /&gt;
 * Click '''Next &amp;gt;'''&lt;br /&gt;
 * Click '''Finish'''&lt;br /&gt;
 * A connection will be established with the target device&lt;br /&gt;
 * Click Apply&lt;br /&gt;
* Select Build &amp;amp; Run from the left pane&lt;br /&gt;
* Select the '''Qt Versions''' tab&lt;br /&gt;
 i. Press the '''Add...''' button&lt;br /&gt;
 * Navigate to /opt/emac/5.0/sysroots/x86_64-emacsdk-linux/usr/bin/&lt;br /&gt;
 * Select qmake&lt;br /&gt;
 * Press apply&lt;br /&gt;
&lt;br /&gt;
[[File:Qt_Kit_qmake.png|500px|thumb|left|Figure 1: Qt Creator Kit Qmake]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
{{note| The ''target_arch'' variable referenced below can either be ''armv5e-emac-linux-gnueabi'' for ARM targets or ''i586-emac-linux'' for x86 targets.}}&lt;br /&gt;
&lt;br /&gt;
* Select the '''Compilers''' tab&lt;br /&gt;
 i. Press '''Add-&amp;gt;GCC'''&lt;br /&gt;
 * Type in a name such as OE5 ARM GCC&lt;br /&gt;
 * Click Browse...&lt;br /&gt;
 * Navigate to /opt/emac/5.0/sysroots/x86_64-emacsdk-linux/usr/bin/'''''target_arch'''''/&lt;br /&gt;
 * Select '''''target_arch'''''-gcc&lt;br /&gt;
&lt;br /&gt;
[[File:Qt_Kit_GCC.png|500px|thumb|left|Figure 2: Qt Creator Kit Compiler]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the '''Debuggers''' tab&lt;br /&gt;
 i. Press '''Add'''&lt;br /&gt;
 * Type in a name such as GDB OE5 ARM&lt;br /&gt;
 * Click '''Browse...'''&lt;br /&gt;
 * Navigate to /opt/emac/5.0/sysroots/x86_64-emacsdk-linux/usr/bin/'''''target_arch'''''/&lt;br /&gt;
 * Select '''''target_arch'''''-gdb&lt;br /&gt;
&lt;br /&gt;
[[File:Qt_Kit_GDB.png|500px|thumb|left|Figure 3: Qt Creator Kit Debugger]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the '''Kits''' tab&lt;br /&gt;
 i. Press the '''Add''' button&lt;br /&gt;
 * Type in a name such as OE 5.0 arm&lt;br /&gt;
 * Change the '''Device type:''' to Generic Linux Device&lt;br /&gt;
 * Change the '''Device:''' to the one configured in step 3&lt;br /&gt;
 * Type /opt/emac/5.0/sysroots/'''''target_arch''''' into the '''Sysroot''' line&lt;br /&gt;
 * Change the '''Compiler:''' to the one created in step 6&lt;br /&gt;
 * Change the '''Debugger:''' to the one created in step 7&lt;br /&gt;
 * Change the '''Qt version:''' to the one created in step 5&lt;br /&gt;
 * Type '''''target_arch'''''-g++ into the '''Qt mkspec''' line&lt;br /&gt;
 * Press '''Apply''' then '''Ok'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Qt_Kit.png|500px|thumb|left|Figure 4: Qt Creator Kit]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
At this time, Qt Creator is configured similarly to the pre-configured version of Qt Creator that is distributed by EMAC. All other pages referencing Qt Creator should apply to this configured version as well.&lt;br /&gt;
==== Where to go next ====&lt;br /&gt;
* [[Creating_a_New_EMAC_OE_SDK_Project_with_qmake_in_Qt_Creator | Creating a new project in Qt Creator]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Configuring_Qt_Creator&amp;diff=5157</id>
		<title>Configuring Qt Creator</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Configuring_Qt_Creator&amp;diff=5157"/>
		<updated>2015-11-17T17:28:00Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| Review (11.09.2015-13:55-&amp;gt;KY+)(11.13.2015-13:00-&amp;gt;MG+)(11.17.2015-11:25-&amp;gt;KY+)|Brian Serrano|project=oe 5,bs,KY,MG,MD,Review}}&lt;br /&gt;
&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Configuring Qt Creator&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Qt Creator&lt;br /&gt;
|description=&lt;br /&gt;
}}&lt;br /&gt;
{{caution| This page is written for customers that have installed Qt Creator using the installer directly from the Qt website, as described on  [[Installing_QtCreator | this page]] (not recommended, unless a Linux distribution other than Ubuntu is being used).}}&lt;br /&gt;
&lt;br /&gt;
==Configure Kits in Qt Creator==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. [[Installing_QtCreator | Install Qt Creator]], which by default is installed in the user's home directory.&lt;br /&gt;
* Open Qt Creator&lt;br /&gt;
{{cli | username=developer | hostname=ldc |/home/developer/qtcreator-3.1.0/bin/qtcreator}}&lt;br /&gt;
&lt;br /&gt;
* Click Tools-&amp;gt;Options...&lt;br /&gt;
* Select '''Devices''' from the left pane&lt;br /&gt;
 i. Press the '''Add...''' button&lt;br /&gt;
 * Select Generic Linux Device then press '''Start Wizard'''&lt;br /&gt;
 * Type in a name, the IP address, user name and password for the device&lt;br /&gt;
 * Click '''Next &amp;gt;'''&lt;br /&gt;
 * Click '''Finish'''&lt;br /&gt;
 * A connection will be established with the target device&lt;br /&gt;
 * Click Apply&lt;br /&gt;
* Select Build &amp;amp; Run from the left pane&lt;br /&gt;
* Select the '''Qt Versions''' tab&lt;br /&gt;
 i. Press the '''Add...''' button&lt;br /&gt;
 * Navigate to /opt/emac/5.0/sysroots/x86_64-emacsdk-linux/usr/bin/&lt;br /&gt;
 * Select qmake&lt;br /&gt;
 * Press apply&lt;br /&gt;
&lt;br /&gt;
[[File:Qt_Kit_qmake.png|500px|thumb|left|Figure 1: Qt Creator Kit Qmake]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
{{note| The ''target_arch'' variable referenced below can either be ''armv5e-emac-linux-gnueabi'' for ARM targets or ''i586-emac-linux'' for x86 targets.}}&lt;br /&gt;
&lt;br /&gt;
* Select the '''Compilers''' tab&lt;br /&gt;
 i. Press '''Add-&amp;gt;GCC'''&lt;br /&gt;
 * Type in a name such as OE5 ARM GCC&lt;br /&gt;
 * Click Browse...&lt;br /&gt;
 * Navigate to /opt/emac/5.0/sysroots/x86_64-emacsdk-linux/usr/bin/'''''target_arch'''''/&lt;br /&gt;
 * Select '''''target_arch'''''-gcc&lt;br /&gt;
&lt;br /&gt;
[[File:Qt_Kit_GCC.png|500px|thumb|left|Figure 2: Qt Creator Kit Compiler]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the '''Debuggers''' tab&lt;br /&gt;
 i. Press '''Add'''&lt;br /&gt;
 * Type in a name such as GDB OE5 ARM&lt;br /&gt;
 * Click '''Browse...'''&lt;br /&gt;
 * Navigate to /opt/emac/5.0/sysroots/x86_64-emacsdk-linux/usr/bin/'''''target_arch'''''/&lt;br /&gt;
 * Select '''''target_arch'''''-gdb&lt;br /&gt;
&lt;br /&gt;
[[File:Qt_Kit_GDB.png|500px|thumb|left|Figure 3: Qt Creator Kit Debugger]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the '''Kits''' tab&lt;br /&gt;
 i. Press the '''Add''' button&lt;br /&gt;
 * Type in a name such as OE 5.0 arm&lt;br /&gt;
 * Change the '''Device type:''' to Generic Linux Device&lt;br /&gt;
 * Change the '''Device:''' to the one configured in step 3&lt;br /&gt;
 * Type /opt/emac/5.0/sysroots/'''''target_arch''''' into the '''Sysroot''' line&lt;br /&gt;
 * Change the '''Compiler:''' to the one created in step 6&lt;br /&gt;
 * Change the '''Debugger:''' to the one created in step 7&lt;br /&gt;
 * Change the '''Qt version:''' to the one created in step 5&lt;br /&gt;
 * Type '''''target_arch'''''-g++ into the '''Qt mkspec''' line&lt;br /&gt;
 * Press '''Apply''' then '''Ok'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Qt_Kit.png|500px|thumb|left|Figure 4: Qt Creator Kit]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
At this time, Qt Creator is configured similarly to the pre-configured version of Qt Creator that is distributed by EMAC. All other pages referencing Qt Creator should apply to this configured version as well.&lt;br /&gt;
==== Where to go next ====&lt;br /&gt;
* [[Creating_a_New_EMAC_OE_SDK_Project_with_qmake_in_Qt_Creator | Creating a new project in Qt Creator]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Advanced_CMake_Features&amp;diff=5156</id>
		<title>Advanced CMake Features</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Advanced_CMake_Features&amp;diff=5156"/>
		<updated>2015-11-17T16:53:33Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: Added link to &amp;quot;Where to go next&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| FinalDraft (09.14.2015-11:59-&amp;gt;KY+)(09.21.2015-11:08-&amp;gt;KY+)(09.24.2015-18:15-&amp;gt;MD-)|Klint Youngmeyer| project=OE 5.0,KY,MD,FinalDraft }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Advanced CMake Features&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=CMakeLists.txt, CMake cross-compiling, CMake, CMake ARM, CMake include&lt;br /&gt;
|description=Advanced features of the CMake build system for use with the EMAC SDK.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
There are several advanced features of the CMake build system that may be of use on projects as they get larger. This is far from a comprehensive list, and information related to unlisted tasks may be found on official [http://www.cmake.org/documentation/ CMake documentation].&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=Advanced CMake Features | desc=Advanced features of the CMake build system for use with the EMAC SDK. | project=OE 5.0 }}&lt;br /&gt;
This page is written with the assumption that the project being worked on has been created using the [[Creating_a_New_EMAC_OE_SDK_Project_with_CMake | oe_init_project]] script or using the EMAC New C/C++ Project in Qt Creator. This page will explain the following CMake tasks:&lt;br /&gt;
*Adding a version number&lt;br /&gt;
*Adding external library files&lt;br /&gt;
*Adding C/C++ sources as libraries&lt;br /&gt;
*Cross platform building&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:geninfo | initials=KY | title=Advanced CMake Features | desc=Advanced features of the CMake build system for use with the EMAC SDK. | project=OE 5.0 }}--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=Advanced CMake Features | desc=Advanced features of the CMake build system for use with the EMAC SDK. | project=OE 5.0 }}&lt;br /&gt;
===Adding a Version Number and Configured Header File===&lt;br /&gt;
It is generally a good practice to put a version number in a project, but maintaining several variables containing the version number can be time consuming. It is possible to provide the executable and project with a version number through CMake. While you can do this exclusively in the source code, doing it in the CMakeLists file provides more flexibility. To add a version number we modify the CMakeLists file as follows:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
# The version number.&lt;br /&gt;
set (Example_VERSION_MAJOR 1)&lt;br /&gt;
set (Example_VERSION_MINOR 0) &lt;br /&gt;
&lt;br /&gt;
# configure a header file to pass some of the CMake settings&lt;br /&gt;
# to the source code&lt;br /&gt;
configure_file (&lt;br /&gt;
  &amp;quot;${PROJECT_SOURCE_DIR}/ExampleConfig.h.in&amp;quot;&lt;br /&gt;
  &amp;quot;${PROJECT_BINARY_DIR}/ExampleConfig.h&amp;quot;  ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# add the binary tree to the search path for include files&lt;br /&gt;
# so that we will find ExampleConfig.h&lt;br /&gt;
include_directories(&amp;quot;${PROJECT_BINARY_DIR}&amp;quot;) &lt;br /&gt;
# add the executable&lt;br /&gt;
add_executable(example main.c)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Since the configured file will be written into the binary tree we must add that directory to the list of paths to search for include files. We then create an &amp;lt;code&amp;gt;ExampleConfig.h.in&amp;lt;/code&amp;gt; file in the source tree with the following contents:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
// the configured options and settings for Tutorial&lt;br /&gt;
#define Example_VERSION_MAJOR @Example_VERSION_MAJOR@&lt;br /&gt;
#define Example_VERSION_MINOR @Example_VERSION_MINOR@&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
When CMake configures this header file the values for &amp;lt;code&amp;gt;@Example_VERSION_MAJOR@&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;@Example_VERSION_MINOR@&amp;lt;/code&amp;gt; will be replaced by the values from the CMakeLists file. Next we modify main.c to include the configured header file and to make use of the version numbers. The resulting source code is listed below.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
// A simple program that computes the square root of a number&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;math.h&amp;gt;&lt;br /&gt;
#include &amp;quot;ExampleConfig.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
int main (int argc, char *argv[]) {&lt;br /&gt;
    &lt;br /&gt;
    if (argc &amp;lt; 2) {&lt;br /&gt;
        fprintf(stdout,&amp;quot;%s Version %d.%d\n&amp;quot;, argv[0], Example_VERSION_MAJOR, Example_VERSION_MINOR);&lt;br /&gt;
        fprintf(stdout,&amp;quot;Usage: %s number\n&amp;quot;,argv[0]);&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    double inputValue = atof(argv[1]);&lt;br /&gt;
    double outputValue = sqrt(inputValue);&lt;br /&gt;
    fprintf(stdout,&amp;quot;The square root of %g is %g\n&amp;quot;,inputValue, outputValue);&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The main points of note are the inclusion of the &amp;lt;code&amp;gt;ExampleConfig.h&amp;lt;/code&amp;gt; header file and printing out a version number as part of the usage message.&lt;br /&gt;
===Adding External Library Files===&lt;br /&gt;
A library is a collection of precompiled object files which can be linked into programs. The most common use of libraries is to provide system functions, such as the image resize function &amp;lt;code&amp;gt;MagickResizeImage&amp;lt;/code&amp;gt; found in the ImageMagick library. The linker needs to know where to find these objects, CMake can accomplish this with the &amp;lt;code&amp;gt;INCLUDE_DIRECTORIES&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;TARGET_LINK_LIBRARIES&amp;lt;/code&amp;gt; functions.&lt;br /&gt;
To add an external library to the CMake project, more changes will need to be made to the &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt; file. Please refer to the code sample below. In this example, the ''ImageMagick'' library will be linked into the project.&lt;br /&gt;
#The library directory must be included using the &amp;lt;code&amp;gt;INCLUDE_DIRECTORIES()&amp;lt;/code&amp;gt; function. This function must be before the &amp;lt;code&amp;gt;ADD_EXECUTABLE()&amp;lt;/code&amp;gt; function.&lt;br /&gt;
#Use the &amp;lt;code&amp;gt;TARGET_LINK_LIBRARIES()&amp;lt;/code&amp;gt; function to link the desired library to the target binary. This function must be after the &amp;lt;code&amp;gt;ADD_EXECUTABLE()&amp;lt;/code&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} &amp;quot;/usr/include/ImageMagick&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ADD_EXECUTABLE(example main.cpp) # This should be here by default&lt;br /&gt;
&lt;br /&gt;
TARGET_LINK_LIBRARIES(example MagickWand)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
====Boost Library Support====&lt;br /&gt;
To use the Boost libraries with CMake and EMAC OE, change the &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt; file to reflect the following example code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
### Boost Library Support&lt;br /&gt;
SET(Boost_USE_STATIC_LIBS OFF)&lt;br /&gt;
SET(Boost_USE_MULTITHREADED ON)&lt;br /&gt;
SET(Boost_USE_STATIC_RUNTIME OFF)&lt;br /&gt;
FIND_PACKAGE(Boost 1.40 COMPONENTS iostreams REQUIRED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Here is how to include some other popular Boost packages&lt;br /&gt;
#FIND_PACKAGE(Boost 1.40 COMPONENTS regex iostreams filesystem system REQUIRED)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if(Boost_FOUND)&lt;br /&gt;
    MESSAGE(STATUS &amp;quot;Boost libs found&amp;quot;)&lt;br /&gt;
    INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})&lt;br /&gt;
    # AUX_SOURCE_DIRECTORY(. SRC_LIST)# (OPTIONAL) This will grab every source file name and put it in the variable SRC_LIST.&lt;br /&gt;
    # To use this option, change the ${SRC_FILE} variable in add_executable to ${SRC_LIST}&lt;br /&gt;
    ADD_EXECUTABLE(${PROJECT_NAME} ${SRC_FILE})&lt;br /&gt;
    TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES})&lt;br /&gt;
else()&lt;br /&gt;
    MESSAGE(FATAL_ERROR &amp;quot;ERROR: Boost libraries not found.&amp;quot;)&lt;br /&gt;
endif()&lt;br /&gt;
###&lt;br /&gt;
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/bin)&lt;br /&gt;
# This allows the use of 'make install'. By default, the binary will be installed&lt;br /&gt;
# into the bin directory inside the project directory. The destination can be changed&lt;br /&gt;
# to the directory of your choice (using absolute path).&lt;br /&gt;
# Libraries and headers can be installed in similar ways:&lt;br /&gt;
# INSTALL(TARGETS test DESTINATION lib)&lt;br /&gt;
# INSTALL(FILES test.h DESTINATION include)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
An example &amp;quot;Hello World&amp;quot; program using the Boost libraries is shown in the following example code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;
#include &amp;lt;fstream&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using std::ostream;&lt;br /&gt;
using std::ofstream;&lt;br /&gt;
using std::cout;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;boost/iostreams/tee.hpp&amp;gt;&lt;br /&gt;
#include &amp;lt;boost/iostreams/stream.hpp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
namespace bio = boost::iostreams;&lt;br /&gt;
using bio::tee_device;&lt;br /&gt;
using bio::stream;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char* argv[])&lt;br /&gt;
{&lt;br /&gt;
    typedef tee_device&amp;lt;ostream, ofstream&amp;gt; TeeDevice;&lt;br /&gt;
    typedef stream&amp;lt;TeeDevice&amp;gt; TeeStream;&lt;br /&gt;
    &lt;br /&gt;
    ofstream ofs(&amp;quot;sample.txt&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    // Define an ostream tee which sends output to both cout and ofs&lt;br /&gt;
    TeeDevice my_tee(cout, ofs);&lt;br /&gt;
&lt;br /&gt;
    // Assign the tee to an ostream object.&lt;br /&gt;
    TeeStream my_split(my_tee);&lt;br /&gt;
&lt;br /&gt;
    my_split &amp;lt;&amp;lt; &amp;quot;Hello, World!\\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    my_split.flush();&lt;br /&gt;
    my_split.close();&lt;br /&gt;
&lt;br /&gt;
    exit(EXIT_SUCCESS);&lt;br /&gt;
}                 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Adding Additional C/C++ Source Files as Libraries===&lt;br /&gt;
Adding additional source files is accomplished similarly to adding external library files. See [[#Adding_External_Library_Files | above]].&lt;br /&gt;
# All included files must be included in the &amp;lt;code&amp;gt;SOURCES&amp;lt;/code&amp;gt; list.&lt;br /&gt;
# All header files must be included in the &amp;lt;code&amp;gt;HEADER_FILES&amp;lt;/code&amp;gt; list.&lt;br /&gt;
# Each C/C++ source file must be added as a library before adding the executable.&lt;br /&gt;
# Add the executable, including the &amp;lt;code&amp;gt;${HEADER_FILES}&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Link the target libraries to the executable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
SET(SOURCES &lt;br /&gt;
    ${PROJECT_SOURCE_DIR}/include/tools.cpp&lt;br /&gt;
    ${PROJECT_SOURCE_DIR}/include/funcs.cpp &lt;br /&gt;
    ${PROJECT_SOURCE_DIR}/include/tools.h&lt;br /&gt;
    ${PROJECT_SOURCE_DIR}/include/funcs.h&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
SET(HEADER_FILES&lt;br /&gt;
    ${PROJECT_SOURCE_DIR}/include/tools.h&lt;br /&gt;
    ${PROJECT_SOURCE_DIR}/include/funcs.h&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
ADD_LIBRARY(tools include/tools.cpp ${HEADER_FILES})&lt;br /&gt;
ADD_LIBRARY(funcs include/funcs.cpp ${HEADER_FILES})&lt;br /&gt;
ADD_EXECUTABLE(example main.cpp ${HEADER_FILES})&lt;br /&gt;
&lt;br /&gt;
TARGET_LINK_LIBRARIES(main tools funcs)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Cross-Platform Building===&lt;br /&gt;
If a project is meant to be used on multiple different platforms, it is sometimes necessary to have different options for each platform. These options could be additional C flags, variables to #define what code is to be run, or various other tasks. The following example shows how to #define which architecture is being built based on the &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; variable that is set by the EMAC toolchain:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
if(${ARCH} STREQUAL &amp;quot;x86&amp;quot;)&lt;br /&gt;
    ADD_DEFINITIONS(-DARCH_X86) # The define name will be ARCH_X86&lt;br /&gt;
elseif(${ARCH} STREQUAL &amp;quot;arm&amp;quot;)&lt;br /&gt;
    ADD_DEFINITIONS(-DARCH_ARM) # The define name will be ARCH_ARM&lt;br /&gt;
elseif(${ARCH} STREQUAL &amp;quot;def&amp;quot;)  &lt;br /&gt;
    ADD_DEFINITIONS(-DARCH_DESKTOP) # The define name will be ARCH_DESKTOP&lt;br /&gt;
else()&lt;br /&gt;
    MESSAGE(FATAL_ERROR &amp;quot;ERROR: Not a valid cross-platform option.&amp;quot;)&lt;br /&gt;
endif()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
In the project source code, it is now possible to make some code architecture dependent, as shown in the following example code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#ifdef ARCH_X86&lt;br /&gt;
    //Run x86 specific code&lt;br /&gt;
#elif defined ARCH_ARM&lt;br /&gt;
    //Run arm specific code&lt;br /&gt;
#elif defined ARCH_DESKTOP&lt;br /&gt;
    //Run desktop specific code&lt;br /&gt;
#else&lt;br /&gt;
#error &amp;quot;Unknown platform&amp;quot;&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;!--{{warning | How to set up a project so that the user may build both a desktop and a target version simultaneously should be described, for cases where both exist.  For example, the md5 tool I'm working on now is just such a project.  The desktop tool will add a few features which won't be in the board-only tool, so the build system will have to set #defines I'll be able to use to selectively compile portions of the code. }}--&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:examples | initials=KY | title=Advanced CMake Features | desc=Advanced features of the CMake build system for use with the EMAC SDK. | project=OE 5.0 }}--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=KY | title=Advanced CMake Features | desc=Advanced features of the CMake build system for use with the EMAC SDK. | project=OE 5.0 }}&lt;br /&gt;
As stated previously, this guide is just a small list of common task requests. Please refer to official or other third-party documentation for more information.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=KY | title=Advanced CMake Features | desc=Advanced features of the CMake build system for use with the EMAC SDK. | project=OE 5.0 }}&lt;br /&gt;
* [https://cmake.org/cmake/help/v3.4/ CMake Official Documentation]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=Advanced CMake Features | desc=Advanced features of the CMake build system for use with the EMAC SDK. | project=OE 5.0 }}&lt;br /&gt;
*[[Creating_a_New_EMAC_OE_SDK_Project_with_CMake | Creating a New EMAC OE SDK Project with CMake]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Some information on this page was provided by the official [http://www.cmake.org/cmake-tutorial/ CMake Tutorial].&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Installing_LILO&amp;diff=5148</id>
		<title>Installing LILO</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Installing_LILO&amp;diff=5148"/>
		<updated>2015-11-16T18:40:07Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: FinalDraft, one minor issue&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo|Final Draft (12.16.13-03:15-&amp;gt;MD+);(12.16.13-12:50-&amp;gt;MD);(12.16.13-13:40-&amp;gt;MD);(12.16.13-13:45-&amp;gt;MW+);(12.16.13-18:20-&amp;gt;KY+);(03.06.14-15:40-&amp;gt;BS-);(04.11.14-16:40-&amp;gt;BS+)(11.12.14-&amp;gt;MD+)(11.10.2015-12:05-&amp;gt;MD+);(11.13.2015-15:50-&amp;gt;MD+);(11.16.2015-12:38-&amp;gt;KY+)|Mike Dean|project=oe 4,oe 5,md,mw,ky,bs,FinalDraft}}&lt;br /&gt;
  &lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Installing LILO&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=LILO Linux USB,Automounter&lt;br /&gt;
|description=LILO can be installed onto a disk for use by the local machine, or it can be installed onto a removable storage device for use in booting on a different machine.&lt;br /&gt;
}}&lt;br /&gt;
==Installing LILO==&lt;br /&gt;
&lt;br /&gt;
LILO can be installed onto a disk for use by the local machine, or it can be installed onto a removable storage device for use in booting on a different machine.  Both installation methods are discussed here.  Usually, the former method will be used to update the existing bootloader for new kernels, new kernel configurations, or new boot time options.  The latter method is generally used to initially set up a bootable storage device which is intended to be inserted into an embedded system for which it is being created.&lt;br /&gt;
&lt;br /&gt;
===Installing Onto the Local Machine===&lt;br /&gt;
&lt;br /&gt;
Before LILO can be used to boot a system, it must be installed onto the boot device.  It must also be reinstalled any time the configuration is changed, or the new configuration will not take effect.  Fortunately, installing LILO is easy.&lt;br /&gt;
&lt;br /&gt;
The easiest way to install LILO onto the local system's Master Boot Record, using the default configuration file (&amp;lt;code&amp;gt;/etc/lilo.conf&amp;lt;/code&amp;gt;), is to type:&lt;br /&gt;
&lt;br /&gt;
{{cli|lilo|hostname=oe}}&lt;br /&gt;
&lt;br /&gt;
This method works well for systems where only a small change is required to the default configuration, but is not often what is desired on an embedded system.  Many times, an alternate file will be used to store the new configuration so that a breaking change to a known-good configuration file will not leave the system without a usable configuration file.  If a configuration file in an alternate location needs to be used, it will have to be specified like this:&lt;br /&gt;
 &lt;br /&gt;
{{cli|lilo -C /etc/alternate_lilo_configuration_file.conf|hostname=oe}}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-C&amp;lt;/code&amp;gt; (capital C) switch tells &amp;lt;code&amp;gt;lilo&amp;lt;/code&amp;gt; to use the configuration file specified after the switch when installing itself.&lt;br /&gt;
&lt;br /&gt;
{{ note | LILO will need to be reinstalled whenever a new kernel is installed on the machine.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The configuration file used to install LILO the last time (most likely, the default config file, &amp;lt;code&amp;gt;/etc/lilo.conf&amp;lt;/code&amp;gt;, can be used to reinstall LILO to use the new kernel.  If the kernel name changed, the configuration file will need to be modified to suit before reinstalling LILO.  See [[Configuring LILO]] for more information on how to do this.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
When the config file is correct, run LILO the same way you did in the section above this note.}}&lt;br /&gt;
&lt;br /&gt;
===Installing LILO Onto a Removable Drive===&lt;br /&gt;
&lt;br /&gt;
The last method shown above is not what is needed when the embedded machine's root drive is not in the running embedded system.  With a Compact Flash disk, for instance, containing the Linux filesystem and mounted on a desktop Linux development machine, a few hoops need to be jumped through in order to install the bootloader onto the Compact Flash card.  This method is usually necessary when there isn't already a bootable disk for the embedded machine.&lt;br /&gt;
&lt;br /&gt;
Two sets of directions for doing this are given here.  The first set of directions is generic, and will work for desktop Linux distributions which do not include an automounter or have an automounter which doesn't interfere with the process.  The second set details a known workaround. The following steps will need to be performed to install LILO onto a removable drive:&lt;br /&gt;
&lt;br /&gt;
====Installing from a System with No Automounter or a Non-Interfering Automounter====&lt;br /&gt;
&lt;br /&gt;
For simpler systems without an automounter, or with an automounter that doesn't try to protect the user from possibly malicious code, follow these directions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;1. Mount the drive.&lt;br /&gt;
 i. Insert the flash card into the development system's card reader.&lt;br /&gt;
 * Find out where the device node for the card was created (assuming the development machine uses &amp;lt;code&amp;gt;udev&amp;lt;/code&amp;gt;) by using &amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt;.&lt;br /&gt;
{{clo|indent=1}}&lt;br /&gt;
{{clio|dmesg | tail -n 15|hostname=debian|username=user}}&lt;br /&gt;
...&amp;lt;br /&amp;gt;&lt;br /&gt;
[126468.154762] sd 6:0:0:0: [sdb] 7831152 512-byte logical blocks: (4.00 GB/3.73 GiB)&amp;lt;br /&amp;gt;&lt;br /&gt;
[126468.182196]  sdb: sdb1&amp;lt;br /&amp;gt;&lt;br /&gt;
[126468.688061] kjournald starting.  Commit interval 5 seconds&amp;lt;br /&amp;gt;&lt;br /&gt;
[126468.691223] EXT3-fs (sdb1): using internal journal&amp;lt;br /&amp;gt;&lt;br /&gt;
[126468.691225] EXT3-fs (sdb1): recovery complete&amp;lt;br /&amp;gt;&lt;br /&gt;
[126468.694526] EXT3-fs (sdb1): mounted filesystem with ordered data mode&amp;lt;br /&amp;gt;&lt;br /&gt;
[173828.541718] sdb: detected capacity change from 4009549824 to 0&amp;lt;br /&amp;gt;&lt;br /&gt;
[179577.977554] sd 6:0:0:0: [sdb] 7831152 512-byte logical blocks: (4.00 GB/3.73 GiB)&amp;lt;br /&amp;gt;&lt;br /&gt;
[179577.994839]  sdb: sdb1&amp;lt;br /&amp;gt;&lt;br /&gt;
[179578.376157] kjournald starting.  Commit interval 5 seconds&amp;lt;br /&amp;gt;&lt;br /&gt;
[179578.381428] EXT3-fs (sdb1): using internal journal&amp;lt;br /&amp;gt;&lt;br /&gt;
[179578.381433] EXT3-fs (sdb1): recovery complete&amp;lt;br /&amp;gt;&lt;br /&gt;
[179578.384661] EXT3-fs (sdb1): mounted filesystem with ordered data mode&amp;lt;br /&amp;gt;&lt;br /&gt;
{{clos}}&lt;br /&gt;
 * Since the device node &amp;lt;code&amp;gt;sdb1&amp;lt;/code&amp;gt; was created for the flash card (in this example), that device needs to be mounted somewhere accessible.  In this example, the &amp;lt;code&amp;gt;/mnt/cfcard&amp;lt;/code&amp;gt; directory is used:&lt;br /&gt;
{{clo|indent=1}}&lt;br /&gt;
{{clio|sudo su|hostname=debian|username=user}}&lt;br /&gt;
[sudo] password for user:&amp;lt;br /&amp;gt;&lt;br /&gt;
{{clio|mkdir -p /mnt/cfcard|hostname=debian}}&lt;br /&gt;
{{clio|mount /dev/sdb1 /mnt/cfcard|hostname=debian}}&lt;br /&gt;
{{clio||hostname=debian}} &lt;br /&gt;
{{clos}}&lt;br /&gt;
* Bind mount the device nodes into the filesystem so that LILO will be able to communicate with the flash card:&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio|cd /mnt/cfcard|hostname=debian}}&lt;br /&gt;
{{clio|mount --bind /dev dev/|pwd=/mnt/cfcard|hostname=debian}}&lt;br /&gt;
{{clio| |pwd=/mnt/cfcard|hostname=debian}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; into the filesystem:&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio|chroot .|pwd=/mnt/cfcard|hostname=debian}}&lt;br /&gt;
{{clio||hostname=debian}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
* Run &amp;lt;code&amp;gt;lilo&amp;lt;/code&amp;gt; with the appropriate LILO configuration file.  Be sure to double check to ensure that the configuration file is correct, because a mistake here could render the desktop system unbootable.&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio|lilo -C /etc/lilo.conf.boot|hostname=debian}}&lt;br /&gt;
Warning: '/proc/partitions' does not exist, disk scan bypassed&amp;lt;br /&amp;gt;&lt;br /&gt;
Added emac-oe *&amp;lt;br /&amp;gt;&lt;br /&gt;
One warning was issued.&amp;lt;br /&amp;gt;&lt;br /&gt;
{{clio||hostname=debian}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
Note that the warning here is normal, because LILO is being installed inside a chroot which doesn't have a mounted &amp;lt;code&amp;gt;/proc&amp;lt;/code&amp;gt; virtual filesystem.&lt;br /&gt;
* Exit the chroot and unmount the device:&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio|exit|hostname=debian}}&lt;br /&gt;
{{clio|cd ..|pwd=/mnt/cfcard|hostname=debian}}&lt;br /&gt;
{{clio|umount cfcard|pwd=/mnt|hostname=debian}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
* It is now safe to remove the flash card and put it into the embedded machine.&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Workaround for the Ubuntu Automounter (and Possibly Others)====&lt;br /&gt;
&lt;br /&gt;
On many Linux desktops, a memory card will be automounted when it is inserted.  While this is a nice convenience feature for most users, it comes at the expense of developers.  This automount feature can be a source of frustration for those who haven't already found a way around the issues it causes.&lt;br /&gt;
&lt;br /&gt;
Fortunately, we at EMAC have already found a method which works reliably on our recommended Linux distribution, Ubuntu 14.04 LTS, and have documented it here. On other systems, such as Debian, a workaround may not be needed.  For a system which automounts, see below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;1. Insert the flash card into the development machine's card reader and wait for the file browser window to appear.  If a messagebox appears asking you to choose what to do, tell it to open a file browser for browsing the files on the card.&lt;br /&gt;
* Keep the file browser window open, and stash it away for later use.&lt;br /&gt;
* Open a terminal and create a &amp;lt;code&amp;gt;/mnt/cfcard&amp;lt;/code&amp;gt; directory, if it does not exist:&lt;br /&gt;
{{cli|sudo mkdir /mnt/cfcard|username=user|hostname=ubuntu}}&lt;br /&gt;
* Find out the device name of the card by looking for the location where the card was mounted.  The file browser window will list the name of the card under Devices in the left pane.  Often times, the name will be EMAC_OE.  Look for this name in the output of the &amp;lt;code&amp;gt;df&amp;lt;/code&amp;gt; command:&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio|df -hT | grep EMAC|username=user|hostname=ubuntu}}&lt;br /&gt;
Filesystem                      Type      Size  Used Avail Use% Mounted on&amp;lt;br /&amp;gt;&lt;br /&gt;
/dev/sdb1                       ext3      3.7G  223M  3.3G   7% /media/EMAC_OE&amp;lt;br /&amp;gt;&lt;br /&gt;
{{clos}}&lt;br /&gt;
* From the output of this command, we can see that the &amp;lt;code&amp;gt;/media/EMAC_OE&amp;lt;/code&amp;gt; mountpoint was mounted onto the &amp;lt;code&amp;gt;/dev/sdb1&amp;lt;/code&amp;gt; device.  Therefore, this is the device needed for the next step.&lt;br /&gt;
* Now, switch to the root user account (if not already running as root) and mount the device on the directory from step 3, without unmounting it first:&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio|sudo su|username=user|hostname=ubuntu}}&lt;br /&gt;
&lt;br /&gt;
[sudo] password for user: &lt;br /&gt;
{{clio|mount /dev/sdb1 /mnt/cfcard|hostname=ubuntu}}&lt;br /&gt;
{{clio||hostname=ubuntu}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
* Bind mount the host system's &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt; directory to the cfcard's &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt; directory.  This will provide the device node file that will be needed for LILO to be able to talk to the flash card.&lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio|cd /mnt/cfcard|hostname=ubuntu}}&lt;br /&gt;
{{clio|mount --bind /dev dev/|pwd=/mnt/cfcard|hostname=ubuntu}}&lt;br /&gt;
{{clio||pwd=/mnt/cfcard|hostname=ubuntu}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
* Now, use the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; command to make the directory where the card is mounted the effective root directory for this terminal session:&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio|chroot .|pwd=/mnt/cfcard|hostname=ubuntu}}&lt;br /&gt;
{{clio||pwd=/mnt/cfcard|hostname=ubuntu}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
* Now that the shell is effectively running inside the filesystem on the flash card, LILO can be run to install the bootloader.  First, be sure to double check to ensure that the configuration file you're using points to the correct device node (in this example, &amp;lt;code&amp;gt;/dev/sdb1&amp;lt;/code&amp;gt;) so that you don't overwrite the bootloader on your desktop (see [[Configuring LILO]] for more information).  &lt;br /&gt;
{{warning|If you overwrite the bootloader on your desktop, '''it will render your desktop system unbootable!'''  Make sure to double check this if you value the ability to boot your desktop.}}&lt;br /&gt;
* When you are sure you're using the right device node, run LILO to install the bootloader:&lt;br /&gt;
{{clop}}&lt;br /&gt;
{{cliop|lilo -C /etc/lilo.conf.boot|hostname=ubuntu}}&lt;br /&gt;
Warning: '/proc/partitions' does not exist, disk scan bypassed&lt;br /&gt;
Added emac-oe *&lt;br /&gt;
One warning was issued.&lt;br /&gt;
{{cliop||hostname=ubuntu}}&lt;br /&gt;
{{closp}}&lt;br /&gt;
The warning, in this case, is normal.  It appears because this is a fake &amp;quot;running system,&amp;quot; which means the virtual files in the &amp;lt;code&amp;gt;/proc/&amp;lt;/code&amp;gt; filesystem aren't mounted and able to provide information; hence, the non-existence of the &amp;lt;code&amp;gt;/proc/partitions&amp;lt;/code&amp;gt; file.&lt;br /&gt;
* Now, you need to umount the device:&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio|exit|hostname=ubuntu}}&lt;br /&gt;
{{clio|cd ..|pwd=/mnt/cfcard|hostname=ubuntu}}&lt;br /&gt;
{{clio|umount cfcard/dev|pwd=/mnt|hostname=ubuntu}}&lt;br /&gt;
{{clio|umount cfcard|pwd=/mnt|hostname=ubuntu}}&lt;br /&gt;
{{clio|exit|pwd=/mnt|hostname=ubuntu}}&lt;br /&gt;
{{clio||hostname=ubuntu}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
* Retrieve the file browser that was stashed away earlier, and unmount the automounted directory for the card by clicking on the eject symbol next to the name of the device in the left pane.&lt;br /&gt;
&lt;br /&gt;
* It is now safe to eject the card and put it into the embedded machine.&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Next Steps==&lt;br /&gt;
&lt;br /&gt;
* [[Configuring LILO]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Getting_Started_With_Qt_Creator&amp;diff=5147</id>
		<title>Getting Started With Qt Creator</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Getting_Started_With_Qt_Creator&amp;diff=5147"/>
		<updated>2015-11-16T18:32:12Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| Complete (02.03.2015-10:42-&amp;gt;BS+);(06.18.2015-14:25-&amp;gt;BS+);(06.18.2015-15:48-&amp;gt;KY+);(11.16.2015-11:35-&amp;gt;MD+);(11.16.2015-12:15-&amp;gt;MG+);(11.16.2015-12:20-&amp;gt;KY+)|Brian Serrano| project=OE 5.0,BS,KY,MD,MG,Complete}}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Getting Started with Qt Creator&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Qt Creator, Tutorial, Qt Creator Examples&lt;br /&gt;
|description=The following page can be used to get familiarized with EMAC Qt Creator.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;background:#00FF00;color:#FF0000;font-size:300%&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
The following page demonstrates the process of getting familiar with EMAC Qt Creator and running it on the target machine.&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}&lt;br /&gt;
Qt Creator is a cross-platform Open Source Integrated Development Environment (IDE) that can be used to develop software for many different languages. It includes a visual debugger and an integrated GUI layout and forms designer. &lt;br /&gt;
&lt;br /&gt;
For more information visit the Qt Project site http://qt-project.org/wiki/Category:Tools::QtCreator.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}&lt;br /&gt;
=== Tools Required ===&lt;br /&gt;
* [[Getting_Started_with_the_EMAC_OE_SDK | EMAC OE 5.0 SDK]]&lt;br /&gt;
* EMAC Qt Creator&lt;br /&gt;
* GNU &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;&lt;br /&gt;
* CMake&lt;br /&gt;
=== Setup === &lt;br /&gt;
# Make sure the system has the [[Getting_Started_with_the_EMAC_OE_SDK | EMAC OE 5.0 SDK and tools installed. ]]&lt;br /&gt;
# Launch EMAC Qt Creator.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
After installing the EMAC SDK, launch Qt Creator using the EMAC Qt Creator desktop icon.&lt;br /&gt;
&lt;br /&gt;
1. Press the Start key or Alt + F2 and search for Qt Creator EMAC&lt;br /&gt;
&lt;br /&gt;
2. Put the Qt Creator EMAC icon on the Launcher for easy access.&lt;br /&gt;
&lt;br /&gt;
[[File:EMAC_Qt_Creator_Icon.png|600px|left|thumb|Figure 1: Qt Creator Launcher Icon]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. To generate a new project from Qt Creator, select '''New Project''' on the opening splash window. The examples being used are all written in the &amp;lt;code&amp;gt;C programming&amp;lt;/code&amp;gt; language.&lt;br /&gt;
&lt;br /&gt;
[[File:Qtcreator_gui.png|600px|left|thumb|Figure 2: Qt Creator GUI]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. After selecting '''New Project''' a new window will pop up. To run a &amp;lt;code&amp;gt;C programming&amp;lt;/code&amp;gt; example using EMAC hardware, select '''EMAC Project''' under the Projects tab. Then select '''EMAC C Project (CMake Build)'''. Click the '''Choose''' button on the bottom right of the window to continue to the next page as shown in Figure 3.&lt;br /&gt;
&lt;br /&gt;
[[File:EMAC_C_Project.png|600px|left|thumb|Figure 3: Qt Creator EMAC Project]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. The next page will be '''Introduction and Project Location'''. Select a name for the &amp;lt;code&amp;gt; C &amp;lt;/code&amp;gt; project. Once the project name is given, choose a directory to store the project. Note: It is highly recommended to store your project somewhere other than the default location. For this example, we used &amp;lt;code&amp;gt;/home/developer/Projects&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Project_location1.png|600px|left|thumb|Figure 4: Qt Creator Project Location]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. The next page summarizes the '''EMAC C Project'''. Click '''Finish''' to continue.&lt;br /&gt;
&lt;br /&gt;
[[File:Project_summary1.png|600px|left|thumb|Figure 5: Qt Creator Project Summary]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Next, it will prompt you to enter the '''CMake Wizard Build Location'''. Click '''Next''' to continue. Note: It is highly recommended to use the default build directory as stated below in Figure 6. &lt;br /&gt;
&lt;br /&gt;
[[File:Build_location.png|600px|left|thumb|Figure 6: Qt Creator Build Location]] &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. The '''CMake Wizard''' will then prompt you to '''Run CMake'''. For setting up the Desktop Kit, click '''Run CMake'''; the output should be similar to Figure 7 below. Click '''Finish''' to start new project.&lt;br /&gt;
&lt;br /&gt;
[[File:Run_cmake1.png|600px|left|thumb|Figure 7: Qt Creator Run CMake]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. The next step is to set up the device you will be using for the Qt Creator examples. Click Tools -&amp;gt; Options&lt;br /&gt;
{{note|The board used for this example is the iPac-9x25. The iPac-9x25 is a 32-bit ARM architecture. Make sure to connect power, Ethernet, and serial to the board.}}&lt;br /&gt;
&lt;br /&gt;
10. Select '''Devices''' from the left pane.&lt;br /&gt;
&lt;br /&gt;
[[File:Options_devices.png|600px|left|thumb|Figure 8: Qt Creator Device Option]] &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11. Click the '''Add''' button &lt;br /&gt;
&lt;br /&gt;
12. Select Generic Linux Device, then click '''Start Wizard'''.&lt;br /&gt;
&lt;br /&gt;
[[File:Generic_linux.png|600px|left|thumb|Figure 9: Qt Creator Wizard Selection]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
13. Type in a name, the IP address, the user name, and the password for the device. Use the credentials below to sign in.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;|Table 4: Default Login Credentials &lt;br /&gt;
|-&lt;br /&gt;
! Username !! Password&lt;br /&gt;
|-&lt;br /&gt;
| root || emac_inc&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:Device_connection.png|600px|left|thumb|Figure 10: Qt Creator Configuration Setup]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
14. Click '''Next'''.&lt;br /&gt;
&lt;br /&gt;
15. Click '''Finish'''.&lt;br /&gt;
&lt;br /&gt;
16. A connection will be established with the target device.&lt;br /&gt;
&lt;br /&gt;
[[File:Device_test.png|600px|left|thumb|Figure 11: Qt Creator Device Test]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
17. Click '''Close'''.&lt;br /&gt;
&lt;br /&gt;
18. Click '''Apply'''.&lt;br /&gt;
&lt;br /&gt;
19. Navigate to '''Add Kit''' in the '''Projects''' tab. Under '''Add Kit''', select the architecture for the board being used. Click '''EMAC OE 5.0 arm'''.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Add_kit_arm.jpg|600px|left|thumb|Figure 12: Qt Creator Add Kit]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
20. As previously stated in step 7, it will prompt you to enter the '''CMake Wizard Build Location'''. Click '''Next''' to continue. Note: It is highly recommended to use the default build directory as stated below in Figure 13.&lt;br /&gt;
&lt;br /&gt;
[[File:Add_arm.png|600px|left|thumb|Figure 13: Qt Creator Add Kit Build Location]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
21. The '''CMake Wizard''' will then prompt you to '''Run CMake'''. For setting up the iPac-9x25 ARM kit, click the box next to '''Arguments'''. Copy and paste the string below:   &lt;br /&gt;
 ''-DARCH:STRING=arm''&lt;br /&gt;
{{note|By default, CMake will build the project using the Debug build configuration. If a Release build is needed, see [[Creating_a_New_EMAC_OE_SDK_Project_with_CMake#Debug_Build_Types | this page.]]}}&lt;br /&gt;
&lt;br /&gt;
[[File:Arm_argument_string.png|600px|left|thumb|Figure 14: Qt Creator Argument String]] &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The EMAC SDK provides another architecture kit for x86 hardware. If using an x86 architecture, copy and paste the argument string below into the '''Arguments''' box.  &lt;br /&gt;
 ''-DARCH:STRING=x86''  &lt;br /&gt;
&lt;br /&gt;
22. Once the arguments string is pasted into the box, click '''Run CMake''', and the output should be similar to Figure 15 below. Click '''Finish''' to add the kit to the current project.&lt;br /&gt;
&lt;br /&gt;
[[File:Run_arm_cmake.png|600px|left|thumb|Figure 15: Qt Creator Run CMake]] &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
23. To confirm the kit installed correctly, click on the '''Kit Selector''' tab (Monitor symbol) on the left hand side of the Qt Creator window as shown in Figure 16. Both '''Desktop''' and '''OE 5.0 arm''' kit should be present.&lt;br /&gt;
&lt;br /&gt;
[[File:Arm_kit.jpg|600px|left|thumb|Figure 16: Qt Creator Kits Installed]] &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
24. To run the example project on the target board remotely, you will need to add it to the '''Run Configuration'''. Click on '''Projects'''.&lt;br /&gt;
&lt;br /&gt;
25. Select '''Run''' under the '''OE 5.0 arm''' tab.&lt;br /&gt;
&lt;br /&gt;
26. To '''Run Configuration''', click on '''Add''' and select your project name (on Remote Generic Linux Host). In this case, our project name is Prime_Numbers (on Remote Generic Linux Host).&lt;br /&gt;
&lt;br /&gt;
[[File:Run_config.jpg|600px|left|thumb|Figure 17: Qt Creator Run Configuration]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You are now ready to run the examples below using Qt Creator.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:examples | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}&lt;br /&gt;
This section will show how to run &amp;lt;code&amp;gt;C programming&amp;lt;/code&amp;gt; examples through the Qt Creator IDE.  The example board will be the iPac-9x25. &lt;br /&gt;
&lt;br /&gt;
The first example is a basic &amp;lt;i&amp;gt; hello c &amp;lt;/i&amp;gt; example project. &lt;br /&gt;
&lt;br /&gt;
1. After creating a new project and installing the necessary kits for the target board, navigate to the '''Edit''' tab on Qt Creator. Qt Creator will automatically have the &amp;lt;i&amp;gt; hello c &amp;lt;/i&amp;gt; example uploaded as shown in Figure 18.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char * argv[])&lt;br /&gt;
{&lt;br /&gt;
    printf(&amp;quot;Hello EMAC OE!\n&amp;quot;);&lt;br /&gt;
   &lt;br /&gt;
    exit(EXIT_SUCCESS);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Edit_window.png|600px|left|thumb|Figure 18: Qt Creator Edit Window]] &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Before executing the example, you must build the program. Click on the build icon (hammer symbol) on the bottom left of Qt Creator. If the build was successful, a green progress bar will fill on the bottom right of the window.&lt;br /&gt;
&lt;br /&gt;
3. Once the program successfully builds, you may run the program. Click on the run icon (green arrow symbol) on the left hand side of Qt Creator. The program prints &amp;lt;code&amp;gt; Hello EMAC OE! &amp;lt;/code&amp;gt; in the '''Application Output''' terminal. &lt;br /&gt;
&lt;br /&gt;
[[File:Final_output.png|600px|left|thumb|Figure 19: Qt Creator Edit Window]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second example will show how to run a ''C programming'' project on a target board. This example will show all prime numbers from 1 through 100 on the Qt Creator remote terminal.&lt;br /&gt;
&lt;br /&gt;
1. Create a new project and install the necessary kits for the target board as shown before. Call this project &amp;lt;code&amp;gt; Prime_Numbers &amp;lt;/code&amp;gt;. Then, navigate to the '''Edit''' tab on Qt Creator. Copy and paste the following code (below) to the Qt Creator terminal: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char * argv[])&lt;br /&gt;
{ &lt;br /&gt;
  int i;&lt;br /&gt;
  int j;&lt;br /&gt;
&lt;br /&gt;
  for (i = 2; i &amp;lt;= 100; i++)&lt;br /&gt;
  {&lt;br /&gt;
    for (j = 2; j &amp;lt;= i; j++)&lt;br /&gt;
    {&lt;br /&gt;
      if (i%j==0)&lt;br /&gt;
      {&lt;br /&gt;
        break;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    if (i == j)&lt;br /&gt;
    {&lt;br /&gt;
      printf (&amp;quot;%d is a prime number. \n&amp;quot;, i);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Prime_Numbers_edit.png|600px|left|thumb|Figure 210: Qt Creator Edit Window]] &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Click on the build icon (hammer symbol) on the bottom left of the Qt Creator window. If the build was successful, a green progress bar will be full on the bottom right of the Qt Creator window.&lt;br /&gt;
&lt;br /&gt;
3. Click on the run icon (green arrow symbol) on the left hand side of Qt Creator. The program prints all prime numbers from 1 through 100 in the '''Application Output''' terminal. &lt;br /&gt;
&lt;br /&gt;
[[File:Final_Prime_Numbers.png|600px|left|thumb|Figure 21: Qt Creator Edit Window]] &lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt; &lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}&lt;br /&gt;
This page is a quick getting started tutorial on how to use EMAC Qt Creator for the first time. It shows you how to create an EMAC C Project, how to set up the necessary kits for your target board, how to set up your target board, and how to build and run example projects.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:moreinfo | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}&lt;br /&gt;
* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}&lt;br /&gt;
* [[Getting_Started_with_the_EMAC_OE_SDK | Getting Started with the EMAC OE SDK ]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Configuring_LILO&amp;diff=5126</id>
		<title>Configuring LILO</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Configuring_LILO&amp;diff=5126"/>
		<updated>2015-11-13T22:27:10Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: FinalDraft&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo|FinalDraft (12.16.13-02:25-&amp;gt;MD+);(12.16.13-15:15-&amp;gt;MD+);(12.17.13-11:45-&amp;gt;MW+);(12.17.13-15:25-&amp;gt;KY+);(03.06.14-15:40-&amp;gt;BS-);(03.17.14-13:10-&amp;gt;MD-);(04.11.14-16:50-&amp;gt;BS+);(11.13.2015-16:15-&amp;gt;MD+)(11.13.2015-16:25-&amp;gt;KY+)|Mike Dean|project=oe 4,oe 5,md,FinalDraft,mw,bs}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Configuring LILO&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=LILO,LILO Configuration,LILO config&lt;br /&gt;
|description=This page describes the parts of the LILO bootloader configuration file, and provides guidance on how to work with it.&lt;br /&gt;
}}&lt;br /&gt;
LILO is a bootloader which provides a number of useful features while remaining compact.  This document describes the details behind configuring the LILO bootloader.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Configuring LILO==&lt;br /&gt;
&lt;br /&gt;
As with any software of moderate or better complexity, configuration is required for LILO to function as desired.  The configuration created by EMAC and shipped with a system will usually suffice.  However, sometimes enough customization is required that the bootloader itself will need to be reconfigured.  Even if custom configuration isn't required, some of this information is important for protecting against accidentally overwriting the bootloader on a developer's desktop with a bootloader that was intended for an embedded machine.&lt;br /&gt;
&lt;br /&gt;
This page describes the parts of the LILO bootloader configuration file, and provides guidance on how to work with it.  The other LILO pages describe how to install and use the bootloader after it has been configured.&lt;br /&gt;
&lt;br /&gt;
===Sections of the LILO Configuration File===&lt;br /&gt;
&lt;br /&gt;
The LILO configuration file is split into two sections: global and per-image.  The global section, as the name implies, specifies options that pertain to LILO itself and to all images specified in the file.  The per-image section specifies options that apply to a specific image, some of which may override the global options.&lt;br /&gt;
&lt;br /&gt;
Shown here is the default configuration for most EMAC boards which make use of LILO:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=bash&amp;gt;&lt;br /&gt;
# This tells the LILO utility where to install LILO.  This must be changed if using a desktop&lt;br /&gt;
# system to install LILO to a CompactFlash card.&lt;br /&gt;
boot=/dev/sda&lt;br /&gt;
map=/boot/map&lt;br /&gt;
&lt;br /&gt;
lba32&lt;br /&gt;
# This is where the disk is found on the current system.  See the wiki for more information.&lt;br /&gt;
disk=/dev/sda&lt;br /&gt;
# This indicates that the BIOS will see this drive as the first drive.&lt;br /&gt;
bios=0x80&lt;br /&gt;
read-only&lt;br /&gt;
prompt&lt;br /&gt;
# This sets the prompt to wait for 2.5 seconds before automatically booting the first image.&lt;br /&gt;
# The time is specified in deciseconds.&lt;br /&gt;
timeout=25&lt;br /&gt;
vga=9&lt;br /&gt;
install=text&lt;br /&gt;
compact&lt;br /&gt;
# This is for lilo serial console (ttyS0,9600,8,n,1):&lt;br /&gt;
#serial=0,115200n8&lt;br /&gt;
&lt;br /&gt;
# The following path points to the Linux kernel that LILO should boot.&lt;br /&gt;
image=/boot/bzImage&lt;br /&gt;
	root=/dev/sda1    # This is the root filesystem for the kernel to use.&lt;br /&gt;
	label=emac-oe&lt;br /&gt;
	# These are kernel commandline parameters:&lt;br /&gt;
	append=&amp;quot;console=ttyS0,115200 quiet splash=silent&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Global Options====&lt;br /&gt;
&lt;br /&gt;
The LILO configuration file needs the following options, at a minimum, configured for the global settings:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;disk&amp;lt;/code&amp;gt; This option specifies the disk to which the LILO bootloader needs to be written.  This should always point to the device node currently associated with the disk.  For example, when mounted on a desktop, this may be &amp;lt;code&amp;gt;/dev/sdc&amp;lt;/code&amp;gt;, which is (usually) the third &amp;quot;SCSI&amp;quot; device connected to the system.  The first would be &amp;lt;code&amp;gt;/dev/sda&amp;lt;/code&amp;gt;, the second &amp;lt;code&amp;gt;/dev/sdb&amp;lt;/code&amp;gt;, etc.  Even though the device may not be a SCSI device, it may be mounted via a generic SCSI driver, which is why it can appear as a SCSI device.  If it were mounted through the IDE subsystem instead, its device node would appear like &amp;lt;code&amp;gt;/dev/hdc&amp;lt;/code&amp;gt; instead.&lt;br /&gt;
* &amp;lt;code&amp;gt;map&amp;lt;/code&amp;gt; This option specifies the location of the map file to use.  Usually, this will be &amp;lt;code&amp;gt;/boot/map&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;lba32&amp;lt;/code&amp;gt; This option tells LILO to use 32-bit Logical Block Addresses instead of cylinder/head/sector addresses.  This is needed for any disk with more than 1024 cylinders.  Since the vast majority of modern drives have more than 1024 cylinders, this option should always be specified.&lt;br /&gt;
* &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; This option specifies the device which contains the boot sector.  As with the &amp;lt;code&amp;gt;disk&amp;lt;/code&amp;gt; option, this should always be the device node associated with the disk on the current system.  For example, &amp;lt;code&amp;gt;boot=/dev/sdc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Additional useful options:'''&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;vga&amp;lt;/code&amp;gt; For systems which have video, this option specifies the video mode the device should use.  The parameter to pass comes from the BSP (Board Support Profile) layer for the board.  If unsure what to set here, EMAC can provide assistance with this.&lt;br /&gt;
* &amp;lt;code&amp;gt;serial&amp;lt;/code&amp;gt; This useful option specifies a serial device to which a console should be attached, as well as the configuration settings for the console.  For example, to use the &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; serial device (the default console port on many boards) as a serial console which communicates as 115,200 baud, 8 bits, with no stop bits: &amp;lt;code&amp;gt;serial=0,115200n8&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;timeout&amp;lt;/code&amp;gt; This specifies the amount of time to wait before timing out and continuing on with the boot process using the configured defaults.  This value is specified in deciseconds.  For example, to set this value to 4.3 seconds: &amp;lt;code&amp;gt;timeout=43&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;read-only&amp;lt;/code&amp;gt; This option tells LILO to mount the root filesystem as read-only.  This is usually desired, since the Linux kernel will remount the device as writeable (if it needs to) once the boot process has been handed over to it.&lt;br /&gt;
* &amp;lt;code&amp;gt;install&amp;lt;/code&amp;gt; This option specifies the type of screen which will be seen when the bootloader starts.  Normally, this will be set to &amp;lt;code&amp;gt;text&amp;lt;/code&amp;gt;, which presents the simple interface shown in the examples on this page.  The &amp;lt;code&amp;gt;menu&amp;lt;/code&amp;gt; option provides a nicer way to select an image to boot, but is usually not desirable to have on an embedded machine.  The &amp;lt;code&amp;gt;bitmap&amp;lt;/code&amp;gt; option provides a graphical boot screen which looks very nice on a desktop installation, but is usually only used on an embedded machine when the product calls for showing graphics as early in the boot process as possible; a logo is typically placed here in such a case.&lt;br /&gt;
&lt;br /&gt;
====Per-Image Options====&lt;br /&gt;
&lt;br /&gt;
The following options are needed to configure images to be available to boot with LILO:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;image&amp;lt;/code&amp;gt; This option specifies the location of the kernel to boot.  Commonly, this will be &amp;lt;code&amp;gt;/boot/bzImage&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;/boot/bzImage-custom-3.10.2&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; This option specifies the root partition to mount for the image.  This is typically &amp;lt;code&amp;gt;/dev/hda1&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;/dev/sda1&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;label&amp;lt;/code&amp;gt; This option tells LILO by what name to call the image.  For instance, this is usually &amp;lt;code&amp;gt;label=emac-oe&amp;lt;/code&amp;gt; for a standard EMAC image, but for a custom product under development, it might be &amp;lt;code&amp;gt;label=custom-image-test-v3&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Working with LILO Configurations====&lt;br /&gt;
&lt;br /&gt;
The above information talks about the common options and how to set them.  Additional information can be found by reading through the manual page for &amp;lt;code&amp;gt;lilo.conf&amp;lt;/code&amp;gt;.  This manpage is available on many sites online.&lt;br /&gt;
&lt;br /&gt;
Actually using these options to create a configuration file is done most easily by copying the EMAC provided LILO configuration file, then modifying the copy.  It is a good practice to make sure a bootable flash card is set aside in case of difficulties with getting the modified flash card back into a bootable state.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=MD | title=System Logging | desc=The page describes how to system log. | project=OE 5.0 }}&lt;br /&gt;
LILO has a straightforward configuration syntax, but the details may not be immediately apparent.  This documentation should fill in the missing pieces when you are configuring LILO.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=MD | title=System Logging | desc=The page describes how to system log. | project=OE 5.0 }}&lt;br /&gt;
* [[Installing_LILO | Installing LILO]]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=MD | title=System Logging | desc=The page describes how to system log. | project=OE 5.0 }}&lt;br /&gt;
* [[LILO_Overview | LILO Overview]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Opkg&amp;diff=5124</id>
		<title>Opkg</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Opkg&amp;diff=5124"/>
		<updated>2015-11-13T22:18:15Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: Final Draft&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| FinalDraft (11.12.2014-18:38-&amp;gt;MD+);(11.05.2015-19:20-&amp;gt;MD+);(11.06.2015-16:10-&amp;gt;MD+);(11.06.2015-17:25-&amp;gt;MD+);(11.13.2015-16:15-&amp;gt;KY+)|Mike Dean| project=OE 5,MD,FinalDraft }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=OPKG&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=opkg,yocto,openembedded&lt;br /&gt;
|description=Package Management with OPKG&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;pagedesc&amp;quot;&amp;gt;&lt;br /&gt;
Every modern operating system is expected to host a variety of software applications and libraries.  Managing their installation, upgrade, and removal has become more complex as software has become more sophisticated.  Additionally, the pervasive presence of the Internet has driven an expectation by users of an ability to perform OS updates and upgrades via the Internet.  This page describes the tool used by EMAC OE to cater to these needs and expectations.&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:bg | initials=MD | title=OPKG | desc=Package Management with OPKG | project=OE 5 }}&lt;br /&gt;
There are many package managers used for Linux systems.  You may already be familiar with the ones most popularly used in desktop and server distributions of Linux: &amp;lt;code&amp;gt;apt&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;apt-get&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;aptitude&amp;lt;/code&amp;gt;, etc), &amp;lt;code&amp;gt;rpm&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;yum&amp;lt;/code&amp;gt;.  You may even be familiar with some of the less popular ones, such as &amp;lt;code&amp;gt;emerge&amp;lt;/code&amp;gt; (from gentoo's &amp;lt;code&amp;gt;portage&amp;lt;/code&amp;gt;), the Mac OS X GNU tools package manager &amp;lt;code&amp;gt;brew&amp;lt;/code&amp;gt;, and the BSD package manager, &amp;lt;code&amp;gt;ports&amp;lt;/code&amp;gt;.  The package manager used by EMAC OE is similar to these tools, but is the popular choice for embedded Linux: &amp;lt;code&amp;gt;opkg&amp;lt;/code&amp;gt;.  If you're already familiar with any of the desktop/server package managers listed here, &amp;lt;code&amp;gt;opkg&amp;lt;/code&amp;gt; should be very easy to learn since it is quite similar to all of those tools.  If not, it should still be easy to learn because it has a well designed interface.&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:geninfo | initials=MD | title=OPKG | desc=Package Management with OPKG | project=OE 5 }}&lt;br /&gt;
The basic capabilities of &amp;lt;code&amp;gt;opkg&amp;lt;/code&amp;gt; are available in OE 4.0 and earlier, but no packages are available online for these older versions.  EMAC OE 5.0 adds an online package repository complete with important updates for packages during the support window for each release.  EMAC creates and hosts packages for all of our standard offerings, and may add updated packages as needed.  EMAC recommends checking for and installing any updates available for your OE 5.x system prior to creating the final image which will be used to deploy your systems to ensure your image contains the latest bug fixes and security patches.  It is important to remember to retest your application after an update to ensure that everything still works as expected, just as you would have to do for a desktop application.&lt;br /&gt;
&lt;br /&gt;
Should your application require the ability to be updated/upgraded remotely, EMAC is able to provide assistance and services for creating custom packages for your application and hosting these packages for a modest fee.  We will also assist you with configuring the systems to check for and install these updates.  Please contact EMAC support should you need more information about this extra level of support.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;opkg&amp;lt;/code&amp;gt; tool is used to work with the OPKG package management system.  This tool provides the user with many different capabilities.  In this document, only the basic capabilities are described.  More information can be found in the last section of this page.&lt;br /&gt;
{{:Templateimpl:using | initials=MD | title=OPKG | desc=Package Management with OPKG | project=OE 5 }}&lt;br /&gt;
The following basic capabilities are shown in this document:&lt;br /&gt;
&lt;br /&gt;
* Updating the list of available packages.&lt;br /&gt;
* Upgrading the system.&lt;br /&gt;
* Finding packages to install.&lt;br /&gt;
* Installing new packages.&lt;br /&gt;
* Removing packages.&lt;br /&gt;
&lt;br /&gt;
=== Updating the List of Available Packages ===&lt;br /&gt;
&lt;br /&gt;
The OPKG Package Manager keeps a local cache of the list of available packages so that it doesn't have to reach out to the Internet every time the user wishes to use this list in any way.  This list is updated on demand, rather than periodically, so it's important to update this list before attempting to search for or install any new packages, or attempting to upgrade the system.&lt;br /&gt;
&lt;br /&gt;
To update the cached list of available packages, run:&lt;br /&gt;
&lt;br /&gt;
{{cli|opkg update}}&lt;br /&gt;
&lt;br /&gt;
Note that you must be root in order to update this list.&lt;br /&gt;
&lt;br /&gt;
=== Upgrading the System ===&lt;br /&gt;
&lt;br /&gt;
You can use &amp;lt;code&amp;gt;opkg&amp;lt;/code&amp;gt; to upgrade the system by selectively telling it which packages to upgrade.  You first need to obtain a list of available packages to upgrade with the following command:&lt;br /&gt;
&lt;br /&gt;
{{cli|opkg list-upgradable}}&lt;br /&gt;
&lt;br /&gt;
You can then upgrade a package with this command:&lt;br /&gt;
&lt;br /&gt;
{{cli|opkg upgrade ''packagename''}}&lt;br /&gt;
&lt;br /&gt;
=== Finding Packages to Install ===&lt;br /&gt;
&lt;br /&gt;
==== Listing Packages ====&lt;br /&gt;
&lt;br /&gt;
There is more than one way to look through packages to see what's available to be installed.  The first is the &amp;lt;code&amp;gt;list&amp;lt;/code&amp;gt; command by itself:&lt;br /&gt;
&lt;br /&gt;
{{cli|opkg list}}&lt;br /&gt;
&lt;br /&gt;
This provides a complete list of all available packages.  ''If you're already comfortable with the Linux command line, you may now wish to skip to the section entitled, &amp;quot;Installing New Pacakges.&amp;quot;  If not, the following content shows how to more easily work with this output.''&lt;br /&gt;
&lt;br /&gt;
==== Browsing the Package List ====&lt;br /&gt;
&lt;br /&gt;
As usual on the Linux command line, this long list can be made much easier to peruse by piping the output of the &amp;lt;code&amp;gt;opkg list&amp;lt;/code&amp;gt; command into the &amp;lt;code&amp;gt;less&amp;lt;/code&amp;gt; command, like so:&lt;br /&gt;
&lt;br /&gt;
{{cli|opkg list {{!}} less}}&lt;br /&gt;
&lt;br /&gt;
{{note|Unlike the &amp;lt;code&amp;gt;more&amp;lt;/code&amp;gt; command, the &amp;lt;code&amp;gt;less&amp;lt;/code&amp;gt; command allows you to scroll bidirectionally through a text file.  It also allows you to search through a document using regular expressions; press the &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; key followed by some text (or a basic regular expression) for which you would like to search.  This can be used to directly read a text file as well: {{icli|less some_text_file}}}}&lt;br /&gt;
&lt;br /&gt;
==== Filtering the Package List ====&lt;br /&gt;
&lt;br /&gt;
Often times, you will wish to search for something more specific.  The &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; command is very useful for this task.  The most basic use of grep looks like this:&lt;br /&gt;
&lt;br /&gt;
{{cli|opkg list {{!}} grep ''packagename''}}&lt;br /&gt;
&lt;br /&gt;
If you're not sure of the full package name, you can put in just a part of the name, since grep doesn't match against whole words by default.&lt;br /&gt;
&lt;br /&gt;
===== Matching Whole Words =====&lt;br /&gt;
&lt;br /&gt;
If, on the other hand, you want it to match against a whole word, you can enclose the word with escaped angle brackets:&lt;br /&gt;
&lt;br /&gt;
{{cli|opkg list {{!}} grep \&amp;lt;''packagename''\&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
This tells &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; to only match against the full word represented by ''packagename''.  Use only the opening angle bracket if you only want it to look for a word that starts with ''packagename'', and likewise, only use the closing angle bracket at the end if you only want it to search for a word that ends with ''packagename''.&lt;br /&gt;
&lt;br /&gt;
===== More Stringent Filtering =====&lt;br /&gt;
&lt;br /&gt;
If the search is returning too many results because the word you're looking for is found in package descriptions, you may want to try using the beginning of line glob character, the caret:&lt;br /&gt;
&lt;br /&gt;
{{cli|opkg list{{!}} grep ^''packagename''}}&lt;br /&gt;
&lt;br /&gt;
This will cause only lines which begin with ''packagename'' to be displayed.&lt;br /&gt;
&lt;br /&gt;
===== More Information about Filtering the Package List =====&lt;br /&gt;
&lt;br /&gt;
There are many more advanced regular expressions which can be used with grep.  These will allow you to do things like match wildcards from the beginning of the line up to the characters you specify after the wildcard (which you might do if you know the package name contains a word, but doesn't start with that word, yet the word is too common to allow it to search through all of the text), but this should be enough to get you started.  There are many in depth resources for the usage of &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; available online.&lt;br /&gt;
&lt;br /&gt;
=== Installing New Packages ===&lt;br /&gt;
&lt;br /&gt;
Once you have found a package or list of packages you wish to install, the &amp;lt;code&amp;gt;opkg&amp;lt;/code&amp;gt; command makes installation simple:&lt;br /&gt;
&lt;br /&gt;
{{cli|opkg install ''packagename''}}&lt;br /&gt;
&lt;br /&gt;
This will download and install ''packagename'' and all of its dependencies for you.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you would like to install more than one at a time, you can do so by specifying them as a space-separated list:&lt;br /&gt;
&lt;br /&gt;
{{cli|opkg install ''package1'' ''package2'' ''package3'' ''etc''}}&lt;br /&gt;
&lt;br /&gt;
As before, all of the dependencies for the packages specified will be automatically downloaded and installed by &amp;lt;code&amp;gt;opkg&amp;lt;/code&amp;gt; as well.&lt;br /&gt;
&lt;br /&gt;
=== Removing Packages ===&lt;br /&gt;
&lt;br /&gt;
When you have installed a package that you no longer want to have on your system, &amp;lt;code&amp;gt;opkg&amp;lt;/code&amp;gt; provides the &amp;lt;code&amp;gt;remove&amp;lt;/code&amp;gt; command for removal of the package:&lt;br /&gt;
&lt;br /&gt;
{{cli|opkg remove ''packagename''}}&lt;br /&gt;
&lt;br /&gt;
If there is anything that depends on it, &amp;lt;code&amp;gt;opkg&amp;lt;/code&amp;gt; will output an error message indicating that packages depend on it.&lt;br /&gt;
&lt;br /&gt;
You can add the &amp;lt;code&amp;gt;--force-removal-of-dependent-packages&amp;lt;/code&amp;gt; to force it to remove the package and everything that depends on it:&lt;br /&gt;
&lt;br /&gt;
{{cli|opkg remove --force-removal-of-dependent-packages ''packagename''}}&lt;br /&gt;
&lt;br /&gt;
{{Caution|The very verbose argument name is required because this can be a dangerous way to remove packages.  The length of the argument's name (&amp;lt;code&amp;gt;--force-removal-of-dependent-packages&amp;lt;/code&amp;gt;)is intended to remind you of the danger.  You may find yourself with an unbootable system if you uninstall a package which was depended upon by important system packages.  It's generally wiser to use the less heavy handed version, &amp;lt;code&amp;gt;--force-depends&amp;lt;/code&amp;gt;, which will only remove the package and the dependencies which are one layer deep:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cli|opkg remove --force-depends ''packagename''}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If more than one layer of dependencies needs to be removed, you should use the &amp;lt;code&amp;gt;remove&amp;lt;/code&amp;gt; command without either of these options.  Use it on each dependency layer to see what depends upon those dependencies, and continue this procedure recursively to ensure that nothing important will be removed before you attempt to remove a package with the heavy handed variant.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
If you do render your system unbootable, you may contact EMAC, and we will help you get your system back into a usable state for a small fee.  If you would prefer to avoid this fee, please be very careful about what you remove since damage to the filesystem caused by misuse of the above commands is not covered under the EMAC warranty.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:examples | initials=MD | title=OPKG | desc=Package Management with OPKG | project=OE 5 }}&lt;br /&gt;
{{example|Removing a Package which has Dependencies}}&lt;br /&gt;
&lt;br /&gt;
{{clo}}&lt;br /&gt;
{{clio|opkg remove alsa-conf-base}}&lt;br /&gt;
No packages removed.&amp;lt;br /&amp;gt;&lt;br /&gt;
Collected errors:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;* print_dependents_warning: Package alsa-conf-base is depended upon by packages:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;* print_dependents_warning: 	libasound2&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;* print_dependents_warning: These might cease to work if package alsa-conf-base is removed.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;* print_dependents_warning: Force removal of this package with --force-depends.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;* print_dependents_warning: Force removal of this package and its dependents&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;* print_dependents_warning: with --force-removal-of-dependent-packages.&amp;lt;br /&amp;gt;&lt;br /&gt;
{{clio|opkg remove --force-depends alsa-conf-base}}&lt;br /&gt;
Removing package alsa-conf-base from root...&lt;br /&gt;
{{clio|}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
{{example|Updating a Package}}&lt;br /&gt;
&lt;br /&gt;
{{clop}}&lt;br /&gt;
{{cliop|opkg update}}&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Downloading ftp://oe50@ftp.emacinc.com/all/Packages.gz.&lt;br /&gt;
Inflating ftp://oe50@ftp.emacinc.com/all/Packages.gz.&lt;br /&gt;
Downloading ftp://oe50@ftp.emacinc.com/ipac9x25/Packages.gz.&lt;br /&gt;
Inflating ftp://oe50@ftp.emacinc.com/ipac9x25/Packages.gz.&lt;br /&gt;
Downloading ftp://oe50@ftp.emacinc.com/armv5e/Packages.gz.&lt;br /&gt;
Inflating ftp://oe50@ftp.emacinc.com/armv5e/Packages.gz.&lt;br /&gt;
Collected errors:&lt;br /&gt;
 * opkg_update_cmd: Not able to update list of packages in /var/lib/opkg/all.&lt;br /&gt;
 * opkg_update_cmd: Not able to update list of packages in /var/lib/opkg/ipac9x25.&lt;br /&gt;
 * opkg_update_cmd: Not able to update list of packages in /var/lib/opkg/armv5e.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;{{closp}}&lt;br /&gt;
If you've forgotten to remount your root filesystem as rw, you'll see output similar to that shown above.  Remount the filesystem rw and try again:&lt;br /&gt;
{{clop}}&lt;br /&gt;
{{cliop|opkg update}}&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Downloading ftp://oe50@ftp.emacinc.com/all/Packages.gz.&lt;br /&gt;
Inflating ftp://oe50@ftp.emacinc.com/all/Packages.gz.&lt;br /&gt;
Updated list of available packages in /var/lib/opkg/all.&lt;br /&gt;
Downloading ftp://oe50@ftp.emacinc.com/ipac9x25/Packages.gz.&lt;br /&gt;
Inflating ftp://oe50@ftp.emacinc.com/ipac9x25/Packages.gz.&lt;br /&gt;
Updated list of available packages in /var/lib/opkg/ipac9x25.&lt;br /&gt;
Downloading ftp://oe50@ftp.emacinc.com/armv5e/Packages.gz.&lt;br /&gt;
Inflating ftp://oe50@ftp.emacinc.com/armv5e/Packages.gz.&lt;br /&gt;
Updated list of available packages in /var/lib/opkg/armv5e.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
{{cliop|opkg list-upgradable}}&lt;br /&gt;
u-boot-fw-utils - v2014.07+git0+91fbeacdf3-r0 - v2015.04+git0+5feae908fd-r0&lt;br /&gt;
libssl1.0.0 - 1.0.2a-r0 - 1.0.2d-r0&lt;br /&gt;
tzdata-pacific - 2015b-r0 - 2015d-r0&lt;br /&gt;
tzdata - 2015b-r0 - 2015d-r0&lt;br /&gt;
openssl-conf - 1.0.2a-r0 - 1.0.2d-r0&lt;br /&gt;
libcrypto1.0.0 - 1.0.2a-r0 - 1.0.2d-r0&lt;br /&gt;
tzdata-arctic - 2015b-r0 - 2015d-r0&lt;br /&gt;
tzdata-africa - 2015b-r0 - 2015d-r0&lt;br /&gt;
tzdata-europe - 2015b-r0 - 2015d-r0&lt;br /&gt;
tzdata-americas - 2015b-r0 - 2015d-r0&lt;br /&gt;
tzdata-atlantic - 2015b-r0 - 2015d-r0&lt;br /&gt;
tzdata-australia - 2015b-r0 - 2015d-r0&lt;br /&gt;
tzdata-antarctica - 2015b-r0 - 2015d-r0&lt;br /&gt;
tzdata-asia - 2015b-r0 - 2015d-r0&lt;br /&gt;
{{cliop|opkg upgrade libssl1.0.0 openssl-conf}}&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Upgrading libssl1.0.0 from 1.0.2a-r0 to 1.0.2d-r0 on root.&lt;br /&gt;
Downloading ftp://oe50opkg:opkgoe50123@ftp.emacinc.com/armv5e/libssl1.0.0_1.0.2d-r0_armv5e.ipk.&lt;br /&gt;
Upgrading libcrypto1.0.0 from 1.0.2a-r0 to 1.0.2d-r0 on root.&lt;br /&gt;
Downloading ftp://oe50opkg:opkgoe50123@ftp.emacinc.com/armv5e/libcrypto1.0.0_1.0.2d-r0_armv5e.ipk.&lt;br /&gt;
Upgrading openssl-conf from 1.0.2a-r0 to 1.0.2d-r0 on root.&lt;br /&gt;
Downloading ftp://oe50opkg:opkgoe50123@ftp.emacinc.com/armv5e/openssl-conf_1.0.2d-r0_armv5e.ipk.&lt;br /&gt;
Configuring openssl-conf.&lt;br /&gt;
Configuring libcrypto1.0.0.&lt;br /&gt;
Configuring libssl1.0.0.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
{{cliop|}}&lt;br /&gt;
{{closp}}&lt;br /&gt;
&lt;br /&gt;
Here, the &amp;lt;code&amp;gt;libssl1.0.0&amp;lt;/code&amp;gt; package and the &amp;lt;code&amp;gt;openssl-conf&amp;lt;/code&amp;gt; package were both upgraded simultaneously by specifying them to &amp;lt;code&amp;gt;opkg upgrade&amp;lt;/code&amp;gt; as a space delimited list.&lt;br /&gt;
&lt;br /&gt;
{{example|Installing a New Package}}&lt;br /&gt;
&lt;br /&gt;
{{clop}}&lt;br /&gt;
{{cliop|opkg update}}&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Downloading ftp://oe50@ftp.emacinc.com/all/Packages.gz.&lt;br /&gt;
Inflating ftp://oe50@ftp.emacinc.com/all/Packages.gz.&lt;br /&gt;
Updated list of available packages in /var/lib/opkg/all.&lt;br /&gt;
Downloading ftp://oe50@ftp.emacinc.com/ipac9x25/Packages.gz.&lt;br /&gt;
Inflating ftp://oe50@ftp.emacinc.com/ipac9x25/Packages.gz.&lt;br /&gt;
Updated list of available packages in /var/lib/opkg/ipac9x25.&lt;br /&gt;
Downloading ftp://oe50@ftp.emacinc.com/armv5e/Packages.gz.&lt;br /&gt;
Inflating ftp://oe50@ftp.emacinc.com/armv5e/Packages.gz.&lt;br /&gt;
Updated list of available packages in /var/lib/opkg/armv5e.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
{{cliop|opkg list {{!}} grep iptables -A 2}}&amp;lt;nowiki&amp;gt;&lt;br /&gt;
iptables - 1.4.21-r0 - Tools for managing kernel packet filtering capabilities  iptables is the&lt;br /&gt;
 userspace command line program used to configure and   control network&lt;br /&gt;
 packet filtering code in Linux.&lt;br /&gt;
iptables-dbg - 1.4.21-r0 - Tools for managing kernel packet filtering capabilities - Debugging files&lt;br /&gt;
 iptables is the userspace command line program used to configure and&lt;br /&gt;
 control network packet filtering code in Linux.  This package contains&lt;br /&gt;
 ELF symbols and related sources for debugging purposes.&lt;br /&gt;
iptables-dev - 1.4.21-r0 - Tools for managing kernel packet filtering capabilities - Development&lt;br /&gt;
 files  iptables is the userspace command line program used to configure&lt;br /&gt;
 and   control network packet filtering code in Linux.  This package&lt;br /&gt;
 contains   symbolic links, header files, and related items necessary for&lt;br /&gt;
--&lt;br /&gt;
iptables-doc - 1.4.21-r0 - Tools for managing kernel packet filtering capabilities - Documentation&lt;br /&gt;
 files  iptables is the userspace command line program used to configure&lt;br /&gt;
 and   control network packet filtering code in Linux.  This package&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
{{cliop|opkg install iptables-doc}}&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Installing iptables-doc (1.4.21-r0) on root.&lt;br /&gt;
Downloading ftp://oe50@ftp.emacinc.com/armv5e/iptables-doc_1.4.21-r0_armv5e.ipk.&lt;br /&gt;
Configuring iptables-doc.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
{{cliop|}}&lt;br /&gt;
{{closp}}&lt;br /&gt;
&lt;br /&gt;
If you try to install a package which is already installed, it will check to see if it's up to date:&lt;br /&gt;
&lt;br /&gt;
{{clop}}&lt;br /&gt;
{{cliop |opkg install iptables}}&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Package iptables (1.4.21-r0) installed in root is up to date.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
{{cliop|}}&lt;br /&gt;
{{closp}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:conclusion | initials=MD | title=OPKG | desc=Package Management with OPKG | project=OE 5 }}&lt;br /&gt;
This article demonstrated the basic usage of &amp;lt;code&amp;gt;opkg&amp;lt;/code&amp;gt;, but did not cover any of the more advanced topics.  Topics covered in this article include installing software, updating software, removing software, and searching for available packages.&lt;br /&gt;
&lt;br /&gt;
More advanced topics are covered in other articles, such as configuring &amp;lt;code&amp;gt;opkg&amp;lt;/code&amp;gt;, inspecting package metadata and package contents, and creating packages.  Look to the last section of this article if you need more information on these topics.&lt;br /&gt;
&lt;br /&gt;
The EMAC opkg package repository contains a wealth of software you can install to customize and enhance the environment of your EMAC OE Linux machine.  While a great deal of additional functionality is provided with the standard EMAC opkg repository, you may not be able to find a particular package you need.  If you encounter this situation, you may contact EMAC support to request the creation of a custom package for you.  EMAC is able to provide custom packages for most opensource software, and can recommend good alternatives in cases where a specific software package has been found to work or perform poorly (or not at all) in an embedded environment.  EMAC charges a nominal fee to provide this package, but this fee includes support for the package as well.&lt;br /&gt;
&lt;br /&gt;
The EMAC opkg repository is a great source of additional functionality for your machine, but even more importantly, the EMAC opkg repository is a source of updates for the software installed on your machine.  Taking advantage of the EMAC opkg repository to update your systems helps to ensure that your systems will be protected from the latest threats, such as the Heartbleed OpenSSL vulnerability that made a big splash in the recent past.&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=MD | title=OPKG | desc=Package Management with OPKG | project=OE 5 }}&lt;br /&gt;
* [[opkg:installedPkgs|Working with Installed Packages]]&lt;br /&gt;
* [[opkg:configuration|Configuring the Package Manager]]&lt;br /&gt;
* [[opkg::advanced|Advanced Package Management]]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=MD | title=OPKG | desc=Package Management with OPKG | project=OE 5 }}&lt;br /&gt;
* [[Install_the_EMAC_SDK#Install_Using_apt_.28Recommended.29 | Installing EMAC Packages Using Apt]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Wifi&amp;diff=5114</id>
		<title>Wifi</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Wifi&amp;diff=5114"/>
		<updated>2015-11-13T20:46:15Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: Complete&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| Complete (10.20.2015-14:23-&amp;gt;JJ+);(10.20.2015-13:43-&amp;gt;JJ+);(10.23.2015-11:50-&amp;gt;MD-);(10.26.2015-16:50-&amp;gt;JJ+);(10.27.2015-15:30-&amp;gt;JJ+); (10.28.2015-15:05-&amp;gt;JJ+);(10.28.2015-16:35-&amp;gt;MD-); (11.2.2015-14:45-&amp;gt;JJ+); (11.3.2015-19:35-&amp;gt;MD-); (11.4.2015-14:40-&amp;gt;JJ+);(11.05.2015-15:40-&amp;gt;MD+); (11.10.2015-15:05-&amp;gt;JJ-);(11.13.2015-14:00-&amp;gt;MG+);(11.13.2015-14:44-&amp;gt;KY+)|Jeffrey Jung| project=OE 5.0,Complete,JJ,MD,MG }}&lt;br /&gt;
{{#seo:wireless, wifi, networking&lt;br /&gt;
|title=Wireless Networking&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Linux wifi,embedded wifi&lt;br /&gt;
|description=How to access a wireless network&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This guide will illustrate how to set up and connect to a wireless network using the ThinkPenguin Wireless N USB Adapter for GNU/Linux and the built-in WiFi on the SoM-200GS carrier.&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--Background Information--&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=JJ | title=Wireless Networking | desc=How to access a wireless network | project=OE 5.0 }} &lt;br /&gt;
While many boards from EMAC are not natively designed to connect to wireless networks, most of these systems do have USB ports. Using a USB wireless network adapter, a system can be equipped with wireless networking capability. Such a USB adapter can be ordered by contacting the [mailto:sales@emacinc.com sales team] here at EMAC. Request the product by its part number, PER-USB-00005-R.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This page describes the actions needed to connect to a wireless network using either a wireless network USB adapter, or the built-in Wi-Fi found on EMAC products like the SoM-200GS carrier. We chose to use the ThinkPenguin USB adapter for this page because it is well supported by the Linux kernel.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- General Information--&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=JJ | title=Wireless Networking | desc=How to access a wireless network | project=OE 5.0 }} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Set Up Instructions --&amp;gt;&lt;br /&gt;
===Set Up=== &lt;br /&gt;
Before the device can be connected to the network, some additional software may need to be installed. Boards with Wi-Fi built in should already have the proper software and drivers to support connecting to a wireless network. If so, skip to the [[#Wireless Networking|Wireless Networking]] section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;1. In order to obtain the new packages, connect the system to a physical network.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This process requires modifying some system files, so start by enabling read and write permissions to the filesystem. &lt;br /&gt;
{{cli | indent=2 | mount -o remount,rw / | hostname=ipac9x25 }} &lt;br /&gt;
&lt;br /&gt;
* A check for any updates to the package list is typically a good practice before installing new software. Use the &amp;lt;code&amp;gt;opkg&amp;lt;/code&amp;gt; manager to update the package list.  &lt;br /&gt;
{{cli | indent=2 | opkg update | hostname=ipac9x25 }}&lt;br /&gt;
&lt;br /&gt;
* One of the best tools to establish the connection to wireless networks is the &amp;lt;code&amp;gt;wpa-supplicant&amp;lt;/code&amp;gt; package. This supplicant will allow the system to make connections to WPA and WPA2 protected networks. Install this package with the &amp;lt;code&amp;gt;opkg&amp;lt;/code&amp;gt; tool. &lt;br /&gt;
{{cli | indent=2 | opkg install wpa-supplicant | hostname=ipac9x25 }} &lt;br /&gt;
&lt;br /&gt;
* Install the wireless firmware&lt;br /&gt;
 * If using the USB adapter, the appropriate firmware may need to be installed. The ThinkPenguin USB adapter requires the installation of the &amp;lt;code&amp;gt;linux-firmware-ath9k&amp;lt;/code&amp;gt; package.  &lt;br /&gt;
{{cli | indent=2 | opkg install linux-firmware-ath9k | hostname=ipac9x25}} &lt;br /&gt;
&lt;br /&gt;
 * The firmware package for the built-in Wi-Fi on EMAC's 200GS carrier board is &amp;lt;code&amp;gt;linux-firmware-sd8787&amp;lt;/code&amp;gt;. &lt;br /&gt;
{{cli | indent=2 | opkg install linux-firmware-sd8787}}&lt;br /&gt;
&lt;br /&gt;
* Independent of whether you're connecting with an adapter or using built-in capabilities, the &amp;lt;code&amp;gt;iw&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;wireless-tools&amp;lt;/code&amp;gt; packages will complete the needed software to get a connection started. &lt;br /&gt;
{{cli | indent=2 | opgk install iw | hostname=ipac9x25}}&lt;br /&gt;
{{cli | indent=2 | opkg install wireless-tools | hostname=ipac9x25 }} &lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All the necessary software required to make the wireless connection has now been obtained. The USB adapter can now be plugged in and will be recognized by the operating system.&lt;br /&gt;
&amp;lt;!-- Wireless Networking --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=JJ | title=Wireless Networking | desc=How to access a wireless network | project=OE 5.0 }} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using the packages that have just been installed, the system can be connected to the wireless network.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;cl&amp;gt;1. Changes to some configuration files will be necessary, so remount the root filesystem with read and write permissions.&lt;br /&gt;
{{cli | indent=2 |  mount -o remount,rw / | hostname=ipac9x25}} &lt;br /&gt;
&lt;br /&gt;
* Wireless networks can be found using the scan option of &amp;lt;code&amp;gt;iw&amp;lt;/code&amp;gt;.&lt;br /&gt;
{{cli | indent=2 | iw dev wlan0 scan | hostname=ipac9x25}} &lt;br /&gt;
: A detailed list of the nearby networks will be printed out to the terminal. To identify the SSIDs and respective signal strengths of the network(s) more easily, pipe the output of the &amp;lt;code&amp;gt;iw scan&amp;lt;/code&amp;gt; command through &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; to scan for the keywords &amp;quot;SSID&amp;quot; or &amp;quot;signal&amp;quot;. The closer the value of the signal strength is to 0, the stronger the connection.&lt;br /&gt;
{{clo | indent=2}}&lt;br /&gt;
{{clio| iw dev wlan0 scan {{!}} grep SSID|hostname=ipac9x25}}&lt;br /&gt;
:SSID: EMAC-A&lt;br /&gt;
{{clio| iw dev wlan0 scan {{!}} grep signal|hostname=ipac9x25}}&lt;br /&gt;
:signal: -78.00dBm&lt;br /&gt;
{{clio||hostname=ipac9x25}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;/etc/wpa_supplicant.conf&amp;lt;/code&amp;gt; file will need to be modified to provide the necessary connection information, the details of which depend upon the type of encryption used for the wireless network. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* For an open network, uncomment the following lines in &amp;lt;code&amp;gt;/etc/wpa_supplicant.conf&amp;lt;/code&amp;gt; and fill in the correct SSID for the network to which the machine should connect.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=bash&amp;gt;&lt;br /&gt;
###open network&lt;br /&gt;
#network={&lt;br /&gt;
#      ssid=&amp;quot;SSID&amp;quot;&lt;br /&gt;
#      scan_ssid=1&lt;br /&gt;
#       key_mgmt=NONE&lt;br /&gt;
#} &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Networks protected by either WEP or WPA2 encryption will need a pre-shared key (PSK), which is generated for the specific network and its password. To get the PSK, use &amp;lt;code&amp;gt;wpa_passphrase&amp;lt;/code&amp;gt; with the SSID and password for the desired network as arguments. Copy the last psk line and paste into the &amp;lt;code&amp;gt;/etc/wpa_supplicant.conf&amp;lt;/code&amp;gt; file.&lt;br /&gt;
{{clo|indent=2}}&lt;br /&gt;
{{clio | indent=2 | wpa_passphrase SSID Password |hostname=ipac9x25}}&lt;br /&gt;
network={&lt;br /&gt;
:ssid=&amp;quot;SSID&amp;quot;&lt;br /&gt;
:&amp;amp;#35;psk=&amp;quot;Password&amp;quot;&lt;br /&gt;
:psk=b99d2c0fb66194f93ad52b71051e1095dc76e12529321334b3feb18332608eb7&lt;br /&gt;
}&lt;br /&gt;
{{clos}}&lt;br /&gt;
&lt;br /&gt;
* The contents of the &amp;lt;code&amp;gt;/etc/wpa_supplicant.conf&amp;lt;/code&amp;gt; should now look similar to the following:&lt;br /&gt;
{{clo|indent=2}}&lt;br /&gt;
{{clio | cat /etc/wpa_supplicant.conf | hostname=ipac9x25}}&lt;br /&gt;
network={&lt;br /&gt;
:ssid=&amp;quot;SSID&amp;quot;&lt;br /&gt;
:proto=WPA&lt;br /&gt;
:key_mgmt=WPA-PSK&lt;br /&gt;
:psk=b99d2c0fb66194f93ad52b71051e1095dc76e12529321334b3feb18332608eb7&lt;br /&gt;
}&amp;lt;br /&amp;gt;&lt;br /&gt;
{{clio||hostname=ipac9x25}}&lt;br /&gt;
{{clos}}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The {{icli | /etc/init.d/wpa_supplicant start | hostname=ipac9x25}} command will attempt to establish a connection with the network. &lt;br /&gt;
&lt;br /&gt;
: As the command is running, watch the terminal output for the status of the connection. A connection has been established when output stops and the last line reads:&lt;br /&gt;
{{clo | indent=2}}IPv6 ADDRCONF(NETDEV_CHANGE):wlan0: link becomes ready{{clos}}&lt;br /&gt;
&lt;br /&gt;
:A connection has failed if output to the terminal continues and the following line is seen repeatedly:&lt;br /&gt;
{{clo | indent=2}}IPv6: ADDRCONF(NETDEV_UP):wlan0: link is not ready{{clos}}&lt;br /&gt;
&lt;br /&gt;
:'''Successful connection''' (waiting a full minute to ensure output to the terminal stopped); &amp;lt;br /&amp;gt; &lt;br /&gt;
{{clo|indent=2}}&lt;br /&gt;
{{clio| /etc/init.d/wpa-supplicant start| hostname=ipac9x25}}&lt;br /&gt;
Successfully initialized wpa_supplicant&amp;lt;br/&amp;gt;&lt;br /&gt;
rfkill: Cannot open RFKILL control device&amp;lt;br/&amp;gt;&lt;br /&gt;
{{clio| wlan0: authenticate with 1c:7e:e5:40:10:fd| hostname=ipac9x25}}&lt;br /&gt;
wlan0: send auth to 1c:7e:e5:40:10:fd (try 1/3)&amp;lt;br/&amp;gt;&lt;br /&gt;
wlan0: send auth to 1c:7e:e5:40:10:fd (try 2/3)&amp;lt;br/&amp;gt;&lt;br /&gt;
wlan0: authenticated&amp;lt;br/&amp;gt;&lt;br /&gt;
wlan0: associating with AP with corrupt beacon&amp;lt;br/&amp;gt;&lt;br /&gt;
wlan0: associate with 1c:7e:e5:40:10:fd (try 1/3)&amp;lt;br/&amp;gt;&lt;br /&gt;
wlan0: RX AssocResp from 1c:7e:e5:40:10:fd (capab=0x431 status=0 aid=6)&amp;lt;br/&amp;gt;&lt;br /&gt;
wlan0: associated&amp;lt;br/&amp;gt;&lt;br /&gt;
IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready&lt;br /&gt;
{{clos}}&lt;br /&gt;
:'''Failed connection''' (waiting more than a minute as output continues to print to the terminal). The repeated lines indicate an issue establishing the connection. &amp;lt;br /&amp;gt; &lt;br /&gt;
{{clo|indent=2}}&lt;br /&gt;
{{clio|/etc/init.d/wpa-supplicant start| hostname=ipac9x25}}&lt;br /&gt;
Successfully initialized wpa_supplicant                                         &lt;br /&gt;
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready                             &lt;br /&gt;
{{clio| IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready|hostname=ipac9x25}}        &lt;br /&gt;
cfg80211: Calling CRDA to update world regulatory domain&amp;lt;br/&amp;gt;&lt;br /&gt;
IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready&amp;lt;br/&amp;gt;                   &lt;br /&gt;
cfg80211: Calling CRDA to update world regulatory domain&amp;lt;br/&amp;gt;                   &lt;br /&gt;
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready&amp;lt;br/&amp;gt;                   &lt;br /&gt;
IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready&amp;lt;br/&amp;gt;                        &lt;br /&gt;
cfg80211: Calling CRDA to update world regulatory domain&amp;lt;br/&amp;gt;                   &lt;br /&gt;
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready&amp;lt;br/&amp;gt;                   &lt;br /&gt;
IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready&amp;lt;br/&amp;gt;                        &lt;br /&gt;
cfg80211: Calling CRDA to update world regulatory domain&amp;lt;br/&amp;gt;                   &lt;br /&gt;
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready&amp;lt;br/&amp;gt;                   &lt;br /&gt;
IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready&amp;lt;br/&amp;gt;                      &lt;br /&gt;
cfg80211: Calling CRDA to update world regulatory domain&amp;lt;br/&amp;gt;                   &lt;br /&gt;
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready&amp;lt;br/&amp;gt;                   &lt;br /&gt;
IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready&amp;lt;br/&amp;gt;                        &lt;br /&gt;
cfg80211: Calling CRDA to update world regulatory domain&amp;lt;br/&amp;gt;                   &lt;br /&gt;
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready&amp;lt;br/&amp;gt;                   &lt;br /&gt;
IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready&amp;lt;br/&amp;gt;                        &lt;br /&gt;
cfg80211: Calling CRDA to update world regulatory domain&amp;lt;br/&amp;gt;                   &lt;br /&gt;
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready&amp;lt;br/&amp;gt;&lt;br /&gt;
{{clos}}&lt;br /&gt;
:A failed connection is likely the result of an improper password. Use &amp;lt;code&amp;gt;wpa_passphrase&amp;lt;/code&amp;gt; to make sure you have the right psk for the password.&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt; command will be used to determine that the device is wirelessly connected to the network. Look to see that &amp;lt;code&amp;gt;wlan0&amp;lt;/code&amp;gt; has an IP address.&lt;br /&gt;
{{clop|indent=2}}wlan0   Link encap:Ethernet HWaddr A8:54:B2:42:89:8D&lt;br /&gt;
:::inet addr:10.0.4.148 Bcast:10.0.255.255 Mask:255.255.0.0&lt;br /&gt;
:::UP BROADCAST RUNNING MULTICAST MTU:1500 METRIC:1&lt;br /&gt;
:::RX packets:3395 errors:0 dropped:6 overruns:0 frame:0&lt;br /&gt;
:::TX packets:60 errors:0 dropped:0 overruns:0 carrier:0&lt;br /&gt;
:::collisions:0 txqueuelen:1000&lt;br /&gt;
:::RX bytes:346619 (338.4 KiB) TX bytes:6318 (6.1 Kib){{closp}}    &lt;br /&gt;
&lt;br /&gt;
* Disconnect any physical connections from the system and ping to [http://www.emacinc.com www.emacinc.com] to verify that the system can wirelessly connect to the Internet. &amp;lt;br /&amp;gt;&lt;br /&gt;
{{clop|indent=2}}&lt;br /&gt;
{{cliop| ping -c 3 www.emacinc.com | hostname=ipac9x25}}&lt;br /&gt;
PING www.emacinc.com (172.16.0.10): 56 data bytes &lt;br /&gt;
64 bytes from 172.16.0.10: seq=0 ttl=63 time=1.910 ms&lt;br /&gt;
64 bytes from 172.16.0.10: seq=1 ttl=63 time=1.748 ms&lt;br /&gt;
64 bytes from 172.16.0.10: seq=2 ttl=63 time=2.061 ms&lt;br /&gt;
&lt;br /&gt;
--- www.emacinc.com ping statistics ---&lt;br /&gt;
3 packets transmitted, 3 packets received, 0% packet loss&lt;br /&gt;
round-trip min/avg/max = 1.748/1.906/2.061 ms&lt;br /&gt;
{{cliop||hostname=ipac9x25}}{{closp}}&lt;br /&gt;
&amp;lt;br clear=all&amp;gt; &lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&amp;lt;!-- {{:Templateimpl:examples | initials=JJ | title=Wireless Networking | desc=How to access a wireless network | project=OE 5.0 }} --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
If your come across any issues communicating though the network, try these suggestions as starting points to resolve the problem(s).&lt;br /&gt;
* View the &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt; file to view the DNS servers provided from the DHCP server.&lt;br /&gt;
* Inspect the routing table using the &amp;lt;code&amp;gt;route&amp;lt;/code&amp;gt; command, as shown here:&lt;br /&gt;
{{clop | indent=2}}&lt;br /&gt;
{{cliop|hostname=ipac9x25|user=root|route -n}}&lt;br /&gt;
Kernel IP routing table&lt;br /&gt;
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface&lt;br /&gt;
0.0.0.0         10.0.2.1        0.0.0.0         UG    0      0        0 eth0&lt;br /&gt;
10.0.0.0        0.0.0.0         255.255.0.0     U     1      0        0 eth0&lt;br /&gt;
{{cliop|hostname=ipac9x25|user=root|}} {{closp}}&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:conclusion | initials=JJ | title=Wireless Networking | desc=How to access a wireless network | project=OE 5.0 }} &lt;br /&gt;
After connecting to a network the first time, the system will be able to connect to the same network when rebooted or powered on. Connecting to a new network will require going through the procedures set out under the [[#Wireless Networking|Wireless Networking]] section to revise the network settings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This page walked the reader through the procedure to connect a machine to a wireless network via a USB Wifi adapter or built-in wireless, and the process to acquire the necessary software tools to make the connection for the first time. While there are plenty of USB wireless adapters available for sale, we used an adapter intended for use on Linux machines with a driver supported by EMAC OE Linux. Other USB wireless adapters may be used to connect EMAC devices to wireless networks, but they will often face issues with driver support or other compatibility issues.  Requests to purchase the adapter should be sent to [mailto:sales@emacinc.com sales@emacinc.com]; please include a reference to the EPN, PER-USB-00005-R, when sending a request to purchase this adapter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=JJ | title=Wireless Networking | desc=How to access a wireless network | project=OE 5.0 }} &lt;br /&gt;
* [[Network_Configuration | Network Configuration]]&lt;br /&gt;
* [[Network_Connections | Network Connections]]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=JJ | title=Wireless Networking | desc=How to access a wireless network | project=OE 5.0 }} &lt;br /&gt;
* [[OE50:Packages | EMAC OE 5.X Release Information]]&lt;br /&gt;
* [[EMAC_OE_50_Add-on_Packages | EMAC OE 50 Add-on Packages]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=OE_50_How_To&amp;diff=5097</id>
		<title>OE 50 How To</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=OE_50_How_To&amp;diff=5097"/>
		<updated>2015-11-12T21:33:08Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: Added some links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| NotStarted (10.06.2015-14:23-&amp;gt;MD+)|Mike Dean| project=OE 5.0,MD }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- No Table of Contents for a navigation page. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /**************************************  Navigation Page Table  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:navpgtable | initials=MD | title=How To Articles | desc=A collection of How To pages for EMAC OE Linux | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  System Administration  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:navtableentry | title=System Administration }}&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:Navti | [[ Network_Configuration | Configure Networking ]] }}&lt;br /&gt;
{{:Templateimpl:Navti | [[ User_Account_Configuration | Configure User Accounts ]] }}&lt;br /&gt;
{{:Templateimpl:Navti | [[ Setting_the_System_Time | Set the Time ]] }}&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:Navti | [[ Mounting_a_Flash_Filesystem | Mount a Filesystem ]] }}&lt;br /&gt;
{{:Templateimpl:Navti | [[ Setting_up_an_NFS_File_Server | Set Up an NFS Server ]] }}&lt;br /&gt;
{{:Templateimpl:Navti | [[ Installing_TFTP_server | Install a TFTP Server ]] }}&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:Navti | [[ Installing_LILO | Install LILO ]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:navtend}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /************************************************  New Row  ***********************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- This section is needed anytime you wish to add another row to the table. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- {{:Templateimpl:navtablenewrow}} --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Software Development  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:navtableentry | title=Software Development }}&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:Navti | [[ Install_the_EMAC_SDK | Install the SDK ]]}}&lt;br /&gt;
{{:Templateimpl:Navti | [[ Creating_a_New_EMAC_OE_SDK_Project_with_CMake | Create a New Project (CMake command line) ]]}}&lt;br /&gt;
{{:Templateimpl:Navti | [[ Advanced_CMake_Features | Advanced CMake Features ]]}}&lt;br /&gt;
{{:Templateimpl:Navti | [[ Creating_a_New_EMAC_OE_SDK_Project_with_qmake_in_Qt_Creator | Create a New Project (Qt Creator) ]]}}&lt;br /&gt;
{{:Templateimpl:Navti | Build Existing Software  (TODO - existing article is OE 4 specific)}}&lt;br /&gt;
{{:Templateimpl:Navti | Build the Linux Kernel   (TODO - existing article is OE 4 specific)}}&lt;br /&gt;
{{:Templateimpl:Navti | [[Getting_Started_With_Qt_Creator | Get Started with Qt Creator]]}}&lt;br /&gt;
{{:Templateimpl:Navti | [[ Installing_QtCreator | Install Qt Creator Manually (Not Recommended) ]]}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:navtend}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************  End Navigation Links Table *************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- This section must be at the end of your table. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:navtableend}}&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Creating_a_New_EMAC_OE_SDK_Project_with_qmake_in_Qt_Creator&amp;diff=5096</id>
		<title>Creating a New EMAC OE SDK Project with qmake in Qt Creator</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Creating_a_New_EMAC_OE_SDK_Project_with_qmake_in_Qt_Creator&amp;diff=5096"/>
		<updated>2015-11-12T21:17:17Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| Complete (11.10.2015-12:42-&amp;gt;JJ+);(11.11.2015-16:05-&amp;gt;JJ+);(11.12.2015-12:30-&amp;gt;JJ+);(11.12.2015-14:30-&amp;gt;MG+);(11.12.2015-14:50-&amp;gt;JJ+);(11.12.2015-15:00-&amp;gt;MG+);(11.12.2015-15:15-&amp;gt;KY+)|Jeffrey Jung| project=OE 5.0,JJ,Complete,MG,KY }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Creating the Project&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=qmake, Qt Creator, Qt applications&lt;br /&gt;
|description=Creating a New EMAC OE SDK Project with qmake in Qt Creator&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--&amp;lt;span style=&amp;quot;background:#00FF00;color:#FF0000;font-size:300%&amp;quot;&amp;gt;'''''Put the page description text here.'''''&amp;lt;/span&amp;gt;--&amp;gt;&lt;br /&gt;
Alongside the EMAC OE 5.0 SDK, EMAC provides the Qt Creator IDE(Interactive Development Environment). A great feature of this IDE is its UI design tool that will allow developers to produce applications with a GUI for EMAC devices equipped with LCD displays. The UI is constructed by dragging and dropping objects to the application UI. Using slots and signals, developers can easily program a functional, interactive, and visually pleasing interface. These project requires Qt Creator's tool &amp;lt;code&amp;gt;qmake&amp;lt;/code&amp;gt; to build these applications. &lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=JJ | title=Creating the Project | desc=Creating a New EMAC OE SDK Project with qmake in Qt Creator | project=OE 5.0 }}&lt;br /&gt;
The user interface (UI) designer tool in Qt Creator can be used to develop applications reliant on a UI. Written in C++, these applications built using the EMAC OE SDK and the &amp;lt;code&amp;gt;qmake&amp;lt;/code&amp;gt; tool can be deployed to EMAC carriers equipped with touch screen displays. Developers will be able to create software that is much more interactive with the user. For more information about Qt Creator, go to the [http://wiki.qt.io/Qt_Creator_Guidance Qt Creator Guidance] page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=JJ | title=Creating the Project | desc=Creating a New EMAC OE SDK Project with qmake in Qt Creator | project=OE 5.0 }}&lt;br /&gt;
This page will present a guide to create a basic application using Qt Creator. You'll not only write the source code, but also design a UI for the application. Once that is done, you'll compile the project and deploy it to run on a remote target machine. A &amp;quot;Hello World&amp;quot; project is used as an example to demonstrate how to use the UI designer and receive output from the IDE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=JJ | title=Creating the Project | desc=Creating a New EMAC OE SDK Project with qmake in Qt Creator | project=OE 5.0 }}&lt;br /&gt;
&amp;lt;cl&amp;gt;1. Launch the EMAC Qt Creator. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:EMAC_Qt_Creator_Icon.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Click on &amp;quot;New Project&amp;quot;.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Qtcreator_gui.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* A new window will pop up to specify the type of project you will be coding for. Select '''Application''' under the Projects column.&lt;br /&gt;
&lt;br /&gt;
* Select '''Qt Widgets Application'''. &amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:SelectQtWidgetApplication.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Click '''Choose'''. You'll be brought to another page requesting you to give the project a name and choose the location of the project. &amp;lt;br &amp;gt;&amp;lt;br /&amp;gt; [[File:QtAppName_Location.png| 800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Once you've given your project a name and have determined the path to store the project, click '''Next'''.&lt;br /&gt;
&lt;br /&gt;
* Select the kit required for the device(s) on which you wish to run the application. In this example, all kits are selected, but this project will be deployed to an OE 5.0 ARM device. Click '''Next'''. &amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:QtKitSelection.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Give the class a name and leave the base class as '''QMainWindow'''. The header, source, and form files will have the same name as the class name, but different extensions. These files may be modified if desired. Click '''Next''' to continue to the project summary.&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt;[[File:ClassInfo.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In the summary window, click '''Finish''' to be begin developing the project.&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this example application, Qt will open &amp;lt;code&amp;gt;helloworld.cpp&amp;lt;/code&amp;gt; in the editor. This is where the functionality of the application is implemented. Within &amp;lt;code&amp;gt;main.cpp&amp;lt;/code&amp;gt;, a new object of the class will be created and launched. Almost all of the C++ code will be written in the class definition. The class definition is also capable of creating an managing UI elements, such as a push button. This example is designed to provide a quick start and won't demonstrate management of UI elements. More information on management of UI elements can be found at http://doc.qt.io/qtcreator/creator-using-qt-designer.html. &lt;br /&gt;
&lt;br /&gt;
===Modify deployment configurations===&lt;br /&gt;
Before developing the project, you will need to make some modifications to allow the project to be displayed and run on the desired device.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;1. Start by double clicking on &amp;lt;code&amp;gt;HelloWorld.pro&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Add the lines &amp;quot;&amp;lt;code&amp;gt;target.path = /tmp&amp;lt;/code&amp;gt;&amp;quot; and &amp;quot;&amp;lt;code&amp;gt;INSTALLS += target&amp;lt;/code&amp;gt;&amp;quot; at the bottom of the file. This will set the location of the object file of the project to the &amp;quot;&amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt;&amp;quot; directory. The full path to the project will be &amp;quot;&amp;lt;code&amp;gt;/tmp/HelloWorld&amp;lt;/code&amp;gt;&amp;quot; on the target device. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:DotProPathConfig.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use &amp;lt;code&amp;gt;'''Ctrl + S'''&amp;lt;/code&amp;gt; to save the file.&lt;br /&gt;
&lt;br /&gt;
* The run configurations can be modified in the '''Project''' tab at the left of the window. At the top of the '''Project''' page, click on '''Run''' under the desired kit.&lt;br /&gt;
&lt;br /&gt;
* Click on '''Details''' for '''Upload files via SFTP''' and make sure the '''Incremental deployment''' box is unchecked. &lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;'''-qws'''&amp;lt;/code&amp;gt; argument is required under the '''Run''' configuration to run the application as a Qt  server application. &amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:QtProjectRunConfig.png|800px]]&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Create a Device Profile===&lt;br /&gt;
A profile will need to be created for  your device in order for Qt Creator to deploy the application to it. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;1. Under the '''Tools''' drop down box, select '''Options'''.&lt;br /&gt;
&lt;br /&gt;
* Select '''Devices''' from the scroll area to the left of the '''Options''' window. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Options_devices.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
* Look to the top right of the window and click '''Add'''.&lt;br /&gt;
&lt;br /&gt;
* You'll be brought to the '''Wizard Selection''' window to identify the type of device your target is. Select '''Generic Linux Device'''. &amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Generic_linux.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Click '''Start Wizard''' and set up the configuration for the device profile. Give the profile a name, set the device's IP Address, enter the username, and specify the authentication type. Provide a password if the authentication type requires it.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:9G45NewDeviceConnection.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Click '''Next''' when all the proper information of the device is provided. &lt;br /&gt;
&lt;br /&gt;
* At the summary window, click '''Finish''' and a connection be tween the target device and the developer's desktop will be tested. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; [[File:Device_test.png]].&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* When the test has completed successfully, click '''Close'''.&lt;br /&gt;
* Click '''Apply''' in the '''Options''' window to save the profile.&lt;br /&gt;
* Click on the '''Build &amp;amp; Run''' section from the list box. Go to the '''Kits''' tab and click on the kit for the device. Under the '''Devices''' drop down menu, select the device profile that was just created. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:SelectDeviceToRun.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Save the device profile by clicking '''Apply'''. The profile has been completed and the options can be closed by clicking '''Ok''' at the bottom right of the window.&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:examples | initials=JJ | title=Creating the Project | desc=Creating a New EMAC OE SDK Project with qmake in Qt Creator | project=OE 5.0 }}&lt;br /&gt;
&lt;br /&gt;
===Coding Hello World and Designing the User Interface===&lt;br /&gt;
Qt Creator is now able to deploy the project to the target device. The application definition needs to be completed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cl&amp;gt;1. Double click the class &amp;lt;code&amp;gt;cpp&amp;lt;/code&amp;gt; file in the '''Edit''' tab.&lt;br /&gt;
&lt;br /&gt;
* In the constructor, use the &amp;lt;code&amp;gt;qDebug()&amp;lt;/code&amp;gt; function to print the string &amp;quot;&amp;lt;code&amp;gt;Hello World&amp;lt;/code&amp;gt;&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* In the destructor, use the &amp;lt;code&amp;gt;qDebug()&amp;lt;/code&amp;gt; function to print the string &amp;quot;&amp;lt;code&amp;gt;Goodbye World&amp;lt;/code&amp;gt;&amp;quot;. &lt;br /&gt;
Here's what your &amp;lt;code&amp;gt;helloworld.cpp&amp;lt;/code&amp;gt; should look like:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;helloworld.h&amp;quot;&lt;br /&gt;
#include &amp;quot;ui_helloworld.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
HelloWorld::HelloWorld(QWidget *parent) :&lt;br /&gt;
    QMainWindow(parent),&lt;br /&gt;
    ui(new Ui::HelloWorld)&lt;br /&gt;
{&lt;br /&gt;
    ui-&amp;gt;setupUi(this);&lt;br /&gt;
    qDebug(&amp;quot;Hello World&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HelloWorld::~HelloWorld()&lt;br /&gt;
{&lt;br /&gt;
    qDebug(&amp;quot;Goodbye World&amp;quot;);&lt;br /&gt;
    delete ui;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Double click &amp;lt;code&amp;gt;helloworld.ui&amp;lt;/code&amp;gt; under the '''Forms''' folder in the '''Edit''' tabe to the left of the screen. This displays an interface that will allow objects to be dragged on to the UI of the application. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:QtUIDesign.png|800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Drag and drop a label to the UI.&lt;br /&gt;
&lt;br /&gt;
* Double click on the label to change the text to &amp;quot;&amp;lt;code&amp;gt;Hello World&amp;lt;/code&amp;gt;&amp;quot;. You may need to resize the label so the text can be seen. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; [[File:HelloUI.png|800px]]&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Building and Running the Project===&lt;br /&gt;
&amp;lt;cl&amp;gt;1. Click on the icon of a monitor at the bottom left of the window. &lt;br /&gt;
&lt;br /&gt;
* Select the proper kit for your device, '''Build-&amp;gt;Debug''', and the project name under '''Run'''. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:BuildDebugRun.png| 800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Build the project by clicking the hammer icon at the bottom left of the window. A little window will momentarily pop up at the bottom right of the screen. The project has been successfully built if the green progress bar is full and now error messages have appeared.      &lt;br /&gt;
&lt;br /&gt;
* Once the project has successfully built, the project may be run. Click the green triangle icon at the bottom left of the window, below the monitor icon. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:HelloWorldRun.png| 800px]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Application Output terminal will pop up and display any error messages, the termination message, and any string output by &amp;lt;code&amp;gt;qDebug()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:conclusion | initials=JJ | title=Creating the Project | desc=Creating a New EMAC OE SDK Project with qmake in Qt Creator | project=OE 5.0 }}&lt;br /&gt;
Although very similar to [[Getting_Started_With_Qt_Creator | Getting Started with Qt Creator]], this guide differs by introducing the reader to the process of developing a Qt application with a graphical user interface using Qt's qmake build system. Developing a new application generally follows these steps: create a new project, configure a new device profile if needed, modify the build and run conditions to allow deployment on the remote device, drag and drop the visual elements to the GUI using the UI designer, write the code needed to respond to interactions with the UI, build the application, and run the application upon a successful build.&lt;br /&gt;
&lt;br /&gt;
More information about running Qt applications on EMAC systems (Open Embedded Linux modules) can be found at http://doc.qt.io/qt-4.8/qt-embedded-running.html. While the UI designer is a great way to visually plan out how the GUI will turn out, the entire application may be coded within the project C++ class file, including the UI elements. Qt provides a couple of example applications with a GUI for Linux Embedded systems coded in such a way. These example can be viewed at http://doc.qt.io/qt-4.8/examples-embeddedlinux.html. A larger set of Qt example applications can be found at http://doc.qt.io/qt-4.8/all-examples.html; not all of these examples will work for Embedded Linux or the EMAC OE SDK. Qt pre-compiled examples and source code can also be found on EMAC systems with Qt in &amp;lt;code&amp;gt;/usr/bin/qtopia&amp;lt;/code&amp;gt; and in the EMAC OE SDK in  &amp;lt;code&amp;gt;/opt/emac/5.0/sysroots/target_arch/usr/bin/qtopia &amp;lt;/code&amp;gt;. These examples are applicable to Qt version 4.8 which is the newest version supported by EMAC OE 5.0. &lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- {{:Templateimpl:moreinfo | initials=JJ | title=Creating the Project | desc=Creating a New EMAC OE SDK Project with qmake in Qt Creator | project=OE 5.0 }}&lt;br /&gt;
* --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=JJ | title=Creating the Project | desc=Creating a New EMAC OE SDK Project with qmake in Qt Creator | project=OE 5.0 }}&lt;br /&gt;
* [[Getting_Started_With_Qt_Creator | Getting Started With Qt Creator]]&lt;br /&gt;
* [[Getting_Started_with_the_EMAC_OE_SDK| Getting Started with the EMAC OE SDK]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=EMAC_OE_50_Add-on_Packages&amp;diff=5094</id>
		<title>EMAC OE 50 Add-on Packages</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=EMAC_OE_50_Add-on_Packages&amp;diff=5094"/>
		<updated>2015-11-12T20:58:20Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo|(12-5-14-12:50-&amp;gt;MG+)(11.12.2015-14:55-&amp;gt;KY+)|Michael Gloff|project=oe 5,mg,FinalDraft}}&lt;br /&gt;
&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=EMAC OE Add-on Packages&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Add-on Packages,File Sharing,Web Servers,Real Time Extenstions,Database&lt;br /&gt;
|description=List of all of EMAC OE Add-on Packages.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{DISPLAYTITLE:EMAC OE 5.X Add-on Packages}}&lt;br /&gt;
&lt;br /&gt;
Additional software packages can be added to the standard EMAC OE distribution for an additional support fee. Thousands of software projects are available through the OpenEmbedded build system, some common packages are listed below. Custom software development is also offered as may be required. Please contact EMAC for information about package availability and pricing.&lt;br /&gt;
&lt;br /&gt;
==Packages==&lt;br /&gt;
&lt;br /&gt;
===Database===&lt;br /&gt;
* &amp;lt;u&amp;gt;MariaDB:&amp;lt;/u&amp;gt; While SQLite3 is provided in EMAC OE 5.x, MariaDB is a more powerful replacement for MySQL.&lt;br /&gt;
:[https://mariadb.org/ mariadb.org]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;PostgreSQL:&amp;lt;/u&amp;gt; PostgreSQL is a powerful, open source object-relational database system.&lt;br /&gt;
:[http://www.postgresql.org postgresql.org]&lt;br /&gt;
===File Sharing===&lt;br /&gt;
* &amp;lt;u&amp;gt;NFS Server:&amp;lt;/u&amp;gt; Network File System Server - Share the device's filesystem over the network or mount a remote network file system.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Samba Server:&amp;lt;/u&amp;gt; Common Internet File System and Domain support for Microsoft Windows clients.&lt;br /&gt;
&lt;br /&gt;
===Network Management===&lt;br /&gt;
* &amp;lt;u&amp;gt;SNMP:&amp;lt;/u&amp;gt; A popular protocol for network management.&lt;br /&gt;
:[http://www.net-snmp.org/ net-snmp.org]&lt;br /&gt;
&lt;br /&gt;
===Real Time Extenstions===&lt;br /&gt;
* &amp;lt;u&amp;gt;Xenomai:&amp;lt;/u&amp;gt; a real-time development framework for Linux&lt;br /&gt;
:[http://www.xenomai.org/ xenomai.org]&lt;br /&gt;
:[[Xenomai | Xenomai for EMAC]]&lt;br /&gt;
&lt;br /&gt;
===Scripting Languages===&lt;br /&gt;
* &amp;lt;u&amp;gt;Perl 5:&amp;lt;/u&amp;gt; A high-level, interpreted programming language.&lt;br /&gt;
:[http://www.perl.org/ perl.org]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;PHP 5:&amp;lt;/u&amp;gt; Server-side HTML embedded scripting language.&lt;br /&gt;
:[http://php.net/ php.net]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Python 2.7.x:&amp;lt;/u&amp;gt; A general purpose high-level programming language.&lt;br /&gt;
:[http://www.python.org/ python.org]&lt;br /&gt;
&lt;br /&gt;
===Toolkits and APIs===&lt;br /&gt;
* &amp;lt;u&amp;gt;QT4 Embedded:&amp;lt;/u&amp;gt; a cross-platform application and UI framework for developers using C++ or QML.&lt;br /&gt;
:[http://qt-project.org/ qt-project.org]&lt;br /&gt;
&lt;br /&gt;
===Utilities===&lt;br /&gt;
* &amp;lt;u&amp;gt;libmodbus:&amp;lt;/u&amp;gt; libmodbus is a C library designed to provide a fast and robust implementation of the Modbus protocol.&lt;br /&gt;
:[http://libmodbus.org/ libmodbus.org]&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
* &amp;lt;u&amp;gt;jamvm:&amp;lt;/u&amp;gt; A compact Java Virtual Machine&lt;br /&gt;
:[http://jamvm.sourceforge.net/ jamvm.sourceforge.net]&lt;br /&gt;
===Web Browsers===&lt;br /&gt;
* &amp;lt;u&amp;gt;Google Chromium:&amp;lt;/u&amp;gt; A web browser ideal for use in kiosk applications.&lt;br /&gt;
:[http://www.chromium.org/ chromium.org]&lt;br /&gt;
&lt;br /&gt;
===Window Managers===&lt;br /&gt;
* &amp;lt;u&amp;gt;Enlightenment:&amp;lt;/u&amp;gt; Enlightenment is a lean, fast, modular and very extensible window manager for X11 and Linux.&lt;br /&gt;
:[https://enlightenment.org/p.php?p=about&amp;amp;l=en enlightenment.org]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Qt4:&amp;lt;/u&amp;gt; Qt can provide its own windowing system on top of a framebuffer, eliminating the need for the X11 windowing system.&lt;br /&gt;
:[http://qt-project.org/doc/qt-4.8/ qt-project.org/doc/qt-4.8]&lt;br /&gt;
&lt;br /&gt;
===Wireless Networking===&lt;br /&gt;
* &amp;lt;u&amp;gt;Wireless Tools and WPA Supplicant:&amp;lt;/u&amp;gt; A typical wireless LAN set up will require the configuration of the network interfaces and WPA Supplicant if wireless encryption is used. &lt;br /&gt;
:[http://wireless.kernel.org/en/users/Documentation/wpa_supplicant WPA Supplicant]&lt;br /&gt;
&lt;br /&gt;
===Bluetooth===&lt;br /&gt;
* &amp;lt;u&amp;gt;Bluez:&amp;lt;/u&amp;gt; Provides support for the core Bluetooth layers and protocols in Linux.&lt;br /&gt;
:[http://www.bluez.org/ bluez.org/]&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[ OE50:Packages | EMAC OE 5.X Standard Packages ]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Serial_Connections&amp;diff=5091</id>
		<title>Serial Connections</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Serial_Connections&amp;diff=5091"/>
		<updated>2015-11-12T20:38:09Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo|SEOKWREV (11.25.13-13:05-&amp;gt;KY+);(11.25.13-18:45-&amp;gt;MD+);(11.26.13-21:40-&amp;gt;MD+);(12.20.13-11:12-&amp;gt;MW+);(03.04.14-15:20-&amp;gt;BS-);(03.14.14-15:55-&amp;gt;BS+)(03.14.14-15:55-&amp;gt;BS+)(10.26.15-18:25-&amp;gt;MG+)|Klint Youngmeyer|project=oe 4,oe 5,ky,SEOKWREV,md,mw,bs}}&lt;br /&gt;
&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Serial Connections&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Serial Connections,Serial Terminal,PuTTY,Serial Communication Parameters&lt;br /&gt;
|description=Serial Connections to EMAC boards.&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;!--'''THIS PAGE NEEDS: 1. To be split into two pages: &amp;quot;Serial Connections&amp;quot;  and  &amp;quot;Network Connections&amp;quot;.  This is because the table listing serial connection information is very important, but has been very difficult to find.  We need the page to have the most obvious name possible for this.  We also should try to find other pages which mention using a serial connection, and refer them to this page to find out the connection information they need for their board.'''--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several ways to connect to a system running EMAC OE Linux. The preferred connection method depends on the capabilities of the hardware. For example, headless systems (those without a graphical interface) will most likely use a serial port console, while systems with a video connection may be accessed using a keyboard and LCD or monitor.  When an LCD or monitor is available, a serial connection can occasionally still be needed; usually, this need arises after a user has accidentally misconfigured the display.  Other times, it may be useful to be able to use a serial console on a board that's running remotely but has had its network connection drop out.  The serial console can be a very useful tool for diagnosing and debugging issues even after development has finished.&lt;br /&gt;
&lt;br /&gt;
== Serial Terminal ==&lt;br /&gt;
A serial terminal connection is most commonly the first connection that will be made to a system in its default configuration. A serial terminal application such as [[Getting_Started_With_Minicom | Minicom]] for Linux or [[PuTTY]] under Windows is required for this connection. The serial cable type, port, and communication parameters for each system type are listed in Table 1 below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;div align=center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center;&amp;quot; |Table 1: Serial Communication Parameters&lt;br /&gt;
|-&lt;br /&gt;
! SoM !! Port !! Cable Type !! Baud Rate !! Data Bits !! Parity !! Stop Bits !! Flow Control&lt;br /&gt;
|-&lt;br /&gt;
| [[ ARM_SOM | 200 Pin SoM's ]] || COMB  || NULL Modem || 115200 || 8 || None || 1 || None&lt;br /&gt;
|-&lt;br /&gt;
| [[ ARM_SOM | 144 Pin SoM's ]] || COME  || NULL Modem || 115200 || 8 || None || 1 || None&lt;br /&gt;
|-&lt;br /&gt;
| [[ SOM-9260 ]] || COMA  || NULL Modem || 115200 || 8 || None || 1 || None&lt;br /&gt;
|-&lt;br /&gt;
| [[ SOM-9G20 ]] || COMA  || NULL Modem || 115200 || 8 || None || 1 || None&lt;br /&gt;
|-&lt;br /&gt;
| [[ iPac-9x25 ]] || HDR4  || NULL Modem || 115200 || 8 || None || 1 || None&lt;br /&gt;
|-&lt;br /&gt;
| x86 Boards               || *     || *          || *      || 8 || None || 1 || None&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{note | '''*''' : These settings vary among x86 systems. Refer to the system manual for the target board for more information. Not all x86 systems have a serial terminal connection enabled by default.}}&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to establish a serial connection:&lt;br /&gt;
# Connect a serial cable between the serial port on the workstation and target board and start a terminal application.&lt;br /&gt;
# Setup the communication parameters for your board according to Table 1.&lt;br /&gt;
# Connect power to the target board; boot messages will begin to print within a few seconds.&lt;br /&gt;
# When the board has finished booting a login prompt will appear.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{note| Boards that do not have the serial device set as the default kernel console (such as the majority of headed x86 systems) will not display boot messages over the serial port during boot without further configuration. In these cases, the login prompt will appear when the board has finished booting. If a login prompt does not appear, press enter in the serial terminal application several times.}}&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Next Steps ==&lt;br /&gt;
After you have established a connection with your device running EMAC OE Linux, you will need to [[System_Log_In | log into the system.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- [[Category:Linux]]&lt;br /&gt;
[[Category:OpenEmbedded]]&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Serial_Connections&amp;diff=5090</id>
		<title>Serial Connections</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Serial_Connections&amp;diff=5090"/>
		<updated>2015-11-12T20:36:05Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo|SEOKWREV (11.25.13-13:05-&amp;gt;KY+);(11.25.13-18:45-&amp;gt;MD+);(11.26.13-21:40-&amp;gt;MD+);(12.20.13-11:12-&amp;gt;MW+);(03.04.14-15:20-&amp;gt;BS-);(03.14.14-15:55-&amp;gt;BS+)(03.14.14-15:55-&amp;gt;BS+)(10.26.15-18:25-&amp;gt;MG+)|Klint Youngmeyer|project=oe 4,oe 5,ky,SEOKWREV,md,mw,bs}}&lt;br /&gt;
&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Serial Connections&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Serial Connections,Serial Terminal,PuTTY,Serial Communication Parameters&lt;br /&gt;
|description=Serial Connections to EMAC boards.&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;!--'''THIS PAGE NEEDS: 1. To be split into two pages: &amp;quot;Serial Connections&amp;quot;  and  &amp;quot;Network Connections&amp;quot;.  This is because the table listing serial connection information is very important, but has been very difficult to find.  We need the page to have the most obvious name possible for this.  We also should try to find other pages which mention using a serial connection, and refer them to this page to find out the connection information they need for their board.'''--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several ways to connect to a system running EMAC OE Linux. The preferred connection method depends on the capabilities of the hardware. For example, headless systems (those without a graphical interface) will most likely use a serial port console, while systems with a video connection may be accessed using a keyboard and LCD or monitor.  When an LCD or monitor is available, a serial connection can occasionally still be needed; usually, this need arises after a user has accidentally misconfigured the display.  Other times, it may be useful to be able to use a serial console on a board that's running remotely but has had its network connection drop out.  The serial console can be a very useful tool for diagnosing and debugging issues even after development has finished.&lt;br /&gt;
&lt;br /&gt;
== Serial Terminal ==&lt;br /&gt;
A serial terminal connection is most commonly the first connection that will be made to a system in its default configuration. A serial terminal application such as [[Getting_Started_With_Minicom | Minicom]] for Linux or [[PuTTY]] under Windows is required for this connection. The serial cable type, port, and communication parameters for each system type are listed in Table 1 below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;div align=center&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center;&amp;quot; |Table 1: Serial Communication Parameters&lt;br /&gt;
|-&lt;br /&gt;
! SoM !! Port !! Cable Type !! Baud Rate !! Data Bits !! Parity !! Stop Bits !! Flow Control&lt;br /&gt;
|-&lt;br /&gt;
| [[ ARM_SOM | 200 Pin SoM's ]] || COMB  || NULL Modem || 115200 || 8 || None || 1 || None&lt;br /&gt;
|-&lt;br /&gt;
| [[ ARM_SOM | 144 Pin SoM's ]] || COME  || NULL Modem || 115200 || 8 || None || 1 || None&lt;br /&gt;
|-&lt;br /&gt;
| [[ SOM-9260 ]] || COMA  || NULL Modem || 115200 || 8 || None || 1 || None&lt;br /&gt;
|-&lt;br /&gt;
| [[ SOM-9G20 ]] || COMA  || NULL Modem || 115200 || 8 || None || 1 || None&lt;br /&gt;
|-&lt;br /&gt;
| [[ iPac-9x25 ]] || HDR4  || NULL Modem || 115200 || 8 || None || 1 || None&lt;br /&gt;
|-&lt;br /&gt;
| x86 Boards               || *     || *          || *      || 8 || None || 1 || None&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{mbox | type = notice | text = '''*''' : These settings vary among x86 systems. Refer to the system manual for the target board for more information. Not all x86 systems have a serial terminal connection enabled by default.}}&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the steps below to establish a serial connection:&lt;br /&gt;
# Connect a serial cable between the serial port on the workstation and target board and start a terminal application.&lt;br /&gt;
# Setup the communication parameters for your board according to Table 1.&lt;br /&gt;
# Connect power to the target board; boot messages will begin to print within a few seconds.&lt;br /&gt;
# When the board has finished booting a login prompt will appear.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{mbox | type = notice | text = Note that boards that do not have the serial device set as the default kernel console (such as the majority of headed x86 systems) will not display boot messages over the serial port during boot without further configuration. In these cases, the login prompt will appear when the board has finished booting. If a login prompt does not appear, press enter in the serial terminal application several times.}}&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Next Steps ==&lt;br /&gt;
After you have established a connection with your device running EMAC OE Linux, you will need to [[System_Log_In | log into the system.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- [[Category:Linux]]&lt;br /&gt;
[[Category:OpenEmbedded]]&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Using_Xenomai_with_the_EMAC_OE_SDK&amp;diff=5089</id>
		<title>Using Xenomai with the EMAC OE SDK</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Using_Xenomai_with_the_EMAC_OE_SDK&amp;diff=5089"/>
		<updated>2015-11-12T20:32:44Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| Final Draft (10.06.2015-14:59-&amp;gt;KY+)(10.27.2015-14:05-&amp;gt;MG+)|Klint Youngmeyer| project=OE 5.0,KY,FinalDraft }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Using Xenomai with the EMAC OE SDK&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=&lt;br /&gt;
|description=This page will cover how to use xenomai with the EMAC OE SDK and how to use some examples.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /****************************************  Page Description Text  ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
This page will describe basically how to use the Xenomai real time operating system API with the EMAC OE SDK.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /***************************************** Background Information ****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:bg | initials=KY | title=Using Xenomai with the EMAC OE SDK | desc=This page will cover how to use xenomai with the EMAC OE SDK and how to use some examples. | project=OE 5.0 }}&lt;br /&gt;
Xenomai is a real-time operating system (RTOS) API designed to work alongside Linux. It provides a means of migrating from a proprietary RTOS to a Linux based system. This also allows for native Linux applications to be run side-by-side with real-time applications on the same target&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  General Information  *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:geninfo | initials=KY | title=Using Xenomai with the EMAC OE SDK | desc=This page will cover how to use xenomai with the EMAC OE SDK and how to use some examples. | project=OE 5.0 }}&lt;br /&gt;
By default, the EMAC SDK includes support for Xenomai. However, due to the hardware dependent nature of the real time API, a Xenomai enabled kernel is necessary.&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************  Using/Working With  ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:using | initials=KY | title=Using Xenomai with the EMAC OE SDK | desc=This page will cover how to use xenomai with the EMAC OE SDK and how to use some examples. | project=OE 5.0 }}&lt;br /&gt;
For the purposes of this document, all examples will be using the CMake build system. These examples can be easily modified to be used on a traditional Makefile project or a Qt qmake project as well. For most Xenomai enabled projects, adding the following lines to the project's CMakeLists.txt file will be sufficient.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
project (example)&lt;br /&gt;
&lt;br /&gt;
#######################################&lt;br /&gt;
### Necessary additions for Xenomai ###&lt;br /&gt;
#######################################&lt;br /&gt;
set(XENO_BASE &amp;quot;${CMAKE_FIND_ROOT_PATH}/usr&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
set(CMAKE_C_FLAGS &amp;quot;${CMAKE_C_FLAGS} -MMD -g&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
set(CMAKE_C_FLAGS &amp;quot;${CMAKE_C_FLAGS} -I${XENO_BASE}/include/xenomai/cobalt -I${XENO_BASE}/include/xenomai -D_GNU_SOURCE -D_REENTRANT -D__COBALT__ -I${XENO_BASE}/include/xenomai/alchemy&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
set(CMAKE_EXE_LINKER_FLAGS &amp;quot;-lalchemy -lcopperplate ${XENO_BASE}/lib/xenomai/bootstrap.o -Wl,--wrap=main -Wl,--dynamic-list=${XENO_BASE}/lib/dynlist.ld -L${XENO_BASE}/lib -lcobalt -lpthread -lrt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
include_directories(${XENO_BASE}/include ${XENO_BASE}/include/cobalt)&lt;br /&gt;
&lt;br /&gt;
link_directories(${XENO_BASE}/lib)&lt;br /&gt;
#######################################&lt;br /&gt;
#######################################&lt;br /&gt;
#######################################&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
add_executable(example example.c)&lt;br /&gt;
&lt;br /&gt;
#######################################&lt;br /&gt;
### Necessary additions for Xenomai ###&lt;br /&gt;
#######################################&lt;br /&gt;
add_definitions(-D_GNU_SOURCE -D_REENTRANT -D__XENO__ -DNO_GPL)&lt;br /&gt;
&lt;br /&gt;
target_link_libraries(example pthread rt alchemy copperplate cobalt)&lt;br /&gt;
#######################################&lt;br /&gt;
#######################################&lt;br /&gt;
&lt;br /&gt;
#######################################&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*****************************************       Examples        *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:examples | initials=KY | title=Using Xenomai with the EMAC OE SDK | desc=This page will cover how to use xenomai with the EMAC OE SDK and how to use some examples. | project=OE 5.0 }}&lt;br /&gt;
To see how to build and use an actual example Xenomai project with the EMAC SDK, please see the [[Example_Xenomai_Timer | Xenomai Timer Example]] page. Additionally, Xenomai provides many example projects on their own [https://xenomai.org/documentation/xenomai-3/html/xeno3prm/examples.html documentation page].&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************     Conclusion      ******************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!--{{:Templateimpl:conclusion | initials=KY | title=Using Xenomai with the EMAC OE SDK | desc=This page will cover how to use xenomai with the EMAC OE SDK and how to use some examples. | project=OE 5.0 }}--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /******************************************   More Information   *****************************************/ --&amp;gt;&lt;br /&gt;
&amp;lt;!-- /*********************************************************************************************************/ --&amp;gt;&lt;br /&gt;
{{:Templateimpl:moreinfo | initials=KY | title=Using Xenomai with the EMAC OE SDK | desc=This page will cover how to use xenomai with the EMAC OE SDK and how to use some examples. | project=OE 5.0 }}&lt;br /&gt;
*[[Xenomai]]&lt;br /&gt;
*[[Install_the_EMAC_SDK | Install the EMAC SDK]]&lt;br /&gt;
&lt;br /&gt;
{{:Templateimpl:whatnext | initials=KY | title=Using Xenomai with the EMAC OE SDK | desc=This page will cover how to use xenomai with the EMAC OE SDK and how to use some examples. | project=OE 5.0 }}&lt;br /&gt;
*[[Example_Xenomai_Timer | Xenomai Timer Example]]&lt;br /&gt;
*[[Getting_Started_with_the_EMAC_OE_SDK | Getting Started with the EMAC OE SDK]]&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Example_Xenomai_Timer&amp;diff=5087</id>
		<title>Example Xenomai Timer</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Example_Xenomai_Timer&amp;diff=5087"/>
		<updated>2015-11-12T20:32:30Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| FinalDraft (10.06.2015-12:58-&amp;gt;KY+)|Klint Youngmeyer| project=OE 5.0,KY,FinalDraft }}&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Example xenomai timer&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Example timer,Xenomai, Timer C,Software Timer&lt;br /&gt;
|description=This is a guide to the &amp;lt;code&amp;gt;xenomai-timer&amp;lt;/code&amp;gt; C example project included in the EMAC OE SDK.&lt;br /&gt;
}}&lt;br /&gt;
This is a guide to the &amp;lt;code&amp;gt;xenomai-timer&amp;lt;/code&amp;gt; C example project included in the EMAC OE SDK.&lt;br /&gt;
&lt;br /&gt;
This project demonstrates how to build the real-time software timer.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;timer&amp;lt;/code&amp;gt; project builds one executable: &amp;lt;code&amp;gt;timer&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Building and Running the Project Files ==&lt;br /&gt;
&lt;br /&gt;
===Hardware Requirements===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;xenomai-timer&amp;lt;/code&amp;gt; C example project will run on an i586 system with a real-time Xenomai kernel.&lt;br /&gt;
&lt;br /&gt;
=== Building the Project ===&lt;br /&gt;
&lt;br /&gt;
There are some options for building this example project: Qt Creator or CMake.&lt;br /&gt;
&lt;br /&gt;
==== Qt Creator ====&lt;br /&gt;
&lt;br /&gt;
This process will show how to build the project using Qt Creator. For further information on using Qt Creator, please see [[Getting_Started_With_Qt_Creator |Getting Started With Qt Creator]].&lt;br /&gt;
&lt;br /&gt;
# Open Qt Creator using the &amp;quot;EMAC IDE&amp;quot; button on the Ubuntu sidebar. &lt;br /&gt;
# Click the &amp;quot;Example&amp;quot; button on the left of the page. This will bring up a list of all included examples. &lt;br /&gt;
# Select the &amp;quot;Xenomai Timer&amp;quot; icon. The example wizard will now request the build directory for the project. It is not recommended to use the default location. The following is a reasonable location on an EMAC LDC.&lt;br /&gt;
#:{{clo}}/home/developer/Projects/xenomai-timer{{clos}}&lt;br /&gt;
# The next window will prompt to run CMake. Click the &amp;quot;Run CMake&amp;quot; button.&lt;br /&gt;
# Click &amp;quot;Finish&amp;quot; (Note: This project may not build for the Desktop kit, unless the Xenomai libraries are installed for your system.)&lt;br /&gt;
# Click the &amp;quot;Projects&amp;quot; icon in the left column, then click &amp;quot;Add Kit&amp;quot; and select &amp;quot;OE 5.x x86&amp;quot;.&lt;br /&gt;
# The default build location is fine, click Next.&lt;br /&gt;
# Enter the following into the Arguments field, then click &amp;quot;Run CMake.&amp;quot;&lt;br /&gt;
#:{{clo}}-DARCH:STRING=x86{{clos}}&lt;br /&gt;
# Click Finish.&lt;br /&gt;
# Ensure that the &amp;quot;OE 5.x x86&amp;quot; kit is selected by clicking the computer icon on the lower left, then click Build (the hammer icon).&lt;br /&gt;
# Add the target device to the Qt Creator devices by following the instructions on [[Getting_Started_With_Qt_Creator#Getting_Started_with_Qt_Creator|this page]], starting at point 9.&lt;br /&gt;
# Click the Run button on the bottom left (green arrow).&lt;br /&gt;
&lt;br /&gt;
=== CMake ===&lt;br /&gt;
&lt;br /&gt;
This process will show how to build the project using CMake.&lt;br /&gt;
&lt;br /&gt;
# Navigate to the Projects directory.&lt;br /&gt;
#:{{cli | username=developer | hostname=ldc | cd ~/Projects }}&lt;br /&gt;
# Copy the xenomai-timer example to the current directory.&lt;br /&gt;
#:{{cli | username=developer | hostname=ldc | cp -r /opt/emac/5.0/sysroots/x86_64-emacsdk-linux/usr/demos/EMAC-Examples/xenomai-timer/ . }}&lt;br /&gt;
# Change directory to the project directory.&lt;br /&gt;
#:{{cli | username=developer | hostname=ldc | cd xenomai-timer }}&lt;br /&gt;
# Create build directory for cross-compilation, then change directory into it.&lt;br /&gt;
#:{{cli | username=developer | hostname=ldc | mkdir xenomai-timer-build-OE5-x86 }}&lt;br /&gt;
#:{{cli | username=developer | hostname=ldc | cd xenomai-timer-build-OE5-x86 }}&lt;br /&gt;
# Run CMake.&lt;br /&gt;
#:{{cli | username=developer | hostname=ldc | 1 = cmake .. -DARCH:STRING=x86 }}&lt;br /&gt;
# Build the project.&lt;br /&gt;
#:{{cli | username=developer | hostname=ldc | make }}&lt;br /&gt;
# Copy the executable to the target board. Substitute the IP address &amp;lt;code&amp;gt;10.0.2.41&amp;lt;/code&amp;gt; with the IP address of your target board.&lt;br /&gt;
#:{{cli | username=developer | hostname=ldc | scp timer root@10.0.2.41:/tmp }}&lt;br /&gt;
#Open a terminal on the target board, using SSH, serial, or a dedicated screen and keyboard.&lt;br /&gt;
# Navigate to the /tmp directory.&lt;br /&gt;
#:{{cli |  hostname=x86 | cd /tmp }}&lt;br /&gt;
# Run the program.&lt;br /&gt;
#:{{cli |  hostname=x86 | ./timer }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Using &amp;lt;code&amp;gt;timer&amp;lt;/code&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;timer&amp;lt;/code&amp;gt; program is executed from the console.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;./timer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The program will continue running until it is manually halted with a CTRL-C.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;timer&amp;lt;/code&amp;gt; C example project demonstrates how to use the xenomai timer.&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.emacinc.com/index.php?title=Configuring_Qt_Creator&amp;diff=5086</id>
		<title>Configuring Qt Creator</title>
		<link rel="alternate" type="text/html" href="https://wiki.emacinc.com/index.php?title=Configuring_Qt_Creator&amp;diff=5086"/>
		<updated>2015-11-12T20:29:49Z</updated>

		<summary type="html">&lt;p&gt;Kyoungmeyer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{todo| Review (11.09.2015-13:55-&amp;gt;KY+)|Brian Serrano|project=oe 5,bs,ky,mg}}&lt;br /&gt;
&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Configuring Qt Creator&lt;br /&gt;
|titlemode=append&lt;br /&gt;
|keywords=Qt Creator&lt;br /&gt;
|description=&lt;br /&gt;
}}&lt;br /&gt;
{{note| For paths that contain '''''{-gnueabi}''''', if the target architecture is ARM, just remove the curly braces. If the target architecture is x86, remove the curly braces and the text they contain entirely.}}&lt;br /&gt;
==Configure Kits in Qt Creator==&lt;br /&gt;
&amp;lt;cl&amp;gt;&lt;br /&gt;
1. Open Qt Creator&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;console&amp;quot;&amp;gt;&lt;br /&gt;
developer@ldc:~$ /home/developer/qtcreator-3.1.0/bin/qtcreator&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Click Tools-&amp;gt;Options...&lt;br /&gt;
* Select '''Devices''' from the left pane&lt;br /&gt;
 i. Press the '''Add...''' button&lt;br /&gt;
 * Select Generic Linux Device then press '''Start Wizard'''&lt;br /&gt;
 * Type in a name, the IP address, user name and password for the device&lt;br /&gt;
 * Click '''Next &amp;gt;'''&lt;br /&gt;
 * Click '''Finish'''&lt;br /&gt;
 * A connection will be established with the target device&lt;br /&gt;
 * Click Apply&lt;br /&gt;
* Select Build &amp;amp; Run from the left pane&lt;br /&gt;
* Select the '''Qt Versions''' tab&lt;br /&gt;
 i. Press the '''Add...''' button&lt;br /&gt;
 * Navigate to /opt/emac/5.0/sysroots/x86_64-emacsdk-linux/usr/bin/&lt;br /&gt;
 * Select qmake&lt;br /&gt;
 * Press apply&lt;br /&gt;
&lt;br /&gt;
[[File:Qt_Kit_qmake.png|500px|thumb|left|Figure 1: Qt Creator Kit Qmake]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the '''Compilers''' tab&lt;br /&gt;
 i. Press '''Add-&amp;gt;GCC'''&lt;br /&gt;
 * Type in a name such as OE5 ARM GCC&lt;br /&gt;
 * Click Browse...&lt;br /&gt;
 * Navigate to /opt/emac/5.0/sysroots/x86_64-emacsdk-linux/usr/bin/''target_arch''/&lt;br /&gt;
 * Select ''target_arch''-emac-linux{-gnueabi}-gcc&lt;br /&gt;
&lt;br /&gt;
[[File:Qt_Kit_GCC.png|500px|thumb|left|Figure 2: Qt Creator Kit Compiler]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the '''Debuggers''' tab&lt;br /&gt;
 i. Press '''Add'''&lt;br /&gt;
 * Type in a name such as GDB OE5 ARM&lt;br /&gt;
 * Click '''Browse...'''&lt;br /&gt;
 * Navigate to /opt/emac/5.0/sysroots/x86_64-emacsdk-linux/usr/bin/''target_arch''/&lt;br /&gt;
 * Select ''target_arch''-emac-linux{-gnueabi}-gdb&lt;br /&gt;
&lt;br /&gt;
[[File:Qt_Kit_GDB.png|500px|thumb|left|Figure 3: Qt Creator Kit Debugger]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the '''Kits''' tab&lt;br /&gt;
 i. Press the '''Add''' button&lt;br /&gt;
 * Type in a name such as OE 5.0 arm&lt;br /&gt;
 * Change the '''Device type:''' to Generic Linux Device&lt;br /&gt;
 * Change the '''Device:''' to the one configured in step 3&lt;br /&gt;
 * Type /opt/emac/5.0/sysroots/''target_arch'' into the '''Sysroot''' line&lt;br /&gt;
 * Change the '''Compiler:''' to the one created in step 6&lt;br /&gt;
 * Change the '''Debugger:''' to the one created in step 7&lt;br /&gt;
 * Change the '''Qt version:''' to the one created in step 5&lt;br /&gt;
 * Type ''target_arch''-emac-linux{-gnueabi}-g++ into the '''Qt mkspec''' line&lt;br /&gt;
 * Press '''Apply''' then '''Ok'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Qt_Kit.png|500px|thumb|left|Figure 4: Qt Creator Kit]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&amp;lt;/cl&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kyoungmeyer</name></author>
		
	</entry>
</feed>