Hello, I need memory usage of seperate .c source files of my project, is there any compiler or linker setting where i can provide the flag in s32 design studio ide, that will print memory usage of each file in output after building the project?
I used this flag but its providing me full memory usage of individual section, but i want the memory usage of each .c file individually
No, the capability to get individual file sizes does not exist in Design Studio or the compiler tools.
But let me suggest a work-around (not supported or endorsed by NXP, however):
1. Create a map file from the linker of your linked project (check the linker settings panel)
2. Use 'linkermap' linkermap
You'll get a listing something like this:
linkermap cdc_msc.elf.map File | .text .data .bss Total ------------------------------------------------------------------------------------ msc_disk.o | 8192 1 313 8506 usbd.o | 24 257 2820 3101 dcd_nrf5x.o | 0 220 2678 2898 msc_device.o | 0 576 2050 2626 libc.a | 1072 33 696 1801 cdc_device.o | 0 312 1044 1356 tusb_fifo.o | 0 0 1142 1142 nrfx_uarte.o | 0 36 800 836 usbd_control.o | 0 84 516 600
which is probably what you're looking for.
Hope it helps.
Hi,
We seem to understand that the command should be the following:
"--print-memory-usage"
And the following description is provided under the GCC linker manual:
"Print used size, total size and used size of memory regions created with the
Section 3.7 [MEMORY], page 71 command. This is useful on embedded targets
to have a quick view of amount of free memory."
There is also another command that might proof useful for your application:
This information is available under the following path:
"C:/nxp/S32DS.3.5/S32DS/build_tools/gcc_v9.2/gcc-9.2-arm32-eabi/arm-none-eabi/share/docs/pdf/ld.pdf"
Where it can vary depending on the versions being used.
We see that this is all the information available from our side, we do apologize if they not proof useful.
As for the specific topic, it seems that this might be a generic C compiler/linker question, not specific to S32DS, hence you might also get useful feedback from the eclipse forum or any C compiler/linker forums. Again, we do apologize for the inconvenience this may cause.
Please, let us know.
where should i use --stats flag?
Hi,
The flag we mentioned is also related to linker, hence you should be able to use it under the same window as the previous flag you have used.
Please, let us know.
But I am getting error after building the code:
/usr/bin/make --no-print-directory main-build
Building target: test.elf
Invoking: Standard S32DS C Linker
arm-none-eabi-gcc -o "test.elf" "@test.args"
c:/nxp/s32ds.3.4/s32ds/build_tools/gcc_v10.2/gcc-10.2-arm32-eabi/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/real-ld.exe: unrecognized option '--stack-analysis'
c:/nxp/s32ds.3.4/s32ds/build_tools/gcc_v10.2/gcc-10.2-arm32-eabi/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/real-ld.exe: use the --help option for usage information
collect2.exe: error: ld returned 1 exit status
make[1]: *** [makefile:47: test.elf] Error 1
make: *** [makefile:38: all] Error 2
"make -j8 all" terminated with exit code 2. Build might be incomplete.
Hi,
We understand that the flag that was used is not the previously mentioned, is this correct? Were you able to use the --stats flag?
We can also recommend using the --help command, since it should provide the available commands.
Please, let us know.