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

How to implement my own bootloader

Altera_Forum
Honored Contributor II
1,118 Views

Hi, 

My system doesn't use CFI Flash but SPI Flash, so I have to creat my own bootloader to read code from SPI Flash to SDRAM. 

Now, I have implemented a bootloader code which is located in an onchip memory and it can work fine to read data from SPI Flash to SDRAM. 

But I have a important question: 

Before reading data from SPI Flash to SDRAM, I should initialize the SPI Flash with my Main Code, but how can I get Main Code??? 

As I know, NiosII IDE will create *.elf for you, but this file will contain many more redundant code which is for programming CFI Flash. What I need is only the following sections: 

.exceptions, .rodata, .rwdata and .text 

 

Anyone help? 

 

Thanks very much!
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
299 Views

Hi David, 

 

> As I know, NiosII IDE will create *.elf for you, but this file will contain many more 

> redundant code which is for programming CFI Flash. What I need is only the following 

> sections: 

> .exceptions, .rodata, .rwdata and .text 

 

Use nios2-elf-objcopy. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
299 Views

Hi Smcnutt: 

 

I'm not familiar with TCL tools, in fact, I never use them. 

Could you teach me how to use nios2-elf-objcopy and what will I get? 

Or, if there is any document related to TCL tools, pls let me know! 

 

Thanks very much!
0 Kudos
Altera_Forum
Honored Contributor II
299 Views

> I'm not familiar with TCL tools, in fact, I never use them. 

 

objcopy is part of binutils -- use it from a command shell prompt. 

 

> Could you teach me how to use nios2-elf-objcopy and what will I get? 

 

Try: 

 

$ nios2-elf-objcopy --help 

 

You can also review documents\gnu-tools\binutils\binutils.html in your 

nios2 installation directory. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
299 Views

Dear Scott: 

 

Thanks very much! 

Everything is OK, now! http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/tongue.gif  

 

Best regards, 

David
0 Kudos
Reply