Stephen Arnold | 8baa178 | 2017-03-23 18:58:08 -0700 | [diff] [blame] | 1 | ---------------------------------------- |
Chin Liang See | c5c1af2 | 2013-12-30 18:26:14 -0600 | [diff] [blame] | 2 | SOCFPGA Documentation for U-Boot and SPL |
Stephen Arnold | 8baa178 | 2017-03-23 18:58:08 -0700 | [diff] [blame] | 3 | ---------------------------------------- |
Chin Liang See | c5c1af2 | 2013-12-30 18:26:14 -0600 | [diff] [blame] | 4 | |
| 5 | This README is about U-Boot and SPL support for Altera's ARM Cortex-A9MPCore |
| 6 | based SOCFPGA. To know more about the hardware itself, please refer to |
| 7 | www.altera.com. |
| 8 | |
Dalon Westergreen | 5c0adb0 | 2019-09-27 18:43:24 -0700 | [diff] [blame] | 9 | --------------------------------------------------------------------- |
| 10 | Cyclone 5 / Arria 5 generating the handoff header files for U-Boot SPL |
| 11 | --------------------------------------------------------------------- |
Stephen Arnold | 8baa178 | 2017-03-23 18:58:08 -0700 | [diff] [blame] | 12 | |
| 13 | This text is assuming quartus 16.1, but newer versions will probably work just fine too; |
| 14 | verified with DE1_SOC_Linux_FB demo project (https://github.com/VCTLabs/DE1_SOC_Linux_FB). |
| 15 | Updated/working projects should build using either process below. |
| 16 | |
| 17 | Note: it *should* work from Quartus 14.0.200 onwards, however, the current vendor demo |
| 18 | projects must have the IP cores updated as shown below. |
| 19 | |
| 20 | Rebuilding your Quartus project |
| 21 | ------------------------------- |
| 22 | |
| 23 | Choose one of the follwing methods, either command line or GUI. |
| 24 | |
Dalon Westergreen | 5c0adb0 | 2019-09-27 18:43:24 -0700 | [diff] [blame] | 25 | Using the command line |
Stephen Arnold | 8baa178 | 2017-03-23 18:58:08 -0700 | [diff] [blame] | 26 | ~~~~~~~~~~~~~~~~~~~~~~ |
| 27 | |
| 28 | First run the embedded command shell, using your path to the Quartus install: |
| 29 | |
| 30 | $ /path/to/intelFPGA/16.1/embedded/embedded_command_shell.sh |
| 31 | |
| 32 | Then (if necessary) update the IP cores in the project, generate HDL code, and |
| 33 | build the project: |
| 34 | |
| 35 | $ cd path/to/project/dir |
| 36 | $ qsys-generate soc_system.qsys --upgrade-ip-cores |
| 37 | $ qsys-generate soc_system.qsys --synthesis=[VERILOG|VHDL] |
| 38 | $ quartus_sh --flow compile <project name> |
| 39 | |
| 40 | Convert the resulting .sof file (SRAM object file) to .rbf file (Raw bit file): |
| 41 | |
| 42 | $ quartus_cpf -c <project_name>.sof soc_system.rbf |
| 43 | |
| 44 | |
| 45 | Generate BSP handoff files |
| 46 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 47 | |
| 48 | You can run the bsp editor GUI below, or run the following command from the |
| 49 | project directory: |
| 50 | |
| 51 | $ /path/to/bsb/tools/bsp-create-settings --type spl --bsp-dir build \ |
| 52 | --preloader-settings-dir hps_isw_handoff/soc_system_hps_0/ \ |
| 53 | --settings build/settings.bsp |
| 54 | |
| 55 | You should use the bsp "build" directory above (ie, where the settings.bsp file is) |
| 56 | in the following u-boot command to update the board headers. Once these headers |
| 57 | are updated for a given project build, u-boot should be configured for the |
| 58 | project board (eg, de0-nano-sockit) and then build the normal spl build. |
| 59 | |
| 60 | Now you can skip the GUI section. |
| 61 | |
| 62 | |
| 63 | Using the Qsys GUI |
| 64 | ~~~~~~~~~~~~~~~~~~ |
| 65 | |
| 66 | 1. Navigate to your project directory |
| 67 | 2. Run Quartus II |
| 68 | 3. Open Project (Ctrl+J), select <project_name>.qpf |
| 69 | 4. Run QSys [Tools->QSys] |
| 70 | 4.1 In the Open dialog, select '<project_name>.qsys' |
| 71 | 4.2 In the Open System dialog, wait until completion and press 'Close' |
| 72 | 4.3 In the Qsys window, click on 'Generate HDL...' in bottom right corner |
| 73 | 4.3.1 In the 'Generation' window, click 'Generate' |
| 74 | 4.3.2 In the 'Generate' dialog, wait until completion and click 'Close' |
| 75 | 4.4 In the QSys window, click 'Finish' |
| 76 | 4.4.1 In the 'Quartus II' pop up window, click 'OK' |
| 77 | 5. Back in Quartus II main window, do the following |
| 78 | 5.1 Use Processing -> Start -> Start Analysis & Synthesis (Ctrl+K) |
| 79 | 5.2 Use Processing -> Start Compilation (Ctrl+L) |
| 80 | |
| 81 | ... this may take some time, have patience ... |
| 82 | |
| 83 | 6. Start the embedded command shell as shown in the previous section |
| 84 | 6.1 Change directory to 'software/spl_bsp' |
| 85 | 6.2 Prepare BSP by launching the BSP editor from ECS |
| 86 | => bsp-editor |
| 87 | 6.3 In BSP editor |
| 88 | 6.3.1 Use File -> Open |
| 89 | 6.3.2 Select 'settings.bsp' file |
| 90 | 6.3.3 Click Generate |
| 91 | 6.3.4 Click Exit |
| 92 | |
| 93 | |
| 94 | Post handoff generation |
| 95 | ~~~~~~~~~~~~~~~~~~~~~~~ |
| 96 | |
| 97 | Now that the handoff files are generated, U-Boot can be used to process |
| 98 | the handoff files generated by the bsp-editor. For this, please use the |
| 99 | following script from the u-boot source tree: |
| 100 | |
| 101 | $ ./arch/arm/mach-socfpga/qts-filter.sh \ |
| 102 | <soc_type> \ |
| 103 | <input_qts_dir> \ |
| 104 | <input_bsp_dir> \ |
| 105 | <output_dir> |
| 106 | |
| 107 | Process QTS-generated files into U-Boot compatible ones. |
| 108 | |
| 109 | soc_type - Type of SoC, either 'cyclone5' or 'arria5'. |
| 110 | input_qts_dir - Directory with compiled Quartus project |
| 111 | and containing the Quartus project file (QPF). |
| 112 | input_bsp_dir - Directory with generated bsp containing |
| 113 | the settings.bsp file. |
| 114 | output_dir - Directory to store the U-Boot compatible |
| 115 | headers. |
| 116 | |
| 117 | This will generate (or update) the following 4 files: |
| 118 | |
| 119 | iocsr_config.h |
| 120 | pinmux_config.h |
| 121 | pll_config.h |
| 122 | sdram_config.h |
| 123 | |
| 124 | These files should be copied into "qts" directory in the board directory |
| 125 | (see output argument of qts-filter.sh command above). |
| 126 | |
| 127 | Here is an example for the DE-0 Nano SoC after the above rebuild process: |
| 128 | |
| 129 | $ ll board/terasic/de0-nano-soc/qts/ |
| 130 | total 36 |
| 131 | -rw-r--r-- 1 sarnold sarnold 8826 Mar 21 18:11 iocsr_config.h |
| 132 | -rw-r--r-- 1 sarnold sarnold 4398 Mar 21 18:11 pinmux_config.h |
| 133 | -rw-r--r-- 1 sarnold sarnold 3190 Mar 21 18:11 pll_config.h |
| 134 | -rw-r--r-- 1 sarnold sarnold 9022 Mar 21 18:11 sdram_config.h |
| 135 | |
| 136 | Note: file sizes will differ slightly depending on the selected board. |
| 137 | |
| 138 | Now your board is ready for full mainline support including U-Boot SPL. |
| 139 | The Preloader will not be needed any more. |
Dalon Westergreen | 5c0adb0 | 2019-09-27 18:43:24 -0700 | [diff] [blame] | 140 | |
| 141 | ---------------------------------------------------------- |
| 142 | Arria 10 generating the handoff header files for U-Boot SPL |
| 143 | ---------------------------------------------------------- |
| 144 | |
| 145 | A header file for inclusion in a devicetree for Arria10 can be generated |
| 146 | by the qts-filter-a10.sh script directly from the hps_isw_handoff/hps.xml |
| 147 | file generated during the FPGA project compilation. The header contains |
| 148 | all PLL, clock, pinmux, and bridge configurations required. |
| 149 | |
| 150 | Please look at the socfpga_arria10_socdk_sdmmc-u-boot.dtsi for an example |
| 151 | that includes use of the generated handoff header. |
| 152 | |
| 153 | Devicetree header generation |
| 154 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 155 | |
| 156 | The qts-filter-a10.sh script can process the compile time genetated hps.xml |
| 157 | to create the appropriate devicetree header. |
| 158 | |
| 159 | |
| 160 | $ ./arch/arm/mach-socfpga/qts-filter-a10.sh \ |
| 161 | <hps_xml> \ |
| 162 | <output_file> |
| 163 | |
| 164 | hps_xml - hps_isw_handoff/hps.xml from Quartus project |
| 165 | output_file - Output filename and location for header file |
| 166 | |
| 167 | The script generates a single header file names <output_file> that should |
| 168 | be placed in arch/arm/dts. |