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

nios2-ide vs nios2-bsp

Altera_Forum
Honored Contributor II
1,202 Views

I don't like to use Eclipse and the NIOS2-IDE. I'm usually much more effective with the tools I'm familiar with like: emacs, make, gcc, gdb, linker scripts, objdump, etc. 

 

However I can't seem to use the command line tools to build an elf file like I do when using the NIOS2-IDE. The problem is that the resulting object file is much bigger when I do it the CLI way. This is basically what I do: 

 

in my syslib 

nios2-bsp HAL bspdir top.sopcinfo --default_stdio uart 

make -C bspdir 

 

in my app I do something like: 

 

CFLAGS = -c -Os -g -DSYSTEM_BUS_WIDTH=32  

LDFLAGS = -g -T../main_syslib/bspdir/linker.x -nostdlib ../main_syslib/bspdir/obj/HAL/src/crt0.o 

 

CC = nios2-elf-gcc 

LD = nios2-elf-ld 

 

 

It compiles fine, but like I said, it gets too big for my RAM: 

 

nios2-elf-ld: region ram is full (main.elf section .text). Region needs to be 3140 bytes larger. 

 

What appears to be the problem is that nios2-bsp does not have as many options (at least that I can find) as the NIOS2-IDE, e.g. the buttons for "Program never exits", "Small C library", etc. 

 

 

Also, is there a simple way to make a script to do the equivalent of opening the SOPC Builder and click generate? I wrote a script for an earlier version of SOPC Builder, but it consisted of a sequence of perl scripts (ptf_update.pl, mk_systembus.pl, etc.) with lots of different options. There must be a better way?
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
415 Views

You can specify all of these options from the command line, the following can significantly help reduce obj size: 

 

--set hal.make.bsp_cflags_optimization -O2 

--set hal.make.bsp_cflags_user_flags "-ffunction-sections -fdata-sections" 

 

on 9.1 it doesn't appear necessary to have the quotes. 

The easiest place to look for these options is in the generated summary.html in the bsp folder. It shows the options and it's default and current value. 

Other options for example are: hal.enable_clean_exit, hal.enable_exit etc. 

 

jcn
0 Kudos
Altera_Forum
Honored Contributor II
415 Views

for sopc, run sopc_builder --help. 

 

You are probably after sopc_builder --generate
0 Kudos
Altera_Forum
Honored Contributor II
415 Views

 

--- Quote Start ---  

You can specify all of these options from the --set  

 

--- Quote End ---  

 

 

Thanks! The --set commands seem to be quite useful. However, I need to explore it further in order to generate the same as NIOS2-IDE.
0 Kudos
Altera_Forum
Honored Contributor II
415 Views

 

--- Quote Start ---  

 

You are probably after sopc_builder --generate 

--- Quote End ---  

 

 

 

Again thanks. I should have figured that one out by myself. I didn't know that sopc_builder did take any arguments.
0 Kudos
Altera_Forum
Honored Contributor II
415 Views

 

--- Quote Start ---  

I didn't know that sopc_builder did take any arguments. 

--- Quote End ---  

 

 

I always thought that sopc_builder was a GUI only application. Well, it's sort of as it's not totally happy running without DISPLAY unset under Linux as I get: 

 

Info: Generating the Example Design. Info: Generating the Pin Planner file. Info: Generating the Synopsys Design Constraints file for the example top level. java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it. at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159) at java.awt.Window.<init>(Window.java:406) at java.awt.Frame.<init>(Frame.java:402) at java.awt.Frame.<init>(Frame.java:367) I do builds at night started from cron so this is a little cumbersome as I have to make a dummy X display and set the DISPLAY variable to it.
0 Kudos
Reply