Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

QSPI boot

Altera_Forum
Honored Contributor II
2,080 Views

hello, 

 

I am trying to boot the example baremetal project: Altera-SoCFPGA-HardwareLib-FPGA-CV-GNU from QSPI (can run it successfully with debugger) with the cyclone 5 dev kit. 

did the following steps but still doesnt work 

 

1. Build an appropriate preloader with the QSPI with boot from QSPI and QSPI_NEXT_BOOT_IMAGE 0x60000 option 

2. because I dont have the ARM compiler license I used the following command to create an bin from hwlib.axf : 

 

arm-none-eabi-objcopy -O binary hwlib.axf hwlib.bin 

 

3. I noticed that the starting address of hwlib.axf is 0x02000000 but the entry point is 0x02000040( __cs3_interrupt_vector is located at 0x02000000 ) so I tryed several combinations all of them failed eventually : 

 

mkimage -A arm -O u-boot -T standalone -C none -a 0x02000000 -e 0x02000040 -n "baremetal image" -d hwlib.bin hwlib.img 

mkimage -A arm -O u-boot -T standalone -C none -a 0x02000000 -e 0x02000000 -n "baremetal image" -d hwlib.bin hwlib.img 

 

4.copy the hwlib.img and change its name hwlib.bin so it can be compatible to the flash programer 

5.burn both binaris : preboot to address 0 , hwlib to address 60000 (both complete succesfuly) 

 

I cant really know where its stuck and appreciate ideas about how to get more information about the problem? 

 

thanks
0 Kudos
10 Replies
Altera_Forum
Honored Contributor II
568 Views

[SUB]Hi! 

 

First things first: Which version of SoCEDS are you using? Looks to either be 13.0 or 13.1. 

 

I'm pretty sure you should be using mkimage with the 0x0200'0000 option, though it won't make a difference unless you are using interrupts in your example. 

 

About your HWLibs program, have you converted your program to not use semihosting? Semihosting is the fancy infrastructure that allows printf() output to be directed to DS-5. To get rid of semihosting try the following: 

- Copy the script to altera-socfpga-unhosted.ld (this will help switch between semihosted and unhosted easily); Modify the Makefile appropriately. 

- Modify your linker file script: Change -lcs3hosted to -lcs3unhosted 

- Modify your source to remove any references to hosted related functions, most noteably printf(). 

- Make; address any issues that might arise. 

- Examine the hwlibs.axf.objdump. There should be no SVC 0x123456 or similar calls. 

 

Then try reflashing your QSPI. 

 

Good luck! 

 

fdh[/SUB]
0 Kudos
Altera_Forum
Honored Contributor II
568 Views

hey fred  

 

working with the 13.1 one. thanks for the reply but still doesnt work 

 

I did the folowing steps to investigate the problem : 

 

I modified the debugger script to load only the preloader and then stop at spl_boot_device 

but instead of loading the hwlib through the debugger I manually got through the preloader hwlib copying from the flash till the jump to hwlib itself. 

 

I see that it does the copy and jumpes to the right spot (0x0200000) as expected and than jumpes to the __cs3_start_asm_sim as expected 

the third instruction of __cs3_start_asm_sim is SVC 0x123456 which gives me the next error in the debugger console : 

 

"unable to determine if the SVC was a semihosting call" 

 

whats strange is that if I load hwlib into RAM with the debugger this instruction doesnt throw anything and everything works fine 

 

*Of course I linked hwlib with the unhosted option and deleted all the printfs
0 Kudos
Altera_Forum
Honored Contributor II
568 Views

You are solve problem or abandon ? 

IMHO, writing of my SVC-"dummy"-handler and connecting it in Preloader is more suitable than debugging all with printf() in DS-5 and conditional recompiling of all to avoid semihosting before fill to flash. 

 

FredHsueh, BIG THANKS TO YOU -- I agonize with this problem from April, only now see explanation, which hardly unearth ! :) 

In which documents you read about this knowledges ? Altera let out something ?
0 Kudos
Altera_Forum
Honored Contributor II
568 Views

Can anyone suggest how to burn C code in HPS of cyclone V.

0 Kudos
Altera_Forum
Honored Contributor II
568 Views

In soc design examples (http://www.altera.com/support/examples/soc/soc.html) Altera give a example "Unhosted" (without semihosting) for Baremetal burning to QSPI.

0 Kudos
Altera_Forum
Honored Contributor II
568 Views

Hello WitFed, 

 

Can you tell me, what is te difference between "Unhosted" "SEMIHOSTING" and "Hosted"?. When to use them?
0 Kudos
Altera_Forum
Honored Contributor II
568 Views

I've not heard the term Hosted in reference to the SOC. Semi-hosting is an ARM term for code running on an ARM using the debugger to support I/O. It's used for debugger control, console C library standard I/O, and sometimes for access to the file system on the host. It can be handy for test scripts, log files, etc. You don't want semi-hosting enabled in your ARM code unless you are running with the debugger and have a debugger configuration that enables semi-hosting.

0 Kudos
Altera_Forum
Honored Contributor II
568 Views

 

--- Quote Start ---  

In soc design examples (http://www.altera.com/support/examples/soc/soc.html) Altera give a example "Unhosted" (without semihosting) for Baremetal burning to QSPI. 

--- Quote End ---  

 

There is no example there with the words "unhosted", "baremetal", or "qspi".
0 Kudos
Altera_Forum
Honored Contributor II
568 Views
0 Kudos
Altera_Forum
Honored Contributor II
568 Views

I think for better referent better try this with some picture. 

http://rocketboards.org/foswiki/view/documentation/gsrd131qspiboot
0 Kudos
Reply