Home
NetFusion Software uCLinux User Guide
Contents
1. ccccceceeeceeeneeece teen eeeeceaeeeceeeeesessaaaeeeseeeeesesnenaeeeeeeeeseeees 16 4 2 KNOWN PROBLEMS A LIMITATIONS cco sasiisiaiandaairnaidaasrnaiina skaida apaa daana daaa diaaa nad dadapan daana danai 16 5 CONFIGURING STARTER KIT FOR UCLINUX DEVELOPMENT ssssssceeeeeseeesssseneeeeees 17 5 1 POWERING UP AND CONNECTING THE SERIAL CONSOLE DEVICE ccccccccceeceeeeceeeeeeeeeeeeeeeeeeeeeeeeeees 17 5 2 CONNECTING A SERIAL CONSOLE TERMINAL APPLICATION TO THE M2S F G484 SOM NETFUSION PCB 18 5 3 INSTALLING U BOOT TO THE M2S FG484 SOM OF NertusaoN nnn 19 5 4 INSTALLING THE TFTP SERVER eege ciel deed EE ive wine ieee 20 5 5 BOOTING THE UCLINUX IMAGE EE 20 6 SMARTFUSION2 SOM BOARD UCLINUX SOFTWARE SET UP cccccesesseeseeeeeeeeeeeesees 22 6 1 UCLINUX DEMO AND DEVELOPMENT ENVIRONMENT nenten tenn 22 6 2 U SoorENWIRONMENT ttrt ettr Anett AAAA EEAS SE AARAA ASEE EE EAEE EEES SEEE ESEE EE EESE EE ESEE Ennen 22 6 3 ETHERNET MAC AppptEas cece cece cece ecae cece secu ee aaeaeeeeeeecesecaaeaeeeeeeeseseccaeeeeeeeeeeessncaeess 23 6 4 NETWORK CONFIGURATION cccccccecsesceeecseeceeeceeeeeeeceeeeeeceeeeeesaeeeesceeeeeessensaeessensaeesseesaeesesesaeess 23 6 5 RUNNING PRE INSTALLED UCLINUX IMAGE 23 6 6 LOADING UCLINUX IMAGES cece cece cece aeaeceeeeeeeeecaaeaeceeeeesesceacaeeeeeeesessccaeeeeeeeeeeesseaeess 23 6 0 U BOOT BUID EE 25 G 8 U BOOTINSTALLATION cs cocina cs scustces d cca tecaunandeges ceadeean
2. reboot f Restarting system Hit any key to stop autoboot 0 A2F LNX EVB gt run netboot inibestacteds Busy lt Ee Elek EES mount rootfs on type rootfs rw proc on proc type proc rw relatime sysfs on sys type sysfs rw relatime none on dev pts type devpts rw relatime mode 600 ptmxmode 000 172 17 0 1 home vlad test linux cortexm 1 12 0 projects on mnt type nfs rw relatime vers 3 rsize 1024 wsize 32768 namlen 255 hard nolock proto udp port 65535 timeo 7 retrans 3 sec sys mountport 65535 mountproto addr 172 17 0 1 ls lt mnt drwxr xr x AS19270 dE 4096 Mar 25 2011 my developer drwxr xr x ARES 2770 T9270 4096 Mar 25 2011 developer Side SSS 2 ESO T9270 3581 Mar 25 2011 Rules make drwxr xr x See 257 0 T9270 4096 Mar 25 2011 hello drwxr xr x S LOZO dE 4096 Mar 25 2011 networking SE ic OC research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 9 5 Install the New Project to Flash This section installs the new project to flash so that it automatically boots up on NetFusion on any power up reset At the U boot prompt load the uCLinux image into the target RAM over TFTP and program it to flash A2F LNX EVB gt print image image vlad v A2F LNX EVB gt run update Corel10 100 link up 100 Full Using Corel0 100 device TRIP from server 1172 17 01 our IP address is 172 17 4 150 Filename vlad v Load address 0x70000000
3. Driver LCD Controller Icd_pcf5074 c LCD optional display controller of text and format Si eee research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 14 8 Analogue Contact Input Connector ACI 5 signal pin 1 pointed to by arrow GND is the other ACI 1 signal pin 1 pointed screw pin pin 2 to by arrow GND is the th in pin 2 EE ACI 6 signal pin 1 pointed to by arrow GND is the other ACI 2 signal pin 1 pointed i i signal pin pointe screw pin pin 2 to by arrow GND is the other screw pin pin 2 ACI 7 signal pin 1 pointed to by arrow GND is the other screw pin pin 2 ACI 3 signal pin 1 pointed to by arrow GND is the other screw pin pin 2 ie ele leie ele ACI 8 signal pin 1 pointed to by arrow GND is the other ACI 4 signal pin 1 pointed BEEN to by arrow GND is the other screw pin pin 2 Driver Analogue Contacts ACI aci_ad7998 c Read analogue voltages from connector input 14 9 RS232 UART Serial Connectors 8 way screw terminal header RS232 with pin on the right indicated by the arrow This is electrically in parallel and the same as the DB9 connector below This is electrically in parallel and the same as the above connector It exposes a Male 9 way connector for normal serial cable attachment Driver Uses standard dev ttyS1 node stream in the uCLinux s
4. GPIO device driver 15 eee research OOO and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 4 1 3 NetFusion UIO Drivers Additional Packages e Default mounting of SPI flash JFFS2 partition to flash on the file system e UIO device drivers for SIP DC UART GPIO Audio LCD ACI Temperature and voltage supervision e SQLite customized uCLinux build Driver scripts and self diagnostic shell script e Patched core kernel to increase flash partition size and more kernel space for SQLite 4 1 4 Development tools e ARMv7 optimized GNU toolchain from CodeSourcery 2010q1 is used for development of U boot uCLinux and user space applications toolchain must be downloaded separately from the CodeSourcery web site e Cross GDB for debugging user space applications e mkimage tool used by the uCLinux kernel build process to create a uCLinux image bootable by U boot 4 1 5 Development environment e uCLinux hosted cross development environment e Development of multiple projects embedded applications from a single installation e hello sample project Hello world single process configuration 4 2 Known Problems amp Limitations This section lists known problems and limitations of this release e CONFIG_KERNEL_IN_ENVM requires disabling CONFIG_ARM_UNWIND and CONFIG_EARLY_PRINTK ID RT 74683 Workaround When enabling CONFIG_KERNEL_IN_ENVM in the kernel disab
5. Open Close functions for DMA main functionality written to be generic mtipDMAcontroller_extraHW c Portable functions for extra device setup for specific custom hardware for instance bespoke target device initialization via IO Register access initialization and shutdown only mtipDMAcontroller_macFIFO c Portable functions for the possibility of MAC IP core setup for the attached hardware to the DMA via IO Register access initialization and shutdown only 60 eee research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 mtipDMAcontroller_switchFIFO c Portable functions for the possibility of SWITCH IP core setup for the attached hardware to the DMA via IO Register access initialization and shutdown only mtipDMAController_timermod c PTP 1588 Clock Synchronization timer interfacing hardware functions mtipDMAController_syncgen c PTP 1588 PTP frame packet generation coding and handling mtipDMAController_slave_receive c PTP 1588 Slave mode of operation functions and code features mtipDMAController_master_receive c PTP 1588 Master mode of operation functions and code features mtipDMAcontroller_UIO c Specific Linux structured and bound source file to allow application software in Linux to send receive sideband data to the RX and TX of the DMA device driver and ten through to from the DMA hardware and MAC SWITCH interconnection m
6. Logis pel Password eeng Jeep Mio emer Syl ibys sessing sein 72 aly E psl pvr logout Connection closed by foreign host e S Start the telnet daemon to allow connections to NetFusion telnetd SS Connect to NetFusion from a local host PC using telnet hit Enter on the password prompt psl ocean linux cortexm 1 12 0 telnet 172 17 4 200 Trying Lio li 4 200 Connected to 172 17 4 200 Escape character is a2f lnx evb login root Password ett Start the dropbear SSH daemon to allow secure connections to NetFusion dropbear 11 OC Z OG research OOO and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Connect to NetFusion from a local host PC using ssh hit Enter on the password prompt psl ocean linux cortexm 1 12 0 ssh root 172 17 4 200 The authenticity of host 172 17 4 200 172 17 4 200 can t be established DSA key ringere intis ddk oedd 4205 ld 2fr ee 69 0c So2d0727270e787 Are you sure you want to continue connecting yes no yes Warning Permanently added 172 17 4 200 DSA to the list of known hosts root 172 17 4 200 s password On NetFusion configure a default gateway and the name resolver Note how the sample configuration below makes use of the public name server provided by Google Note also use of vi to edit target files under uCLinux route add default gw 172 17 0 1 vi etc
7. NetFusion Software uCLinux User Guide V1 0 August 2014 NetFusion Software uCLinux User Guide lt gt Microsemi i Jo eee research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Table of Contents 1 INTRODUCTION TO NETFUSION s ssssssssssssssssssssssscsssssssssssssssnsnsssnssssssssssseneseeseesesees 7 121 DEVELOPER SIMPLICITY eroina deet 7 e em Le ICH gt ee ep Ra 2 a A E a 8 1 3 NETFUSION UCLINUX ESTENSION eretet eter et arer er ererat eneren er nne 8 TA UCLNUX CORTEX eebe 8 2 HARDWARE PLATFORM sesesesesusunusununurururururunununununununnnunununnnunnnnnnnunnnnnnnnnnannnnnnnnnnnnnnnn nnaman 9 3 PRE INSTALLED DENO een 10 3 1 PRE INSTALLED DEMO ON THE NETFUSION HARDWARE DLATEORM 10 3 2 DESCRIPTION OF THE PRE INSTALLED DEMO ccccccccccceccceececeeeceeucecueeeeeeeeeeeeeeeeeseueesuceseeaeeeanenegs 10 d SOFTWARE FUNCTIONALITY wcessssistisescicssccievevcsaseievarssevensssevenescssssdevnsevivescseviveveseiinenssendneneaavienen 15 dh SUPPORTED FEATURES sieiavottssisvaadscsavadeuste vied sasvetesseaardsduaeddsdiosstaiginastaiedaraadsciraiedetesaiuleaavatliadys 15 4 1 1 UPDOOUTINM WANG EEN 15 4 1 2 UCENUX EE 15 4 1 3 NetFusion UIO Drivers Additional Packages ssssseessenrnensseesttnnrnnssretrnnnnnnsrrennrnnnenne 16 4 1 4 Development tool Snie ainia a aaa A AEA eeu seus sacha cea sanavecs 16 4 1 5 Development environment
8. A2F LNX EVB gt setenv image netfusion uImage A2F LNX EVB gt printenv image image netfusion ulImage A2F LNX EVB gt Running setenv lt var gt will un set the U boot variable e saveenv save the up to date U boot environment possibly updated using setenv commands into persistent storage A2F LNX EVB gt saveenv Saving Environment to Flash Un Protected 2 sectors Iert done Erased 2 sectors Weiering Lo Flesh done Protected 2 sectors A2F LNX EVB gt Io OC Z OG research OOO and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 8 3 2 Autoboot The autoboot sequence in U boot is controlled by the following environment variables e bootcmd command to execute automatically after reset To disable the autoboot undefine this variable e bootdelay delay in seconds before running the autoboot command During the bootdelay countdown you can interrupt the autobooting by pressing any key 8 3 3 Networking in U boot U boot supports downloading of images over network using the TFTP service To enable networking the following U boot variables must be set to values matching the local network configuration e ipaddr IP address of your NetFusion SOM board e serverip IP address of the TFTP server e netmask local network mask optional variable e image filename of an image loaded from the TFTP server optional variable After you have defin
9. AE FE AE AE AE AE FE FE FEAE AE FE H done Bytes transferred 2084704 lfcf60 hex 16384 KiB S25FL128S 64K at 0 0 is now current device Saving Environment to SPI Flash Erasing SPI flash Weiting to SP flesh done M2S SOM gt Reset the NetFusion baseboard and verify that the newly programmed image boots in the autoboot mode M2S SOM gt reset resetting U boote Ol0MOS lb nusc corm E oe 0G DE DEE SE Starting kernel Inte Started Busyebor vl 17 0 Dec 06 2013 EE 12 6 Board uCLinux Target Directory Structure Separate to the file structure on your host cross compilation PC above previous section it is important to know the default file system tree of the NetFusion SOM uCLinux running on the embedded hardware This is the file system that your embedded application software will see and use on the NetFusion The entire initial file system is started from a default state at boot up that is unpacked from the initramfs system in the uCLinux kernel This means that each time the NetFusion re starts or powers up the file changes in the main root tree are erased and defaulted back to a known state defined by the cross compilation contents of the rc directory in the netfusion project folder The exception to this is the flash directory on the NetFusion file system which is separately mounted to the JFFS2 flash partition of the SPI flash hardware on the SOM In this flash directory all files and changes are kept
10. GE peto0i4 PEESO zsh spimaudion line win e spirande ines inish spisaudiom line route spi_audio line out sh sqlite temp _sensor c temp_sensor sh vs_ad 998 c vs_ad 998 sh linuxPC Project linux cortexm 1 xx x projects netfusion source The execution script shell files aci_ad7998 sh coreUART sh ds1307rtc sh factory_test sh Icd_pcf5074 sh pcf5074 sh spi_audio_line_in sh spi_audio_line_out sh temp_sensor sh and vs_ad7998 sh may need to be modified to allow them to be executable scripts Type linuxPC Project linux cortexm 1 xx x projects netfusion source chmod x sh 52 Jo d and development NINE WAYS research NetFusion Software uCLinux User Guide File Descriptions NetFusion UIO user space device drivers for driving the PCB baseboard hardware SE EE coreUART c ds130 DEE E led ip mtipt perso CAE SOT pic est c Wal xc Sp ipauciouliinewinsc spi audio line Toute temp _ vs_ad sensor c EE V1 0 August 2014 C file Contact Inputs device driver C file R5485 stream device driver C file Real Time clock handler C file Base file that compiles into kernel to allow the rest of these device drivers at the user space level to attach to a UIO node C file LCD control device driver Q file iperf like test tool E file General purpose input output GPIO signal driver Controls LED relays GPIO and reads buttons switches inputs and option selectors E f
11. adding IP cores into the Libero IDE fabric design In short design development time can be as little as months to tailor and customize functionality to your needs If you add an IP core you can write the device driver for uCLinux then test and debug With a full UNIX file system using the bundled SQLite MySQL uCLinux provides easy database management at the power your embedded device eee research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 1 2 uCLinux uCLinux on SmartFusion2 opens up a new horizon of possibilities for application designers SmartFusion2 with its ARM Cortex M3 processor core and I O interfaces FPGA and programmable analogue is truly feature rich All these various features must be supported with software drivers stacks and programming interfaces uCLinux undoubtedly is the only OS that is ready for the job today Many hardware interfaces of SmartFusion2 are supported out of box by standard uCLinux device drivers and software frameworks For those that are not uCLinux provides a convenient development environment as well as an array of open source projects that can be used as starting points when developing support for required hardware interfaces uCLinux experts are everywhere and support is easy to find Whatever new feature or capability may be required by your customers in the future it is a safe bet that uCLinux will provide a level of support
12. coreUART sh ds130 deel factory test sh Led ste 4 ish PEESI 74 sh spi audio line in si spi audro Er temp _sensor sh vs ad 799279 Shedile sierra Corresponds to user space driver Shell Script Corresponds to user space driver Shell sicrsalae Corresponds to user space driver Shelileesicrarst Corresponds to user space driver Sihedulees ershare Corresponds to user space driver Shelly sicrsalaie Corresponds to user space driver Shelly sierra Corresponds to user space driver Shelileesieralste Corresponds to user space driver Sihedilees ersakaie Corresponds to user space driver Sinedelaes ersakeite Corresponds to user space driver Directories with in the source development tree tre mErpE de ese Sub directory Contains all C file include header files from this directory Sub directory Contains the bulk of the iperf styled SOM Ethernet test application 53 dai OC research OOA and development V1 0 August 2014 Temporary compiler dump directory NetFusion Software uCLinux User Guide object Sub directory sqlite Sub directory AMBA DMA kernel device driver object generation genGPIO_UIO ko Kernel Object mtipdw_dma_sw ko Kernel Object uCLinux build script Makefile for this local directory Makefile BUAR CIPE modules order BUNOS CIPE Go back out and then to the include directory All SQLite MySQL uCLinux source Pre compiled device driver for UIO user space
13. until they are deliberately erased or modified This is the location that can be used for instance with SQLite databases settings files debug logs stored data of other kinds iol OC research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 We can have a look at the root filesystem 1s pin ete httpd meiptest sql vac dev factory init prod sys drivers flash lib root sx bin directory contains Emcraft uCLinux binary executables such as busybox etc directory has inittab hosts passwd and configuration Linux files for the system httpd directory specific NetFusion web server files and scripts cgi and html mtiptest directory the Nine Ways MorethanIP test app for any Ethernet cores which is like iperf and allows for throughput measurement testing iperf is quite un portable to this uCLinux and so this custom application has been designed and written for this specific environment sql directory SQLite3 database query executable var directory general normal Linux system directory dev directory NetFusion devices listed as file nodes factory directory Factory manufacturer s test scripts for self diagnostics init directory contains the init binary that is first booted by the uCLinux kernel proc directory uCLinux kernel read only file nodes representing the kernel s status sys directory structure of classes and UIO devices regi
14. 4000 datapathL lt datapathL gt datapathR lt datapathR gt When driver loads it will check for an Enable Disable or Quit Program code Please enter e enable d disable or q quit program Carriage return terminated Support www nineways co uk pbates nineways co uk Description The line OUT audio is stereo and so has two independent channels Once the driver has been executed on the command line with the settings passed at the same time as parameters the arbitrary input streams are opened ready for transmitting the data to a DAC then out the analogue line circuitry The two input streams are not the standard input stream but in fact two independently declared file streams that can be written to by other applications in order to send the audio data These are setup on the command line parameters before the session begins and for the duration of the session the two input file streams receive the data and send to the DAC and Line OUT circuitry The standard input stream is also used in addition to the two file streams The standard input allows single character commands shown above to enabled disabled the audio and also to exit the session and close the driver application The file streams allow the user to create their own functionality to handle the sent audio data maybe the user will write an application to receive from the UDP IP using RTP and then send the audio digitized data on each of the independent input file
15. Guide V1 0 August 2014 23 References Visit Emcraft s web site at www emcraft com to obtain additional materials related to Linux Cortex M Emcraft Systems provides detailed kit information and materials from this page http www emcraft com som m2s As new SmartFusion2 and kit related materials become available they will be posted on the Microsemi and Emcraft Systems web sites Microsemi recommends that you sign up for Product Updates to be notified when new material is available Microsemi product updates https www actel com portal default aspx r 2 Emcraft Systems product updates http www emcraft com som m2s register Refer to Emcraft Systems SmartFusion2 SOM System On Module Hardware Architecture for detailed information on the hardware architecture of the Emcraft Systems SmartFusion2 SOM board Refer to Emcraft Systems SOM BSB EXT Baseboard Hardware Architecture for detailed information on the hardware architecture of the Emcraft Systems SOM BSB EXT baseboard Refer to Linux Cortex M User s Manual for detailed information on the software architecture of the Linux SmartFusion2 distribution 106 JV eee research and development Ki NetFusion Software uCLinux User Guide V1 0 August 2014 24 Contact Nine Ways Research amp E Mail pbates nineways co uk Development Ltd Internet www nineways co uk UK Unit G 15 iDCentre Lathkill House rtc Business Park London Road Derby DE24 8UP United Kingd
16. LPDDR 16384 KiB S25FL128S_ 64K at 0 0 is now current device 93 OC Z OG research OOO and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Then a bootm command is called upon the image loaded into DDR What this command does is parse the image header figure out the image type and size optionally verify the checksum and pass control to the kernel entry point Booting kernel from Legacy Image at a0007fc0 Image Name Linux 2 6 33 arml Image Type ARM Linux Kernel Image uncompressed Data Size 941920 Bytes 919 8 kB Load Address a0008000 Entry Polat et This is where U boot is done and the uCLinux kernel starts running Starting kernel The following are the first messages printed by the kernel Linux version 2 6 33 arml vlad ocean emcraft com gcc version 4 4 1 Sourcery Gir Lite 2010q1 189 79 thin Dec E MSK 2002 CPU ARMv7 M Processor 412fc231 revision 1 ARMv7M CPU NO data cache 8K instruction cache Machine Actel M2S Note the kernel input arguments passed by U boot to the kernel This is defined by bootargs in U boot Kernel command line mis platform m2s fg484 som console ttyS0 115200 panic 10 to l 2 17 4 2192172 17 0 1s 2 im2s foe4c4 somietnU ort ethaddr C0 81 lt 302783283783 The kernel proceeds to set the memory up We have 64 MB of LPDDR to run uCLinux from Memory 64MB 64MB total Memory 64016k 64016k available 1520k reserved
17. Loading HHHHHHEREEEEEE EERE TE HE EA EA EEE REE REE HA EA ER AE REE REE E E EE E E E E HEE FE TE HE FE HE FE TE FE AE EE REESE RHEE EERE E E E done Bytes transferred 1439232 15f600 hex Un Protect Flash Bank 1 Erased 22 sectors Copy to Flash done A2F LNX EVB gt Reset the NetFusion baseboard and make sure that the new project boots from flash in the autoboot mode A2F LNX EVB gt reset resetting Hit any key to stop autoboot 0 Booting kernel from Legacy Image at 74020000 init started BusyBox v1 17 0 2013 12 06 19 58 44 MSK ls lt mnt drwxr xr x AES 270 TIZA 4096 Mar 25 2011 my developer SE io OC research OOO and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 9 6 Develop a Custom Loadable Device Driver over NFS Go to the application sub directory in your project s directory bash 3 2 cd app bash 3 28 pwd home vlad test linux cortexm 1 12 0 projects hello app The developer project you have cloned your new project off already provides a loadable kernel device driver implemented in sample c The device driver allows reading device data from a pseudo device which keeps its data in a character array defined in sample c Let s enhance the device driver to allow changing the device data by writing into the character array Note that this being a simple example of a development session the code below assumes that the user s
18. OCH research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Proceed to update the library configuration file to your liking The example below enables the RPC related build time options in the configuration UCLIBC_HAS IPV6 is not set UCLIBC_HAS RPC y UCLIBC_HAS FULL _RPC y UCLIBC_HAS REENTRANT RPC y UCLIBC_USE_NETLINK is not set Remember to save your edits when exiting the editor Build the internal configuration file that will be used to by the library build procedure bash 3 2 make s ARCH_CFLAGS CPU_CFLAGS mthumb march armv7 mfix cortex m3 ldrd oldconfig configuration written to config bash 3 2 Build the updated library Ignore the compiler warnings bash 3 2 make ARCH_CFLAGS CPU_CFLAGS mthumb march armv7 mfix cortex m3 ldrd j2 s bash 3 2 Install the newly build library wherever you would like to install it You can of course install it to the same directory where it is installed in the uCLinux distribution as shown in the below command bash 3 2 make ARCH_CFLAGS CPU_CFLAGS mthumb march armv7 mfix cortex m3 ldrd s PREFIX INSTALL ROOT A2F root install bash 3 2 45 OC Z OG research and development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 If you would like to preserve the original library and install the updated library to some other directory
19. OK highmem Virtual kernel memory layout vector 0x00000000 0x00001000 4 kB fixmap Oxfff00000 Oxfffe0000 896 kB vmalloc 0x00000000 Oxfffffff f 4095 MB lowmem 0xa0000000 0xa4000000 64 MB modules 0xa0000000 0x01000000 1552 MB init 0xa0008000 0xa0047000 252 kB text Oxa00cd7e8 Oxa00e3000 87 kB data 0xa00e4000 Oxa00edf60 40 kB ic 94 OCH research O and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Then the kernel runs the so called calibration loop in order to calculate loops in jiffies also referred to as lol The lpj value is used by the kernel to implement various delays Note that as part of the calibration loop the kernel also calculates the BogoMIPS value which is a uCLinux approximation of the MIPS Million Instructions Per Second metric Calibrating delay loop 154 82 BogoMIPS lpj 774144 The UART device driver and the serial console are initialized Serial 8250 16550 driver 2 ports IRQ sharing disabled serial8250 0 ttySO at MMIO 0x40000000 irq 10 is a 16550A console ttyS0 enabled The SPI device driver is started and the SPI flash is partitioned onto three separate logical partitions Each partition can be accesses as a separate logical device by user space code m25p80 spi0 0 s25f1129p1 16384 Kbytes Creating 3 MID partitions on s25fli29pl 0x000000000000 0x000000010000 spi flas
20. Out serial ieg serial Net M2S MAC Hit any key to stop autoboot 0 M2S SOM gt U boot makes use of the so called environment variables to define various aspects of the system functionality Parameters defined by the U boot environment variables include target IP address target MAC address address in RAM where uCLinux bootable images will be loaded and many more To examine the current settings of the environment variables run printenv from the U boot command interface U boot provides a command called saveenv that stores the up to date run time environment to the persistent storage which will be the external flash for the U boot configuration used on the NetFusion board You need to call saveenv any time when you want to copy current settings of the environment variables to the persistent storage in flash This is how you can write the current U boot environment to the external flash M2S SOM gt saveenv Saving Environment to SPI Flash Erasing SP flash Writing to SPI flesh done M2S SOM gt 22 COOC research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 6 3 Ethernet MAC Address The MAC address of the Ethernet interface is defined by the ethaddr U boot environment variable The value of the MAC address can be examined from the U boot command line monitor as follows M2S SOM gt printenv ethaddr ethaddr C0 B1 3C 88 88 88 M2S SOM gt The SmartFusio
21. Software uCLinux User Guide V1 0 August 2014 14 13 5 General I O GPIO General I O GPIO pcf5074 c Individual spare pins and the LEDs Switches amp Jumpers This driver is demonstrated and handled in the shell script on NetFusion drivers pcf5074 sh Usage amp Syntax pcf5074 parameter syntax Must be more than 12 parameters with switches gpiooffs lt addr gt sdabit lt bit gt clkbit lt bit gt gpiol lt string gt gpio2 lt string gt gpio3 lt string gt gpiooffs is the user memory offset within the UIO mechanism phys mem of the i2c GPIO signal sdabit is the bit position within the i2caddr location of the sda signal Zero based between 0 31 clkbit is the bit position within the i2caddr location of the clk signal Zero based between 0 31 gpiol is 8 bits long binary word representing the output state of the P port gpio2 is 6 bits long binary word representing the output state of the P port gpio3 is 1 bit long binary word representing the output state of the P port Green LED Example pcf5074 gpiooffs 1879048192 sdabit 2 clkbit 1 gpiol 10101110 gpio2 101000 gpio3 Support www nineways co uk pbates nineways co uk Description All of the NetFusion PCB individual I O lines that are not buses or protocols are under the umbrella of this GPIO user space driver application The command line parameters setup the settings and also set the output states of those I O
22. allow for priority to take place and thus lower priority Ethernet frames are held up in their lanes whilst the higher priority are transacted through first The Linux software device driver shall provide for the two lanes per direction Thus CHO CH1 for RX DMA Also CHO CH1 for TX DMA No other assumptions or priority takes place with the device driver as the hardware reads the TX DMA first and the IP stack upper layers in the OS can decide themselves the priority of the reading of the RX DMA from the descriptor information The device driver just has to provide the parallel channels in both directions 12 4 6 Linux uC Linux Network Interface Exposure The device driver will cause the Linux uC Linux OS to expose two separate network interfaces to the application layers for the DMA Controller connected to a MAC SWITCH Note Whilst the name of the exposed network interfaces is configurable described below it will be illustrated and described as dev eth0O and dev eth1 here in this sub section The CHO for RX and TX together will be piped through to exposed interface dev eth0 This is easy to remember as eth0 is CHO high priority Also CH1 for RX and TX together will be piped through to exposed interface dev eth7 62 OC research and development NINE WAYS At this point it is widely assumed that the software application programs that bind to selected NetFusion Software uCLinux User Guide V1
23. be changed using the arm uclinuxeabi fithdr utility psl ocean app arm uclinuxeabi flthdr arm uclinuxeabi flthdr invalid option invalid option usage arm uclinuxeabi flthdr options flat file Allows you to change an existing flat file p print current settings z compressed flat file d compressed data only flat file Z un compressed flat file r 2 ram load R do not RAM load k kernel traced load for debug K normal non kernel traced load S Size Stack Size 6 file outputs le default is to modify input file Report bugs to lt URL https support codesourcery com GNUToolchain gt psl ocean app arm uclinuxeabi flthdr app app Magic bFLT Rev 4 Build Date Heil Now 23 13 24 57 2012 Entry 0x45 Data Start 0x4300 Data End 0x5440 BSS End 0x7500 Stack Size 0x1000 Reloc Start 0x5440 Reloc Count Ox7d Flags Oxl Load to Ram psl ocean app arm uclinuxeabi flthdr s 8192 app psl ocean app arm uclinuxeabi flthdr app app Magic bFLT Rev 4 Build Dates ri Now 23 1324 57 2012 Entry 0x45 Data Start 0x4300 Data End 0x5440 100 el SSeS e008 OO OS research DOEA and OOO development 8000 SO2ee NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 BSS End 0x7500 Stack Size 0x2000 Reloc Start 0x5440 Reloc Count Ox7d Elags xl Toad to Ram psl ocean app 101 do OC research OOA
24. bugbutton and select g4m_system_MSS_CM3_app Debug Confirm the Perspective Launch dialog The program will be loaded to the NetFusion SRAM and stopped on the first breakpoint at main Step over F6 and into the functions F5 examine variables just point the mouse over the variable and so on Single step until up to the sprintf just after the config_mddr_lpddr Add a memory monitor to the RAM address 0xa0000000 using the Memory tab lower SoftConsole window Now step over sprintf and observe that the string appears at location Oxa0000000 Resume the program run with F8 green triangle in the Debug window Observe the SoftConsole application working on the NetFusion baseboard 15 4 Modifying the Libero and SoftConsole Projects To modify the Libero project rebuild and rerun the application in SoftConsole Terminate the program with Ctrl F2 red square and switch back to the C C Editor perspective Don t leave SoftConsole In Libero open the Design gt Configure Firmware tab Let s add a new software driver to our SoftConsoleproject Add a checkbox to the SmartFusion2_MSS_NVM_Driver_0 Re generate SoftConsole workspace yellow barrel with gear in the middle of the Libero window i e LZ OR Now switch to SoftConsole and observe that the mss_nvm firmware appears in the tree of the g4m_system_MSS_CM3_HW_platform project in the drivers directory iol eee research OOA and develo
25. commands to load the image over TFTP and install it to the flash BOARD gt setenv image netfusion uImage BOARD gt run update Next reset will load the newly installed image from the flash BOARD gt reset resetting 91 eee research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 17 Booting uClinux on SmartFusion2 in 0 5 Seconds Ki 17 1 Fast booting uCLinux on SmartFusion2 Watch this video to see how Linux uCLinux boots up on SmartFusion2 from power up to the interactive shell in about 0 5 seconds Both Cortex M3 and LPDDR are configured to run at 166MHz PCLKO is set to a 1 2 of the main clock 83MHz allowing to run SPI_O and access the SPI flash at up to 41 5MHz The on chip cache is enabled by software for LPDDR The uCLinux configuration used in this demo targets a typical data harvesting device Support for the SPI controller SPI flash flash partitioning and JFFS2 are all enabled in the kernel As soon as uCLinux comes up to the shell a data harvesting application or any number of such applications can be started from the etc rcstart up script collecting data from various sensors and logging collected data into the system on module SPI flash As can be seen from the above video it takes uClinux only 0 5 seconds from power up reset to the point where data harvesting can commence 17 2 uCLinux Bootstrap Sequence The uCLinux bootstrap can b
26. configured as outputs The return string is the state of those GPIO lines configured as inputs The outputs are the expansion GPIO connector the user LED relays and the RS232 extended signals The inputs signals include the rotary switches option jumper selectors LCD buttons and the expansion connector inputs Typical return string 2 128 n3 64 n4 23 n 83 aoe eee research OOO and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 14 13 6 Line OUT Stereo Audio Line OUT Stereo Audio spi_audio_line_out c Stream digital audio to analogue Line OUT audio This driver is demonstrated and handled in the shell script on NetFusion drivers spi_audio_line_out sh Usage amp Syntax spi_audio_line_out parameter syntax Must be 10 parameters with switches rightaddr lt rightaddr gt leftaddr lt leftaddr gt samprate lt samprate gt datapathL lt datapathL gt datapathR lt datapathR gt rightaddr is used to define the right base address of the spi_audio_line_out in memory leftaddr is used to define the left base address of the spi_audio_line_out in memory samprate is the channel left right frequency rate datapathL is the string that accesses channel 0 inode file to allow data transfer datapathR is the string that accesses channel 1 inode file to allow data transfer Example spi_audio_line_out rightaddr 8 leftaddr 4 samprate
27. for your PUTTY session Specify the destination you want to connect to Seral line Speed COM11 115200 Connection type ORaw O Tenet O Rogn OSSH Seral Load save or delete a stored session Saved Sessions Defaut Settings Close window on ext O Aways ONever Only on clean ext 18 OC research OOO and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Push the reset button on the NetFusion You should see the U Boot banner U Boot 2010 03 linux cortexm 1 11 0 July 5 2013 19 43 46 CPU 2 SmartFusionz Soc Cortex M3 Hard IP Freqs CORTEX M3 166MHz PCLKO 83MHz PCLK1 83MHz Board M2S FG484 SOM Rev 1A www emcraft com DRAM 64 MB In serial Out serial Err serial Net M2S MAC Hit any key to stop autoboot 0 M2S FG48 4 SOM gt To verify the serial console is working please stop at the U Boot prompt by pushing any key If needed hit the reset to restart U Boot If there is no activity on the PuTTY window or something else is printed out then you should install the stp image with U Boot to the NetFusion M2S FG484 SOM 5 3 Installing U boot to the M2S FG484 SOM of NetFusion e Install the Libero SoC v11 4 e Download the stp image from the Nine Ways website nineways co uk e Attach the FlashPro programmer to the development host PC and to the JTAG programming header of NetFusion Start the FlashPro application From the FlashPr
28. linux cortexm 1 xx x projects netfusion local html ls aci cgi aci_driver html board checks main html datetime _bc html drivers main html dsi307 driver html electronve jpg f ille gt name filesys be html index shtml led cgil lcd_driver html main htm mydemo cgi pcf cgi pcf_driver html rtc cgi sql cgi tem cgi vol cgi volt_sup_ driver html linuxPC Project linux cortexm 1 xx x projects netfusion local html jpg image picture file Used in the demo web page as images html HTML web page file Secondary web page HTML files referred deeper into the website from the index html Index html Main root web page Start root web page when pointing a browser to the NetFusion web server jp address cgi CGI script file CGI files that are invoked from the HTML files to action a driver on the NetFusion board which then passes back the information to be displayed This is a simpler form of using Python or PHP linking to a database etc Go back out and then to the netfusion patch directory linuxPC Project linux cortexm 1 xx x projects netfusion local html cd linuxPC Project linux cortexm 1 xx x projects netfusion cd patch linuxPC Project linux cortexm 1 xx x projects netfusion patch 1s applypatch spi c linuxPC Project linux cortexm 1 xx x projects netfusion patch ic OC research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 Au
29. nenten anneanne ena 89 16 INSTALLING A BOOTABLE UCLINUX IMAGE TO THE NETFUSION BOARD 91 17 BOOTING UCLINUX ON SMARTFUSION2 IN 0 5 SECONDS ssaassssneessnnnnnnnnnnnnnennnnnennne 92 17 1 FAST BOOTING UCLINUX ON BMARTEUSIONZ 92 17 2 rei Ideeen Tee 92 17 3 INSTALGING THE DEMO rasirio aan AREATA ER AEAEE EAA AETS 93 17 4 UNDERSTANDING THE DEMO weesciziesscccutsscedcceisecctacssetecdcasadacadssaedieesveeccadsvadaceeaseascadssaaicduieeeciieds 93 17 5 CONFIGURING FOR FAST BOOT eet Edel 96 17 6 RESTORING DEFAULT CONFIGURATION isaossrssiinini nanakia Aana AAAA AEA 98 18 USING DHCP CLIENT IN U BOOT cccccccesseeceeeseeeeenseaeeeeeseaecesenaaesesnneaeaesnsaaeaesnsaaeeeennaaes 99 19 SETTING THE STACK SIZE FOR A USER SPACE APPLICATION ccssseeeeeteseeeees 100 20 BUILDING MULTI THREADED APPLICATIONS c c ceceesseceeessseeeeesseeeeeesseeeeensneeeeeneas 102 21 HOW TO DEFINE AN IRQ HANDLER IN A CUSTOM UCLINUX DEVICE DRIVER 103 22 UNDERSTANDING WHAT CAUSES SEGV IN AN APPLICATION essseeeeessseeeeeees 105 23 REFERENCES is cccceccsecceecssectes fssectei ANENA AAN SANAAA ss RNAAR A es secu ossetved SA ANKRA RARASAANANA ANAKARA N AARAA 106 24 CONTAC EE 107 25 DOCUMENT HISTORY vce isciscesscctcces SEKR Ee Kee KSE cs svete cect envi tssustee KSE EEN See Sek 108 iol eee research OOA and development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014
30. resolv conf nameserver 8 8 8 8 Use wget to download a file from a remote server wget ftp ftp gnu org README Connecting Core onu Orgi AOne Ore Olas README 100 el 1765 EEGEN ETA cat README This is ftp gnu org the FTP server of the the GNU project Comments suggestions problems and complaints should be reported via email to lt gnu gnu org gt Use ntpd to synchronize the time on the NetFusion with the time provided by a public server date Thu Jan 1 00 03 08 UTC 1970 ntpd p 0 fedora pool ntp org sleep 5 date Bie Dec Oe Ee UMC 2 Oils Mount a directory exported by a development host over NFS mount o nolock rsize 1024 172 17 0 212 opt tmp mnt mount rootfs on type rootfs rw proc on proc type proc rw relatime none on dev pts type devpts rw relatime mode 600 ptmxmode 000 TAO ee io ane Ee sues rw relatime vers 3 rsize 1024 wsize 32768 namlen 255 hard nolock proto udp port 65535 timeo 7 retrans 3 sec sys mountport 65535 mountproto addr 172 17 0 212 ls mnt CREDITS busybox hello c hello2 gdb tests tgz address cache demo hello gdb EIERE EE sh ulmage bacserv event hello good test window bin hello hello2 test log S a ic OC OO research OOO and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Start the HTTP daemon httpd h httpd html From a local host PC open a Web browse
31. space Here is the code that registers the IRQ and enables the interrupt at the GPIO level Register an IRG handler for the User push button press event EH ret request irq 50 sample irg 0 sample 0 if ret lt 0 printk KERN_ALERT s request_irg failed with d n eve EE goto Done I Configure GPIO O as input enable interrupts Level Low el anSigned int 0x40013000 0 1 lt lt 1 l lt lt 3 1 lt lt 5 Here is the interrupt handler For the level sensitive interrupts no explicit clearing is needed for edge sensitive you would have to add code to explicitly clear the interrupt by writing into the GPIO_IRQ register EE Ee hee en eet ee de abel printk beer ee lian P return IRQ RETVAL 1 Here is how the code was tested on the NetFusion Load the driver as a kernel module the driver was developed over NFS mnt insmod sample ko mnt 103 GK OC research and gt development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Push the button and then release it quickly As can be seen from the snapshot below the interrupt is triggered as long as there is the hardware event the push button signal is being low then there is no interrupt when the push button is released mnt irq 50 aer S0 Zaemer 20 we SO mnt mnt mnt 1s Makefile app c sample c sample mod o Module symver
32. specify the target directory with PREFIX in the above command Whenever you have installed the updated library provide the correct path to it with the L and I compiler flags when building your application For instance for the installation command above you need to specify the following when building your application bash 3 2 arm uclinuxeabi gcc o test test c mcpu cortex m3 mthumb ISINSTALL_ROOT A2F root usr include L INSTALL ROOT A2F root usr 1lib bash 3 2 46 OC Z OG research and development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 11 Building Multi Threaded Applications The version of the uClibc included with the CodeSourcery tool chain does not provide support for POSIX threads To address this limitation Emcraft has enabled POSIX threads in uClibc and included the updated library built for Thumb in our uClinux distribution In order to build a multi threaded application and link it with the appropriate uClibc binary do the following After activation of the cross build environment source ACTIVATE sh run the following command inux dp c being the application in the below example arm uclinuxeabi gcec o linux dp linux dp c I INSTALL ROOT A2F root usr include mcpu cortex m3 mthumb LIN INSTALL ROOT A2F root usr lib pthread iol eee research OOO and development Ki NINE WAYS NetFusion Software uCLinux User Gu
33. the following documentation SQLite Official Website Also type sqlite3 help on the NetFusion prompt for full descriptive options and usage as a command helper 12 4 The AMBA DMA Controller Device Driver 12 4 1 What is the AMBA DMA Controller The DMA Controller is an IP core that is provided in the Libero starter project that is bundled with the NetFusion product It is located in the SmartFusion2 FPGA fabric and interfaces via an AHB Lite memory bus Below describes the related and associated device driver and the source files that have briefly been covered above 12 4 2 Source Files The files associated with the AMBA DMA Controller are include lt directory gt object lt directory gt Makefile moduleparms mtipDMAcontroller_main c mtipDMAcontroller_dmaCORE c mtipDMAcontroller_extraHW c mtipDMAcontroller_macFIFO c mtipDMAcontroller_switchFIFO c mtipDMAcontroller_UlO c mtipDMAController_timermod c mtipDMAController_syncgen c mtipDMAController_slave_receive c mtipDMAController_master_receive c mtipsw_dma_s ko include lt directory gt All C header files for the DMA device driver object lt directory gt DMA device driver target object file compilation dump Makefile A copy of one of the next two make files below moduleparms DMA device driver settings file upon driver registration mtipDMAcontroller_main c DMA device driver kernel object structured main source mtipDMAcontroller_dmaCORE c Portable Send Receive
34. this list Name Type What it does mtipDefine h Header Store the names used in the whole code Mtiptest c Main Implementation Store the Main Function mtipFunctions h Header mtipFunctions c Functions Functions used by all files Implementation Table 2 App Program Exceptions for File List 12 2 1 1 Understanding the names of the Functions The main file of the App mtiptest c will read the command line to know if it is going to work as server client or loop back than each test UDP TCP RAW will be called for the selected operational mode In this case the functions names follow a pattern that will be described in the next table Inside the TCPsvMain another function will be called to handle the communication between the endpoints but this one is not recurrent Each type of test will have its own function that will call all functions necessary to create sockets change their options and handle the communication Name What it does TCPclIMain TCP Client Main TCPsvMain TCP Server Main TCPloMain TCP Loop Back Main UDPclIMain UDP Client Main UDPsvMain UDP Server Main UDPloMain UDP Loop Back Main RAWc IMain RAW Client Main RAWsvMain RAW Server Main RAWIloMain RAW Loop Back Main UDPloReport UDP Loop Back Report TCPloReport TCP Loop Back Report RAWIoReport RAW Loop Back Report UDPclReport UDP Client Report TCPclReport TCP Client Report RAWc IRepor
35. 0 August 2014 network interfaces will ultimately control how the TX DMA effectively utilizes this mechanism The RX DMA will automatically tend to according to the hardware specification in the MAC SWITCH IP cores prioritize and order the packets arriving This means the upper layer software is not aware of the prioritization However it is for the system architect and designer to ensure that the different software using different Ethernet traffic types to ensure that the application programs are binding to the relevant exposed network interfaces Usually bridge protocol packets are assigned higher priority and so they could be using dev eth0O and the RSTP demon can assign bridge lt br0 gt to use this network interface This allows for those BPDU packets to be processed much higher priority as the network topology has to be prioritized to a much more important extent that the normal Ethernet frame data traffic This whole mechanism is to enforce packet type prioritization from end point software applications through DMA MAC interfaces switches and routing Not all of this can often be achieved but for this product the DMA Controller is fully ready for the functionality requirement of channel priority 12 4 7 DMA Controller Device Driver Parameter List The parameters for the uCLinux AMBA DMA Controller device driver are kept in lt moduleparms gt file in the lib directory of the delivered package This is a text file but is not
36. CS and or SWITCH cores however the default deliverable driver usually will only handle DMA registers with basic minimal support for the additional MAC SWITCH hardware The aim is not to provide full operational control and management but purely for basic information gathering such as Link UP and DOWN and flow control error checking via IRQ Interrupt Service Routines ISRs The driver is implemented in a kernel module named MTIP DMA SW 61 eee research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 12 4 4 Driver Operation amp Functional Description The Linux kernel device driver named mtipsw dma sw is an installable independent module written in the C programming language It is considered separate in meaning because it is not part of the compiled kernel or available in the mainline released kernel from lt www linux org gt In fact this device driver that is bundled with the DMA Controller comes packaged as C source code with make file scripts for GCC Linux It allows the Ethernet frame to from the DMA hardware connected to a MAC SWITCH to pass to a network interface in uC Linux From here it then allows as standard application programs to communicate with a network via standard sockets using IP and other allowed upper layer protocols The application programs run as threads in uCLinux utilizing all the powerful features of such a well established OS The relevance
37. EA SATEN 35 9 SAMPLE DEVELOPMENT SESSION ccccsseccccesseceeeseeeeeeesneeseeeseeeseeeseeeseseseeeseseseaeeeeeseaeeeeesoaes 37 HI SAMPLE SESSION OUTLINE wic cstensiiccectidecddstebucecsatdccudanpidadaaside iia iidr iaaiiai asida aidia dadar 37 9 2 CREATE Te EE 37 9 3 SETUP TARGET FOR DEBUGGING OF THE NEW DROUET 37 9 4 UPDATE THE NEW EE 39 9 5 INSrALLTHENGwPpoOgcCTTobtaen 40 9 6 DEVELOP A CUSTOM LOADABLE DEVICE DRIVER OVER NES 41 9 7 DEVELOP A CUSTOM USER SPACE APPLICATION OVER NES 43 10 BUILDING UCLIBC secs soci secsarts sett stce fecncres ste cxtcs sesbared ea oe aeaa aa aiana piap ear Enara narea Ern siaaa 44 11 BUILDING MULTI THREADED APPLICATIONS cccsseeeeeeeeeeeeeeeeeeseseeeeeeeeeseeeeeseeeeneneeess 47 12 NETFUSION PROJECT IN THE UCLINUX TREE cccccssecceeeseeeeeeeeeeeeeeeseeeeeeeseeeeeeeseeneeeeeees 48 12 1 WHAT IS THE NETFUSION PROJECT WITH IN THE UCLINUX ccccceeeeeeeeeeeeeeeeeseneeeseaeeesseeesenees 48 12 2 SOURCE FILE STRUCTURE amp NETFUSION PaCHKAGE ttnn nte tnt 49 1221 Package Deliverable s iici scecccncte seotttees cadeceeecideceesevineseeet dagae eeateceeed dantnevieaseeviaedeeh a 49 12 2 2 Host PC Cross Compile Directory Structure 0 cccceceeeeeeeeeneeeeeeeeeeeeeneeeeeseneeeeeeenanees 50 12 2 1 File List of mtiptest Directory sscan iaaa an aaie aadA ana AA aAA 56 122 2 SQLite DINGO EE 59 12 3 SOLITE USAGE EE 60 12 4 THE AMBA DMA CONTROLLER DEVICE DpIWMER 60 12 4 1 What is the AMBA DMA C
38. List of Figures Figure 1 The NetFusion CAT5 PCB Hardware Platform SERDES variant also available 9 Figure 2 USB Cable Connected to the USB UART Interface from a PDC 17 Figure 3 TFTP Application on Windows SPIEL 20 Figure 4 An example on Ubuntu Linux of the Terminal being launched 2 0 0 eee eeeeeeeteeeeeteesees 48 Figure 5 Default MAC Setting oo cc ceceecssessescssessescsseseeecseesesecsesaeeecaseaesecaseaesecaeeaeeecaeeaeeecaseaeereaeeaeeenteaeers 58 Figure 6 Default Server Name Setting oo ec ceccescsseseescsseseescseeseeecseeaeeecaseaeeecaeeaeeecaeeaeeecaseaeeeaeeaeereneeaeers 58 Figure 7 Main opening screen for the NetFusion Demo Website A 69 Figure 8 Drivers Hardware Page for the NetFusion Demo Website A 70 List of Tables Table 1 App Program File List and Meanings cceeccceeccssessceseeeceseeseesecseesecsseeeeaecsessecsessecsseneseaeeseeaeeas 56 Table 2 App Program Exceptions for File List 57 Table 3 App Program Source Content 57 Table 4 App Program Source important Variables cccccccsessseecseescesecseeeceesecsaecseesecsesseesseeeseaeeseeaeeas 58 Table 5 Full NetFusion User Space Hardware Drivers 73 Table 6 Document History Entry Log 108 JoD OCH research and development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 About This Document This specification fully documents and describes the process of file structure of so
39. MAC below sl ifndef DEFAULTMAC define DEFAULTMAC c0 bi 3c 83 83 83 endif Figure 5 Default MAC Setting Change c0 b1 3c 83 83 83 to your client MAC address To change the DEFAULT server address below ifndef SERVERNAME define SERVERNAME 10 1 1 106 endif Figure 6 Default Server Name Setting Then change 10 1 1 106 to your Server Address Save the file with the same name in the same directory 58 OC research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 12 2 2 SQLite Directory Go to the sqlite directory from the netfusion source directory linuxPC Project linux cortexm 1 xx x projects netfusion source cd sqlite linuxPC Project linux cortexm 1 xx x projects netfusion source sqlite 1s backup diit en hi Makefile sqiiites cc sqlites configure sqlitesext h sqiite3 h bits lockfille sh shell c sqlite3 linuxPC Project linux cortexm 1 xx x projects netfusion source sqlite The execution script shell file sqlite3_ configure may need to be modified to allow it to be an executable script Type linuxPC linux cortexm 1 xx x projects netfusion source sqlite chmod x sqlite3 configure sqlite3_configure configuration initialization shell run this to discover cross compile environment for the SQLite build process backup sub directory Old files remaining from before uCLinux Emcraft por
40. PC Project linux cortexm 1 xx x projects cp source dir netfusion uclinux x xx gz You can use the following command to unpack the package file into the projects dir linuxPC Project linux cortexm 1 xx x projects gzip d netfusion uclinux x xx gz Or alternatively linuxPC Project linux cortexm 1 xx x projects gunzip netfusion uclinux x xx gz If the package is a file with an extension of tar gz linuxPC Project linux cortexm 1 xx x projects tar xzvf netfusion uclinux x xx tar gz You will now have the following contents in the projects directory linuxPC Project linux cortexm 1 xx x projects ls linuxPC Project linux cortexm 1 xx x projects netfusion opentftp Rules make The netfusion directory contains all of the make files configuration files source files header files device drivers applications SQLite source and much more for the NetFusion baseboard The opentftp is the full TFTP server used as a stand alone tool for when the uCLinux kernel binary file is to be uploaded to the NetFusion via the network This is customized and defaults to the needs of the upload operation There are scripts in the build system that invokes this service The file Rules make is the make build script that is used by the Emcraft uCLinux compile procedure 49 OC research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 12 2 2 Host PC Cross Compile Direct
41. SB Serial console port using any terminal application HyperTerm PuTTY etc with the 115200 8N1 parameters 15 2 Installing the Software on the Development Host PC For this application note we use SoftConsole and Libero software running on a Windows development host PC Download and install Libero SoC v11 4 Select the following components during installation e Synplify Pro e SoftConsole 3 4 e ModelSim AE with SmartFusion and SmartFusion2 Download the NetFusion M2S FG484 Starter Libero project and open it in Libero update IP cores if asked Download the prebuilt NetFusion M2S FG484 firmware design stp file Program the stp design into M2S FG484 SOM using the FlashPro Start FlashPro on a Windows host PC From the FlashPro IDE create a new project with an arbitrary name From the main FlashPro window push Configure Device Push Browse next to load existing programming file Browse to the uCLinux SmartFusion2 project stp file and choose it Power reset the board after the successful programming 88 eee research OOO and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 15 3 Running and Debugging the Project In the Libero Design Flow view launch the Write Application Code action Soft Console will start with the sample project workspace with two projects opened Start debugging the prebuilt application Open the Debug as pull down menu to the right of the
42. Uptime 100000255 160 0 l2 53214 15 STRINGs teststring iol OC research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Erase the third partition of the external flash format it as a JFFS2 file system and then mount the newly created file system to a local directory Copy some files to the persistent JFFS2 file system storage z flash eraseall j dev mtd2 Erasing 64 Kbyte 500000 100 complete Cleanmarker written at 4f0000 mkdir m mount t jffs2 dev mtdblock2 m cp bin busybox m cp etc re m ls lt m EE 1 root root SES wie ll Ozi sere Y WX Xr xX rooe TOOL 238 724 Jan 1 00 18 busybox SS df Filesystem 1K blocks Used Available Use Mounted on dev mtdblock2 5120 436 4684 93 m m busybox echo Hello from Flash Hello from Flash SS umount m This is an example above but the flash is by default mounted at flash on the root system anyway Reboot NetFusion reboot f Restarting system Eeer EE Derek BYstes 0G AOS gt ALE es iG ol eee research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 4 Software Functionality 4 1 Supported Features The following list summarizes the features and capabilities of uCLinux SmartFusion2 Release 1 12 0 4 1 1 U boot firmware e U boot v2010 03 NetFusion initialization from power on r
43. a C header file or any other programming language format In fact it is a standard scripting format that is piped into lt xargs gt and lt insmod gt Linux commands upon device driver registration and instantiation 12 5 Building the NetFusion Customized uCLinux Kernel The entire NetFusion uCLinux environment can be built from clean in two simple steps For a normal incremental make which just updates any changes then it can be generally built in a single step However if the changes are being made to SQLite then it is once again two steps as opposed toa single make process If you have just booted your PC or have closed down a terminal session and then re started you will have to go through an initialization step first You must activate your uCLinux Cortex M development session by navigating to the top of your uCLinux Cortex M installation and run linuxPC Project 1 linuxPC Project 1 linuxPC Project 1 Then make the SQL linuxPC Project 1 linuxPC Project linux cortexm Also if you had to run the source A linuxPC Project linux cortexm To clean the entire project type linux cortexm linux cortexm linux cortexm ite by typing linux cortexm psl pvr linux cortexm 1 12 0 source ACTIVATE sh Then change into the netfusion directory xx x cd projects netfusion CTIVATE sh above then you must also run the following xx x projects netfusion startftftp xx x projects netfusi
44. a80 hex A2F LNX EVB gt e Unprotect flash A2F LNX EVB gt protect off all Un Protect Flash Bank 1 A2F LNX EVB gt e Erase the destination flash area A2F LNX EVB gt erase flashaddr filesize SEHR done Erased 13 sectors A2F LNX EVB gt e Copy the image from RAM to flash A2F LNX EVB gt cp b loadaddr flashaddr filesize Copy to Flash done A2F LNX EVB gt iol OC research OOA and development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 8 3 5 U boot Self Upgrade The uCLinux Cortex M distribution provides a full tree of the U boot source files This allows you to configure or otherwise enhance U boot for your specific needs To build U boot do the following from the uCLinux Cortex M installation on NetFusion refer to Section 7 e Go to the uCLinux Cortex M installation and activate it unless you have activated it already psl ocean linux cortexm 1 12 0 source ACTIVATE sh psl ocean linux cortexm 1 12 0 e Goto the top of the U boot source tree psl ocean linux cortexm 1 12 0 cd u boot psl ocean u boot e Configure U boot for your NetFusion board Please refer to the Starter Kit Guide or BSP Guide for your hardware board for the name of the corresponding U boot configuration target For example the following command configures U boot for the NetFusion board psl ocean u boot make a2f lnx evb_config Configuring for az7i l
45. acked clock This driver is demonstrated and handled in the shell script on NetFusion drivers ds1307rtc sh Usage amp Syntax ds1307rtc parameter syntax Must be more than 15 parameters with switches gpiooffs lt addr gt sdabit lt bit gt clkbit lt bit gt deviceid lt bit gt time lt hh mm ss gt date lt dd mm yy gt dow lt string gt r w gpiooffs is the user memory offset within the UIO mechanism phys mem of the i2c RTC signal deviceid sets the device ID of the 12C RTC device sdabit is the bit position within the i2caddr location of the sda signal Zero based between 0 31 clkbit is the bit position within the i2caddr location of the clk signal Zero based between 0 31 time set the time that will be written for the first time in the RTC Format hh mm ss date set the date that will be written for the first time in the RTC Format dd mm yy dow set the day of week that will be written for the first time in the RTC All letters low case r read the RTC memory Do not need a parameter W write the RTC memory Do not need a parameter Example read ds1307rtc sdabit 2 clkbit 3 gpiooffs 1879048192 deviceid 104 r Example write ds1307rtc sdabit 2 clkbit 3 gpiooffs 1879048192 dow friday time 11 11 11 date 11 11 11 deviceid 104 w Support www nineways co uk pbates nineways co uk Description The NetFusion PCB baseboard has an independent battery backed 3 year clo
46. age to create a truly useful product which all takes advantage of the flash mounted SPI hardware using the JFFS2 partition to allow for the persistent storage Se L Nineways Research and x em lt D 10 1 1 7 cgi bin mydemo cgi Oo i NINE WAYS Research amp Development NetFusion Demo Site Home Board Checks Drivers SQL Server Nineways Contact Details Welcome to the NetFusion inbuilt demo site From the menu above you can test all the DRIVERS currently loaded onto this board as well as options to check the date and time and all current proccessors running on the board If you have any quieres or issues please contact Nineways via the Contact Details link above Figure 7 Main opening screen for the NetFusion Demo Website 69 oe 000o DODD research DOEA and DOO development o Sane wars NetFusion Software uCLinux User Guide V1 0 August 2014 cje J Nineways Research and D x KR gt CG D 10 1 1 7 drivers_main html a NINE WAYS Research amp Development NetFusion Demo Site Home Drivers Temperature Sensor H e Voltage Supervisor e DS1307 H H H ACI LCD PCF Drivers for the NetFusion Product Above you will see the list of DRIVERS currently installed and operational on this NetFusion PCB They all have pre set parameters input which will output a basic operation for the part
47. and development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 20 Building Multi Threaded Applications The version of the uClibc included with the CodeSourcery tool chain does not provide support for POSIX threads To address this limitation we have enabled POSIX threads in uClibc and included the updated library built for Thumb in our uClinux distribution In order to build a multi threaded application and link it with the appropriate uClibc binary do the following After activation of the cross build environment source ACTIVATE sh run the following command linux dp c being the application in the below example arm uclinuxeabi gcec o linux dp linux dp c I INSTALL ROOT A2F root usr include mcpu cortex m3 mthumb L INSTALL ROOT A2F root usr lib pthread 102 a OC research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 21 How to Define an IRQ Handler in a Custom uCLinux Device Driver This note explains how to add an IRQ handler to a custom device driver in the uClinux kernel running on the SmartFusion2 SOM on NetFusion The specific example below was developed on the M2S FG484 System On Module plugged into the NetFusion baseboard The example defines an IRQ handler for the user push button The push button input is tied to MSS GPIO_0 in the default Libero design used with the M2S FG484 SOM This is IRQ 50 in the NVIC
48. args bootargs ipaddr serverip gatewayip netmask hostname eth0 off Save the updated environment in flash A2F LNX EVB gt save Saving Environmen Un Protected 2 se Erasing kilasi done Erased 2 sectors Writing to Flash Protected 2 secto A2F LNX EVB gt env Eeer ctors done rs Boot the uCLinux image over the network and test that the networking is functional Note that given a correct ipaddr setting in U boot the kernel brings up the Ethernet interface in uCLinux automatically without an explicit ifconfig command A2F LNX EVB gt run Corel10 100 link Using Corel0 100 TFTP from server Filename Load address 0x7 Loading HEE HEHE done Bytes transferred Booting kernel Image Name Image Type Data Size Load Address Entry Pomnt Verifying Chec Loading Kernel OK Starting kernel D Linux version 2 EIST IP Config Comple device etho host a2f l1nx bootserver 1 Freeing init memo init started Bus eee AsO See from 172 from 172 ping PING 172 64 bytes 64 bytes vlad v netboot up 100 Full device Toad E Our 0000000 HEHEHE EEREEE HHHHEPHEPEEREEE 1439232 15f ARM Linux Kerne 439168 Bytes 70008000 70008001 SUM r EOK Image sois OK elek tes addr evb domain TALO Te root FE yBox vl 17 0 ail UTM ssl Ss SG ell SEH HHP REET HEHE 600 hex from Legacy Image at 70000000 EE 1 Image 1 4 MB
49. ave no housing or any means to survive alone and must be hosted on a customized baseboard to allow the devices to perform the tasks that developers desire NetFusion short cuts the development process in achieving a customized baseboard as much as possible with exceptions only when extremely bespoke design requirements are needed The product can be used either in the format of an IP core Ethernet SWITCH development kit as most of the hardware orientates network communications hence the name NetFusion or as an M2S SOM SmartFusion2 trial and evaluation baseboard more extensive interfaces than the more basic competitors or finally as a fully ready to deploy industrial product solution to a customer s needs having developed customized software and IP core designs to tailor to intended product functionality NetFusion is ideal for collating IP cameras old legacy equipment using RS232 485 or contact relays into an Ethernet topology at an industrial site building or remote location Moreover with a collection of modern communication interfaces the seemingly huge number of variations of product usage allows this to be a truly powerful attractive efficient and desirable embedded tool to add to your portfolio 1 1 Developer Simplicity With the PCB hardware already available for you to evaluate develop and then deploy to your customers it can be as easy as developing application programs within the uCLinux software environment and if needed
50. c hardware platform include file for iol 54 ed OC research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 the AMBA DMA Controller in the previous directory mtipswitchFIFO h C header file SWITCH FIFO interface C definition for DMA Controller Go back out and then to the mtiptest directory linuxPC Project linux cortexm 1 xx x projects netfusion source include cd linuxPC Project linux cortexm 1 xx x projects netfusion source cd mtiptest linuxPC Project linux cortexm 1 xx x projects netfusion source mtiptest Ts mtipdefine h mtipRAWClient c mtipRAWlo h mtipTCPClient c mtipTCPClient c mtipUDPlo h mtipFunctions c mtipRAWClient h mtipRAWServer c mtipTCPClient h mtipTCPServer c mtipUDPCLient h mtipUDPServer c mtipFunctions h mtipRAWlo c mtipRAWServer h mtipTCPlo c mtipTCPServer h mtipUDPlo c mtipUDPServer h linuxPC Project linux cortexm 1 xx x projects netfusion source mtiptest All of the contents of the mtiptest directory are described in detail in the SmartFusion2 User Guide PDF Important Note ALL of the lt mtipDMAController gt AMBA DMA Controller functionality and files are described in the AMBA DMA Controller Linux Device Driver User Guide PDF iol eee research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 12 2 1 File List of mtiptest Directory The files in the lt mt
51. ck that can be accessed by the application software The SmartFusion2 FPGA does have an RTC in the MSS but does not keep time with power down situations This driver allows for full writing and updating of the time and date using the command line parameters and returns the current time and date if request as text The output text can be piped into another process or application program in a shell script if necessary Typical return string Local Time 10 45 23 Local Date 29 08 14 Current Day friday n iol eee research OOO and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 14 13 4 LCD Controller LCD Controller Icd_pcf5074 c LCD optional display controller of text and format This driver is demonstrated and handled in the shell script on NetFusion drivers Icd_pcf5074 sh Usage amp Syntax Icd_pcf5074 parameter syntax Must be 16 parameters with switches dev lt addr gt sdabit lt bit gt clkbit lt bit gt gpioaddr lt addr gt enbit lt bit gt rsbit lt bit gt init data lt data gt gpiooffs is the user memory offset within the UIO mechanism phys mem of the i2c LCD data dev is the i2C address of the pcf5074 device on the i2c bus Check circuit schematics sdabit is the bit position within the i2caddr location of the sda signal Zero based 0 31 clkbit is the bit position within the i2caddr location of the clk signal Z
52. ckage o libexpat so 1 the expat package e The CodeSourcery cross build tools Please refer to the toolchain README at http www codesourcery com sgpp lite arm portal doc7632 getting started pdf e The tools mkimage utility It is expected that the utility will work as is on most of today s uCLinux distributions If it fails to run on a certain host you can build it for your specific uCLinux host from the sources included in the uCLinux Cortex M distribution by running make tools from the top of the U boot tree e To exercise the sample projects included to the uCLinux Cortex M distribution you need to install the following host packages e NFS server e TFTP server e Terminal emulator picocom minicom kermit or PuTTY With NetFusion using the USB for the serial console connection you might need to install the FTDI USB UART driver from http www ftdichip com Drivers VCP htm for your host PC iol 28 eee research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 7 2 Projects Framework 7 2 14 Multiple Target Projects In the NetFusion uCLinux Cortex M installation there is a directory called projects which provides a framework that you will be able to use to develop multiple projects embedded applications from a single installation of uCLinux Cortex M This directory has the following structure e projects Rules make build rules common for all pro
53. danii iA AEE ANA EE a 74 14 6 RELAY OUTPUT CONNECTOR geet eet eiaa an aaa aa a aA eaa aA aA aA aAA Naa ie 75 14 7 ep fe ellene 75 14 8 ANALOGUE CONTACT INPUT CONNECTOR s srerrsniinun nan innn AAN NNAR NAAA Anan KAANAA AAAA RAA ANAA KRAANE ARNEE 76 14 9 RS232 UART SERIAL CONNECTORS ariin ania aa a dese ANa a aA AAE AAA AAAA A 76 14 10 RS485 UART CONNECTOR oiiaii aa aaaea aAa aAA A NASA ANa a AAN 77 1411 GPIO ee ent 77 VE Eh SEN eelere e 78 14 13 NETFUSION HARDWARE DRIVERS USAGE isssrssiitai sunn inenkn nainun NAA ANAA AARNA NKAN ANEA KA AANEEN AARAA 79 14 13 1 Analogue Contacts ACI EE 79 14 13 2 RS485 ET RETTEN 80 14 13 3 Real Time Clock RTC herauten aa oobi aA AE 81 14 13 4 LCD Controller EE 82 14 13 5 General HO GRIO cc sccccecsacecsessagevseesigesseedenssscesaeedsetaaysseeesaedavedavedecsnavesdusdeesienearetecs 83 14 13 6 Line OUT Stereo Audio 84 14 13 7 Line IN Stereo Audio 85 14 13 8 PCB Temperature Gensor tttn nnne n ttrt Ennn nna E rE Ennens rnr Ennen 86 14 13 9 Voltage PCB Supervisor eccceeeeeeeee cence erent reer etneee nantin tarttu nant tnnnat tunane en nanten nnne en nnt 87 15 RUNNING A SOFTCONSOLE HELLO WORLD PROJECT ON NETFUSION 88 15 1 HARDWARE PLATFORMiwisi souvtsedeeeesadess Aa A E Ee RATRE 88 15 2 INSTALLING THE SOFTWARE ON THE DEVELOPMENT HOST bt 88 15 3 RUNNING AND DEBUGGING THE DROUET 89 15 4 MODIFYING THE LIBERO AND SOFTCONSOLE PROJECTS s sssssassknsseantneen nereta arnein
54. drivers accessing the physical hardware DMA Controller kernel device driver pre compiled for use without a re build nesting Main build file script for the outer makefile to invoke to compile the contents of this directory and the sub directories except the SQLite which is separate linuxPC Project linux cortexm 1 xx x projects netfusion source cd include linuxPC Project linux cortexm 1 xx x projects netfusion source include ls implementation h lockfile h mtipDMAController h mtipDMAController tsm_defs h mtipmacFIFO h mtipUIO h mtip1588 syncgen h mtipextraHW h mtipswitchFIFO h linuxPC Project linux cortexm 1 xx x projects netfusion source include implementation h C header file define controls for the entire AMBA DMA Controller device driver in the previous directory lockfile h C header file Used to allow for file node semaphores across many of the NetFusion device driver applications to protect memory resources from mutli threaded problems mtipDMAController h C header file Used as an include for DMA Controller mtipDMAController_tsm_defs h C header file DMA Controller PTP 1588 include file mtipmacFIFO h h C header file MAC FIFO interface C definition for DMA Controller mtipUIO h C header file UIO memory base access include file for the DMA Controller mtip1588_syncgen h C header file DMA Controller PTP 1588 include file mtipextraHW h C header file Specifi
55. e described by the following sequence On reset U boot firmware runs from the on chip eNVM eSRAM U boot performs SmartFusion2 initialization from power on reset including setting up the DDR controller and enabling access to the SPI flash e U boot copies the uCLinux bootable image from the SPI flash to the LPDDR and then passes control to the kernel entry point D uCLinux proceeds to boot up in LPPDR A RAM based filesystem initramfs is mounted as a root filesystem initramfs is populated with required files and directories and is then simply linked into the uCLinux bootable image at build time on a cross development host PC e As a part of the boot up sequence the SPI controller SPI flash device drivers and the JFFS2 sub system are initialized by the kernel e Having mounted the root file system uCLinux starts the init application which in turn spawns the first shell and runs a start up command sequence defined in the etc rc script e etc rc can do generally speaking whatever In this demo it is assumed that etc rc will be defined to start a data harvesting application as soon as possible To emulate this we run an echo Data harvesting can commence command from the start up script 92 OC research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 17 3 Installing the Demo The procedure described here explains how to install the bootable uCLinux
56. e system as well as in the netfusion initramfs file to provide a reference to the uCLinux Cortex M installation directory CROSS_COMPILE arm uclinuxeabi Reference to the cross tools used to build U boot and the uCLinux kernel CROSS_COMPILE_APPS arm uclinuxeabi Reference to the cross tools used to build user space applications and tools PATH NSTALL_ROOT tools arm 2010q1 bin INSTALL_ROOT tools bin lt orig_path gt Path to the cross tools used by the shell MCU lt arch gt MCU architecture supported by the uCLinux Cortex M distribution 7 1 5 Dependency on NetFusion Components The uCLinux Cortex M distribution has the following dependencies on Linux host PC software components Please consult the notes below in case the uCLinux Cortex M development environment does not function as documented in the sections that follow e The U boot busybox and uCLinux kernel build systems require that certain host packages be installed on the development host to function correctly These packages are make gcc perl and some others Please refer to inux Documentation Changes for a list of host tools required to build the uCLinux kernel The same set of tools is required for the U boot and busybox build e The uCLinux Cortex M GNU debugger too s bin arm uclinuxeabi gdb and the configuration scripts require that the following dynamically linked libraries to be installed on the host o libncurses so 5 and libtinfo so 5 the ncurses libs pa
57. ed the above variables you can use the tftp U boot command to download images to RAM For example A2F LNX EVB gt tftp netfusion uImage Corel0 100 link up 100 Full Using Corel0 100 device WEE Zeenen I O ike pe Unie eeh aer als G72 kgs iO 5 200 Filename netfusion uImage Load address 0x70000000 Loading HHHHEEEEEEEEHEEEEREEREEE REE RRA HE FE E FE EEE EE REE EA HA EA EE done Bytes transferred 821888 c8a80 hex A2F LNX EVB gt 8 3 4 Flash related Commands To program uCLinux image to the flash use the update U boot macro as follows A2F LNX EVB gt print update update tftp S image prot off flashaddr filesize era flashaddr filesize cp b S loadaddr flashaddr filesize A2F LNX EVB gt setenv image netfusion ulImage A2F LNX EVB gt run update io OC research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Alternatively you can program uCLinux image to the flash using the following sequence of commands the commands are only valid for the NOR type of the flash e Download the image to RAM A2F LNX EVB gt tftp netfusion uImage Corel0 100 link up 100 Full Using Corel0 100 device TRIP from server L 2 17 0 1 our P address is 172 17 10 200 Filename netfusion uImage Load address 0x70000000 Loading HHHFEEEEEEEEEEEEREEEEEE REE FE TE FE AE HE FE E RHEE EE HEE RHEE RHEE EE done Bytes transferred 821888 c8
58. ero based 0 31 enbit is the bit position within the location of the LCDen sig Zero based 0 31 rsbit is the bit position within the location of the LCDrs sig Zero based 0 31 data is the string of data for the LCD to display Expressed in HEX characters two per char init is only included if LCD is to be initialized at first use use only instead of data Example init lcd_pcf5074 dev 60 gpiooffs GPIO_ADDR sdabit 6 clkbit 8 enbit 14 rsbit 11 init Example data Icd_pcf5074 dev 60 gpiooffs GPIO_ADDR sdabit 6 clkbit 8 enbit 14 rsbit 11 data data here Support www nineways co uk pbates nineways co uk Description The LCD screen can be set to display any alpha numeric character on a 16x2 mono chrome orientation The data and the settings are set as command line parameters and as an alternative to sending data the screen can be initialized using the init switch operator As the screen contents survives a reboot but not a power down in terms of data content displayed a manual initialization command has to be issued if you want to blank or revert back to default settings The data is passed with the data switch and is entered in the form of printable HEX characters to allow for the full range of shapes and extended characters the screen supports without upsetting the uCLinux parameter restrictions iol eee research OOA and development Ki NINE WAYS NetFusion
59. eset Runs from the internal eNVM and internal SRAM no external memory required for standalone operation Serial console Ethernet driver for loading images to NetFusion Serial driver for loading images to NetFusion Device driver for built in flash eNVM and self upgrade capability Device driver for storing environment and uCLinux images in external flash Autoboot feature allowing boot of OS images from flash or other storage with no operator intervention Persistent environment in flash for customization of NetFusion operation Sophisticated command interface for maintenance and development of NetFusion 4 1 2 uCLinux e uClinux kernel v2 6 33 e Boot from compressed and uncompressed images e Ability to run critical kernel code from integrated flash of SmartFusion2 e Serial device driver and uCLinux console e Ethernet device driver and networking ping NFS Telnet FTP ntpd etc e busybox v1 17 e POSIX pthreads e Process to kernel and process to process protection using the Memory Protection Unit MPU of the SmartFusion2 core Hardened exception handling an exception triggered by a process affects only the offending process Loadable kernel modules Secure shell ssh daemon Web server MTD based flash partitioning and persistent JFFS2 flash file system for external flash Device driver for the USB OTG interface DC device driver SPI controller master mode device driver Device driver for the embedded NVM
60. f of the developer project and create a clone called my_developer bash 3 25 pwd home vlad test linux cortexm 1 12 0 projects developer bash 3 2 make clone new my_ developer New project created in home vlad test linux cortexm 1 12 0 projects my_ developer SE Go to the new project directory build it and copy the downloadable uCLinux image to the TFTP server directory bash 3 2 cd my_developer bash 3 2S make Image arch arm boot uImage is ready bash 3 2 cp my developer uImage tftpboot vlad v 9 3 Set Up Target for Debugging of the New Project This section sets up U boot for debugging of the new project on the NetFusion Reset the NetFusion and enter the U boot command monitor hitting any key to stop the autoboot Hit any key to stop autoboot 0 A2F LNX EVB gt Define the IP addresses for the NetFusion and a TFTP server define the name of the image to be downloaded by tftpboot A2F LNX EVB gt setenv ipaddr 172 17 4 150 A2F LNX EVB gt setenv serverip 172 17 0 1 A2F LNX EVB gt setenv image vlad v 37 research OOA and development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Check that U boot defines appropriate commands macros for booting the uCLinux image from a TFTP server and running it on the NetFusion A2F LNX EVB gt netboot tftp A2F LNX EVB gt addip setenv ip pein prin tenv netboot tenv addip S image run addip bootm boot
61. for it External memory utilized by uCLinux takes away the worries of having to squeeze required software functionality into the limited space of the integrated eNVM and eSRAM of SmartFusion2 Products based on uCLinux can be made feature rich and highly user friendly Reliable upgrades for new releases and capabilities are easy to implement providing for obvious maintenance procedures and a long lifespan for your designs as well as your products 1 3 NetFusion uCLinux Extension The Emcraft M2S SOM F484 plug in board utilizes uCLinux as standard However in order for NetFusion to build on this foundation Nine Ways has developed UIO user space device drivers to access and control all PCB hardware that is not specifically any of the Ethernet pathways in the fabric of the SmartFusion2 FPGA All are fully available as open source in your GZIP NetFusion software bundle and will be deployed as binary in the UNIX embedded file system 1 4 uCLinux Cortex M The aforementioned uCLinux mentioned is based on the uCLinux Cortex M and provides a platform and software development environment for evaluation and development of uCLinux on the Cortex M CPU core on the MCU devices This is the chosen OS platform for the NetFusion software environment running on the ARM Cortex M3 processor inside the SmartFusion2 FPGA It is fully available as open source and can be changed and re built to suit your needs No royalty rights are involved and it is free to use and depl
62. g in U boot Generally you need to set the following U boot environment variables as in the example below the actual addresses must match your local network configuration M2S FG484 SOM gt setenv ipaddr 172 17 4 129 M2S FG484 SOM gt setenv serverip 172 17 0 41 M2S FG484 SOM gt saveenv iol OC O research OOA and development CO NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Check that the connection to the TFTP server works M2S FG484 SOM gt tftp networking uImage Fotos et DIE Using M2S MAC device IRIS serio eene IL AN SO ale epp Iie he baren ke Ms Aly 54h 12 Filename networking ulImage Load address 0xa0007fc0 Loading EILER TEE FE EE HEH EH HE AE AE AE FE AE EEE EEE HEHEHE FE FE TE AE AE AE AE AE AE AE AE AE AE EEE EEE EEE FE FE FE FE FE FE FE FE FE E E E E EEE EE FE FE FE FE FE FE FE FE AEE EE EEE FH FE AE AE AE AE TE AE AE AE AE AE AE E EEE FE FE FE FE FE E FE FE FE FE FE FE FE FE FE E E E E E E E FE E FE FE FE FE FE FE FE E FE TE TE TE TE TE TE TE TE TE TE FE FE HE H FE FE FE AE AE AE AE AE AE AE AE AE AE AE AE AAA done Bytes transferred 3256224 3lafa0 hex M2S FG484 SOM gt Note f your are having trouble with TFTP transfer please check that the networking setup in U boot IP address of the M2S FG484 NetFusion and the TFTP server subnet mask matches your local network settings If this doesn t help try to enable the PXE Compatibility chec
63. gust 2014 The script shell file app ypatch may need to be modified to allow it to be an executable script Type linuxPC Project linux cortexm 1 xx x projects netfusion patch chmod x applypatch applypatch shell script file copies the source files in this directory into the relevant locations that they reside in the uCLinux kernel from Emcraft Only when a configuration of the OS environment cannot be controlled by the main config scripts in the main directory is the patch necessary spi c C source file a modified resized image of the JFFS2 flash on the SPI memory on the SOM This allows for a much larger uCLinux kernel and NetFusion overall package to be deployed Go back out and then to the source directory linuxPC Project linux cortexm 1 xx x projects netfusion patch cd linuxPC Project linux cortexm 1 xx x projects netfusion cd source linuxPC Project linux cortexm 1 xx x projects netfusion patch 1s aciad 998 croci aIde woh cCOncUART ics EE Csils07etesshy factory test om genGPIO UIO ko gen_uio_driver c include lcd_pcf5074 c lcd_pcf5074 sh Makefile moduleparms modules order mtipDMAontroller dmaCORE c mtipDMAController _extraHW c mtipDMAController macFIFO c mtipDMAController main c mtipDMAController master receivere mtipDMAController slave receive c mtipDMAController switchFIFO c mtipDMAController syncgen c mtipDMAController timermod c mtipDMAController UIO c mtipdw_dma_sw ko mtiptest mtiptest c
64. h _uboot_env 0x000000010000 0x000000410000 spi flash linux image 0x000000410000 0x000001000000 spi flash jffs2 spi_m2s spi_m2s 0 SPI Controller 0 at 40001000 c1k 83000000 The initramfs root filesystem is mounted and init which is the first user space process is launched E Started BusyBox v1l 17 0 2Ul2 12 14 10 29 39 MSk init proceeds to execute a start up command line sequence defined by the etc rc script In our application we have etc rc contain a single command echo Data harvesting can commence which results in the output below Data harvesting can commence And finally init starts the interactive command shell da 95 OC research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 17 5 Configuring for Fast Boot To achieve the 0 5 seconds boot times shown in the above video you will need to specifically configure U boot Note that each of the configuration steps described below is optional in the sense that if you don t perform a certain optimization step the demo will still boot on the NetFusion although slightly slower than it would otherwise From the U boot prompt do the following Disable validation of the bootable uCLinux image checksum M2S FG484 SOM gt set verify no Add pj 774144 to bootargs This tells the kernel to avoid running the calibration loop and instead set Ipj loops per jiffy to a fixed value pre calculated fo
65. he USB UART Interface from a PC Your IDE on the PC should open a window that can see the debug and allow for commands and text to be entered This will interact with the U boot Once you have programmed the SPI flash with the uCLinux then the interaction and debug will be with the booted uCLinux This includes how to connect a CAT5 to the 10 100 RJ45 for TFTP network transfer of the uCLinux kernel file 17 doy eee OO research OOO and development CO NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 5 2 Connecting a serial console terminal application to the M2S FG484 SOM NetFusion PCB For a Windows development host PC install the drivers Connect and power up the NetFusion PCB Download and install PuTTY a free serial and networking terminal application Open Control Panel gt System gt Hardware gt Device Manager Extend the Ports COM amp LPT item and note the name of the USB serial port If you do not have the USB serial ports listed the drivers were not probably installed correctly Please solve this problem before proceeding Open the PuTTy window select Connection type Serial Speed 115200 Push Open an empty window will appear XS PuTTY Configuration Category Session Losong Teminal Keyboard Bel Features VW d ry d ow Appearance Behaviour Translation Selection Colours Connection Data Proxy Telnet Fe 9 n 4 SSH Sena Basic options
66. he hardware and the user space During normal operation i e when the user space application accesses the hardware no additional software layers are involved Memory accesses performed by the software are directly interchanged with the hardware 14 2 NetFusion User Space Driver List Name of Driver Source File Description Analogue Contacts ACI aci_ad7998 c Read analogue voltages from connector input RS485 UART coreUART c Data in out through RS485 bus interface Real Time Clock RTC ds1307rtc c Separate PCB baseboard battery backed clock LCD Controller Icd_pcf5074 c LCD optional display controller of text and format General I O GPIO pcf5074 c Individual spare pins and the LEDs Switches amp Jumpers Line OUT Stereo Audio spi_audio_line_out c Stream digital audio to analogue Line OUT audio Line IN Stereo Audio spi_audio_line_in c_ Line IN audio analogue to digital output stream PCB Temperature Sensor temp_sensor c An on board temperature sensor on the baseboard Voltage PCB Supervisor vs_ad7998 c Monitor and check all voltages and rails on the PCB Table 5 Full NetFusion User Space Hardware Drivers 73 ZE eee research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 14 3 Option Selector Switches The UP position labeled ON produces a 1 on the software read data Oppositely the DOWN position labeled OFF pr
67. icular driver If you have any quieres or issues please contact Nineways via the Contact Details link above Figure 8 Drivers Hardware Page for the NetFusion Demo Website eee OG research OOO and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 13 After First Compilation Getting the System Customized for the User This is a very important step and thus is contained in a main section heading to make this information easily obtainable Once you have compiled and downloaded the uCLinux NetFusion image to the baseboard you can reboot and play There will be a demo website all the binary command at your disposal SQLite lots of discovering the setup including in the etc directory When you have familiarized all of the system and cross referenced most of this document to the practical experimentation using the NetFusion product then you may be comfortable to start planning your customization This is where you take your copy of the installed bundled into your own project creating your own unique design product In order to control the boot up driver and application launching that is defaulted to a mandatory scheme for you before you think about modifying the edit the etc rc configuration file The contents are listed below bin sh mount t proc proc proc mount the proc directory into the filesystem mount t sysfs sysfs sys mount the sysfs directory int
68. ide V1 0 August 2014 12 NetFusion Project in the uCLinux Tree 12 1 What is the NetFusion project with in the uCLinux The NetFusion baseboard is in effect an add on to the M2S050 F484 SOM as opposed to the other way round Consider the brain board SOM has having the NetFusion PCB hosting it and therefore what is statutorily available for the Emcraft M2S F484 SOM in terms of the uCLinux development environment will required add on software drivers etc for the NetFusion baseboard It is easy to get confused and incorrectly assume that because the M2S F484 SOM brain board containing the SmartFusion2 FPGA and the ARM Cortex M3 processor with in that is a sub set component of the NetFusion PCB is an extension of the baseboard Software wise it is completely the opposite The SOM plug in brain board hosts the processor and therefore is the seat of the OS and the surrounding sub system environment This means that the uCLinux development directory structure on the host cross compile PC is the primary install which contains sample and template application projects with in As NetFusion is effectively an attachment to the M2S F484 SOM uCLinux project it is logical for the NetFusion hardware and functionality to be an inner application project in the uCLinux environment Therefore the projects netfusion directory exists in the required build as a sub directory which contains the user space device drivers UIO and included and bundled u
69. ile Line IN Stereo audio stream driver C file Line OUT Stereo audio stream driver C file PCB mounted Temperature sensor device driver C file Voltage monitor driver Included Special AMBA DMA IP core device driver for linking Ethernet MAC FIFO to SDRAM modul mtipD mtipD mtipD mtipD mtipD mtipD mtipD mtipD mtipD mtipDMAControll eparms MAontrol MAControll MAControll MAControll MAControll MAControll MAControll MAControll ler_dmaCORE c MAControl ler_extraHW c eremachiVvOre er_main c er_master_receive c er_slave_receive c er _switchFIFO c er_syncgen c er_timermod c ermon Configuration File DMA config setup amp control file C file Core DMA functions in C C file Additional specific hardware platform setup and configuration C functions such as Microsemi amp Altera C file MAC interface functions C file Main start program for the DMA and setup containing IRQ handlers and call pack functions from the uCLinux kernel IP stack C file PIP 1568 Clock Sync Functionality C file PIP 1568 Clock Sync Functionality E file SWITCH interface functions E file PIP 1558 Clock Sync Functionality C file PIP 1558 Clock Sync Functionality fille ULO platform for user space applications to interrogate the DMA IP core with out using this device driver NetFusion device drivers shell scripts for easier use and examples of executing the drivers of the PCB baseboard hardware aci a drogen si
70. image fastboot ulmage to the NetFusion Here is how you can build and install the bootable uCLinux image from the project sources fastboot tgz having installed them on top of the NetFusion SmartFusion2 uClinux distribution Note The uCLinux image and the sample project have been built and validated in context of the uCLinux Release 1 11 0 If you are using a different release some porting changes may be needed 17 4 Understanding the Demo The first message printed by U boot after power up reset is as follows U poot PAOLO EE U boot proceeds with initialization of the NetFusion and reports various characteristics of the hardware platform CPU SmartrusionZ cSeC Cortex M3 Hard TE Freqs CORTEX M3 166MHz PCLKO 83MHz PCLK1 83MHz Board M2S FG484 SOM Rev 1A www emcraft com DRAM 64 MB In serial Out serial Err serial Net M2S MAC U boot then waits for the number of seconds defined by the bootdelay environment variable before proceeding to execute a bootup sequence defined by the bootcmd variable If the user presses any key while in the bootdelay loop U boot interrupts the boot up sequence and enters the interactive command monitor Initially we set bootdelay to 3 Hit any key to stop autoboot 0 Now this is the point when the bootdelay loop has expired and the bootcmd commands sequence is being executed On SmartFusion2 the first action bootcmd performs is loading a bootable uCLinux image from the SPI flash to the
71. iptest gt directory will be named after the test that they will be performing there are a few exceptions and the list below shows the name and the meaning of all files names Name Type Test MtipRAWClient c Functions Implementation RAW socket Client test mtipRAWClient h Header RAW socket Client test mtipRAWServer c Functions Implementation RAW socket Server test mtipRAWServer h Header RAW socket Server test mtipRAWIo c Functions RAW socket Loop Back Test Implementation mtipRAWIlo h Header RAW socket Loop Back Test mtipTCPClient c Functions TCP Client test Implementation mtipTCPClient h Header TCP Client test mtipTCPServer c Functions Implementation TCP Server test mtipTCPServer h Header TCP Server test MtipTCPlo c Functions TCP Loop Back Test Implementation mtipTCPlo h Header TCP Loop Back Test mtipUDPClient c Functions UDP Client test Implementation mtipUDPClient h Header UDP Client test mtipUDPServer c Functions Implementation UDP Server test mtipUDPServer h Header UDP Server test MtipUDPlo c Functions UDP Loop Back Test Implementation mtipUDPlo h Header UDP Loop Back Test 56 Table 1 App Program File List and Meanings ioD COOC research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 There are a few exceptions from
72. ith the symbol drivers temp_sensor file httpd html ts txt amp For any other customization it requires new code builds applications and device drivers Happy Coding iol eee research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 14 NetFusion Board Drivers 14 1 uCLinux Application UIO Netfusion currently has nine user space hardware drivers They are compiled as applications all separate to each other and are structured and designed such that they interface to the NetFusion PCB hardware via resource protected memory accessible FPGA IP cores such as the GPIO and coreUART etc At the top of the driver they communicate either using the input and output streams or error stream as well or if necessary just with command line parameter control and error code return values However all drivers have the common hierarchy of access hardware via UIO memory addressing and interpret and format the data through the shell streams or command line The UIO device driver lib genGPIO_UIO ko which is invoked as default by the start up process unless the user removes it by choice operates at the uCLinux kernel level It provides the user space drivers with a UIO connection down into accessing the physical memory This in turn enables the user drivers to controls the I O lines buses and IP core hardware The driver establishes the lt UioX gt interface between t
73. jects e project1 Project source files and build tree e project2 Project2 source files and build tree e The installation provides two sample projects called hello A Hello world application AND netfusion the main NetFusion start project You will be able to add more projects to this directory and develop your own embedded applications using this framework Each project directory such as projects hello contains the following configuration files e project kernel MCU Kernel configuration for this project Note that the kernel configuration is specific for the microcontroller architecture supported by the distribution e project busybox busybox configuration for this project e project initramfs File defining content of the initramfs filesystem for this project The main NetFusion directory that is projects netfusion contains the following configuration files e netfusion kernel MCU Kernel configuration for NetFusion e netfusion busybox busybox configuration for NetFusion e netfusion initramfs File defining content of the initramfs file system for NetFusion When you run make linux or simply make from the NetFusion project directory the build system builds project specific versions of the uCLinux kernel and busybox then creates an initramfs filesystem containing the newly built busybox binary as well as other target files defined by the initramfs filesystem specification file and finally wraps it al
74. kbox in the Tftpd32 Settings menu TFTP tab Now you are ready for development in the uCLinux environment and loading of images to the M2S FG484 NetFusion PCB product iol OC research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 6 SmartFusion2 SOM Board uCLinux Software Set up 6 1 uCLinux Demo and Development Environment The NetFusion baseboard comes with a preloaded uCLinux default start project To initiate the uCLinux bootstrap simply power up the NetFusion or reset it by pushing the Reset Push Button The uCLinux development environment for NetFusion including the configuration installed opening the box can be downloaded from the NetFusion page on the Nine Ways website nineways co uk 6 2 U boot Environment When the SmartFusion2 SOM NetFusion is reset the uCLinux bootstrap will proceed to boot the U boot firmware from the on chip eNVM Unless interrupted U boot proceeds to load the uCLinux bootable image from the SPI flash into the LPDDR and passes control to the uCLinux kernel entry point in LPDDR uCLinux bootstraps the kernel mounts a root file system in RAM and enters the interactive shell command interface printing the following output to the serial console U boot Eleng 0 Een 20s en Eed CPU SmartFusion2 SoC Cortex M3 Hard IP Freqs CORTEX M3 166MHz PCLKO 83MHz PCLK1 83MHz Board M2S SOM Rev 2A www emcraft com DRAM 64 MB EE serial
75. l Err serial Net M2S_MAC Hit any key to stop autoboot 0 6384 KiB S25FL128S 64K at 0 0 is now current device Booting kernel from Legacy Image at a0007fc0 mage Name Linux 2 6 33 arml mage Type ARM Linux Kernel Image uncompressed Data Size 941920 Bytes 919 8 kB Load Address a0008000 Entry Point a0008001 loading Kernel Image OK OK Starting kernel Init Starceds BusyBox Vile 0 a 2012 14 Os 29 OMSK Data harvesting can commence S fob OC research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 17 6 Restoring Default Configuration Please step through the following procedure to restore the default configuration Push and hold C At the same time push the reset button on the NetFusion baseboard This will bring you to the U boot prompt U Boot 2010 03 00001 gc9f691b Dec 26 2012 14 06 31 CPU gt Smart husions SoC Cortex Ms Hard TE Freqs CORTEX M3 166MHz PCLKO 83MHz PCLK1 83MHz Board M2S FG484 SOM www emcraft com DRAM 64 MB In serial Out serial Err serial Net M2S MAC Hit any key to stop autoboot 0 M2S FG484 SOM gt M2S FG484 SOM gt M2S FG484 SOM gt M2S FG484 SOM gt M2S FG484 SOM gt Roll back the changes you have recently made M2S FG484 SOM gt print bootargs bootargs m2s platform m2s fg484 som console ttysS0 115200 panic 10 1pj 774144 quiet quiet M2S FG484 SOM gt se
76. l cd mtiptest mtiptest ls test mtiptest Change to the sqi directory mtiptest cd sql sql 1s sqlite3 sql Change to the var directory sql cd var var 1s config lock log run tmp var Change to the dev directory var cd dev eve tacks console kmem mem mtdO mtdOro mtdl mtdlro mtd2 mtd2ro mtd3 mtd3ro mtdblockO mtdblockl mtdblock2 mtdblock3 mtdblock4 mtdblock5 mtdblock6 mtdblock 7 null ptmx pts random sample tty Et ttysl ttys2 uro ulol urandom zero dev SS tol OC Z research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Change to the factory directory dev cd factory factory ls factory test sh BEAGEORY Change to the init directory factory cda nit init 1s pahe A e 28 Change to the proc directory if aie i Gl ooe proc is 11011 12 13 14 2 42 5 67 8 83 9 buddyinfo bus cmdline config gz cpuinfo crypto devices diskstats driver execdomains filesystems fs interrupts iomem ioports irq key users keys kmsg loadavg locks maps meminfo misc modules mounts mtd net pagetypeinfo partitions self slabinfo softirgs stat sys timer list timer stats tty uptime version vmstat zoneinfo proc Change to the sys directory proc cd sys sys ls block class devices fs module bus dev firmware kernel sys Change to the drivers directory
77. l up into a uCLinux image netfusion ulmage ready for download to the target by U boot Each project directory has a Makefile identifying the following make variables You need to set these variables correctly for your project e SAMPLE the name of the project The downloadable uCLinux image has this name with the ulmage extension Additionally SAMPLE is passed to the initramfs build subsystem as a reference to the directory where file system binaries reside e CUSTOM_APPS this variable provides a list of the sub directories containing custom applications for the project Custom applications are built in the specified order prior to building the uCLinux kernel and initramfs images If a project doesn t have custom applications the variable should be left empty The following make targets are implemented in projects Rules make common build rules file e all or linux build an uncompressed uCLinux image ready for download to NetFusion and place it to the project directory as for instance netfusion ulmage e kclean clean up the uCLinux kernel source tree by running make clean in INSTALL_ROOT linux 29 eee research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 e bclean clean up the busybox source tree by running make clean in INSTALL_ROOT A2F busybox e aclean clean up the custom application source trees by running make clean in each applicatio
78. le CONFIG_ARM_UNWIND and CONFIG_EARLY_PRINTK e Debugging of multi threaded applications using GDB is not supported ID RT 77243 Workaround None This issue will be resolved in future releases of the product e USB hot plug doesn t work on SmarFusion2 under uClinux ID RT 82415 Workaround Limitation will be fixed in the next release 16 eee O research OOA and gt development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 5 Configuring Starter Kit for uClinux Development Before you can work with uClinux on the SmartFusion2 NetFusion you need to have a firmware bootloader called U boot installed in the on chip non volatile memory Your NetFusion comes pre loaded with U boot but it may have been erased if you loaded other demonstration software on your system Also to load uCLinux and root filesystem images you will need to set up a TFTP server on your PC or in the local network To load U boot and to set up a TFTP server please see the steps below 5 1 Powering up and connecting the serial console device As the NetFusion SOM s Cortex M3 processor embedded inside the SmartFusion2 FPGA begins to boot up the debug and process can be observed using the USB UART interface This is a USB device that your connected PC will recognize as a USB Serial Device and allocate a COM port to it Windows XP 7 8 Note dev ttySO 1 2 for Linux PCs 2 Figure 2 USB Cable Connected to t
79. libc library prebuilt for the Cortex M architecture You can just link your applications with the provided library and never worry about having to build the library from scratch In the installation tree the library is available in the following directory relative to the top of the installation bash 3 2S pwd home vlad test linux cortexm 1 12 1 bash 3 2 cd A2F uclibc pash sma In some situations however our customers asks us how to rebuild the library Typically they want to do that in order to enable some additional functionality available from the library but not included in the prebuilt configuration This application note explains how to build the uClibc library First step is to activate the cross development environment on the host PC This is done by running the ACTIVATE sh script from the top of the installation tree bash 3 2S pwd home vlad test linux cortexm 1 12 1 bash 3 2S source ACTIVATE sh bash 3 25 Go to the uClibc directory bash 3 2 ed A2F uclibc bash 3 2 Copy the default configuration file to the working config that will be used by the build procedure bash 3 2 cp dot_config pthreads config bash 3 2 Edit the config file to provide the correct path to the header files To do that search for KRNL_HDR and replace it with root usr include bash 3 2 vi config UCLIBC_HAS FENV is not set KERNEL HEADERS root usr include UCLIBC UCLINUX BROKEN MUNMAP y 44
80. mpile environment by running source ACTIVATE sh e Go to the U boot source directory cd u boot e Run the following commands psl pvr u boot make m2s som_config Configuring for mzs som board psl pvr u boot make s psl pvr u boot make s u boot hex 6 8 U boot Installation The SmartFusion2 SOM NetFusion arrives with the U boot firmware pre installed into the on chip Flash of the SmartFusion2 The U boot command line interface provides commands that allow upgrading U boot on the running target in self upgrade mode However should you program a faulty U boot image into SmartFusion2 U boot can be re installed using them provided uCLinux SmartFusion2 Libero project and a Microsemi FlashPro tool Note It is critical that the stp file match the kit version revision of the SF2 SOM otherwise damage to the hardware may result Here is an example of how this can be done e Start FlashPro on a Windows host PC e From the FlashPro IDE create a new project with an arbitrary name e From the main FlashPro window push Configure Device e Push Browse next to load existing programming files Browse to the uCLinux SmartFusion2 project stp file corresponding to your M2S SOM hardware revision on the NetFusion PCB and choose it e Push Program at the top of the main window to program the project onto the SmartFusion2 device and wait for the programming procedure to complete If the programming completes successfully a next
81. n source directory as listed in CUSTOM_APPS e clean clean up the entire project by removing for instance netfusion ulmage and then cleaning up the uCLinux kernel and busybox trees as described above Additionally if CUSTOM_APPS is not empty make clean is performed in each custom application sub directory e kmenuconfig configure the uCLinux kernel by running make menuconfig in the uCLinux source tree Copy the resultant configuration file to the project directory as netfusion kernel MCU e bmenuconfig configure the busybox tool by running make menuconfig in the busybox source tree Copy the resultant configuration file to the project directory as netfusion busybox e clone new newproject clone the current project into a new project with a specified name The current project directory with all sub directories is copied into the new project directory The project kernel busybox and initramfs configuration files are copied with the new name In Makefile SAMPLE is set to the name of the new project The main idea behind this framework is that each project keeps its own configuration for the uCLinux kernel in the netfusion kernel MCU file its own definition of the contents of the NetFusion file system in the netfusion initramfs file and its own configuration of busybox in the netfusion busybox file These files are enough to rebuild both the project kernel and the project file system with a specific configuration of the bus
82. n2 SOM NetFusion board comes with ethaddr set to a MAC address uniquely allocated for it Given that each baseboard has a unique MAC address allocated to it there is no need to update the ethadadr variable although it is possible to do so The MAC address can be changed by modifying the ethaddr variable as follows M2S SOM gt setenv ethaddr C0 B1 3C 88 88 89 Don t forget to store your update in the persistent storage using saveenv so it is remembered across resets and power cycles 6 4 Network Configuration You will have to update the network configuration of your NetFusion baseboard to match settings of your local environment Typically all you have to allow loading images over network from a TFTP server is update the U boot environment variables ipaddr the board IP address and serverip the IP address of the TFTP server Update ipaddr and serverip M2S SOM gt setenv ipaddr 192 168 0 2 M2S SOM gt setenv serverip 192 168 0 1 Then save the updated environment to the external flash so that your changes are persistent across resets power cycles 6 5 Running Pre installed uCLinux Image The NetFusion board comes with uCLinux bootable image for the networking project installed into external flash To boot this uCLinux configuration onto board just reset the board and let U boot perform the autoboot sequence 6 6 Loading uCLinux Images At this point you are able to load uCLinux bootable images to the board over TFTP and either bo
83. ns source files headers file of the NetFusion software apps device drivers and packages The two execution script shell files savetfip and starttftp may need to be modified to allow them to be executable scripts Type linuxPC Project linux cortexm 1 xx x projects netfusion chmod x savetftp linuxPC Project linux cortexm 1 xx x projects netfusion chmod x starttftp iol OC research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Go into the ocal directory linuxPC Project linux cortexm 1 xx x projects netfusion cd local linuxPC Project linux cortexm 1 xx x projects netfusion local 1s default script group hosts html httpd conf inittab ALL passwd rc securetty services shadow ssh host dss key ssh host rsa key linuxPC Project linux cortexm 1 xx x projects netfusion local html sub directory contains files for the default apache web server All other files are placed into the etc directory on the NetFusion SOM uCLinux environment file system You can change the contents of the file that get deployed into the etc directory of the NetFusion here in this directory and know it will be the default contents of the etc files This is because the root file structure in ramFS and defaults back to the start contents for each reboot Go into the htmi directory linuxPC Project linux cortexm 1 xx x projects netfusion local cd html linuxPC Project
84. nx evo board psl ocean u boot e Build the U boot image ready for download to the NetFusion over TFTP and copy it to the TFTP server directory psl ocean u boot make psl ocean u boot cp u boot bin tftpboot psl a2f To upgrade the firmware do the following on the NetFusion e Configure the networking in U boot if necessary e Download the U boot image from the TFTP server A2F LNX EVB gt tftp psl a2f u boot bin Corel0 100 link up 100 Full1 Using Corel0 100 device WEI Eent Sete IAs Ol ike rouble Uli ek ae aber A Lg O AN Filename psl a2f u boot bin Load address 0x7 70000000 Loading t Ht done Bytes transferred 96052 17734 hex A2F LNX EVB gt iol OC OG research and development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Program the new U boot image to the embedded flash of the MCU using the cptf command Note that the cptf command automatically resets the NetFusion upon completion of the eVNM upgrade which calls the newly programmed image from the reset vector in the eNVM Note also that the first parameter passed to the cptf command specifies the base address of the embedded flash area being updated by the command Depending on your CPU pass the following address as the first parameter to cptf e STM32F 0x08000000 e LPC17xx 0x0 e SmartFusion and SmartFusion2 0x0 e Kinetis 0x0 As an example the following command perform
85. o IDE create a new project with an arbitrary name From the main FlashPro window push Configure Device Push Browse next to load an existing programming file e Browse to the NetFusion project stp file and choose it Push Program to start programming the M2S FG484 SOM on the NetFusion with the chosen stp image e Push the reset button and observe the U boot banner see above in the PuTTY window iol 19 OC research OOA and development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 5 4 Installing the TFTP server e To load uCLinux images to the NetFusion M2S FG484 SOM you will need the capabilities of your local network and the TFTP server Connect the Ethernet cable to the NetFusion s SOM Ethernet port and to a network switch or to your host PC Install the TFTP server and start it Unblock the application if the Windows firewall asks for permission Tftpd32 by Ph Jounin SE Current Directory C Program Files T ftpd32 D Browse Server interfaces 17217 04 D Tip Server Tftp Client DHCP server Syslog server Log viewer start time progress About Settings Help Figure 3 TFTP Application on Windows XP 7 8 e Put the uCLinux image netfusion ulmage you want to load to the TFTP server stage directory C Program Files Tftpd32 by default 5 5 Booting the uCLinux Image To boot the image you first need to set up networkin
86. o the filesystem mount t devpts none dev pts mount the pts directory into the filesystem mount t jffs2 dev mtdblock2 flash mount the flash directory into the filesystem non volatile area echo 1 gt gt proc sys kernel panic set the Linux kernel panic time to 1 second A panic will reboot ifconfig lo 127 0 0 1 up bring up the loopback 127 0 0 1 netif cat lib mtipsw_parms sed e s e d xargs insmod lib mtipsw_dma_sw ko launch DMA driver ifconfig mtipO down hw ether ethaddr default down mtipO high priority netif and set mac address ifconfig mtip1 down hw ether ethaddr default down mtip1 lower priority netif with same mac address ifconfig mtipO 10 1 1 190 up bring up the new DMA controller CHO network interface mtip0 ifconfig mtip1 10 1 1 191 up bring up the new DMA controller CH1 network interface mtip1 insmod lib genGPIO_UIO ko launch general GPIO UIO device driver ifconfig show on debug output the current network interfaces present usr app busybox httpd h httpd html drivers temp_sensor file httpd html ts txt amp If you do not want to use or invoke the AMBA DMA Controller device driver because you do have removed it from the SmartFusion2 FGPA fabric then you can comment out the following lines with the symbol cat lib mtipsw_parms sed e s e d xargs insmod lib mtipsw_dma_sw ko launch DMA driver ifconfig mtipO down hw ether ethaddr default do
87. oduces a 0 on the software read data Driver General I O GPIO pcf5074 c Individual spare pins and the LEDs Switches amp Jumpers 14 4 RS232 GPIO Extended Signals For each of the additional extra RS232 signals such as DTR DSR etc they can be switched instead to the GPIO connector if the RS232 functionality is not required UP position RS232 signal DOWN position GPIO USR signal Driver General I O GPIO pcf5074 c Individual spare pins and the LEDs Switches amp Jumpers 14 5 Relays and the Selector Switches For each of the Relays RL1 and RL2 they can be switched instead to the GPIO connector if the relay output functionality is not required LEFT position GPIO USR signal RIGHT position RELAY operation Driver General I O GPIO pcf5074 c Individual spare pins and the LEDs Switches amp Jumpers 74 eee research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 14 6 Relay Output Connector Relay RL2 non Relay RL1 non polarized voltage free polarized voltage free isolation protected isolation protected screw terminals screw terminals Driver General I O GPIO pcf5074 c Individual spare pins and the LEDs Switches amp Jumpers 14 7 LCD Connector PIN 1 GND here on the LEFT with PIN 16 Backlight Current Source at the far end
88. of distributing as source is to allow as standard with in a Linux environment for the compiler and linker to detect and adjust for the host architecture and surrounding kernel structure As there is no specific kernel that is needed although stay more recent than version 2 6 14 the compilation and build of the device driver source to a kernel object file will fit to its surrounds In the event that a significant step in kernel produces a compilation error then you will have to contact MorethanIP GmbH or Nine Ways R amp D Ltd for support www nineways co uk 12 4 5 High and Low Priority Channels As already discussed the DMA Controller concept is built on a dual RX and dual TX channel mechanism Basically from the FIFO interface on a MAC SWITCH all the way to the application software programs in the processor sub system a dual channel pathway in each direction exists offering overtaking of packet frames This sounds unnecessary as the frame usually will stay in order along the route of a fiber router hop unless the higher layer router functionality obeys IP fragmentation rules However the section of the pathway in between a given MAC and the software applications handling the data information contained in the Ethernet packets is often bottlenecked and the slowest part of the whole process In order to allow for this section of restriction to be less hindering to chosen packets two pathways for the TX system and two pathways for the RX system
89. om 44 0 1332 258847 44 0 1332 258823 iol 107 eee research OOO and development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 25 Document History Document Change Notices DCO Version Description Created Changed By Version 1 0 Initial Release accordingto Paul Bates Nine Ways 29th August 2014 Version 1 0 Copyright Nine Ways R amp D Ltd 2014 All Rights Reserved Table 6 Document History Entry Log iol 108
90. ompleted the basic initialization U boot configures the memory controller to allow accesses to the external RAM and flash memory and then copies the uCLinux image from flash to RAM and jumps to the uCLinux kernel entry point in RAM It is possible to interrupt the U boot autoboot sequence by hitting a key before U boot starts relocating the uCLinux image to RAM and enter the command line interface of U boot however assuming no operator intervention U boot proceeds to boot uCLinux up as soon as possible U boot 20100 0S linux contexm l 20 Decl 06 20137 Eh CPU SmartFusion FPGA Cortex M3 Hard IP Board A2F LNX EVB Rev 2 A www emcraft com DRAM 16 MB Flash 8 MB Mog serial Out serial Ent serial Net Corel r00 Hit any key to stop autoboot 0 Booting kernel from Legacy Image at 74020000 Image Name eeben Image Type ARM Linux Kernel Image uncompressed Data Size 821816 Bytes 802 6 kB Load Address 70008000 Entry Point 70002001 Verifying Checksum OK Loading Kernel Image OK OK Starting kernel Uncompressing Linux done booting the kernel ig Linux version 2 6 33 arml psl ocean emcraft com gcc version 4 4 1 Sourcery G Lite ZOO Gi GS 5 spies ma DES AG Or Wes ZOS CPU ARMv7 M Processor 411fc231 revision 1 ARMv7M CPU NO data cache NO instruction cache Machine Actel A2F Freeing init memory 292K init Started BusyBox vili17 0 2013 12 06 19 58 44 MSK SS 10 OCH
91. on make clean Then to clean the SQLite separate build system type xx x projects netfusion cd source sqlite xx x projects netfusion source sqlite make clean xx x projects netfusion source sqlite make 63 OC research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Then make the full uCLinux build with NetFusion including the SQLite3 binary by typing linuxPC Project linux cortexm 1 xx x projects netfusion source sqlite cd linuxPC Project linux cortexm 1 xx x projects netfusion source cd liuxPC Project linux cortexm 1 xx x projects netfusion make Finally prepare the newly generated uCLinux kernel package binary for TFTP upload linuxPC Project linux cortexm 1 xx x projects netfusion savetftp 12 5 1 Building the SQLite Incrementally Then change into the netfusion source sqlite directory and build the binary with make linuxPC Project linux cortexm 1 xx x cd projects netfusion source sqlite linuxPC Project linux cortexm 1 xx x projects netfusion source sqlite make 12 5 2 Building the main uCLinux with NetFusion Incrementally Then change into the netfusion directory and build the binary with make linuxPC Project linux cortexm 1 xx x cd projects netfusion linuxPC Project linux cortexm 1 xx x projects netfusion make Finally prepare the newly generated uCLinux kernel package binary for TFTP upload linu
92. ontroller nenna 60 1242 Source UE 60 EE Ge WE e ne 61 12 4 4 Driver Operation amp Functional Description 62 12 4 5 High and Low Priority Channels A 62 12 4 6 Linux uC Linux Network Interface Exposure ssssssensnssesetnrtnnsreettnrrnnssernttnn nn nsnren reenn 62 12 4 7 DMA Controller Device Driver Parameter Ust 63 12 5 BUILDING THE NETFUSION CUSTOMIZED UCLINUX KERNEL 63 12 5 1 Building the SQLite Incrementally 0 ec eeeeeee cence ee eeeeeeeeseeeeeeeseeeeeeeseeeaeeeseeaeeeeeeaeees 64 12 5 2 Building the main uCLinux with NetFusion Incrementally ecceeeeeeeeeeeeeneeeeeeeneeees 64 12 5 3 Uploading the kernel to the NetFUSION 0 000 ceeeeeeeeeeneeeeseeeeeeeeeeeeeeeseneaeeeseeeaeeeeeenanees 64 12 6 BOARD UCLINUX TARGET DIRECTORY STRUCTURE sssesssesesttttettttetttttttttttntttnstt nett nstrnssennen 65 12 6 1 NetFusion Web Gerver tnts nt rrtt EnEn nsan ttnn Enns nErenn Enana e EEEn 69 13 AFTER FIRST COMPILATION GETTING THE SYSTEM CUSTOMIZED FOR THE USER 71 14 NETFUSION BOARD DRIVERS EE 73 14 1 UCLINUX APPLICATION UO 73 14 2 NETFUSION USER SPACE DRIVER Liser 73 iol research d and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 14 3 OPTION SELECTOR SWITCHES urc diiin aE ARTA etd 74 14 4 RS232 GPIO EXTENDED SIGNALS i cc dece eeved des ectdeactecvads Joeeasceetevadues Adel ceeds 74 14 5 RELAYS AND THE SELECTOR SWITCHES eeccneisnrciddiiaiie
93. ory Structure Change into the netfusion directory linuxPC Project linux cortexm 1 xx x projects cd netfusion Look at the contents linuxPC Project linux cortexm 1 xx x projects netfusion ls local netfusion busybox netfusion initramfs netfusion uImage savetftp starttftp Makefile netfusion kernel M2S netfusion uboot s patch source linuxPC Project linux cortexm 1 xx x projects netfusion local sub directory contains files to be copied onto the NetFusion file system netfusion busybox build configuration file Busybox apps enable disable configuration file netfusion initramfs build configuration file defines tree structure of the NetFusion file system netfusion ulmage image of compiled NetFusion kernel pre compiled image of the kernel file savetftp script copies the compiled kernel to the TFTP server root directory starttftp startup script invoked at start of a session to run the TFTP server Makefile Linking makefile used for the build process Add your apps to this netfusion kernel M2S_ build configuration file uCLinux kernel build options for NetFusion netfusion uboot s u boot image file image of the u boot used to by NetFusion before uCLinux boot up patch sub directory contains files to applya NetFusion specific modification to the uCLinux kernel code that is not possible from the above configuration files source sub directory contai
94. ot them directly or install them to the external flash to allow booting uCLinux from flash on power up reset On the host activate the uCLinux SmartFusion2 development environment and build the networking project bash 3 2 ACTIVATE sh bash 3 2 cd projects networking bash 3 2 make bash 3 2 23 OC research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Copy the uCLinux bootable image to the TFTP download directory bash 3 25 cp netfusion uImage tftpboot vlad bash 3 2 To load the image directly use the netboot U boot macro M2S SOM gt setenv image netfusion uImage M2S SOM gt run netboot WEE Ee Zeenen TYAS AO ike yb wie eeh oe ben 2 E Gs Sig ONO Filename vlad networking ulImage Loading HHT PETE AE dE AE AE HE EH AE AE FE AE AE AE AE FE E AE FE FE FE FE FE E AE AE FE FE E AE AE FE AE AE FE E AE AE AE HE E FE E AE AE FE FE AE FE AE AE AE FE FE E AE AE FEFE E AE E AE FE HE E E AE FE FE FE E AE E AE FE FE FE E AE FE FE FEAE PE AE FE FE E E AE FE AE FE E AE E AE FE FE FE E AE HR ER FE E AE FE AE FE AE AE AE AE FE FEFE F FEAE AE AE AE AE FE FE FEAE AE FE H done Bytes transferred 2084704 1fcf60 hex Image Name tert Image Type ARM Linux Kernel Image uncompressed Verifying Checksum OK Loading Kernel Image OK OK Starting kernel Linux version 2 6 33 arml vlad ocean emcraft com gcc version 4 4 1 Sourcer
95. oy eee research development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 2 Hardware Platform For this specific product uCLinux Cortex M comes as a software distribution image supporting the corresponding ARM Cortex M microcontroller embedded in the SmartFusion2 FPGA It provides support for the hardware architecture on the SOM and comes as a Board Support Package BSP specific to the NetFusion board This User s Manual document proceeds to outline information that is common for all supported MCU architectures but in particular to this NetFusion board d d A A Figure 1 The NetFusion CAT5 PCB Hardware Platform SERDES variant also available iol OCH research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 3 Pre installed Demo 3 1 Pre installed Demo on the NetFusion Hardware Platform NetFusion comes with the U boot firmware installed into the internal flash of the microcontroller device and uCLinux image installed into the external flash memory 3 2 Description of the Pre installed Demo The installed uCLinux image provides a default NetFusion start up environment that includes all SOM hardware and the NetFusion baseboard hardware support drivers On a power on or reset U boot runs from the embedded flash and uses the embedded SRAM of the microcontroller as storage for volatile data Having c
96. ple Unload the device driver mnt hello app rmmod sample Iterate to update and test your custom device driver from the NFS mounted host directory ioD OC research OOA and development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 9 7 Develop a Custom User Space Application over NFS You are in the application sub directory in your project s directory bash 3 28 pwd home vlad test linux cortexm 1 12 0 projects hello app The developer project you have cloned your new project off already provides a user space application implemented in app c This is an example so let s add a simple print out to the application code bash 3 29 vi appe printf s THIS IS CONTENT OF s n app name dev_name ie Read the sample device byte by byte if while 1 Build the updated application bash 3 2S make On NetFusion install the device driver and test the updated application mnt hello app insmod sample ko mnt hello app E app app THIS IS CONTENT OF dev sample This is the simplest loadable kernel module Unload the device driver mnt hello app rmmod sample Iterate to update and test your custom application from the NFS mounted host directory iol 43 OC research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 10 Building uClibc The NetFusion uCLinux distribution provides the uC
97. pment NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 14 13 9 Voltage PCB Supervisor Voltage PCB Supervisor vs_ad7998 c Monitor and check all voltages and rails on the PCB This driver is demonstrated and handled in the shell script on NetFusion drivers vs_ad7998 sh Usage amp Syntax vs_ad7998 parameter syntax Must be 10 parameters with switches dev lt addr gt sdabit lt bit gt clkbit lt bit gt gpioaddr lt addr gt convbit lt bit gt gpiooffs is the user memory offset within the UIO mechanism phys mem of the i2c GPIO signal dev is the i2C address of the ad7998 IC device on the i2c bus Check circuit schematics sdabit is the bit position within the i2caddr location of the sda signal Zero based between 0 31 clkbit is the bit position within the i2caddr location of the clk signal Zero based between 0 31 convbit is the bit position within the convaddr location of the conv signal Zero based between 0 31 Example vs_ad7998 dev 33 gpiooffs 1879048192 sdabit 5 clkbit 4 convbit 18 Support www nineways co uk pbates nineways co uk Description The NetFusion baseboard has many different power supply voltages and rails This driver makes it possible for the application code to gain access to the power voltage levels via an IP core and an ADC device in the hardware By calling and invoking this application driver the command line parameter
98. pment Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Before rebuilding the project open the sys_config h present in the editor tab and change define MSS SYS MDDR CONFIG BY CORTEX 1 To define MSS SYS MDDR CONFIG BY CORTEX 0 This is needed because Libero re generated the SoftConsole project workspace and unconditionally enabled initialization of the LPDDR memory by the DDR module firmware added to the SoftConsole project This initialization is incompatible with the memory used on the NetFusion M2S FG484 SOM the demo application uses the correct LPDDR initialization code in config_mddr_Ipdadr e Rebuild project Project gt Clean select Clean all projects and Start the build immediately e Re run the debug session of the project gi iol OCH research O and development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 16 Installing a Bootable uCLinux Image to the NetFusion Board Step through the following procedure in order to install the netfusion ulmage bootable uCLinux image to your board e Download the bootable uCLinux image netfusion ulmage and copy it to the TFTP boot directory on your development host PC C Program Files Tftpd32 if you installed Tftpd32 on the Windows host PC e Connect to the serial console reset the board and stop auto boot by hitting any key e Being at the U boot prompt run the following U boot
99. populated with required files and directories at build time and is then simply linked into the kernel U boot operation is controlled at run time by the so called environment variables which are stored in persistent storage such as external flash Each environment variable controls a certain aspect of U boot operation For instance there is an environment variable called bootargs that defines a kernel command string that U boot passes to the uCLinux kernel as the parameters 31 OC research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 8 3 Selected Use Scenarios 8 3 1 U boot Environment To manipulate the U boot environment the following commands are used e printenv lt var gt print the value of the variable var Without arguments print all environment variables A2F LNX EVB gt printenv bootargs console ttyS0 115200 panic 10 bootcmd run flashboot bootdelay 3 baudrate 115200 hostname a2f 1nx evb loadaddr 70000000 addip setenv bootargs bootargs ip ipaddr serverip gatewayip netmask hostname eth0 off flashaddr 74020000 flashboot run addip bootm flashaddr netboot tftp image run addip bootm image blabla uImage ethact Corel10 100 stdin serial stdout serial stderr serial ethaddr 00 22 44 66 88 AA Environment size 430 4092 bytes A2F LNX EVB gt e setenv lt var gt lt val gt set the variable var to the value val
100. r the specific hardware configuration M2S FG484 SOM gt set bootargs mis platform m2s fg484 som console ttyS0 115200 panic 10 1pj3 774144 Add quiet quiet to bootargs in U boot This tells the kernel to suppress printing information messages onto the serial console M2S FG484 SOM gt set bootargs mis platform m2s fg484 som console ttyS0 115200 panic 10 1pj 774144 quiet quiet To restore the message printing function remove quiet quiet from bootargs Set bootdelay to 0 This tells U boot to immediately proceed with running bootcmd without waiting for user input for bootdelay seconds M2S FG484 SOM gt set bootdelay 0 To restore the bootdelay function in U boot press Ctrl C at the same time as you push the reset button This will return you to the U boot command monitor where you can reset bootdelay to a non zero value Save the updated environment variables to the SPI flash M2S FG484 SOM gt saveenv Saving Environment to SPI Flash Erasing SPL flash Writing to SPl flash doone 96 A research OOA and development CO NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Push the reset button and watch the demo to boot up on SmartFusion2 in a blink of eye U Boot 2010 03 00001 gc9f691b Dec 26 2012 14 06 31 CPU SmartFusion2 SoC Cortex M3 Hard IP Freqs CORTEX M3 166MHz PCLKO 83MHz PCLK1 83MHz Board M2S FG484 SOM Rev 1A www emcraft com DRAM 64 MB In serial Out Seria
101. r to http 172 17 4 200 and watch the demo web page provided by the Cortex M NetFusion baseboard Next step is to test SNMP Make sure that the daemon snmpd is not running on your host Create the following configuration file snmpd conf agentAddress udp 161 rocommunity public default rwcommunity private default Then run the daemon snmpd on the host with the above configuration root vladimir net snmp snmpd C c snmpd conf Le f Then run the snmpget application on the NetFusion and collect information about the host using the snmpget application snmp e public Ly 17 0 253 le ees E EE STRING Linux vledimir emeratt com 2 0 32 26 175 1cl 16860 PAr 41 SMP Wed Aug 24 16 45 50 UTC 2011 i686 Make sure that the daemon snmptrapd is not running on your host Create the following configuration file snmptrapd conf snmpTrapdAddr udp 162 authCommunity log public Then run the daemon snmptrapd on the host with the above configuration root vladimir net snmp snmptrapd C c snmptrapd conf Le f Then send a trap from the NetFusion to the host using the snmptrap application EP EIERE A oe egener IPQ EE Vil 2 SpA D GY Vil cis el eS E CV Ser AL Lal ALA IL Sh ake le Gren CS Ering y On the host PC you should see a log message similar to the one below 2011 08 25 13 45 34 192 193 194 195 vie UDP 172 17 4 201 44563 gt 172 17 0 253 TRAP SNMP Vil COMMUNE SAS son 2524 5 0 enterprise speci kile rape 99
102. research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 The uCLinux kernel is configured to mount a root file system in the external RAM using the initramfs file system initramfs is populated with required files and utilities at the kernel build time and then simply linked into the uCLinux image initramfs doesn t have hard limits on its size and is able to grow using the otherwise unused RAM memory The uCLinux image installed on the board provides a demonstration of basic shell and network capabilities of uCLinux Cortex M In addition to that the demo provides support for flash partitioning and persistent data storage using the JFFS2 journalled file system for the external flash memory Here is how you can test some of these capabilities From a local host test that the NetFusion is accessible over network assuming that the NetFusion board is assigned with the 172 17 4 200 IP address psl ocean linux cortexm 1 12 0 ping 172 17 UNG IPA ci Et hye 17 4 64 bytes from 172 17 4 200 64 bytes from 172 17 4 200 64 bytes from 172 17 4 200 200 56 84 bytes icmp seg ttl 64 Temprseq 2 ttl oA icmp_seq 3 ttl 64 4 200 Of data time 3 11 ms time 0 900 ms time 0 854 ms On NetFusion connect to a local host using telnet a hi wenlixete E Entering character mode Escape character is Fedora release 12 Constantine Kernel 256 3226 5 fol EE E E E 68e 67
103. reset should bring the U boot start up messages and the command line interface onto the serial console interface 25 OC research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 7 uCLinux Cortex M Software Development Environment 7 1 Distribution and Installation 7 1 1 Distribution Image The uCLinux Cortex M development software is distributed as a linux lt mcu gt lt release gt gzip file available for download from nineways co uk When unpacked this archive contains along with the other materials the software distribution file linux lt MCU gt lt release gt tar bz2 That file can be installed to an arbitrary directory on your Linux development host as follows psl ocean SF mkdir release psl ocean SF cd release psl ocean release tar xvjf linux A2F 1 12 0 tar bz2 linux cortexm 1 12 0 linux cortexm 1 12 0 linux linux cortexm 1 12 0 linux lib psl ocean SF 1s 1 linux cortexm 1 12 0 See 20 EE 2 psl users 4096 2013 12 06 17206 ALE EWE xi A 1 psl users 215 2Ole 17 06 16226 ACTIVATE sh drwst xr x 24 psl users 4096 2013 12 06 21 32 linux drwxr xr x 5 psl users 4096 2013 12 06 20 16 projects Orwar ar n 2 psl users 4096 2013 12 06 19214 tools drwxr xr x 31 psl users 4096 2013 12 06 19 16 u boot You do not need to be the super user roof in order to install the uCLinux Cortex M distribution on NetFusion The installation can be performed f
104. ro is the mid point This driver operates as unsigned however iol eee research OOA and development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 14 13 8 PCB Temperature Sensor PCB Temperature Sensor temp_sensor c An on board temperature sensor on the baseboard This driver is demonstrated and handled in the shell script on NetFusion drivers temp_sensor sh Usage amp Syntax temp_sensor parameter syntax file lt filename gt is optional and if present on the command line parameter list saves the output from the driver to a file rather than to the standard output stream Example temp_sensor le usr temp Support www nineways co uk pbates nineways co uk Description The temperature sensor on board the NetFusion PCB baseboard outputs the real time temperature When launching this driver it operates until a command in the standard input stream forces the driver application to exit Whilst running the calculated averaged and settled temperature is output once every 60 seconds With the absence of a declared output file the temperature string is written to the standard output stream However if a file is passed as a command line parameter then the temperature string is outputted to the file every 60 seconds instead Typical return string 55 4C n Typical return string 2 3C n iol eee research OOA and develo
105. rom an arbitrary unprivileged user account 7 1 2 Installation Tree Having been installed onto the Linux host the uCLinux Cortex M provides the following files and directories relative to the top of the installation directory e A2F this is a directory with target components e A2F busybox busybox source and development tree e A2F dropbear dropbear SSH server source and development tree e A2F net snmp source and development tree of the net snmp package e A2F uclibc source and development tree of the uClibc package e A2F gdb 2011 03 source and development tree of the GNU Debugger package e A2F hostapd 1 0 source and development tree of the HostAP Daemon package e A2F wireless_tools source and development tree of the Wireless Tools package e A2F libni 3 2 11 source and development tree of the Netlink Protocol Library package e A2F netperf 2 6 0 source and development tree of the Netperf network benchmarking package e A2F root pre built target binaries ready for use on the target e u boot U boot source and development tree e finux Linux uClinux kernel source and development tree 26 OC research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 e projects contains a Hello World template project and importantly the NetFusion project embedded applications e tools development tools e tools bin mkimage utilit
106. s app gdb sample ko sample o app modules order sample mod c mnt 104 eee research OOO and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 22 Understanding what causes SEGV in an Application amp If a user space application terminates with SEGV this means as it is always the case in uCLinux that the application did something that triggered an exception to the Cortex M processor core The most likely causes are e You built your application for a processor architecture other than Cortex M which causes an Unsupported instruction exception e Your application makes an attempt to access an address outside of the Cortex M address space e Your application makes an attempt to access unaligned data To understand what is causing an exception do the following Enable CONFIG_DEBUG_USER in the kernel configuration From your project directory bring up the kernel configuration interface by running make kmenuconfig Go to Kernel hacking and enableVerbose user fault messages In U boot add user_debug 8 to bootargs Having done the above rebuild your uCLinux project bring it up on the NetFusion and re run your application When the application fails with SEGV there should be some informational messages on the system console indicating the cause of the fault 105 eee research OOA and development Ki NINE WAYS NetFusion Software uCLinux User
107. s provide the settings and then the return text provides the voltage levels Like the GPIO RTC and the ACI driver above this driver exits immediately with the values and does not maintain continuous operation To read the voltages again this driver must be invoked once again and the new updated values are output as text The output text displays the intended voltage in the order 5V 2 5V 1 8V 3 3V SOM 3 3V Baseboard 1 2V Vin Power DC inlet Typical return string 4 97V 2 39V 1 81V 3 28V 3 26V 1 19V 18 37V n iol eee research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 15 Running a SoftConsole Hello World Project on NetFusion This application note explains how to use the Libero SoC and SoftConsole software to develop a simple Application on the M2S FG484 NetFusion baseboard The application is a Hello world demo that uses GPIO to blink the on board LED and use the LPDDR memory for data storage 15 1 Hardware Platform The hardware platform is the NetFusion baseboard The demo described in this application note assumes that the mini USB cable is plugged into the mini USB connector on the baseboard to provide the serial console and the FlashPro4 or FlashPro3 JTAG programmer is connected also The serial connection may require the FT232R USB drivers to be installed to the development host PC Also please open the serial console window on the U
108. s the U boot self upgrade on NetFusion A2F LNX EVB gt cptf 0x0 loadaddr filesize 1 cptf Updating eNVM Please wait U boot 2010 03 Dec 06 2013 20 15 52 CPU SmartFusion FPGA Cortex M3 Hard IP Board A2F LNX EVB Rev 2 A www emcraft com A2F LNX EVB gt Note be extra careful when performing the cptf command specified above In case you program an incorrect U boot image to the eNVM this will render the board non bootable The only resort in this scenario is to program the U boot image to the board over the JTAG port OC research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 9 Sample Development Session 9 1 Sample Session Outline This sample session illustrates a possible software development cycle in uCLinux Cortex M We will do the following e Create a new project by cloning it off of the developer demo project e Modify the new project to automatically NFS mount a development tree from the uCLinux host where we have installed uCLinux Cortex M e Program the new project image into flash so that it autoboots on NetFusion on each power up reset e Develop anew custom application and a kernel module and debug them from the NFS mounted host directory without having to even reboot the NetFusion target 9 2 Create a New Project This section creates a new project as a clone of the existing project and makes sure the new project builds Start of
109. seful applications and packages The NetFusion build becomes the primary makefile build and this refers on to the main uCLinux kernel when required The installation of the entire NetFusion Emcraft development on the host Linux PC for cross compilation is derived from just three simple zip file and installation steps Firstly you download and unpack the Emcraft uCLinux development tree Secondly download and unpack the cross compile ARM Cortex M3 toolset which installs into a sub directory of the first installation above Finally download and unpack the NetFusion project into the projects directory deepest with in the Emcraft uCLinux tree also The host PC has to be Linux natively and is ideal on Ubuntu and similar No prior installation dependencies exist and as long as the package three files aforementioned can be fetched and installed with tar or gzip the process is simple and you can be up and running very quickly and easily fe Applications Places System P Accessories A B calculator o gt Games Character Map A Graphics p Disk Usage Analyzer internet Li Manage Print Jobs hM Pl Office Search for Files Sound amp Video Take Screenshot M Terminal E Text Editor YSE the command line d Tomboy Notes y Ubuntu Software Center Figure 4 An example on Ubuntu Linux of the Terminal being launched The terminal screen can be typically accessed from the GUI of most Linux IDEs It is from here that steps previou
110. sly described in this document can be executed and the cross compilation can take place Delivery of the compiled uCLinux kernel with environment uses a TFTP server bundled with NetFusion package via Ethernet cable along with CLI command line using the USB UART iol 48 OC research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 12 2 Source File Structure amp NetFusion Package 12 2 1 Package Deliverable From the Nine Ways www nineways co uk or Distributor website you can obtain the netfusion uclinux x xx gz file The x xx is the version of that build Use earlier sections in this document to instruct and help you to install the Emcraft uCLinux deployment and then the toolset of the cross compile inside the target destination Those are the first two steps of the three required to get the full NetFusion development environment Copy the netfusion uclinux x xx gz package file into the Project linux cortexm 1 xx x projects directory that was created from the first Emcraft uCLinux package installation Firstly you have default initial directory folders which need to be deleted linuxPC cd Project linux cortexm 1 xx x projects linuxPC Project linux cortexm 1 xx x projects rm fr The directory will now be empty ready for the NetFusion package contents Copy the package gzip file into the projects directory that you downloaded or have kept archived linux
111. stered in the system drivers directory NetFusion UIO driver binaries and associated shell scripts for the PCB baseboard hardware The shell scripts give examples and show usage more clearly flash directory SPI flash temporary working directory do not use lib directory default installed uCLinux user device drivers This is defaulted to the AMBA DMA controller and also the UIO platform for the NetFusion user space drivers root directory home directory of the default root account usr directory uCLinux usr directory that has symbolic reference links to other nested deeper areas of the filesystem contains secondary binaries commands and also sharing applications Change to the bin directory cd bin bin 1s aci bash busybox cat chmod chown uname vi volt wc wget xargs bin 66 00 research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Change to the etc directory bin cd etc etc 1s dropbear hosts initab rc services group httpd conf passwd securetty shadow etc Change to the httpd htm directory etc cd httpd html httpd html 1s Untitled png aci cgi aci_driver html board checks mani html cgi bbin contact _details html datetimecsbe shen drivers maine nen ee Ee Fenn col eSMpmsensor nda yore ien tx txt vol cgi volt_sup driver html httpd html Change to the mtiptest directory httpd htm
112. streams Important Note the data is 8 bit unsigned This means that 128 is the mid line silence and 0 and 255 are the negative and positive extremes of the audio signal This is unlike signed values whereby zero is the mid point This driver operates as unsigned however iol eee research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 14 13 7 Line IN Stereo Audio Line IN Stereo Audio spi_audio_line_in c_ Line IN audio analogue to digital output stream This driver is demonstrated and handled in the shell script on NetFusion drivers spi_audio_line_in sh Usage amp Syntax spi_audio_line_in parameter syntax Must be 8 parameters with switches baseaddr lt baseaddr gt samprate lt samprate gt datapathL lt datapathL gt datapathR lt datapathR gt baseaddr is used to define the base address of the spi_audio_line_in in memory samprate is the channel left right frequency rate datapathL is the string that accesses channel 0 inode file to allow data transfer datapathR is the string that accesses channel 1 inode file to allow data transfer Example spi_audio_line_in baseaddr 1073811456 samprate 4000 datapathL dev datapathL datapathR dev datapathR When driver loads it will check for an Enable Disable or Quit Program code Please enter e enable d disable or q quit program Carriage return terminated Suppor
113. sys cd drivers drivers ls acivad 998 Vaci Tad o9e sh corcuART corevART Sh ads Onte ds MOr tesh Hedi perso74 led_pef5074 sh milli pef5074 pcf5074 sh spi_audio_ line in spi_audio line in sh spi_audio_ line out spi audio line out sh temp sensor tem_sensor sh vs_ad7998 vs_ad7998 sh drivers Change to the ib directory drivers cd lib lib 1s genGPIO UIO ko mtipsw_dma_sw ko mtipsw_parms lib SS tol 00 research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Change to the usr directory lib cd usr usr als bin share usr 12 6 1 NetFusion Web Server The NetFusion default uCLinux bundle as shown above has a working and ready to run apache2 web server This is compiled and guised in the form of httpd from busybox The httpd htm directory contains the web page echo system where you can change and re design to you own desires and architectural requirements As a start point in the bundled NetFusion uCLinux package the web page system shows a demonstration of the PCB hardware and the SQLite capabilities Also the NetFusion user space UIO drivers are all used to facilitate the web content which can aid and help the user see how the cgi mechanism by default can allow hardware to interact with the web front end Moreover you can then grasp the value of the SQLite database system be able to use the hardware and the web p
114. t www nineways co uk pbates nineways co uk Description The line IN audio is stereo and so has two independent channels Once the driver has been executed on the command line with the settings passed at the same time as parameters the arbitrary output streams are opened ready for receiving the data from the ADC from the analogue line circuitry The two output streams are not the standard output stream but in fact two independently declared file streams that can be read from by other applications in order to receive the audio data These are setup on the command line parameters before the session begins and for the duration of the session the two output file streams send the data to the piped application from the ADC and Line IN circuitry The standard input stream is also used in addition to the two file streams The standard input allows single character commands shown above to enabled disabled the audio and also to exit the session and close the driver application The file streams allow the user to create their own functionality to handle the received audio data maybe the user will write an application to send to the UDP IP using RTP which was received from the audio digitized data on each of the independent output file streams Important Note the data is 8 bit unsigned This means that 128 is the mid line silence and 0 and 255 are the negative and positive extremes of the audio signal This is unlike signed values whereby ze
115. t RAW Client Report Table 3 App Program Source content 57 io eee research d and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 12 2 1 2 Understanding Variables and Socket names To name the variables and sockets used in this code the same standard used to name functions will be used here the protocol names will be expressed in capital letters RAW UDP TCP and the operational mode will be expressed in two lower case letters cl sv lo The next table will show some of the variables used on the code excluding the explanation of which protocol or mode it belongs Name Functional Description TCPloTotalBytesT0 Total of bytes received in the first test UDPclPacketRec Total of packets received SockUDPsv Name of one of the sockets RAWclITimeTest Duration of the test speedT0 Speed of the first test in one of the reports local variable RAWcITotalBytes ler Get bytes received in the last test before applying it to a test number Table 4 App Program Source important variables 12 2 1 3 Changing the Default Settings To change the DEFAULT sever address MAC address and port numbers the file mtipDefine h has to be edited and the software must be recompiled and exported to the SmartFusion2 again Inside this file change the old information to the new address of port number as in these two examples To change the Default
116. t path to the directory where you have installed the cross tools The tools can be installed from an unprivileged account In case you already have the toolchain installed on your development host PC it would be the case for instance if you have more than one installation of uCLinux Cortex M on your host PC and the underlying file system supports symbolic links DOS FAT does not you do not have to install the whole toolchain again Instead do the following psl pvr linux cortexm 1 12 0 cd tools psl pvr tools ln s lt path to tools gt arm 2010q1 Note The CodeSourcery tools are 32 bit applications and need a compatibility library to run on 64 bit Linux OS distributions On the recent Fedora distributions the compatibility package e g glibc 2 17 14 f 19 i686 is installed by default On Debian you need to install it running sudo apt get install ia32 libs iol OC research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 7 1 4 Activation Whenever you want to activate uCLinux Cortex M development session go to the top of your uCLinux Cortex M installation and run psl pvr linux cortexm 1 12 0 source ACTIVATE sh This command sets up exports the following environment variables required by the uCLinux Cortex M development environment INSTALL_ROOT lt dir gt root directory of the installation This variable is used by the uCLinux Cortex M mak
117. tanddgusceadecaunaadesesdaadecanteaaedes 25 7 UCLINUX CORTEX M SOFTWARE DEVELOPMENT ENVIRONMENT 0 c seeeceeeeeeeeeees 26 7 1 DISTRIBUTION AND INSTALLATION suisti ienaa naana AAAA AA E aAa AAAA AA AAAA ANEA Aa 26 7 1 1 DIST UTM Image EE 26 7 1 2 NEIE el RTE 26 7 1 3 GNUECross Bulld WK EE 27 7 1 4 Let le EE 28 7 1 5 Dependency on NetFusion Components sssssseserenssssrtnrrensstttttnntnnssterrtnn nennen nn nnne nee 28 Zei PROJECTS FRAMEWORK ive 3 Eegenen ee 29 7 2 1 Multiple Target Projects ceodna AARAA S AAAS 29 iol eee research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 7 2 2 Hello World Demo Project EE 30 8 U BOOT LOADER FACILITY we cicccsscicccsscetcctssscecessecetectseciecesiecttectsnctveesneceteeiiecesevhsecrtevtsecnseessscries 31 8 1 POINTERS TO DETAILED INFORMATION ON U BOOT ss sssissstesresrtstttttttsttnsttntttrsrnstnstnssrnssrnsnnn 31 8 2 U BOOT THEORY OF OPERATION ccsice cestepceacesgecavitepeeqeceacectveatage desea gadencaapecavedssiccvcaaqguateesgaceness 31 8 3 SELECTED USE SCENARIOS sciigis coset pg sazchcnedcnsanpsscucescecanend age ancbsgedensaapecaec sjacexcal SEENEN 32 8 3 1 U boot Environment sormia ea aaa ancaanacecdinaccaneta gacdecdhencandhagacevctaaadanaas 32 8 3 2 ee e EE 33 8 3 3 Networking InsU DOOT sisan E AE D E AE EEA EREE ESE 33 8 3 4 Flash related Commande 33 8 3 5 U boot Self Uporad E eriep E AESA oe EAEE AE
118. tatus of other equipment s relay outputs door contacts sensors etc With analogue inherently built into the core capability you can design into your product monitored contact functionality to check for temper and sabotage features using series and parallel resistors Also this can be used to poll the voltage levels several hundred times per second so this has a lot of other useful added useful purposes Typical return string 4 56 255 255 0 0 1 254 n iol eee research OOO and development NINE WAYS NetFusion Software uCLinux User Guide 14 13 2 RS485 UART V1 0 August 2014 RS485 UART coreUART c Data injout through RS485 bus interface This driver is demonstrated and handled in the shell script on NetFusion drivers coreUART sh Usage amp Syntax coreUART parameter syntax Must be 10 parameters with switches baudrate lt baudrate gt databits lt 7 8 gt baseaddr lt baseaddr gt clk lt clk gt parity lt offlodd jeven gt baudrate databits baseadadr clk parity is the number of bytes per second transferred through the port is used to define the number of valid data bits per byte is used to define the base address of the coreUART in memory is the system clock frequency in hertz is enabled disabled with the input odd or even or off Example coreUART baudrate 115200 databits 8 baseaddr 1929379840 clk 166000000 parity off To exit
119. tenv bootargs m2s_ platform m2s fg484 som console ttyS0 115200 panic 10 M2S FG484 SOM gt setenv bootdelay 3 M2S FG484 SOM gt setenv verify M2S FG484 SOM gt saveenv Saving Environment to SPI Flash Erasing SP E lash ee Wrktang tor seh filash done M2S FG484 SOM gt e tol OC OG research and development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 18 Using DHCP Client in U boot Step through the following procedure in order to add DHCP client to U boot Define the CONFIG_CMD_DHCP configuration parameter in the U boot configuration file for your board u boot include configs lt board gt h define CONFIG CMD DHCP Refer to the u boot README u boot file and the u boot doc directory for more DHCP related options Build the U boot image as described in this document previously earlier Upgrade U boot on your board Connect to the serial console reset the NetFusion baseboard and stop auto boot by hitting any key Being at the U boot prompt run the dhcp command to invoke DHCP client to obtain an IP address and other network parameters BOARD gt dhcp 99 OC research OOO and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 19 Setting the Stack Size for a User Space Application This application note explains how to set up the stack size for a user space application The stack size can
120. terrupt or stop the application rather than resetting the system 30 eee research OOO and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 8 U boot Loader Facility 8 1 Pointers to Detailed Information on U boot uCLinux Cortex M makes use of the U boot firmware to bring the Cortex M target up from a power on reset and to boot uCLinux onto the NetFusion The U boot is a popular firmware monitor developed and maintained by DENX Software Engineering www denx de DENX publishes extensive U boot user documentation at their web site This section provides a brief introduction to U boot as relevant to the uCLinux Cortex M software environment 8 2 U boot Theory of Operation A typical uCLinux Cortex M boot up sequence is as follows e U boot firmware runs on the NetFusion from the integrated flash eNVM eSRAM no external memory required and performs all required initialization from power on reset including setting up the memory controller for external memory accesses e U boot relocates uCLinux image from external flash to external RAM and passes control to the kernel entry point in RAM External flash resides at the memory interface uCLinux image can be compressed to save the flash storage in this case U boot explodes the image when relocating it to RAM e uCLinux proceeds to boot up and mount a RAM based filesystem initramfs as a root filesystem initramfs is
121. the driver input on the command line Support www nineways co uk Iglenn nineways co uk Description The RS485 protected and isolated long distance differential full duplex 4 wire bus is controlled by a soft core UART This is accessed via memory address from this user space driver and the data to from the UART core is passed received using not the command line but in fact the read and write streams The command line parameters setup the configuration and settings of the session and then the driver remains in execution whilst shell scripts or other programs can send receive data through the read and write I O streams to the driver application By sending the escape characters to the write stream the driver is forced to exit Whilst the driver is running up to exit the RS485 bus is active and RX data is presented to a controlling program reading the stream from this driver Oppositely data sent to the write stream is presented on the hardware TX bus differential pair to form a proper full duplex system Typical shell script instantiation transmit_queue gt coreUART baudrate 115200 databits 8 80 baseaddr 1929379840 clk 166000000 parity off gt receive_queue amp eee research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 14 13 3 Real Time Clock RTC Real Time Clock RTC ds1307rtc c Separate PCB baseboard battery b
122. ting bits sub directory Some Header files Makefile build system file Separate make system to the main Emcraft uCLinux in outer directories This allows for the separate compilation to produce the sq ife3 executable sglite3 Pre compiled executable Cross compiled SQLite binary difen h C header file SQLite C header file sqlite3 c C source file Main 150 000 function containing core of the entire SQLite system This was ported and merged into a few extremely large files sqlite3ext h C header file SQLite C header file sqlite3 h C header file SQLite C header file lockfile h C header file Used to allow for file node semaphores across many of the NetFusion device driver applications to protect memory resources from mutli threaded problems shell c C source file Functions and structures relating to the command line queries and the IO streams of the database contents iol eee research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 12 3 SQLite Usage The SQLite is a specifically ported uCLinux orientated MySQL query binary application As discussed the source code compiles to the binary using make However once the user is running and using in the target NetFusion uCLinux system a whole level of support and documentation is needed for those users who are not as familiar with the service Please refer to
123. tipsw_dma_s ko If not cleaned this file exists as the last delivered default kernel object of the DMA device driver This will get deployed into the lib directory on the uCLinux NetFusion file system as part of a dynamic device driver kernel object mechanism 12 4 3 Concept The driver for the DMA Controller fulfills the following tasks 1 It exposes a regular network device in the Linux stream architecture ethX eth X 1 or mtipX mtip X 1 usually with the pneumonic lt dev ethO dev mtip0 gt or lt dev eth1 dev mtip1 gt that any application layer API program can access This along with very importantly the BASH Unix scripting that binds powerful high level programs to work together The configuration file for the driver source allows for the naming of the exposed network device Note the network interface name eth or mtip are just ideal default names They are configurable text wise in the software device driver 2 It manages the full control of the data throughput of the DMA master AXI controller invoking memory transfer to from the DDR physical contiguous SDRAM 3 It exposes a UIO interface for the API application programs UioX to be able to access all of the MorethanlP register mapping of all integrated hardware logic IP cores with in the silicon device of the ARM processor 4 Finally the device driver initializes ALL hardware IP cores additional to the DMA Controller module such as any MAC PHY P
124. upplied device data does not exceed 1023 bytes bash 3 2S vi sample c Pe Devalcemicdaivay G static char sample str 1024 This is the simplest loadable kernel module n je Device write af statice seizet sampllelwritelstruct file srp const char butter Done size kt EE EE int ret 0 Check that the user has supplied a valid buffer S we EE wrer LERE ret EINVAL goto Done Write the user supplied string into the sample device string rif strncpy sample str buffer length sample _str length 0 xoffset length 1 ret length d_printk 3 length d n length return ret Build the updated device driver bash 3 2S make On NetFusion go to the application directory mnt my_developer app cd mnt hello app 41 OC OG research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Install the updated device driver mnt hello app insmod sample ko Test that the read operation returns the content of the built in device data mnt hello app cat dev sample This is the simplest loadable kernel module Write into dev sample in order to change the device data and test the device returns the updated data on a next read mnt hello app cat gt dev sample This is the new content of dev sample elt mnt hello app cat dev sample This is the new content of dev sam
125. urce compiling building kernel building scripts toolset description API coding and using the board drivers for the NetFusion baseboard The deliverable bundle is the NetFusion software project as an extension of the Emcraft uCLinux installed directory tree Intended Audience This document is fully written for Nine Ways customers using the hardware NetFusion CAT5 SFP baseboard for evaluation full product deployment test and or further customer product development This document covers all variants of the NetFusion family as the Ethernet media hardware derivative are abstracted at the uCLinux Software level eee research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 1 Introduction to NetFusion The NetFusion PCB baseboard forms several different product usages Simplistically it is an interface product for Emcraft s SOM F484 series SmartFusion 2 FPGA sub system to allow real world connectivity in a deployed light heavy industrial environment in any situation It incorporates not only many different legacy connectors and interfaces but also compact high speed connectivity such as 10 100 1000M Ethernet USB and GPIO Its versatility enables it to be an ideal platform as a conduit for the highly reputable and endurable M2S SOM 484 family of SmartFusion2 FPGA system on module to interact in many given environments and deployable scenarios On their own the SOM FPGA units h
126. usion Hardware Drivers Usage 14 13 1 Analogue Contacts ACI Analogue Contacts ACI aci_ad7998 c Read analogue voltages from connector input This driver is demonstrated and handled in the shell script on NetFusion drivers aci_ad7998 sh Usage amp Syntax aci_ad7998 parameter syntax Must be 10 parameters with switches dev lt addr gt sdabit lt bit gt clkbit lt bit gt gpioaddr lt addr gt convbit lt bit gt gpiooffs is the user memory offset within the UIO mechanism phys memory of the i2c GPIO signal dev is the i2C address of the ad7998 IC device on the i2c bus Check circuit schematics sdabit is the bit position within the i2caddr location of the sda signal Zero based between 0 31 clkbit is the bit position within the i2caddr location of the clk signal Zero based between 0 31 convbit is the bit position within the convaddr location of the conv signal Zero based between 0 31 Example aci_ad7998 dev 33 gpiooffs GPIO_ADDR Global definition of the GPIO address sdabit 27 clkbit 26 convbit 19 Support www nineways co uk Iglenn nineways co uk Description The ACI Analogue Contact Input driver is responsible for reading the voltage levels of each of the 8 x connector inputs all reference the GND The results are presented as text values between 0 255 Zero is OV and 255 are 5V This driver and the hardware are incredibly useful with regards to reading the s
127. vlad ocean emcraft com 8 Fro Mer 25 17226237 MSK 2011 Zea EE nis domain none server 172 17 0 1 data bytes 38 P address is 172 17 4 150 FEE E AE REE E AE AE AEE A EEE EHR REET ERR AE FE H uncompressed gcc version 4 4 1 Sourcery Gth Lite QW 259 299 255 255 rootpath 2013 12 06 19 58 44 MSK seq 0 ttl 64 time 11 617 ms seq 1 ttl 64 time 2 016 ms OC research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 9 4 Update the New Project This section updates the new project for the required functionality and validates it on NetFusion In the new project update the NetFusion start up script so that it automatically mounts the projects directory from the uCLinux Cortex M installation on the NetFusion This makes all projects immediately available on the NetFusion allowing you to edit build and test your sample applications and loadable device drivers without having to re flash or even reboot NetFusion bash 3 2 vi local rc bin sh mount t proc proc proc mount t sysfs sysfs sys mount t devpts none dev pts mkdir mnt mount o nolock rsize 1024 172 17 0 1 home vlad test linux cortexm 1 12 0 projects mnt iroontia Lo lar omom Build the updated project and copy it to the TFTP server directory bash 3 2 make cp my developer uImage tftpboot vlad v Reboot the NetFusion load the updated image over the network and test it
128. wn mtipO high priority netif and set mac address ifconfig mtip1 down hw ether ethaddr default down mtip1 lower priority netif with same mac address ifconfig mtipO 10 1 1 190 up bring up the new DMA controller CHO network interface mtip0O lfconfig mtip1 10 1 1 191 up bring up the new DMA controller CH1 network interface mtip1 71 doy eee research OOA and development Ki NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 If you do not want to use or invoke the UIO GPIO core device driver which is used for ALL of the NetFusion user space drivers although this is not a sensible idea then you can comment out the following line with the symbol insmod lib genGPIO_UIO ko launch general GPIO UIO device driver If you wish to invoke and use the iperf styled test app for checking the throughput of the Ethernet ports device drivers and IP cores then comment back in the following line of code lusrlapp Of course this can just be called in the command line shell at any time but this will start the process at boot up time automatically If you do not want to use the demo site web server and have no HTTP access at all to the NetFusion then you can comment out the following line with the symbol busybox httpd h httpd html If you do not want to have the NetFusion polling and reading the on board temperature sensor then you can comment out the following line w
129. xPC Project linux cortexm 1 xx x projects netfusion savetftp 12 5 3 Uploading the kernel to the NetFusion To load the image directly use the netboot U boot macro M2S SOM gt setenv image netfusion uImage M2S SOM gt run netboot WEE Eet Seve mle Alva Oly aout iPad dines ke wily eller EE Filename networking uImage Loading PERETEH HRT HE AE HH HH AE AE AE FE HH PRE FE FE E AE HRT EH EE PRET ER ER REET HERE BEEF aE E AE FE FE E E AE FE FE FE HR ER FE FE FE E AE HR EH PE EEE HE RATE HERR RET HR ER RAAT ERR BEEF PREP AE FE FE HH AE FE H done Bytes transferred 2084704 1fcf60 hex Image Name DEE Image Type ARM Linux Kernel Image uncompressed Verifying Checksum OK Loading Kernel Image OK OK Starting kernel Linux version 2 6 33 arml vlad ocean emcraft com gcc version 4 4 1 Sourcery G Lite 2010q1 189 1 Fri Dec 06 15 43 44 MSK 2013 iol OC research and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 To load the image into the flash use the u boot update macro M2S SOM gt setenv image netfusion uImage M2S SOM gt run update WINE Geico Seniors hy A Si sO gike ibe ie eYelchaarsis leg Filename networking uImage Loading AEAEE dE AE AE AE AE AE AE AE HE EH EH FE AE AE FE AE HH PRET EEE HE EEE EH EH PRET HR ER RATE THERE BEEF FEAE E AE E AE FE FE FE E RE ERE AE FE REE ERE PE EEE HE RATE HER REE AE AE FE AE FE ETHER REEF
130. y G Lite 2010q1 189 1 Fri Dec 06 15 43 44 MSK 2013 To load the image into the flash use the U boot update macro M2S SOM gt setenv image netfusion ulImage M2S SOM gt run update TENER romiserve rain 2 sOg epps We ee keet als 72s LG stig EE Filename vlad networking ulImage Loading HPP PETE HH PTET HHH AE ERE HH PRE EEE HE RET EH EH HE E AE AE AE HR ERR BEE HERE AE aE EE HE AE E AE FE FE HR EH PE EEE HR AT ERE RR RE HR ER FE AE AE FE ERE BEEF FEE AE AE RET FE HERE done Bytes transferred 2084704 1fcf60 hex 16384 KiB S25FL128S 64K at 0 0 is now current device Saving Environment to SPI Flash Krasing SPh flash so Writing to SPi flash cdone M2S SOM gt 24 il OC research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 Reset the NetFusion baseboard and verify that the newly programmed image boots in the autoboot mode M2S SOM gt reset resetting Vasco ZNG Eege L250 dice WG Oils gt EES Starting kernel inlet started Busyboxw vl 17 0 Dec 0G 2013 17221230 6 7 U boot Build The BSP distribution comes with U boot pre built for the NetFusion board If however you need to re build U boot for your board please follow the instructions below e Install the uCLinux SmartFusion2 distribution to this NetFusion board e From the top of the uCLinux SmartFusion2 installation activate the uCLinux SmartFusion2 cross co
131. y used by the uCLinux Cortex M kernel build process to create a bootable U boot kernel image such as netfusion ulmage e ACTIVATE sh shell script you need to perform in order to activate the uCLinux Cortex M development environment on NetFusion 7 1 3 GNU Cross Build Tools As a next step in the uCLinux Cortex M installation procedure you need to download the GNU cross build tools for the Cortex M target The tools are available from CodeSourcery and can be downloaded from the following URL http www codesourcery com sgpp lite arm portal package6503 public arm uclinuxeabi arm 2010q1 189 arm uclinuxeabi i686 pc linux gnu tar bz2 It is recommended that you install the GNU development tools to the tools directory of the uCLinux Cortex M installation as follows psl pvr linux cortex m 1 12 0 cd tools psl pvr tools wget http www codesourcery com sgpp lite arm portal package6503 public arm uclinuxeabi arm 2010g1 189 arm ucl inuxeabi 1686 pe linux gnu tar bz2 Saving to arm 20109l lg o eim ucl 1 nukes 1 6e6 pc 1 1 nux Gnu tar bz7 psl pvr tools tar xvfj arm 2010q1 189 arm uclinuxeabi 1686 oc linux gnu tar bz2 arm 2010q1 arm uclinuxeabi arm 2010q1 arm uclinuxeabi libc It is possible to install the tools to an alternative location however should you do that you will need to modify the ACTIVATE sh script to provide a correct path to the installed tools specifically PATH must include a correc
132. ybox tool embedded from scratch If a project makes use of a custom application specific to the project such an application must be built from the sources located in an arbitrarily named sub directory local to the project directory There could be several sub directories in a project one per a custom application Each subdirectory will have its own Makefile defining rules for building the custom application from the corresponding sources Each custom application listed in CUSTOM_APPS must have a Makefile in the custom application sub directory defining the following makefile targets e all build the application from the sources e clean clean anything that has been previously built Content of the initramfs file system is defined for a project in the file named netfusion initramfs Note that this file makes use of INSTALL_ROOT to provide a reference to the top of the uCLinux Cortex M installation directory 7 2 2 Hello World Demo Project This additional directory resides in projects hello It is the only additional project other than the default main NetFusion project A single application uCLinux configuration demonstrating the minimal possible kernel initramfs memory requirements The application starts as an init process as soon as the kernel has mounted the root filesystem mounts the proc filesystem and prints out the content of oroc meminfo Then it proceeds to print a Hello message in an endless loop There is no way to in
133. ystem This has no specifically written NetFusion driver as it is statutory io eee research OOA and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 14 10 RS485 UART Connector The RS485 screw terminals provide a full duplex industrial bus system Pin 1 is indicated by the arrow with pin 6 at the other end Driver RS485 UART coreUART c Data injout through RS485 bus interface 14 11 GPIO Connector Pin 1 VCC3 These pins provide a user expansion connector for some of the dedicated signals on this PCB and also for the rest of the spare GPIO from the SOM headers Driver General I O GPIO pcf5074 c Individual spare pins and the LEDs Switches amp Jumpers 77 Jol research OOO and development NINE WAYS NetFusion Software uCLinux User Guide V1 0 August 2014 14 12 Stereo Audio Phono Jacks Line Out 4 pin 3 5mm Stereo Jack Line In 4 pin The contacts on the 3 5mm Stereo PCB are labeled in Jack The contacts the below tables on the PCB are labeled in the below tables Driver s Line OUT Stereo Audio spi_audio_line_out c Stream digital audio to analogue Line OUT audio Line IN Stereo Audio spi_audio_line_in c_ Line IN audio analogue to digital output stream 78 research and development NetFusion Software uCLinux User Guide V1 0 August 2014 14 13 NetF
Download Pdf Manuals
Related Search
Related Contents
040(a) 301060 EU Drawer Warmers.pub Installation Guide Panasonic WV-SW558 CAD File Mémorandum de l`Interfédération Switching amplifier for piezoelectric actuators Philips MZ-33 Stereo System User Manual Copyright © All rights reserved.
Failed to retrieve file