{"id":253,"date":"2013-03-12T19:47:02","date_gmt":"2013-03-12T23:47:02","guid":{"rendered":"http:\/\/www.the-greathouses.net\/blog\/?p=253"},"modified":"2014-01-12T10:10:16","modified_gmt":"2014-01-12T15:10:16","slug":"pcduino-u-boot-part-1","status":"publish","type":"post","link":"https:\/\/www.the-greathouses.net\/blog\/2013\/03\/pcduino-u-boot-part-1\/","title":{"rendered":"pcDuino U-Boot &#8211; Part 1"},"content":{"rendered":"<p>This evening I decided it was time to check out the boot loader and boot command options on the pcDuino. To access the serial port on the J5 debug port I used a <a href=\"https:\/\/www.sparkfun.com\/products\/9873\" target=\"_blank\">Sparkfun FTDI Basic Breakout-3.3v<\/a> &#8212; a simple to use logic level serial to USB interface. With the power off and the FTDI Basic disconnected from the computer, I connected the serial lines and ground.<br \/>\n<a href=\"https:\/\/www.the-greathouses.net\/blog\/wp-content\/2013\/03\/DebugHookup.jpg\"><img decoding=\"async\" src=\"https:\/\/www.the-greathouses.net\/blog\/wp-content\/2013\/03\/DebugHookup-300x225.jpg\" alt=\"DebugHookup\" width=\"500\" class=\"alignnone size-medium wp-image-266\" srcset=\"https:\/\/www.the-greathouses.net\/blog\/wp-content\/2013\/03\/DebugHookup-300x225.jpg 300w, https:\/\/www.the-greathouses.net\/blog\/wp-content\/2013\/03\/DebugHookup-1024x768.jpg 1024w, https:\/\/www.the-greathouses.net\/blog\/wp-content\/2013\/03\/DebugHookup.jpg 1280w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n<!--more--><\/p>\n<h6>Connections<\/h6>\n<table>\n<tr>\n<td><strong>pcDuiono J5 Pin<\/strong><\/td>\n<td><strong>FTDI Basic<\/strong><\/td>\n<td><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td>1 &#8211; RX<\/td>\n<td>3 &#8211; TXO<\/td>\n<td>pcDuino to FTDI serial data<\/td>\n<\/tr>\n<tr>\n<td>2 &#8211; GND<\/td>\n<td>6 &#8211; GND<\/td>\n<td>common signal reference<\/td>\n<\/tr>\n<tr>\n<td>3 &#8211; TX<\/td>\n<td>2 &#8211; RXI<\/td>\n<td>FTDI to pcDuino serial data<\/td>\n<\/tr>\n<\/table>\n<p>After double checking the connections, I plugged the FTDI Basic into my Windows laptop computer. After confirming the port assignment, I used <a href=\"http:\/\/en.sourceforge.jp\/projects\/ttssh2\/\" target=\"_blank\">TeraTerm<\/a> to open the serial port on my computer. The serial communication configuration needed to be set for 115200 Baud, 8-bit, No parity, 1 stop bit, no flow control, and the serial port assigned by Windows to the FTDI Basic.<\/p>\n<h6>Power On and Boot<\/h6>\n<p>After applying power to the pcDuino, the bootloader (<a href=\"http:\/\/www.denx.de\/wiki\/U-Boot\/\" title=\"Das U-Boot -- the Universal Boot Loader\" target=\"_blank\">U-Boot<\/a>) startup sequence showed in the terminal window, followed by the familiar Linux boot messages as the kernel was loaded and Linux started. Surprisingly, at the end of the Linux boot, I was presented with a <strong><em>root<\/em><\/strong> prompt. Instead of presenting a login prompt, the debug port goes directly to a root shell. This I will need to change!<\/p>\n<pre class=\"theme:terminal striped:false marking:false nums:false nums-toggle:false wrap-toggle:false plain:false plain-toggle:false lang:default decode:true \" title=\"Debug Port Linux Boot\" >[   12.776652] Freeing init memory: 5108K\r\n\/dev\/nandd\r\ne2fsck 1.42.7 (21-Jan-2013)\r\n\/dev\/nandd: clean, 60026\/96000 files, 314839\/384000 blocks\r\n[   12.837041] EXT3-fs (nandd): using internal journal\r\n[   12.842051] kjournald starting.  Commit interval 5 seconds\r\n[   12.847559] EXT3-fs (nandd): mounted filesystem with ordered data mode\r\n[   13.098102] set to DVI mode\r\n[   13.101848] get_hdmi_mode == DVI\r\n[   13.140992] hostname used greatest stack depth: 5648 bytes left\r\n[   13.200950] hwclock used greatest stack depth: 5592 bytes left\r\n[   13.253305] plymouthd used greatest stack depth: 5208 bytes left\r\n[   13.262105] init: ureadahead main process (71) terminated with status 5\r\n[   13.685501] df used greatest stack depth: 5168 bytes left\r\n[   13.708732] grep used greatest stack depth: 4960 bytes left\r\n\r\n * Starting NTP server ntpd                                                     Welcome to Linaro 12.11 (GNU\/Linux 3.0.8+ armv7l)\r\n\r\n * Documentation:  https:\/\/wiki.linaro.org\/\r\n                                                                         [ OK ]\r\n[   20.106130] android_usb: already disabled\r\nroot@ubuntu:~#<\/pre>\n<h6>U-Boot Fun<\/h6>\n<p>Now for the real reason I wanted to try this. Access to U-Boot and the boot command line.<\/p>\n<p>In the serial terminal window, I rebooted the pcDuino&#8230;<\/p>\n<pre class=\"theme:terminal striped:false marking:false nums:false nums-toggle:false wrap-toggle:false plain:false plain-toggle:false lang:default decode:true \" title=\"Reboot Linux\" >root@ubuntu:~# shutdown -r now\r\nroot@ubuntu:~#\r\nBroadcast message from root@ubuntu\r\n        (\/dev\/ttyS0) at 19:14 ...\r\n\r\nThe system is going down for reboot NOW!\r\n * Asking all remaining processes to terminate...                        [ OK ]\r\n * All processes ended within 1 seconds....                              [ OK ]\r\nnm-dispatcher.action: Caught signal 15, shutting down...\r\nnm-dispatcher.action: Disconnected from the system bus, exiting.\r\n * Deconfiguring network interfaces...                                   [ OK ]\r\n * Unmounting temporary filesystems...                                   [ OK ]\r\n * Deactivating swap...                                                  [ OK ]\r\n * Unmounting local filesystems...                                       [ OK ]\r\numount: \/run\/lock: not mounted\r\n * Will now restart\r\n[  631.725545] Restarting system.<\/pre>\n<p>&#8230; and interrupted the U-Boot start up by pressing the space bar at the &#8220;Hit any key to stop autoboot&#8221; prompt.<\/p>\n<pre class=\"theme:terminal striped:false marking:false nums:false nums-toggle:false wrap-toggle:false plain:false plain-toggle:false lang:default decode:true \" title=\"Stop in U-Boot\" >HELLO! BOOT0 is starting!\r\nboot0 version : 1.5.0\r\ndram size =1024\r\nSucceed in opening nand flash.\r\nSucceed in reading Boot1 file head.\r\nThe size of Boot1 is 0x00056000.\r\nThe file stored in 0X00000000 of block 2 is perfect.\r\nCheck is correct.\r\nReady to disable icache.\r\nSucceed in loading Boot1.\r\nJump to Boot1.\r\n[       0.181] boot1 version : 1.5.0\r\n[       0.181] pmu type = 3\r\n[       0.182] bat vol = 0\r\n[       0.213] axi:ahb:apb=3:2:2\r\n[       0.213] set dcdc2=1400, clock=1008 successed\r\n[       0.215] key\r\n[       0.227] no key found\r\n[       0.227] flash init start\r\n[       0.239] flash init finish\r\n[       0.241] fs init ok\r\n[       0.242] fattype FAT16\r\n[       0.242] fs mount ok\r\n[       0.247] script finish\r\n[       0.249] power finish\r\n[       0.257] BootMain start\r\n[       0.257] 0\r\n[       0.272] usbdc_vol = 4000, usbdc_cur = 0\r\n[       0.272] usbpc_vol = 4000, usbpc_cur = 0\r\n[       0.275] init to usb pc\r\n[       0.278] set pc\r\n[       0.368] power_start=0x00000002\r\n[       0.368] pre sys mode\r\n[       0.368] startup status = -1\r\n[       0.371] key value = 0\r\n[       0.374] unable to find recovery_key key_max value\r\n[       0.382] test for multi os boot with display\r\n[       1.006] show pic finish\r\n[       1.006] load kernel start\r\n[       1.024] load kernel successed\r\n[       1.024] start address = 0x4a000000\r\n[       1.026] power exit detect\r\n[\r\n\r\nU-Boot 2011.09-rc1-svn62 (Feb 01 2013 - 22:20:45) Allwinner Technology\r\n\r\nCPU:   SUNXI Family\r\nBoard: A10-EVB\r\nDRAM:  512 MiB\r\nNAND:  1900 MiB\r\nIn:    serial\r\nOut:   serial\r\nErr:   serial\r\n--------fastboot partitions--------\r\n-total partitions:5-\r\n-name-        -start-       -size-\r\nbootloader  : 1000000       2000000\r\nenv         : 3000000       1000000\r\nboot        : 4000000       1000000\r\nrootfs      : 5000000       5dc00000\r\nUDISK       : 62c00000      14000000\r\n-----------------------------------\r\nno misc partition is found\r\nHit any key to stop autoboot:  0\r\nsunxi#<\/pre>\n<p>Greeted by the U-Boot prompt. No to check for what commands are available for modifying the environment using the <strong><em>help<\/em><\/strong> command.<\/p>\n<pre class=\"theme:terminal striped:false marking:false nums:false nums-toggle:false wrap-toggle:false plain:false plain-toggle:false lang:default decode:true \" title=\"U-Boot Commands\" >sunxi#help\r\n?       - alias for 'help'\r\nbase    - print or set address offset\r\nboot    - boot default, i.e., run 'bootcmd'\r\nboota   - boota   - boot android bootimg from memory\r\n\r\nbootd   - boot default, i.e., run 'bootcmd'\r\nbootm   - boot application image from memory\r\ncmp     - memory compare\r\ncp      - memory copy\r\ncrc32   - checksum calculation\r\nenv     - environment handling commands\r\nexit    - exit script\r\nfalse   - do nothing, unsuccessfully\r\nfastboot- fastboot- use USB Fastboot protocol\r\n\r\nfatdown - download data to a dos filesystem\r\nfatinfo - print information about filesystem\r\nfatload - load binary file from a dos filesystem\r\nfatls   - list files in a directory (default \/)\r\ngo      - start application at address 'addr'\r\nhelp    - print command description\/usage\r\nkey_test- Test the key value and dump key registers\r\nloop    - infinite loop on address range\r\nmd      - memory display\r\nmm      - memory modify (auto-incrementing address)\r\nmmc     - MMC sub system\r\nmmcinfo - display MMC info\r\nmtest   - simple RAM read\/write test\r\nmw      - memory write (fill)\r\nnand    - NAND sub-system\r\nnboot   - boot from NAND device\r\nnm      - memory modify (constant address)\r\nprintenv- print environment variables\r\nreset   - Perform RESET of the CPU\r\nrun     - run commands in an environment variable\r\nsaveenv - save environment variables to persistent storage\r\nsetenv  - set environment variables\r\nshowvar - print local hushshell variables\r\nsunxi_flash- sunxi_flash sub-system\r\ntest    - minimal test like \/bin\/sh\r\ntrue    - do nothing, successfully\r\nversion - print monitor, compiler and linker version\r\nsunxi#<\/pre>\n<p>Current environment settings.<\/p>\n<pre class=\"theme:terminal striped:false marking:false nums:false nums-toggle:false wrap-toggle:false plain:false plain-toggle:false lang:default decode:true \" title=\"U-Boot Environment\" >sunxi#env print\r\nboot_fastboot=fastboot\r\nboot_normal=fatload nand 0 0x48000000 uImage; bootm 0x48000000\r\nboot_recovery=nand read 40007800 recovery;boota 40007800\r\nbootargs=console=ttyS0,115200 root=\/dev\/nandd init=\/init loglevel=8 rootfstype=ext4 rootwait\r\nbootcmd=run setargs load1 boot_normal\r\nbootdelay=3\r\nconsole=ttyS0,115200\r\nfastboot_key_value_max=0x8\r\nfastboot_key_value_min=0x2\r\ninit=\/init\r\nload1=fatload nand 0 43000000 evb.bin\r\nloglevel=8\r\nmmc_root=\/dev\/mmcblk0p7\r\nnand_root=\/dev\/nandd\r\npartitions=nanda@boot:nandb@rootfs:nandc@UDISK\r\nrecovery_key_value_max=0x13\r\nrecovery_key_value_min=0x10\r\nsetargs=setenv bootargs console=${console} root=${nand_root} init=${init} loglevel=${loglevel}\r\nstderr=serial\r\nstdin=serial\r\nstdout=serial\r\n\r\nEnvironment size: 749\/131068 bytes\r\nsunxi#<\/pre>\n<p>Interesting. By default, the A10 settins are loaded to memory from <em>evb.bin<\/em> and the kernel is loaded from <em>uImage<\/em> from the NAND flash <em>\/boot<\/em> partition. The default kernel command line sets <em>\/root<\/em> to the NAND flash root partition. Then off it goes.<\/p>\n<h6>Next<\/h6>\n<p>My next project is to get the pcDuino booting from the SDCARD. All of the pieces are present for accomplishing this. Stay tuned for <a href=\"https:\/\/www.the-greathouses.net\/blog\/2013\/03\/pcduino-u-boot-part-2\/\" title=\"pcDuino U-Boot - Part 2\" ><strong>Part 2<\/strong><\/a> later tonight. Right now, it is dinner time.<\/p>\n<p><strong>Update 14-Mar-2013:<\/strong> For those interested in <a href=\"https:\/\/www.the-greathouses.net\/blog\/2013\/03\/pcduino-u-boot-part-2\/\" title=\"pcDuino U-Boot - Part 2\" ><strong>Part 2<\/strong><\/a> &#8212; where I planned on enabling automatic SD booting, there has been a delay. The U-Boot implementation on the pcDuino is crippled. It does not have the ability to save an updated environment to NAND flash and does not support the newer boot.scr or uEnv.txt files. I am currently in the process of creating a U-Boot for pcDuino that will support SD card booting without removing the NAND flash support.  <\/p>\n<h6><span style=\"color: #ff0000;\">WARNING<\/span><\/h6>\n<p><strong>ONLY TRY THE ABOVE IF YOU UNDERSTAND WHAT YOU ARE DOING. Connecting to the serial debug port has the potential to damage your pcDuino if your connections are incorrect. Changes to the U-Boot environment can render your pcDuino unbootable. YOU HAVE BEEN WARNED!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"This evening I decided it was time to check out the boot loader and boot command options on the pcDuino. &hellip;<a href=\"https:\/\/www.the-greathouses.net\/blog\/2013\/03\/pcduino-u-boot-part-1\/\">Continue reading &rarr;<\/a>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,35],"tags":[38,29,28,31,30],"class_list":["post-253","post","type-post","status-publish","format-standard","hentry","category-computers","category-pcduino","tag-cooking-3","tag-debug","tag-serial","tag-teraterm","tag-u-boot"],"_links":{"self":[{"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/posts\/253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/comments?post=253"}],"version-history":[{"count":33,"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/posts\/253\/revisions"}],"predecessor-version":[{"id":340,"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/posts\/253\/revisions\/340"}],"wp:attachment":[{"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/media?parent=253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/categories?post=253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/tags?post=253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}