Forum Discussion

drbarryh's avatar
drbarryh
Icon for Contributor rankContributor
2 months ago

How to reduce ROM/RAM requirements for a NIOSV Compact CPU Platform?

Hello ALTERA NIOSV Experts,

I am trying to create a system in Quartus Platform Designer which has the following components:

  1. A 1G Tri mode ethernet IP (with 32 bit AVALON-ST TX/RX interfaces using minimum sized FIFOs)
  2. A RS 232 UART with no FIFO
  3. A couple of small FIFOs using AVALON-ST interfaces for data in and out of Platform via Conduits
  4. A NIOSV Compact CPU
  5. A JTAG UART
  6. ROM for NIOSV
  7. RAM for NIOSV

My questions are about how to reduce the ROM (for the NIOSV compacts program) and RAM to the minimum amount. I am trying to shoehorn this all into a MAX10 FPGA ( Altera Max 10 part number 10M08SAU169I7G). When i build the BSP for this platform, with a "Hello World" program, it seems to need around 128 Bytes of ROM and several KBytes of RAM. Why is the program so large ? I expect it has to do with the BSP adding in drivers for all the Platform IP and it is getting bloated.

What tactics are available for me to use in the Ashling RISC FREE IDE which i am using to create my BSP and/or Platform Designer to reduce the program size ? The FPGA i am trying to use only has around 48 K Bytes of RAM available in total ...so maybe this is not possible and i need a bigger FPGA of course !

Thanks for your help,

Dr Barry

4 Replies

  • LiangYuG_Altera's avatar
    LiangYuG_Altera
    Icon for Occasional Contributor rankOccasional Contributor

    Hi drbarryh​ ,

    You might be interested in this chapter : Nios V Processor Software Developer Handbook - Reducing Code Footprint in Embedded Systems

    My first recommendation is Apply Compiler Flags in the BSP.

    Remember to run the cmake with "CMAKE_BUILD_TYPE=Release" to enforce the optimization flag.
    Without it, the ELF will be unoptimized for debug purpose.

    cmake -S sw/app -B sw/app/build -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Release

    Regards,
    Liang Yu

    • drbarryh's avatar
      drbarryh
      Icon for Contributor rankContributor

      Thanks for your help Liang,  And the compiler flag suggestions i will try out. Yes your right i do need to use the Release version during my compiles !!

      Cheers, Dr Barry H

      • BoonBengT_Altera's avatar
        BoonBengT_Altera
        Icon for Moderator rankModerator

        Dear drbarryh ,

        Since clarification has been provided and no further follow‑up questions have been raised, we will assume the issue has been resolved. 
        This thread will now be transitioned to community support, where other users can continue to assist with any additional inquiries.
        For new questions, please feel free to open a fresh thread — we’ll be happy to support you there.

         

        Thank you for being part of the community!

        Best regards,
        Altera Technical Support