Forum Discussion

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

What is the meaning of Small C library

Hi,

In system library properties there is option called small C library, enabling and disabling this option means what?.

and also what is clean exit, what does this do?.

thanks,

Anand

6 Replies

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

    Enable Small C library means that you have a small footprint compiled binary code.

    Some of the Standard C library function is reduced to simpler function.

    For example, the printf function in Small C library don't have buffering mechanism anymore.

    Same like other function too.

    This option is very useful if you try to fit a bigger ELF into a smaller ROM/RAM.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    hi,

    but i'm able to run my code in h/w only thru small C library enabled else it gives me error saying that " region needs to be larger 7000 bytes etc...".

    do you know some concepts in performance counter, i'm facing some problem in tht too.

    thnks for your help and advise.

    thanks

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

    Basicly, the performance counter component will calculate the time and clock taken between the time you start and stop this component. So you can use it to calculate how fast your function is, and then report it in detail, you can easily use it for performance test.

    It comes with very useful API:

    PERF_RESET(p)
    PERF_START_MEASURING(p)
    PERF_STOP_MEASURING(p)
    PERF_BEGIN(p,n)
    PERF_END(p,n)
    int perf_print_formatted_report (void* perf_base, alt_u32 clock_freq_hertz, int num_sections, ...)

    See attached document for more detail.

    Hope this will help you.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    hi,

    ... error saying that " region needs to be larger 7000 bytes etc...".

    --- Quote End ---

    This is what I mean "whenever you need a smaller footprint" --> You don't have enough RAM to fit in your program, your program is too big either because it is really big or you code is not effective

    So --> Increase the memory size if you are using onchip memory

    else try to remove unnecessary code if you can't change the external memory
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    I tried all sorts things like;

    increasing on chip memory to 50KB , all works fine only when I enable small C library.

    But If I enable small C library along with perfomance counter, I c that perfomance counter stays in reset state itself.

    can u think of anything else where I can rid of this small C library, I included SDRAM controller, build is fine.. but I am not able to downlaod it to fpga it says

    "no Nios II core found

    leaving target processor"

    why is this because of?.

    I just added a SDRAM controller of width 16 bits and On chip ram of 50KB and gave CPU with SDRAM as reset vector and exception vector.

    Is there anything which I left out and anything istake I have done?.

    Thanks,

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

    Hi,

    I used the debugger , and i could c the following:

    In my design I have included an SDRAM controller with data width 16 bits and I have used it as main memory, though I have on chip memory for 50KB. ie; for CPU exception vector and reset vector.

    Now I c that

    int i;

    PERF_RESET(PERFORMANCE_COUNTER_BASE);

    PERF_START_MEASURING(PERFORMANCE_COUNTER_BASE);

    PERF_BEGIN(PERFORMANCE_COUNTER_BASE, 1);

    i=10;

    i=i+1;

    PERF_END(PERFORMANCE_COUNTER_BASE, 1);

    PERF_STOP_MEASURING(PERFORMANCE_COUNTER_BASE);

    these statements works fine with its address and data values, but when I include the

    "perf_print_formatted_report((void *)PERFORMANCE_COUNTER_BASE,ALT_CPU_FREQ, 1,"Time");"

    I get error from Nios build saying " Region needs to be 6684 bytes larger. ".

    The design works well for lights example from altera, but when I include my code which is above; it gives the region needs to be larger, I understand that this is because of lack of memory, but I dont understand why there is not enough memory, as I have included SDRAM also.

    In this I have not included the small C library option.

    Thanks,

    Anand