1*4882a593SmuzhiyunLego Mindstorms EV3 2*4882a593Smuzhiyun 3*4882a593SmuzhiyunIntro 4*4882a593Smuzhiyun===== 5*4882a593Smuzhiyun 6*4882a593SmuzhiyunThis is the buildroot basic board support for the Lego Mindstorms EV3 7*4882a593Smuzhiyunprogrammable brick. 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunThe Lego Mindstorms EV3 brick comprises a Texas Instruments AM1808 SoC, with 10*4882a593Smuzhiyunan ARM 926EJ-S main processor running at 300 MHz. 11*4882a593SmuzhiyunSee: 12*4882a593Smuzhiyun- https://en.wikipedia.org/wiki/Lego_Mindstorms_EV3 13*4882a593Smuzhiyun- http://www.lego.com/en-us/mindstorms/products/ev3/31313-mindstorms-ev3/ 14*4882a593Smuzhiyun- http://www.ti.com/product/am1808 15*4882a593Smuzhiyun 16*4882a593SmuzhiyunHow it works 17*4882a593Smuzhiyun============ 18*4882a593Smuzhiyun 19*4882a593SmuzhiyunBoot process : 20*4882a593Smuzhiyun-------------- 21*4882a593Smuzhiyun 22*4882a593SmuzhiyunThe EV3 boots from an EEPROM. This loads whatever is on the built-in 16MB flash 23*4882a593Smuzhiyun(usually U-Boot) and runs it. The U-Boot from the official LEGO firmware and 24*4882a593Smuzhiyunmainline U-Boot will attempt to boot a Linux kernel from the external µSD card. 25*4882a593SmuzhiyunIt will try to load a uImage (and optional boot.scr) from the first µSD card 26*4882a593Smuzhiyunpartition, which must be formatted with a FAT filesystem. If no µSD is found or 27*4882a593Smuzhiyunit does not contain a uImage file, then the EV3 will boot the uImage from the 28*4882a593Smuzhiyunbuilt-in 16MB flash. 29*4882a593Smuzhiyun 30*4882a593SmuzhiyunHow to build it 31*4882a593Smuzhiyun=============== 32*4882a593Smuzhiyun 33*4882a593SmuzhiyunConfigure Buildroot 34*4882a593Smuzhiyun------------------- 35*4882a593Smuzhiyun 36*4882a593SmuzhiyunThe lego_ev3_defconfig configuration provides basic support to boot on the Lego 37*4882a593SmuzhiyunMindstorms EV3 programmable brick: 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun $ make lego_ev3_defconfig 40*4882a593Smuzhiyun 41*4882a593SmuzhiyunBuild everything 42*4882a593Smuzhiyun---------------- 43*4882a593Smuzhiyun 44*4882a593SmuzhiyunNote: you will need to have access to the network, since Buildroot will 45*4882a593Smuzhiyundownload the packages' sources. 46*4882a593Smuzhiyun 47*4882a593Smuzhiyun $ make 48*4882a593Smuzhiyun 49*4882a593SmuzhiyunResult of the build 50*4882a593Smuzhiyun------------------- 51*4882a593Smuzhiyun 52*4882a593SmuzhiyunAfter building, you should obtain this tree: 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun output/images/ 55*4882a593Smuzhiyun ├── boot.vfat 56*4882a593Smuzhiyun ├── flash.bin 57*4882a593Smuzhiyun ├── rootfs.ext2 58*4882a593Smuzhiyun ├── rootfs.ext3 -> rootfs.ext2 59*4882a593Smuzhiyun ├── rootfs.squashfs 60*4882a593Smuzhiyun ├── sdcard.img 61*4882a593Smuzhiyun ├── u-boot.bin 62*4882a593Smuzhiyun ├── uImage -> uImage.da850-lego-ev3 63*4882a593Smuzhiyun └── uImage.da850-lego-ev3 64*4882a593Smuzhiyun 65*4882a593SmuzhiyunInstallation 66*4882a593Smuzhiyun============ 67*4882a593Smuzhiyun 68*4882a593SmuzhiyunYou can use either flash.bin or the sdcard.img. To load flash.bin, use the 69*4882a593Smuzhiyunofficial Lego Mindstorms EV3 programming software firmware update tool to load 70*4882a593Smuzhiyunthe image. To use sdcard.img, use a disk writing tool such as Etcher or dd to 71*4882a593Smuzhiyunwrite the image to the µSD card. 72*4882a593Smuzhiyun 73*4882a593SmuzhiyunNOTE: The sdcard.img created by lego_ev3_defconfig won't boot if the official 74*4882a593SmuzhiyunLEGO firmware is installed on the EV3 (it has an old version of U-Boot that 75*4882a593Smuzhiyundoesn't know about device tree). You must either set the kernel configuration 76*4882a593Smuzhiyunoption to append the device tree to the kernel or you can create a boot.scr 77*4882a593Smuzhiyunthat chainloads a newer U-Boot or you can install a newer U-Boot in the flash 78*4882a593Smuzhiyunmemory (just flashing u-boot.bin is enough). 79*4882a593Smuzhiyun 80*4882a593SmuzhiyunFinish 81*4882a593Smuzhiyun====== 82*4882a593Smuzhiyun 83*4882a593SmuzhiyunTo have a serial console, you will need a proper USB to Lego serial port 84*4882a593Smuzhiyunadapter plugged into the EV3 sensors port 1. 85*4882a593SmuzhiyunSee: 86*4882a593Smuzhiyun- http://botbench.com/blog/2013/08/15/ev3-creating-console-cable/ 87*4882a593Smuzhiyun- http://botbench.com/blog/2013/08/05/mindsensors-ev3-usb-console-adapter/ 88*4882a593Smuzhiyun 89*4882a593SmuzhiyunThe serial port config to use is 115200/8-N-1. 90*4882a593Smuzhiyun 91*4882a593SmuzhiyunBluetooth 92*4882a593Smuzhiyun========= 93*4882a593Smuzhiyun 94*4882a593SmuzhiyunTo enable Bluetooth: 95*4882a593Smuzhiyun 96*4882a593Smuzhiyun # modprobe hci_uart 97*4882a593Smuzhiyun # /usr/libexec/bluetooth/bluetoothd & 98*4882a593Smuzhiyun # bluetoothctl 99*4882a593Smuzhiyun [bluetooth]# power on 100