Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

Problems with Nios II

Hi all

I'm new in using nios II and I have some problems:

after generating system on SOPC Builder with:

- nios 2/f

- jtag uart

- pio (output, 1 bit)

- sysid

- onchip_memory

i open nios 2 SBT and select the template hello world. Now:

- if i build the pjt, the error is

"on chip memory overflowed by xxx bytes"

i solved it entering in the BSP editor , unchecking

- enable c++

- enable clean exit

- enable exit

and checking

- enable small c library

- enable reduced device drivers

than generate BSP. That's ok?

But if i add to hello world.c

# include "system.h"# include "altera_avalon_poi_regs.h"
and the other code suggested in "my first nios II software design" to let blink a led,next to the 2 added include i have a question mark that says

"unresolved inclusion" and gives me error in building pjt ("undefined reference to main")

someone can help?

(the only code that i run without problems is hello world small...)

n.b: my hardware is altera DE2 board (cyclone 2), and my sw, quartus 2 10.1 and last version of nios2 SBT

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The first problem seems due to the fact the initial code didn't fit into onchip_memory. Enabling small C lib and reduced drivers generates a code with smaller footprint. If you need the complete lib and drivers you may try to implement a bigger onchip mem, provided your device has it.

    The second problem probably indicates that thelinker can't find the main() entry point. Does your project use main or alt_main?

    Last remark: you wrote "altera_avalon_poi_regs.h"; is this a mistype or is really like this in your code? It should be altera_avalon_pio_regs.h

    Regards
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for your fast answer!

    - to implement a bigger on chip memory i have to set a higher number of bytes or select a different one?

    - my pjt use main() i have to change it?

    - yes, "poi" is a mistype!
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    - to implement a bigger on chip memory i have to set a higher number of bytes or select a different one?

    --- Quote End ---

    Right. Set a bigger size in sopc builder, changing onchip mem properties.

    Regarding the other issue, using main is correct.

    Probably you have some something wrong in linker script.

    I still use Quartus 9 and Nios IDE, so I can't help you much with Quartus 10 and Nios SBT