Forum Discussion

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

non-cacheable instruction memory

Hi at all, I'm new in this forum.

I create a Nios II system containing a Nios II/f core, with 2k data cache and 2k instruction cache, and 128k of on chip-memory.

I want to run on this system an assembly code, but i need to use both cacheable and non-cacheable instruction. How can I define a non-cacheable sector of instruction memory?:confused:

Thanks at all.

Daniele.

16 Replies

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

    You might be having problems with the way the linker is configured to handle multiple code (and initialised data) sections. Although it usually causes different problems!

    I'd run 'objdump -p <program>' on the linked elf image and have a look at the virtual and physical addresses of the various segments. Also look at the symbol table (nm -n <program>, or from objdump) to see what the linker put where. If things aren't where you expect the you need to fix the compile/link phases.

    The linker script altera used to default to (might have changed since I last used it) puts all the initialised code/data physically following the end of the main code/data sections and expects initialisation code to copy it to the correct place. This is fine if you have a simple 'boot from flash' booter and are basing everything in external DRAM. It doesn't work otherwise!

    The JTAG boot code will load all the loadable elf sections to their correct physical addresses (link with phys == virt). It wouldn't be hard to make a flash loader that did the same...
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I use NiosII IDE tool because I have to write assembler code, and I debug step by step the assembler code. For these reasons I don't start from a C/C++ application and I haven't the objdump file. Is it correct???

    How can I see section memory location of my system????:confused::confused::confused:

    Thank you for helpfulness.

    Rolfo Daniele.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You can run objdump by hand, I've NFI where Altera hide it in their install!

    In fact, almost any copy of objdump will do - doesn't need to be a nios2 version.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thank you for the answer.

    After the creation of the .objdump file I see that new section isn't created. :mad::mad:

    I read that a new section can be created using BSP Editor, usins SBT tool, but I don't know how to create a bsp file using the NiosII IDE tool.

    How can I import the information contained into the BSP file into a NiosII IDE project???:confused::confused:

    Thank you for the helpfulness.

    Daniele Rolfo.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I solved the problem using the section .ddr_sdram_0 (name of section corresponding to my on-chip memory) to load the cacheable part of the code.

    The instruction is:

    .section .ddr_sdram_0

    inserted before the part of code to load on that memory.

    Now observing the content of my .elf file the instructions corresponding to cacheable and not cacheable parts of my code are loaded at correct addresses.

    But when I debug the code on my board, when the code jumps to cacheable part there aren't the same instructions listed in .elf file.

    At the same address the .elf file contains a different instruction compared to the disassembly of the debugging code.

    What does it means?:confused::confused::confused::confused:

    Thank you.

    Rolfo Daniele