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++
12603 Discussions

a question about boot from QSPI

Altera_Forum
Honored Contributor II
1,526 Views

Hi, 

I need some help about boot from QSPI. 

I know altera named our boot-stages as BootROM, Preloader, U-boot or RTOS or Baremetal on 3th stage. 

I have succeeded to boot from QSPI now. 

But I want to divide the Baremetal stage into 2 stages to acomplish some other jobs. 

 

Stage1:UART burn Program 

(1)If there is handshake signal from UART,program will receive Uart data stream--"App Pragram data" and write it to QSPI. 

Uart data stream is tranmited from Uart of PC and this data file is .bin generated by DS-5. 

(2)If there is no handshake signal,program will read App Pragram data from QSPI and write it to RAM.then jumps to entry point of App Pragram. 

 

so,after powerd on,Preloader will load this program,now I can do it. 

 

UART burn Program is stored from 0x60000 of QSPI and runs from 0x100040 of DDR. 

 

Stage2:App Pragram. 

... 

UART burn Program is stored from 0x160000 of QSPI and runs from 0x200040 of DDR. 

 

I have modified .ld file for RAM region. 

But when program counter jumps from Stage1 to Stage2,App Pragram doesn't run! 

I simlpy add a jump cmd at the end of Stage1,such as ‘b 0x200000’, and program counter indeed jumps to this address. 

 

do I missed something? 

 

Thanks!
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
452 Views

your bare metal spited stage into 2, is this still under the same *.bin file which located in 0x60000?

0 Kudos
Altera_Forum
Honored Contributor II
452 Views

no,they are in different .bin. 

each .bin in different addresses of Qspi. 

so preloader only load stage 1 program, 

then stage 1 program load stage 2 program,and jumps to it. 

Now, i can run stage 1 program successfully,but not stage2.
0 Kudos
Altera_Forum
Honored Contributor II
452 Views

If ram space in .ld is not enough for the program,does Ds-5 prompt error?

0 Kudos
Altera_Forum
Honored Contributor II
452 Views

 

--- Quote Start ---  

your bare metal spited stage into 2, is this still under the same *.bin file which located in 0x60000? 

--- Quote End ---  

no,they are in different .bin. 

each .bin in different addresses of Qspi. 

so preloader only load stage 1 program, 

then stage 1 program load stage 2 program,and jumps to it. 

Now, i can run stage 1 program successfully,but not stage2.
0 Kudos
Altera_Forum
Honored Contributor II
452 Views

The first one should be working as that attach to the pre-loader header. But the second one, a bit doubt if can jump to execute another image file by this way. 

 

Or maybe to do another checking in the init.d or systemd ?
0 Kudos
Altera_Forum
Honored Contributor II
452 Views

I successfully finished it today ! 

I modifiy my stage1 program based on altera-qspi demo program. 

There is a function called "system_uinit()" at the end of program. 

At beginning I modified program counter before the function executes.Stage 2 program fails. 

now I modified counter after the function executes, stage 2 program runs! 

i wonder if system_uinit doesn't run,some init functions in stage 2 program fail .
0 Kudos
Reply