Altera_Forum
Honored Contributor
11 years agoHelp required! Baremetal application with custom Preloader
Hi guys,
As I want to now more about the design flow for developing on the Cyclone V SoC, I decided to create a new design, which allows to run a simple LED application on the NiosII processor and on the ARM processor. I am working with the Altera Cyclone V SoC Development Kit, Quartus II V13.1 and ARM DS-5 (5.18 - Evalualtion). The first steps were straight forward: 1) creating a QSYS design with the Nios II + peripheral and the HPS-bridge ( SDRAM controller, QSPI controller and 4 GPIOs for the LEDs only ). 2) generating + full compilation - check 3) Board setup: # removing SDCard from board # BSEL for QSPI ( J28-R/L, J29-L, J30-L) # CSEL (J26-L, J27-L) should always be 0x00 as there is a bug in the Cyc V SoC FPGA with an internal PLL!!! (was a hint from the Altera support!) # MSEL ( all ON ) # JTAG Enable ( HPS + FPGA ) 4) Hello World with blink LEDs for Nios II - check 5) I tried the "Getting Started with Bare-Metal Debugging" from the Altera SoC Embedded Design Suite User Guide --> I could not debug the demo, it seems as if the connection could not be established. --> maybe it has something to do with the preloader, so I started to generate a custom preloader 6) generating custom preloader: # run embedded_command_shell.bat as admin # call bsp-editor, create new BSP # browse to the *_isw_handsoff/*_hps_0 folder # OS: preloader, and press ok # Settings-tab: + Common: BOOT_FROM_QSPI = true, QSPI_NEXT_BOOT_IMAGE = 0x6000, PRELOADER_TGZ (I don't know what to select, or what it is for??) + Advanced: FPGA_DATA_BASE = 0xffff0000 (HPS-OCRAM?), WATCHDOG_ENABLE = false, SEMIHOSTING = false ( what is it good for?? For debugging purpose??), ... # Save + generate: + Generation fails when done with DS-5 delivered with Quartus II V14.0 ( generation stucks ) + Generation succeed when done with DS-5 delived with Quartus II V13.1 ---> PROBLEM is here: one cannot mix different verions of quartus tool chain -> take 14.0! # files were generated in the <quartus prj dir>/Software/spl_bsp # use embedded_command_shell to call make in this folder -> lots of files and folders were generated (preloader-mkpimage.bin, preloader.ds, uboot.ds and the uboot-socfpga folder) 7) writing a baremetal application: q: what to do next? what is needed to create a debugable baremetal project, which can be copied on the qspi? Can I create a new ARM GCC project in DS-5, add some source code, compile it and copy the .axf - file onto the QSPI at a certain address? The online tuturial says that it is possible to create a baremetal application makefile in the embedded_command_shell, but nothing more about it. After this step I would do the following: 8) Adding the next boot step header to the preloader with the "mkimage" # create a folder in <quartus prj dir>/software/spl_bsp/binaries # copy hello.bin int binaries # change to uboot-socfpga/tools to run mkimage.exe for adding a mkimage signiture header to the binary, otherwise preloader could not recognice the bin-file as next boot stage!!! # $ ./mkimage.exe -A arm -O u-boot -T standalone -C none -a 0x100000 -e 0x100040 -n "hello-baremetal" -d ../../binaries/hello.bin ../../binaries/hello-mkimage.bin 9) copy the preloader.bin + appliction.bin on the QSPI with the USB-Blaster II# change to <quartus prj dir>/software/spl_bsp/# $ quartus_hps -c 1 -o PV -a 0x0000 preloader-mkpimage.bin# $ quartus_hps -c 1 -o PV -a 0x60000 ./binaries/hello-mkpimage.bin# open a terminal tool with config.: 115200-8-N-1# press cold reset and some prints should be displayed in the terminal 10) download the sof again + cold reset by pressing a button -> generates a warm reset for 1 ms I am getting tired in searching for some piece of information. Most of the tuturials are based on the GSDR with the already created Preloader, but this not the way I'd like to go. My way should simply be Cold Reset -> Preloader -> Hello World ( without UBoot or something else, keep it short and simple (KISS) ) Thank you in advance, Roland