Zedboard.Tool 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. (*
  2. The following build commands assumes that the ARM folder is reachable from the search path.
  3. If this is not the case replace all ARM/ by full qualified path to folder ARM/
  4. *)
  5. (* Execute this command to use 1024 x 768 @ 62 Hz display settings *)
  6. FSTools.CreateFile -c -r Zedboard.DisplayLinear.Replacements.tmp
  7. DisplayLinear.Width = 1024;
  8. DisplayLinear.Height = 768;
  9. DisplayLinear.PlClkDiv0 = 10;
  10. DisplayLinear.PlClkDiv1 = 15;
  11. DisplayLinear.PlClkDiv2 = 3;
  12. DisplayLinear.HorizFrontPorch = 24;
  13. DisplayLinear.HorizSyncWidth = 136;
  14. DisplayLinear.HorizBackPorch = 160;
  15. DisplayLinear.HorizSyncPolarity = TRUE;
  16. DisplayLinear.VertFrontPorch = 3;
  17. DisplayLinear.VertSyncWidth = 6;
  18. DisplayLinear.VertBackPorch = 29;
  19. DisplayLinear.VertSyncPolarity = TRUE;
  20. ~
  21. (* Execute this command to use 800 x 480 @ 65 Hz display settings *)
  22. FSTools.CreateFile -c -r Zedboard.DisplayLinear.Replacements.tmp
  23. DisplayLinear.Width = 800;
  24. DisplayLinear.Height = 480;
  25. DisplayLinear.PlClkDiv0 = 10;
  26. DisplayLinear.PlClkDiv1 = 30;
  27. DisplayLinear.PlClkDiv2 = 6;
  28. DisplayLinear.HorizFrontPorch = 40;
  29. DisplayLinear.HorizSyncWidth = 48;
  30. DisplayLinear.HorizBackPorch = 88;
  31. DisplayLinear.HorizSyncPolarity = TRUE;
  32. DisplayLinear.VertFrontPorch = 13;
  33. DisplayLinear.VertSyncWidth = 3;
  34. DisplayLinear.VertBackPorch = 32;
  35. DisplayLinear.VertSyncPolarity = TRUE;
  36. ~
  37. System.DoCommands
  38. (* 1. Mount Filesystems *)
  39. FSTools.Mount MINOS RelativeFileSystem ARM/Minos~
  40. FSTools.Mount ENET RelativeFileSystem ARM/Enet~
  41. FSTools.Mount ZBL RelativeFileSystem ARM/zbl~
  42. FSTools.Mount ZYNQ RelativeFileSystem ARM/ARM.A2 ~
  43. FSTools.Mount USB RelativeFileSystem ARM/USB ~
  44. (* Cleanup bootloader-specific files *)
  45. FSTools.DeleteFiles WORK:*.Syb WORK:*.arm WORK:Init.Bin WORK:Zbl.Bin WORK:BOOT.BIN ~
  46. (*
  47. Build everything required for the bootloader
  48. *)
  49. (* 2. Build Host Tools *)
  50. (* 2.1. Compilation Tools *)
  51. Compiler.Compile --mergeSections
  52. ZBL:/tools/ZynqTools.Mod
  53. MinosLinker.Mod
  54. ~
  55. (* 2.2. Command Tools *)
  56. Compiler.Compile --mergeSections
  57. TFTPServer.Mod
  58. ZBL:/tools/BlCommands.Mod
  59. ZBL:/tools/BlTools.Mod
  60. ~
  61. (* 3. Compile Bootloader
  62. The bootloader is composed of 3 parts:
  63. - the bootstrap image, which will load the actual bootloader application
  64. - the bootloader core, which implements the command mechanism
  65. - additional feature modules, which implement transfer protocols, programming destinations and checksum algorithms
  66. *)
  67. (* 3.2. Build Bootstrap Image *)
  68. (* The first step does not depend on the board. *)
  69. Compiler.Compile -p=ARMA2 --metaData=simple
  70. ZBL:/Boot.Mos
  71. ~
  72. Linker.Link --fileName=Init.Bin --displacement=0H -a
  73. Boot
  74. ~
  75. Release.Build -b -f=ZBL:/BootloaderRelease.Tool --only=Bootstrap Zedboard ~
  76. MinosLinker.Link Init.Bin 0H Zbl.Bin
  77. Platform Board TclInit ZynqInitializer FPE64 Builtins PsUartMin Trace TraceDevice Caches Memory
  78. MemoryMapping Interrupts Bit Clocks KernelUtils GlobalTimer Kernel Utils Strings Heaps OFS Modules
  79. SdEnvironment Sd Disks SdDisks SdControllers OFSDiskVolumes Bootstrap ~
  80. ZynqTools.GenerateBootROM Zbl.Bin ~
  81. (* 3.3. Build Bootloader Core *)
  82. Release.Build -f=ZBL:/BootloaderRelease.Tool --build --only='EnetMinos Enet Bootloader' Zedboard ~
  83. (* 3.4. Build Additional Features *)
  84. (* Additional packages give more features to the bootloader. Available packages: *)
  85. (* o A2 Boot Configuration Programmer *)
  86. Release.Build -b -f=ZBL:/BootloaderRelease.Tool --only=A2ConfigProgrammer Zedboard ~
  87. (* o TFTP Loader *)
  88. Release.Build -b -f=ZBL:/BootloaderRelease.Tool --only=TFTPLoader Zedboard ~
  89. (* o XMODEM loader *)
  90. Release.Build -b -f=ZBL:/BootloaderRelease.Tool --only=XModemLoader Zedboard ~
  91. (* o ZYNQ-7000 FPGA Programmer *)
  92. Release.Build -b -f=ZBL:/BootloaderRelease.Tool --only=ZynqFpgaProgrammer Zedboard ~
  93. (* o MD5 Checksum *)
  94. Release.Build -b -f=ZBL:/BootloaderRelease.Tool --only=MD5Checksum Zedboard ~
  95. (*
  96. Build everything required for the A2 on Zynq
  97. *)
  98. FSTools.CreateDirectory build/ ~
  99. FSTools.DeleteFiles build/* ~
  100. Release.Build -b --path='build/' -f=ZYNQ:/ARM.Release.Tool
  101. -o='--mergeSections --traceModule=Trace --noInitLocals --useFPU64' --only=Kernel
  102. ZynqDynamic
  103. ~
  104. Release.Build -b --path='build/' -f=ZYNQ:/ARM.Release.Tool --only='System SD BootConsole' ZynqDynamic ~
  105. Release.Build -b -z --path='build/' -f=ZYNQ:/ARM.Release.Tool
  106. --only='System SystemExt FpgaDisplay Kernel Math SD Shell SystemTools Usb DMA FS Profiler Crypto GUI Compiler Archives Gfx'
  107. --exclude="Network Enet Inga" ZynqDynamic ~
  108. Compiler.Compile -p=ARMA2 --mergeSections --useFPU64 --replacements=Zedboard.DisplayLinear.Replacements.tmp --destPath='build/'
  109. ZYNQ:/Zynq.DisplayLinear.Mod
  110. ~
  111. Linker.Link --fileName=A2.Bin --displacement=100000H -a --path=build/
  112. Runtime Initializer Platform FPE64 Builtins Trace BootConfig PsUartMin PsUart TraceDevice PrivateWatchdog Machine Heaps Modules Objects Kernel KernelLog Plugins
  113. Streams Pipes Commands Reals Clock Dates Strings Files Disks Reflection TrapWriters Traps Locks Options PsConfig SdEnvironment
  114. Sd SdDisks SdControllers Caches DiskVolumes DiskFS BitSets StringPool ObjectFile Diagnostics GenericLinker Loader
  115. BootConsole ~
  116. (* ShellController Shell Displays AcAxisIo StreamVideoOut AxiDma DisplayLinear UTF8Strings CLUTs Raster WMRectangles
  117. WMRasterScale SoundDevices Configuration XMLObjects XML DynamicStrings XMLScanner XMLParser Inflate CRC Unzip FP1616 WMEvents
  118. Texts Archives Codecs WMGraphics WMDefaultFont WMFontManager OpenTypeInt OpenTypeScan OpenType WMOTFonts WMBitmapFont WMOberonFonts
  119. Debugging WMMessages WMWindowManager Inputs WMGraphicUtilities WMDefaultWindows WindowManager PNGDecoder SystemTools ProcessInfo
  120. ProcessInfo0 SystemVersion Localization Repositories UnicodeProperties TextUtilities Types Models WMProperties Events WMDropTarget
  121. WMComponents WMStandardComponents WMTrees WMMenus IngaObjects IngaContexts WMRestorable IngaViews Math GfxMatrix GfxPaths
  122. GfxRegions GfxImages GfxFonts Gfx GfxRaster GfxBuffer IngaContexts2d IngaImshow Random MathL FoxArrayBase IngaArrays IngaLine
  123. Buffers IngaRealTimePlot IngaLinePlot IngaExampleLayer ComponentViewer IngaScale FSTools WMTabComponents MainMenu ~ *)
  124. (* 5. Preparing the Boot SD Card*)
  125. (* The installation is done in a virtual disk that will be copied to the SD card: *)
  126. VirtualDisks.Create build/Zedboard.ZynqA2.img 819200 512 ~
  127. VirtualDisks.Install -b=512 VDISK0 build/Zedboard.ZynqA2.img ~
  128. (* First we create the 2 partitions needed by the bootloader: *)
  129. Partitions.WriteMBR VDISK0#0 BootManagerMBR.Bin BootManagerTail.Bin ~
  130. Partitions.Create VDISK0#1 11 64 ~
  131. Partitions.Create VDISK0#2 76 64 ~
  132. Partitions.Format VDISK0#1 FatFS Quick ~
  133. Partitions.Format VDISK0#2 AosFS ~
  134. (* Then we install the bootloader: *)
  135. FSTools.Mount BLFATFS FatFS VDISK0#1 ~
  136. FSTools.Mount BLAOSFS AosFS VDISK0#2 ~
  137. (* Copy Bootstrap Image *)
  138. FSTools.CopyFiles -o WORK:/BOOT.BIN => BLFATFS:/BOOT.BIN ~
  139. (* Copy the bootloader core: *)
  140. FSTools.CopyTo BLAOSFS:/ WORK:/
  141. Bootloader.arm Checksum.arm Enet.arm EnetArp.arm EnetBase.arm EnetEmacPs7.arm EnetEnvironment.arm EnetIcmp.arm
  142. EnetInterfaces.arm EnetPhy.arm EnetStreams.arm EnetTftp.arm EnetTiming.arm EnetTrace.arm EnetUdp.arm EnetUdpChannels.arm
  143. EnetUtils.arm Loader.arm Programmer.arm StreamReaders.arm StreamWriters.arm PsUartInterrupts.arm PsUart.arm UncachedHeap.arm
  144. OFSStreams.arm PrivateWatchdog.arm XModem.arm XModemLoader.arm
  145. ~
  146. (* Boot configuration for the specific hardware *)
  147. FSTools.CopyFiles -o ARM/Zedboard.bootconfig.txt => BLAOSFS:bootconfig ~
  148. (* Copy additionnal bootloader packages: *)
  149. (* o TFTP: *) FSTools.CopyTo BLAOSFS:/ WORK:/ TFTPLoader.arm ~
  150. (* o ZYNQ-7000 FPGA Programmer: *) FSTools.CopyTo BLAOSFS:/ WORK:/ ZynqFpgaProgrammer.arm ~
  151. (* o MD5 Checksum: *) FSTools.CopyTo BLAOSFS:/ WORK:/ MD5.arm MD5Checksum.arm ~
  152. (* o A2ConfigProgrammer: *) FSTools.CopyTo BLAOSFS:/ WORK:/ A2ConfigProgrammer.arm ~
  153. (* Setup bootloader initialization script *)
  154. FSTools.CreateFile BLAOSFS:/init.txt netstart 10.3.34.8 255.255.255.0 0.0.0.0
  155. timeout 1
  156. setinput UDP
  157. ~
  158. (* Setup bootloader auto script *)
  159. FSTools.CreateFile BLAOSFS:/auto.txt deploy bs ZynqFpga
  160. deploy bootconfig A2Config
  161. deploy a2 memory 100000H 0 1
  162. start
  163. ~
  164. FSTools.CopyFiles
  165. WORK:/A2.Bin => BLAOSFS:/a2
  166. ZYNQ:Zedboard.VideoOutVga.bin => BLAOSFS:/bs
  167. ~
  168. FSTools.Unmount BLFATFS ~
  169. FSTools.Unmount BLAOSFS ~
  170. (* Now we create a partition for A2 itself: *)
  171. Partitions.Create VDISK0#3 76 256 ~
  172. Partitions.Format VDISK0#3 AosFS ~
  173. FSTools.Mount ZYNQA2 AosFS VDISK0#3 ~
  174. ZipTool.ExtractAll --prefix=ZYNQA2: --sourcePath=build/ --overwrite --silent
  175. BootConsole.zip DMA.zip FpgaDisplay.zip FS.zip Kernel.zip Math.zip
  176. SD.zip Shell.zip System.zip SystemExt.zip SystemTools.zip Usb.zip
  177. Profiler.zip GUI.zip Gfx.zip Crypto.zip
  178. Compiler.zip PET.zip Zip.zip
  179. ~
  180. FSTools.CopyFiles -o
  181. build/DisplayLinear.Gof => ZYNQA2:/DisplayLinear.Gof
  182. build/DisplayLinear.Sym => ZYNQA2:/DisplayLinear.Sym
  183. ~
  184. FSTools.Unmount ZYNQA2 ~
  185. VirtualDisks.Uninstall VDISK0 ~
  186. System.Show 'Zedboard Zynq A2 image has been built!' ~
  187. FSTools.CloseFiles build/Zedboard.ZynqA2.img ~
  188. ~
  189. #
  190. # Copy all release files to already existing partitions on SD card
  191. #
  192. WinDisks.Install E: RW ~
  193. VirtualDisks.Install -b=512 VDISK0 build/Zedboard.ZynqA2.img ~
  194. System.DoCommands
  195. FSTools.Mount BOOT FatFS VDISK0#1 ~
  196. FSTools.Mount BL AosFS VDISK0#2 ~
  197. FSTools.Mount AOS AosFS VDISK0#3 ~
  198. FSTools.Mount SDBOOT FatFS PhysicalDrive1#1 ~
  199. FSTools.Mount SDBL AosFS PhysicalDrive1#2 ~
  200. FSTools.Mount SDAOS AosFS PhysicalDrive1#3 ~
  201. FSTools.CopyFiles -o BOOT:*.* => SDBOOT:*.* ~
  202. FSTools.CopyFiles -o BL:*.* => SDBL:*.* ~
  203. FSTools.CopyFiles -o AOS:*.* => SDAOS:*.* ~
  204. FSTools.Unmount BOOT ~
  205. FSTools.Unmount BL ~
  206. FSTools.Unmount AOS ~
  207. FSTools.Unmount SDBOOT ~
  208. FSTools.Unmount SDBL ~
  209. FSTools.Unmount SDAOS ~
  210. (* this is to uninstall Zynq A2 image *)
  211. VirtualDisks.Uninstall VDISK0 ~
  212. WinDisks.Uninstall "PhysicalDrive1" ~
  213. ~
  214. #
  215. # !!! Write the whole release image to SD card !!!
  216. # !!! MAKE SURE THE RIGHT PhysicalDriveX IS USED !!!
  217. #
  218. Partitions.FileToPartition PhysicalDrive1#0 build/Zedboard.ZynqA2.img 0 819200 ~
  219. #
  220. # Compiler options for ARM
  221. #
  222. -p=ARMA2 --mergeSections --useFPU64 --destPath='build/'