Home
Getting started with uClinux™ for STM32F10x high
Contents
1. Loading the images to the board AN3012 5 1 3 20 36 Load the hex file to the Flash memory Before loading the file move the boot jumpers to System Memory Mode then power up the board Run the Flash loader demonstrator application from the Programs menu 1 The first step consists in selecting the connection settings UART port baud rate and timeout In the second step the connection is established and communication has started This step consists in displaying the Flash memory status If this status is read protected the Next button is disabled until the read protection is removed by clicking on the Remove protection button Removing the read protection causes all the Flash memory pages to be erased At this step the Wizard displays the available device information such as the target ID the firmware version the supported device the memory map and the memory protection status Select the target from the target combobox and click on Next At this step select the Download operation and set the related parameters as shown in Figure 11 Download from file should point to the Kernel boot loader file from the STM3210E EVAL uClinux kit Depending on the board configuration selected in Section 4 3 Configure uClinux for STM3210E EVAL when booting from the STM32 s internal Flash memory you require a tiny boot loader to preserve some Flash pages for the kernel In the case when the kernel is p
2. i console parameter arm 2009q1 163 arm uclinuxeabi bin i console Doc ID 16051 Rev 2 11 36 Building the uClinux image AN3012 4 2 12 36 Preparing the source code tree Let us assume that all the downloaded files are present under the sources directory Make a new workspace directory where the build process will take place mkdir workspace 1 Extract the original uClinux distribution files make sure you have enough free space more than 2 Gbytes cd workspace tar xjvf sources uClinux dist 20080808 tar bz2 Figure 3 shows what is under the uClinux dist directory Figure 3 uClinux dist directory RD uClinux dist i 3 bin 3 config 3 Documentation 3 freeswan include E lib B linux 2 0 x pa Pa B linux 2 4 x 2 linux 2 6 x openswan tools ED uClibc user P vendors 2 Update the uClinux distribution with the uClinux dist 20080808 200901 12 patch gz patch cd workspace uClinux dist zcat sources uClinux dist 20080808 20090112 patch gz patch p1 3 Toenable support of STM32 MCUS patch the uClinux distribution with uClinux on stm32 patch gz from the STM3210E EVAL uClinux kit zcat sources uClinux on stm32 patch gz patch pl Doc ID 16051 Rev 2 ky AN3012 Building the uClinux image 4 3 Figure 4 uClinux kernel directory Sp a linux 2 6 x arch a 22 block i BD cr
3. No license express or implied by estoppel or otherwise to any intellectual property rights is granted under this document If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein UNLESS OTHERWISE SET FORTH IN ST S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION OR INFRINGEMENT OF ANY PATENT COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE ST PRODUCTS ARE NOT RECOMMENDED AUTHORIZED OR WARRANTED FOR USE IN MILITARY AIR CRAFT SPACE LIFE SAVING OR LIFE SUSTAINING APPLICATIONS NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY DEATH OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE ST PRODUCTS WHICH ARE NOT SPECIFIED AS AUTOMOTIVE GRADE MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER S OWN RISK Resale of ST products with provisions different from the statements and or technical featur
4. 9 3 2 GNUMOGIGNAIN 4a ox ide soe ORS REPRO ORA eds RR OR Ow enw Koen ares 9 3 3 DFuSe amp Flash loader demonstrator 0 000 e eee eee eee 9 3 3 1 DFuSe applet 10 3 3 2 Flash loader demonstrator 0c eee eee eee 10 4 Building the uClinux image esee 11 4 1 Installing the toolchain ie ea Lech ER Rr ERR pa CR PE 11 4 2 Preparing the source code tree 12 4 3 Configure uClinux for STM3210E EVAL 00 c eee eee 13 4 3 1 Configuring the Kernel 15 4 3 2 Application library settings 0 0000 e eee ee 17 4 4 Running the build process 18 5 Loading the images to the board 19 5 1 Loading the kernel loader software updater 19 5 1 1 Software installation 19 5 1 2 Hardware installation llli 19 5 1 3 Load the hex file to the Flash memory LL 20 5 2 Loading the kernel root file system images Less 21 5 2 1 DfuSe demonstration installation 21 5 2 2 Generating the dfu image and upgrading the board 22 6 FIFSETHD iius hse S ITUPetkkDrc em Rak rss PE RE RR EEEE x 25 7 Command examples tutorials lllsles 27 2 36 Doc ID 16051 Rev 2 ky AN3012 Contents 8 How to add new features 0 00 cee eee eee 29 8 1 How to add a new hardware driver 29 8 1 1 Helerenc S s oos eR EE d Re RE e ERA ER RR E RU 29 8 1 2 Example of a kernel dri
5. vi AN3012 Sf Application note Getting started with uClinux for STM32F 10x high density devices Introduction uClinux pronounced you see Linux literally means microcontroller uC Linux uClinux is a Linux kernel fork for microcontrollers MCUs embedded systems It does not have a memory management unit MMU Originally derived from version 2 0 1996 of the Linux kernel it now has ports based on Linux 2 6 Since version 2 6 the major parts of uClinux have been integrated with the mainline kernel for a number of processor architectures The project continues to develop patches and supporting tools to use Linux on microcontrollers uClinux supports many architectures and this new version supports the STM3210E EVAL evaluation board The purpose of this application note is to explain you how to 1 Install the uClinux operating system the toolchain and configure the kernel for the STM3210E EVAL board 2 Build a uClinux image and download it to the STM3210E EVAL board 3 Add applications to the kernel September 2009 Doc ID 16051 Rev 2 1 36 www st com Contents AN3012 Contents 1 Package description eee eee eens 6 2 Hardware description 00 ccc eee eee 7 3 Getting the toolS aca ss oe eh E raa de deen gn eae Nee weed ees 9 3 1 uClinux PACKAGE sic eb ee ieee SHES SR ESSENCES eR EER REESE 9 3 1 1 Standard distribution o 9 3 1 2 STM3210E EVAL uClinux software kit
6. Click on OK to validate Figure 13 Multi Bin injection window STM3210E EVAL MCU Flash configuration W Multi Bin injection ioj xj File C Workspacetimages xiplmage bin n Address Ox 06003000 Add to list gt gt Delete Ox08003000 0 080772FF C Workspace images xiplmage bin Ej OK Cancel 4 To create the DFU file click on Generate How to download a DFU file Run the DfuSe demonstration application Start gt All Programs gt STMicroelectronics gt DfuSe gt DfuSe Demonstration 1 Click on the Choose button to select the previously generated DFU file The displayed Information such as VID PID Version and target number is read from the DFU file 2 Choose NOR Flash or internal Flash in the Select target s area 3 Checkthe Verify after download checkbox if you want to launch the verification process after downloading data this step is optional 4 Click on the Upgrade button to start upgrading the file content to the memory 5 Wait until the end of the upgrade process Doc ID 16051 Rev 2 23 36 Loading the images to the board AN3012 24 36 Figure 14 DfuSe demonstration window DfuSe Demo 2 2 1 zm Ente DEO maede HID detach Target 02 Upgrading Download Phase 596 Doc ID 16051 Rev 2 ky AN3012 First run 6 First run After completing the previous steps you should be able to boot up u
7. count switch uvalue case value case T value default value gpio_get_value gpio break gpio get output value gpio break uvalue 0 break on Wu e switch dir case gpio direction input gpio value break case 0 gpio direction output gpio value break if uvalue gpio set value gpio value return ret Conclusion An easy way of developing new device drivers is to avoid starting from scratch when possible and to try and find some similar drivers in linux 2 6 x drivers so that you can port them Doc ID 16051 Rev 2 33 36 How to add new features AN3012 8 2 34 36 How to add a new application To add a new application to the uClinux image 1 Create a new folder named myprog in the uClinux dist user directory for your application files Put your source and header files c h in the new directory uClinux dist user myprog Create a new Makefile for your application like the one shown below OBJS file1 o file2 0 PROG myexec all PROG PROG OBJS CC LDFLAGS o 9 OBJS LDLIBS romfs ROMFSINST bin PROG clean rm f PROG gdb o Add a block to uClinux dist user Kconfig under the STM3210E EVAL Demo s menu as shown below menu Miscellaneous Applications menu STM3210E EVAL Demo s config USER_myprog bool my new application help this is how to add
8. following processes to build the kernel image e f you chose the STM3210E EVAL jffs configuration Simply type the make command and wait the end of the build process At this step the kernel and the selected application are built After this operation the xip mage bin rootfs img bin and logo bin files are generated and copied to the uClinux dist images folder e f you chose the STM3210E EVAL MCU_Flash configuration To build the minimal image proceed as follows a Run the make ucfront command to prepare tools to build user applications b Run the make user_only command to prepare user applications c Run the make romfs command to build the initramfs folder tree d Run the make image command to copy the kernel image to the uClinux dist images folder At the end of this step a single xip mage bin file is generated Whatever the configuration you used STM3210E EVAL jffs or STM3210E EVAL MCU Flash now all you need to do is copy the generated image s and jump to the next step Loading the images to the board Doc ID 16051 Rev 2 ky AN3012 Loading the images to the board 5 5 1 Loading the images to the board Loading the kernel loader software updater On a host PC running with a recent version of Microsoft Windows you need to verify that you have an available COM port to communicate with the board To check that you have an available communication po
9. needed functions you have to call the e uart register driver to bind the low level driver with the SERIAL CORE e uart add one port that lets the TTY layer know that a new device has been added These two functions can be called from the module Init function e register console to insert the console in the list of active consoles It can be exported with the console initcall macro to be called during the initial stage of the kernel startup Figure 22 STM3210E EVAL console Init function static int init stm3210e eval console init void t register console amp stm3210e eval console i return 0 console_initcall stm3210e_eval_console_init Doc ID 16051 Rev 2 31 36 How to add new features AN3012 The following configuration lines should now be added to the drivers serial Kconfig file to enable the driver selection from the kernel configuration menu config SERIAL_STM3210E_EVAL_USART bool STM3210E EVAL USART port depends on CONFIG_ARCH_STM3210E_EVAL select SERIAL_CORE help This selects the STM3210E EVAL USART port support config SERIAL STM3210E EVAL CONSOLE bool Support for console on STM3210E EVAL USART port depends on SERIAL STM3210E EVAL USART y select SERIAL CORE CONSOLE help This selects the console support on STM3210E EVAL USART port Finally you need to add the following line to the drivers serial Makefile file to ensure that the driver will be compiled when se
10. scratch to successfully build the uClinux image you have to Install GNU toolchain extract the uClinux source files apply the path to the source configure uClinux for the STM3210E EVAL board and finally run the build process Installing the toolchain On a host PC running with the Linux OS 1 2 3 Move to the directory containing the previously downloaded arm 2009q1 163 arm uclinuxeabi bin file Execute the installer by double clicking on the bin file or from the command line by typing arm 2009q1 163 arm uclinuxeabi bin Follow the installer Wizard to install the typical toolchain settings Figure 2 Configuring the installation parameters di Sourcery G Lite for ARM GNU Linux Add product to the PATH welcome The Wizard can add Sourcery G Lite for ARM GNU Linux to d Important Information the PATH environment variable This will make it easier to use Choose install set Sourcery G Lite for ARM GNU Linux and will mean less o E configuration for other tools d Choose Install Folder WARNING Without this change some tools may not function gt Add to PATH Note Read only environment files will not be changed Do not modify PATH O Modify PATH for current user O e CODESOURCERY InstallAnywhere by Macrovision Se ATA Cancel Previous Next When no windowing server is running you can use the console installation mode which is enabled with the
11. Clinux on your board e Connect the board s USARTI to the PC COM port e Open a serial terminal on you PC e g MS HyperTherminal and configure it as shown in Figure 15 Bits per second 19200 Data bits 8 Parity None Stop bits 1 Flow control none e Reset the board You should then be able to see the boot log see Figure 16 and finally the shell prompt Figure 15 Example of MS HyperTherminal COM1 Properties Port Settings Bits per second Data bits Parity Stop bits Flow control Restore Defaults Doc ID 16051 Rev 2 25 36 First run AN3012 26 36 Figure 16 uClinux boot log platform Initialisation finished jumping to kernel Linux version 2 6 26 uc0 stm32 localhost localdomain gcc version 4 3 3 Sourcery G Lite 2009q1 163 1 Fri Jul 3 11 17 34 UTC 2009 CPU ARMv7 M Processor 411fc231 revision 1 ARMv 11 M Machine STM3210E EVAL SRAM Config bank 0 0x68000000 size 1024KB bank 1 0x20000000 size 64KB Built 1 zonelists in Zone order mobility grouping off Total pages 254 Kernel command line noinitrd root mtdl ro rootfstype jffs2 init linuxrc console ttyS0 PID hash table entries 16 order 4 64 bytes console ttyS0 enabled Dentry cache hash table entries 1024 order 0 4096 bytes Inode cache hash table entries 1024 order 0 4096 bytes Memory 1MB OMB 1MB total Memory 980KB available 436K code 55K data 8K
12. Clinux package Standard distribution You should first download the original uClinux source files from the uClinux project page http www uclinux org or simply follow the following direct link http www uclinux org pub uClinux dist uClinux dist 20080808 tar bz2 To get the uClinux dist 20080808 tar bz2 file 281Mbytes which is compatible with the STM3210E EVAL uClinux kit Porting is based on the latest stable version of uClinux which implements the Linux kernel 2 6 26 ucO You also need the uClinux distribution update patch file uClinux dist 20080808 200901 12 patch gz 47 1 Mbytes available from http www uclinux org pub uClinux dist patches uClinux dist 20080808 200901 12 patch gz STM3210E EVAL uClinux software kit This package contains the kernel patch update of 399 files and the kernel boot loader see Section 1 Package description The package is available from http Avww st com stm32 GNU toolchain A toolchain known to successfully build the kernel for ARM Cortex M3 targets can be downloaded from the CodeSourcery web site http www codesourcery com or using the following link http Avww codesourcery com sgpp lite arm portal release827 The G Lite 2009q1 toolchain is a free version of the CodeSourcery G toolchain which is an improvement of the GNU toolchain for ARM processors It supports ARM thumb and thumb 2 compilation for all architectures including Version 7 of the ARM Architecture This applicatio
13. a new application Add a line to uClinux dist user Makefile which adds myprog to the list of directories to be built dir_ CONFIG_USER_myprog myprog To build your application and to add it to the rootfs root file system image run the following commands make user_only make romfs make image Doc ID 16051 Rev 2 ky AN3012 Revision history 9 Revision history Table 1 Document revision history Date Revision Changes 15 Sep 2009 1 Initial release Section 3 3 1 DFuSe applet updated Addresses corrected in DFU file manager 29 Sep 2009 2 Figure 12 Multi Bin injection window STM3210E EVAL jffs configuration modified Bits per second modified in Section 6 First run Doc ID 16051 Rev 2 35 36 AN3012 Please Read Carefully Information in this document is provided solely in connection with ST products STMicroelectronics NV and its subsidiaries ST reserve the right to make changes corrections modifications or improvements to this document and the products and services described herein at any time without notice All ST products are sold pursuant to ST s terms and conditions of sale Purchasers are solely responsible for the choice selection and use of the ST products and services described herein and ST assumes no liability whatsoever relating to the choice selection or use of the ST products and services described herein
14. art_port struct LL 30 STM3210E EVAL uart_ops struct 30 STM3210E EVAL console struct 31 STM3210E EVAL console Init function LL 31 Simple GPIO file operations struct LL 32 Simple GPIO write operation liiielessleeeeee 33 Doc ID 16051 Rev 2 5 36 Package description AN3012 6 36 Package description This section presents all the files in the package that are needed to get started with uClinux on STM32F101xC D E and STM32F103xC D E devices uClinux_on_stm32 patch gz the uClinux patch using which the ARM Cortex M3 CPU and STM3210E EVAL board are supported AN3012 pdf the purpose of this guide is to show all the steps necessary to successfully configure build and run uClinux on the board It also presents the procedure to add new hardware driver and applications to the kernel Tiny kernel boot loader hex kernel_boot_loader hex these are the boot loaders required to boot up the board and load uClinux kernel loader firmware updater uClinux on stm32 jffs dfu uClinux on stm32 MCU Flash dfu these are the binary image files that can immediately be downloaded to the board to get uClinux running Doc ID 16051 Rev 2 ky AN3012 Hardware description 2 Hardware description The STM3210E EVAL evaluation board is designed as a complete development platform for STMicroelectronics s ARM Cortex M3 core based STM32F103xx microcontrollers delivered in 144 pin packages This device features
15. box If you chose the STM3210E EVAL jffs configuration in Section 4 3 Configure uClinux for STM3210E EVAL you have to Set the start address in the Address field to 6400 0000 Click the Browse button to select the xip mage bin file at C Workspace lmages xipI mage bin Click on the Add to list button to add the selected binary file at the given address Redo the same sequence to add C Workspace lmages rootfs img bin at address 6410 0000 and C Workspace lmages logo bin at address 6416 0000 Click on OK to validate Figure 12 Multi Bin injection window STM3210E EVAL jffs configuration KK Multi Bin injection lOl x File C Workspace images logo bin m Address Ox en 60000 Add to list gt gt Delete D 54000000 0 5407BAB57 C Workspace images xiplmage bin 0x64100000 0x641538B7 C Workspace images rootts img bin 0x64160000 0x64185841 C Workspace images logo bin 2 OK Cancel Doc ID 16051 Rev 2 ky AN3012 Loading the images to the board If you chose the STM3210E EVAL MCU_ Flash configuration in Section 4 3 Configure uClinux for STM3210E EVAL you have to Set the start address in the Address field to 0800 3000 Click the Browse button to select the xip mage bin file at C Workspace Images xipImage bin Click on the Add to list button to add the selected binary file at the given address
16. es set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever any liability of ST ST and the ST logo are trademarks or registered trademarks of ST in various countries Information in this document supersedes and replaces all information previously supplied The ST logo is a registered trademark of STMicroelectronics All other names are the property of their respective owners 2009 STMicroelectronics All rights reserved STMicroelectronics group of companies Australia Belgium Brazil Canada China Czech Republic Finland France Germany Hong Kong India Israel Italy Japan Malaysia Malta Morocco Philippines Singapore Spain Sweden Switzerland United Kingdom United States of America www st com 36 36 Doc ID 16051 Rev 2 ky
17. et mctrl Stop_tx Start_tx Stop rx enable ms break ctl startup shutdown set_termios type release_port request port config port verify port stm3210e eval tx empty stm3210e eval set mctrl stm3210e eval get mctrl stm3210e eval stop tx stm3210e eval start tx stm3210e eval stop rx stm3210e eval enable ms stm3210e eval break ctl stm3210e eval startup stm3210e eval shutdown stm3210e eval set termios stm3210e eval type stm3210e eval release port stm3210e eval request port stm3210e eval config port stm3210e eval verify port 30 36 Doc ID 16051 Rev 2 AN3012 How to add new features Note 1 All these structures are declared and well commented in include linux serial_core h e struct console in order to implement console support over the serial port you have to fill this struct with the necessary data like the name the write function used to print the kernel message various console flags etc Figure 21 STM3210E EVAL console struct static struct console stm3210e_eval_console name STM32_USART_NAME write stm3210e eval console write device uart console device setup stm3210e eval console setup flags CON PRINTBUFFER index 1 pecified on the cmdl le data amp stm3210e eval uart driver T See the include linux console h header file for more details Once you have implemented all the
18. etermine which file system will be supported according to your product memory size For example if you need the jffs2 file system you have to enable it In the case of the STM3210E EVAL jffs configuration this file system is mandatory because it is used as the root file system Under the File systems gt Miscellaneous File system submenu toggle JFFS2 fs with fs standing for file system Journalling Flash File System v2 JFFS2 support Doc ID 16051 Rev 2 ky AN3012 Building the uClinux image 4 3 2 Application library settings In this menu leave the vendor default settings In Miscellaneous Applications gt STM3210E EVAL Demo s you will find a few applications examples exploiting the STM32 hardware and the uClinux features and drivers Applications under development will also appear there Figure 9 STM3210 EVAL demonstration menu 1 If you use the STM3210E EVAL MCU_ Flash configuration the Show Logo application will not be selected because the LCD is not initialized during the boot process hardware initialization When exiting the configuration menu save the settings Doc ID 16051 Rev 2 17 36 Building the uClinux image AN3012 4 4 18 36 Running the build process You are now ready to start building the uClinux system Depending on the previously selected configuration STM3210E EVAL jffs or STM3210E EVAL MCU_Flash you will use one of the two
19. full soeed USB2 0 CAN2 0A B compliant interface two 17S channels two I C channels five USART channels with Smartcard support three SPI channels two DAC channels FSMC interface SDIO 64 Kbyte of internal SRAM and 512 Kbyte of Flash memory JTAG and SWD debug support The STM3210E EVAL has the following onboard hardware features Three 5 V power supply options power jack USB connector or daughterboard Boot from user Flash memory system memory or SRAM 12S audio DAC stereo audio jack 128 Mbyte MicroSD card A and B type Smartcard support 64 or 128 Mbit serial Flash memory 512 Kbit x 16 SRAM 512 Mbit or 1 Gbit NAND Flash and 128 Mbit NOR Flash memory I2C SMBus compatible serial interface temperature sensor Two RS 232 channels with RTS CTS handshake support on one channel IrDA transceiver USB2 0 full speed connection CAN2 0A B compliant connection Inductor motor control connector JTAG and trace debug support 240 x 320 TFT color LCD Joystick with 4 direction control and selector Reset wakeup tamper and user buttons 4 color LEDs RTC with backup battery Doc ID 16051 Rev 2 7 36 Hardware description AN3012 8 36 Figure 1 STM3210E EVAL board Doc ID 16051 Rev 2 ky AN3012 Getting the tools 3 3 1 3 2 Note 3 3 Getting the tools This section explains how to get the software tools that are required to build and run uClinux on the STM3210E EVAL evaluation board u
20. he microcontroller s internal Flash memory Figure 6 Vendor amp Product selection B Select the Vendor you wish to target V S Return to the main menu with the Exit button or the ESC key 14 36 Doc ID 16051 Rev 2 y AN3012 Building the uClinux image Under the Kernel Library Defaults Selection menu choose Linux 2 6 x for the kernel version and none for the libc version and toggle the next three menus as shown in Figure 7 e Default all settings will apply the default vendor product configuration to the kernel and application e Customize Kernel Settings is used to edit the kernel configuration e Customize Application Library Settings is used to choose the application that will be add to the root file system e Finally Update Default Vendor Settings is used to save the new configuration as the vendor default configuration for future use Figure 7 Kernel Library Defaults selection ustomize Application Library Settings E You can now exit the configuration menu When prompted to save choose yes 4 3 1 Configuring the kernel The Linux kernel has many configuration items If you have followed the above described steps the kernel should be configured to meet the STM3210E EVAL evaluation board specifications Let us now look into some of the main configuration menus e The System Ty
21. init Mount cache hash table entries 512 JFFS2 version 2 2 2001 2006 Red Hat Inc simple gpio now handling 16 GPIOs 0 15 ttyS0 at MMIO 0x40013800 irg 37 is a STM32 USART1 Port Probed and found the STM3210E EVAL NOR flash chip Creating 4 MTD partitions on M29W128F NOR FLASH 0x00000000 0x00100000 Kernel raw data 0x00100000 0x00160000 rootfs 0x00160000 0x00190000 rawdata 0x00190000 0x001c0000 cramfs_partition stm3210e_eval as rtc0 rtc stm3210e eval rtc stm3210e eval 0 setting system clock to 2009 07 03 12 00 26 VFS Mounted root jffs2 filesystem readonly Freeing init memory 8K Mounting proc fs Mounting sysfs Welcome to a Xd do x Ae JT CN NAN For further information check http www uclinux org http www st com stm32 rtc stm3210e_eval rtc stm3210e_eval 0 rtc core registered rtc Doc ID 16051 Rev 2 2 AN3012 Command examples tutorials 7 Command examples tutorials 1 Is 1 drwxr xr x 2 0 0 0 Jul 3 2009 bin drwxr xr x 2 0 0 0 Jul 3 2009 dev drwxr xr x 2 0 0 0 Jul 3 2009 etc drwxr xr x 2 0 0 0 Jul 3 2009 home drwxr xr x 2 0 0 0 Jul 3 2009 lib rWXr xr x 10 0 153 Jul 3 2009 linuxrc drwxr xr x 2 0 0 0 Jul 3 2009 mnt dr xr xr x 19 0 0 0 Jan 970 proc drwxr xr x 2 0 0 0 Jul 3 2009 root drwxr xr x 2 0 0 0 Jul 3 2009 sbin drw
22. laced in an external Flash memory you can use a standard boot loader Use Tiny_kernel_boot_loader hex lt 12 Kbytes when booting from the STM32 s Flash memory with the STM3210E EVAL MCU_ Flash configuration Use Kernel boot loader hex when booting from the NOR Flash memory with the STM3210E EVAL jffs configuration Doc ID 16051 Rev 2 ky AN3012 Loading the images to the board Note 5 2 5 2 1 Figure 11 Flash loader demonstrator download configuration 4 Flash loader demonstrator 2 0 0 lol x STMicroelectronics Kyy C Erase e All Selection Download to device Download from file c Workspace Kernel_boot_loader kernel_boot_loader hex E Erase necessary pages Erase all pages faster thi 8000000 z Jump to the user program Optimize Remove some FFs MW Verify after download Apply option bytes Eg C Upload from device IE to file E C Enable Disable Flash protection ENABLE z WRITE PROTECTION m C Edit option bytes Next Cancel Finish 5 The last Wizard page shows the operation page It gives the size of the data to be downloaded the percent completed and the duration of the operation If an error message appears you can consult the Flash Loader demonstrator user manual available from the Programs menu Loading the kernel root file system images Move the boot jumpers to select the User Flash b
23. lected from the kernel configuration menu obj CONFIG SERIAL STM3210E EVAL USART stm32_usart o Simple GPIO driver This is another example of a character char device driver It differs from the serial driver because it directly implements system calls on the device node e g open read write and SO on The major struct is the file operations data structure used to link the device node major minor numbers to the driver Each field in the structure points to a function in the driver that implements a specific operation Figure 23 Simple GPIO file operations struct static struct file operations simple gpio fops Owner THIS_MODULE read simple_gpio_read write simple gpio write open simple_gpio_open release simple_gpio_release ioctl simple gpio ioctl An example of implementation is the write operation It consists in identifying the pin on which the changes will take effect via the device node minor number then in parsing the buffer sent by the user application and in applying the result to the hardware 32 36 Doc ID 16051 Rev 2 ky AN3012 How to add new features 4 Figure 24 Simple GPIO write operation static ssize_t bimple_gpio_write struct file file const char _user buf size t count loff t pos unsigned int gpio iminor file gt f_path dentry gt d_inode ssize_t ret char dir uvalue int value ret 0 while ret lt
24. n note only shows how to Install the easy to install recommended packages You need a PC running on the Linux operating system to be able to install and compile uClinux The Linux distribution Fedora Mandriva Ubuntu etc should have the kernel development kit DFuSe amp Flash loader demonstrator These two tools are needed to load the final binary images to the board Doc ID 16051 Rev 2 9 36 Getting the tools AN3012 3 3 1 3 3 2 Note 10 36 DFuSe applet DFuSe stands for Device firmware upgrade application This applet coupled to the kernel boot loader firmware allows the upgrade of the final dfu file to the on board Flash memory It can be downloaded from the STMicroelectronics website or directly using the following link http www st com stonline products support micro files um04 12 zip Flash loader demonstrator This applet together with the System memory boot loader capabilities is used to upgrade kernel_boot_loader hex to the STM32F101 103xC D E s 512 Kbyte internal Flash memory The Flash loader demonstrator is available from st com at http www st com stonline products support micro files um0462 zip You need a PC running on the Microsoft Windows operating system to be able to run and use these two applets Doc ID 16051 Rev 2 ky AN3012 Building the uClinux image 4 4 1 Note Building the uClinux image This section shows the kernel building process from
25. o add new features 8 8 1 How to add new features How to add a new hardware driver The kernel device driver is the software support which allows the application to interact with the hardware via the kernel system call interface It implements the what capabilities are to be provided mechanism and the how these capabilities can be used policy while respecting higher layer specifications Figure 17 Linux device driver architecture Applications System call layer FileSystem Device drivers Hardware ai17173 References e A typical book is the third edition of Linux Device Drivers http wn net Kernel LDD3 e Also refer to the uClinux dist linux 2 6 x Documentation and uClinux dist linux 2 6 x Documentation driver model folders Example of a kernel driver The purpose of this section is to present Linux device drivers and to give two examples of drivers the STM3210E EVAL evaluation board s USART driver and the GPIO port driver USART driver This section gives an overview of UART drivers First you must know that serial drivers are not accessed directly by applications but through a software stack which exports the whole functionality of the driver TTY Layer You should therefore implement all the APIs needed by the higher layer and register the driver The main structures needed for this purpose are e struct uart dri
26. oot mode set the JP14 board jumper to connected mode and reset the board DfuSe demonstration installation Software Installation Run the DfuSe Demo VX Y Z Setup exe file the InstallShield Wizard will guide you to install DfuSe applications and source code on your computer When the software is successfully installed click on the Finish button You can then explore the driver directory The driver files are in the Driver folder located at your install path C Program files STMicroelectronics DfuSe Doc ID 16051 Rev 2 21 36 Loading the images to the board AN3012 5 2 2 22 36 Hardware installation e Connect the device to a spare USB port on your PC e The Found New Hardware Wizard then starts Follow the wizard to install the new hardware driver available in the Driver folder at your install path Generating the dfu image and upgrading the board Let us assume that the files generated from Running the build process have been copied to a local folder on the MS Windows host e g C Workspace lmages DFU file manager Start the DFU file manager application Start gt All Programs gt STMicroelectronics gt DfuSe gt DFU File Manager select i want to GENERATE a DFU file from S19 HEX or BIN files then click on OK 1 Set an unused Target ID number 2 Fill the VID PID Version and target name fields 3 Click on the Multi Bin button to show the Multi Bin Injection dialog
27. pe menu see Figure 8 shows the MMU setting ARM System type processor type Flash and SRAM settings All these options should coincide with the board specifications ky Doc ID 16051 Rev 2 15 36 Building the uClinux image AN3012 16 36 Figure 8 System Type configuration MMU based Paged Memory Management Support The boot options menu is used to enable the XIP execute in place mode and set the physical location of the kernel xiplmage You can also specify the default kernel command line The XIP Kernel Physical Location parameter points to the Flash memory address where the kernel image is located For example if STM3210E EVAL jffs was selected the kernel binary will be written to the external Flash memory address 0x6400 0000 set in the configuration menu as described in Section 5 2 2 Generating the dfu image and upgrading the board If STM3210E EVAL MCU_ Flash was chosen the XIP setting will point to 0x0800 3000 Kernel Execute In Place from ROM 0x6400 0000 XIP Kernel Physical Location or 0x0800 3000 XIP Kernel Physical Location For console input output enter Device Drivers gt Character Device gt Serial Drivers Set the two following options STM3210E EVAL USART Port Support for console on STM3210E EVAL USART Port Many file systems are supported by the uClinux kernel and can be enabled from the File systems menu You can d
28. rt right click on the My Computer icon on the desktop and select Properties from the pop up menu The System Properties dialog box appears Click on the Hardware tab and then on the Device manager button to display the system hardware configuration Available COM ports are grouped under the Ports COM amp LPT node in the hardware tree as shown in Figure 10 Figure 10 Device Manager window Sm File Action View Help 9 4 2 4 Computer S Disk drives 3 Display adapters 4 DVD CD ROM drives Floppy disk controllers IDE ATAJATAPI controllers u Keyboards Mice and other pointing devices Monitors BB Network adapters PF Ports COM amp LPT Communications Port COM1 F ECP Printer Port LPT1 SM Processors Sound video and game controllers Se Storage volumes System devices Universal Serial Bus controllers 3 RIDE REDI RT RT RT 8T Ae Cd baad Oo bed ee ERES E Software installation Run the Flash Loader Demonstrator VX Y Setup exe file the InstallShield Wizard will guide you through the installation of the Flash loader demonstrator application on your computer Once the software has been successfully installed click on the Finish button Hardware installation Connect the device to a spare COM port on your PC Doc ID 16051 Rev 2 19 36
29. ver 29 8 2 How to add a new application 34 9 Revision history uude in depp ewer C rau RR RR RR RR a c cn 35 ky Doc ID 16051 Rev 2 3 36 List of tables AN3012 List of tables Table 1 Document revision history LL 35 4 36 Doc ID 16051 Rev 2 ky AN3012 List of figures List of figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 Figure 9 Figure 10 Figure 11 Figure 12 Figure 13 Figure 14 Figure 15 Figure 16 Figure 17 Figure 18 Figure 19 Figure 20 Figure 21 Figure 22 Figure 23 Figure 24 STM3210E EVAL board 8 Configuring the installation parameters 11 uClinux dist directory 0 0 0 0 liess mr 12 uClinux kernel directory llle rr 13 uClinux configuration main MENU 2 6 rn 14 Vendor amp Product selection o 14 Kernel Library Defaults selection LL 15 System Type configuration 16 STM3210 EVAL demonstration menu LL 17 Device Manager Window LL 19 Flash loader demonstrator download configuration LL 21 Multi Bin injection window STM3210E EVAL jffs configuration 22 Multi Bin injection window STM3210E EVAL MCU Flash configuration 23 DfuSe demonstration WINDOW LL 24 Example of MS HyperTherminal 0 0000 c cece eee 25 uClinux boot log LL 26 Linux device driver architecture 0 0 00 ee eae 29 STM3210E EVAL uart_driver Struct i 30 STM3210E EVAL u
30. ver in this data struct you need to fill the name major minor numbers and the number of UARTS supported by the driver The console file is only needed when you enable console Input Output over the serial port Doc ID 16051 Rev 2 29 36 How to add new features AN3012 Figure 18 STM3210E EVAL uart_driver struct static struct uart_driver owner driver_name dev_name major minor ifdef CO endif H nr cons NFIG SERIAL STM32 amp stm3210e eval console stm3210e eval uart driver THIS MODULE STM32 USART DRIVER STM32 USART NAME STM32 USART MAJOR STM32 USART MINOR STM32 NR USARTS 10E EVAL CONSOLE struct uart port this struct exports the low level configuration data of the hardware like the memory base IRQ number I O type etc Figure 19 STM3210E EVAL uart_port struct static struct uart_port stm3210e eval usartl port membase u8 USARTI1 iotype SERIAL IO MEM irq USART1_IRQn fifosize 0 flags UPF_BOOT_AUTOCONF line 0 b ops amp stm3210e eval ops struct uart ops the information stored in this data struct allows the higher layer to interact with the hardware Most of the functions exported by this data struct are hardware dependent and should take care of hardware requirements Figure 20 STM3210E EVAL uart ops struct static struct uart ops stm3210e eval ops tx empty set mctrl g
31. xr xr x 9 0 0 0 Jan 970 sys drwxr xr x 3 0 0 O Jul 3 2009 usr 2 cat proc meminfo MemTotal 988 kB MemFree 272 kB Buffers 0 kB Cached 128 kB SwapCached 0 kB Active 104 kB Inactive 8 kB SwapTotal 0 kB SwapFree 0 kB Dirty 0 kB Writeback 0 kB AnonPages 0 kB Mapped 0 kB Slab 0 kB SReclaimable 0 kB SUnreclaim 0 kB PageTables 0 kB NFS Unstable 0 kB Bounce 0 kB WritebackTmp 0 kB CommitLimit 492 kB Committed_AS 0 kB VmallocTotal 0 kB VmallocUsed 0 kB VmallocChunk 0 kB ki Doc ID 16051 Rev 2 27 36 Command examples tutorials AN3012 28 36 G ui E VSZ 148 0 o ooo o oo 0 32 132 Ov Ui 0oOSJAUDLWNE usd n o o oooooooooo 4 kill ALRM 15 Pause signal received kill ALRM 15 STAT COMMAND R SW SWN SW SW SW SW SW SW S R Resume signal received Using the Linux signal resumes the animation bin sh kthreadd ksoftirqd 0 events 0 khelper pdflush pdflush kswapd0 aio 0 Led_Show ps to interact with process 15 pauses and 5 kill TERM 15 Ends the task with PID 15 Led Show application ps PID USER VSZ STAT COMMAND 10 172 S bin sh 2 0 0 SW kthreadd 3 0 0 SWN ksoftirqd 0 4 0 0 SW events 0 50 0 SW khelper 6 0 0 SW pdflush 7 0 0 SW pdflush 8 0 0 SW kswapd0 9 0 0 SW aio 0 18 0 132 R ps Doc ID 16051 Rev 2 2 AN3012 How t
32. ypto PB Documentation drivers ifs include init ip kernel lib imm n WU L2 net samples scripts j 9 security j 3 sound j usr i P3 virt Configure uClinux for STM3210E EVAL Now that you have enabled support of the STM3210E EVAL evaluation board by uClinux you need to set up the configuration for the kernel and the final application Many types of kernel binary images can be built depending on how you configure uClinux In this section you will see how to configure the uClinux kernel to run from the STM32 s internal Flash memory or the external NOR Flash memory make menuconfig From the main menu select the vendor product as shown in Figure 5 Doc ID 16051 Rev 2 13 36 Building the uClinux image AN3012 Figure 5 uClinux configuration main menu v wClinux Distribution Configuration Vendor Product Selection gt K L S mSS lt Select gt L Select STMicroelectronics for Vendor and depending on the type of kernel image you want to build select STM3210E EVAL jffs or STM3210E EVAL MCU_ Flash for Product By selecting STM3210E EVAL jffs you apply the default configuration that enables support of an external Flash memory and boot from it If you choose the STM3210E EVAL MCU_Flash configuration the compilation script will build a mini image that runs from t
Download Pdf Manuals
Related Search
Related Contents
マイティーバック 取扱説明書 ABI PRISM SNaPshot™ Multiplex Kit Elgato Game Capture HD TP 4 : Ondes périodiques - Correction La longueur d`onde λ est la 37029320-lave botte Manual del usuario Térmo-Anemómetro PCM/MCM Allied Telesis 10/100/100T x 24 ports GE L3 Switch w/ 4 combo SFP exp. slots Thuin 52/1-2 - Portail environnement de Wallonie Panasonic Toughpad FZ-A1 16GB 3G Silver Copyright © All rights reserved.
Failed to retrieve file