Audi McAvoy / Mbed 2 deprecated FRDM_K64F-TFTP

Dependencies:   EthernetInterface mbed-rtos mbed

Fork of FRDM_K64F-Ethernet by Rangel Alvarado

Committer:
audim
Date:
Thu Oct 11 15:25:58 2018 +0000
Revision:
1:2944c0d494ff
Child:
2:28ddb9b073ec
first working concept; only supports ETH0 due to "eTSEC1" setting in environment variables

Who changed what in which revision?

UserRevisionLine numberNew contents of line
audim 1:2944c0d494ff 1 /* If you make any chnages to this file, then you must take the following steps.
audim 1:2944c0d494ff 2 ** 1) compile and upload this program to FRDM-K64F
audim 1:2944c0d494ff 3 ** 2) reset FRDM-K64F and wait for green light
audim 1:2944c0d494ff 4 ** 3) connect FRDM-K64F and IPCU 2 to the same Ethernet switch
audim 1:2944c0d494ff 5 ** 4) gain access to the IPCU 2 u-boot prompt
audim 1:2944c0d494ff 6 ** 5) type 'run upenv' and press Enter
audim 1:2944c0d494ff 7 ** 6) wait for green light
audim 1:2944c0d494ff 8 ** 7) type 'run chkenv' and press Enter
audim 1:2944c0d494ff 9 notice that there is an error, for example "byte at 0x0100033b (0x62) != byte at 0x0200033b (0x63)"
audim 1:2944c0d494ff 10 ** 8) type 'md.b 2000x00 100' and press Enter
audim 1:2944c0d494ff 11 replace the x with the base address in the error message
audim 1:2944c0d494ff 12 in the example above the error was at 33b, so enter 'md.b 2000300 100' and press Enter
audim 1:2944c0d494ff 13 ** 9) find the 'filesize' entry in the memory dump, and edit the filesize value below to match
audim 1:2944c0d494ff 14 ** 10) repeat steps 1 through 7 above, this time there should be no error message
audim 1:2944c0d494ff 15 */
audim 1:2944c0d494ff 16 char *env_string[] = {
audim 1:2944c0d494ff 17 "addargs=setenv bootargs $bootargs ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off console=$consoledev,$baudrate sdhci-of.max_clock=$sdclk\n",
audim 1:2944c0d494ff 18 "baudrate=115200\n",
audim 1:2944c0d494ff 19 "bootcmd=echo && echo This is a test environment. Must 'run upenv' against && echo production server to restore production environment.\n",
audim 1:2944c0d494ff 20 "bootdelay=0\n",
audim 1:2944c0d494ff 21 "bootdrive=sda1\n",
audim 1:2944c0d494ff 22 "bootfile=uImage\n",
audim 1:2944c0d494ff 23 "chkenv=mw.b 1000000 0 1000 && tftpboot 1000000 $tftpdir/$ubootenv && mw.b 2000000 0 1000 && env export -t 2000000 && cmp.b 1000000 2000000 $filesize\n",
audim 1:2944c0d494ff 24 "consoledev=ttyS0\n",
audim 1:2944c0d494ff 25 "doboot=bootm $loadaddr - $fdtaddr;\n",
audim 1:2944c0d494ff 26 "dtboffset=180000\n",
audim 1:2944c0d494ff 27 "dtbsize=3500\n",
audim 1:2944c0d494ff 28 "envimport=if mmc part 0 && fatload mmc 0:1 $loadaddr $ubootenv; then env -d import $loadaddr $filesize && saveenv; else echo \"Missing file: $ubootenv\"; fi'\n",
audim 1:2944c0d494ff 29 "ethact=eTSEC1\n",
audim 1:2944c0d494ff 30 "ethprime=eTSEC1\n",
audim 1:2944c0d494ff 31 "fdtaddr=ff0000\n",
audim 1:2944c0d494ff 32 "fdtfile=p1022ipcu_dtb\n",
audim 1:2944c0d494ff 33 "fileaddr=1000000\n",
audim 1:2944c0d494ff 34 "filesize=c5c\n",
audim 1:2944c0d494ff 35 "flashfsfile=flashfs_jffs2\n",
audim 1:2944c0d494ff 36 "flashfsoffset=A00000\n",
audim 1:2944c0d494ff 37 "flashfssize=600000\n",
audim 1:2944c0d494ff 38 "flashhdboot=run sethdargs addargs;nand read $fdtaddr $dtboffset $dtbsize;nand read $loadaddr $kernoffset $kernsize; run doboot;\n",
audim 1:2944c0d494ff 39 "gatewayip=192.168.1.1\n",
audim 1:2944c0d494ff 40 "hostname=ipcu\n",
audim 1:2944c0d494ff 41 "hwconfig=esdhc;\n",
audim 1:2944c0d494ff 42 "ipaddr=192.168.1.100\n",
audim 1:2944c0d494ff 43 "kernoffset=200000\n",
audim 1:2944c0d494ff 44 "kernsize=800000\n",
audim 1:2944c0d494ff 45 "loadaddr=1000000\n",
audim 1:2944c0d494ff 46 "minimalboot=run setminimalargs addargs; nand read $fdtaddr $dtboffset $dtbsize; nand read $loadaddr $kernoffset $kernsize; run doboot;\n",
audim 1:2944c0d494ff 47 "minimalfsfile=rootfs_jffs2\n",
audim 1:2944c0d494ff 48 "minimalfsoffset=1000000\n",
audim 1:2944c0d494ff 49 "minimalfssize=F000000\n",
audim 1:2944c0d494ff 50 "monitor=1\n",
audim 1:2944c0d494ff 51 "netdev=eth0\n",
audim 1:2944c0d494ff 52 "netmask=255.255.255.0\n",
audim 1:2944c0d494ff 53 "nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=$serverip:$rootpath\n",
audim 1:2944c0d494ff 54 "nfsboot=run nfsargs addargs nfsget doboot;\n",
audim 1:2944c0d494ff 55 "nfsget=nfs $loadaddr $rootpath/boot/$bootfile; nfs $fdtaddr $rootpath/boot/$fdtfile;\n",
audim 1:2944c0d494ff 56 "ramboot=setenv bootargs root=/dev/ram rw console=$consoledev,$baudrate;tftp $ramdiskaddr $tftpdir/$ramdiskfile;tftp $loadaddr $tftpdir/$bootfile;tftp $fdtaddr $tftpdir/$fdtfile;bootm $loadaddr $tftpdir/$ramdiskaddr $fdtaddr\n",
audim 1:2944c0d494ff 57 "ramdiskaddr=2000000\n",
audim 1:2944c0d494ff 58 "ramdiskfile=uramdisk\n",
audim 1:2944c0d494ff 59 "rootpath=/opt/nfsroot\n",
audim 1:2944c0d494ff 60 "sdclk=22000000\n",
audim 1:2944c0d494ff 61 "serverip=192.168.1.10\n",
audim 1:2944c0d494ff 62 "sethdargs=setenv bootargs root=/dev/$bootdrive rw\n",
audim 1:2944c0d494ff 63 "setminimalargs=setenv bootargs tftpserver=$serverip tftpdir=$tftpdir root=/dev/mtdblock4 rw rootfstype=jffs2\n",
audim 1:2944c0d494ff 64 "tftpdir=/production\n",
audim 1:2944c0d494ff 65 "tftpkernel=setenv bootargs root=/dev/sda1 rw console=ttyS0,115200; tftpboot $loadaddr $tftpdir/$bootfile;tftpboot $fdtaddr $tftpdir/$fdtfile;run doboot\n",
audim 1:2944c0d494ff 66 "uboot=u-boot-nand_bin\n",
audim 1:2944c0d494ff 67 "ubootenv=u-boot-env_txt\n",
audim 1:2944c0d494ff 68 "updtb=tftpboot $loadaddr $tftpdir/$fdtfile; nand erase $dtboffset $filesize; nand write $loadaddr $dtboffset $filesize;\n",
audim 1:2944c0d494ff 69 "upenv=if tftpboot $loadaddr $tftpdir/$ubootenv; then env import -d $loadaddr $filesize && saveenv; else echo \"Missing file: $ubootenv\"; fi\n",
audim 1:2944c0d494ff 70 "upflashfs=tftpboot $loadaddr $tftpdir/$flashfsfile; nand erase $flashfsoffset $flashfssize; nand write $loadaddr $flashfsoffset $filesize;\n",
audim 1:2944c0d494ff 71 "upkernel=tftpboot $loadaddr $tftpdir/$bootfile; nand erase $kernoffset $filesize; nand write $loadaddr $kernoffset $filesize;\n",
audim 1:2944c0d494ff 72 "upminimal=tftpboot $loadaddr $tftpdir/$minimalfsfile; nand erase $minimalfsoffset $minimalfssize; nand write $loadaddr $minimalfsoffset $filesize;\n",
audim 1:2944c0d494ff 73 "upuboot=if tftpboot $loadaddr $tftpdir/$uboot; then nand erase 0 $filesize; nand write $loadaddr 0 $filesize; fi\n",
audim 1:2944c0d494ff 74 "usb_phy_type=ulpi\n",
audim 1:2944c0d494ff 75 "vtos=tftpboot 0x01000000 $tftpdir/vtos.ipcu.bin; go 0x01003000\n",
audim 1:2944c0d494ff 76 "\0" // end of table
audim 1:2944c0d494ff 77 };