Huge Size Hello world with FreeRTOS on NIOS II

kshamim wrote on Monday, April 02, 2018:

Hello everyone,

I’ve created hello world program with FreeRTOS on NIOS II based on CYCLONE III FPGA.
Elf file created is of huge size, 8244 KBytes to be exact.
This is size is not acceptable as I intend to run code from on-chip memory and I’ve only 128 KB on-chip memory available.

Please suggest why hello world based on FreeRTOS is so large in size ?

Thank you

rtel wrote on Monday, April 02, 2018:

A couple of things:

  1. The size of the elf file is not representative of the size of the
    binary image that gets programmed into the device. If you want to know
    the size of the image then there are a couple of options:
    a) Look at the .map file output by the compiler.
    b) Run -elf-size, giving the .elf file as the input.
    This is a utility that comes with the compiler, not sure of the exact
    name for your particular compiler, it might be something like
    nios-elf-size, you will have to look it up.

  2. Inspect the map file to see what is actually taking up the .text
    space. I suspect very little of it will be FreeRTOS code. Often,
    especially if you are using floating point and newlib, a large
    proportion of the binary image will be newlib code which has had all the
    floating point support stuff dragged in.