We have executed below command on terminal to get stack size using ARMCLANG compiler. but we are getting "undefined symbol".
armclang --target=arm-arm-none-eabi -march=armv8-a -c -g file.c -o file.o armlink file.o --info=stack armlink file.o --callgraph -o FileImage.axf
Could anyone answer me that how to get stack size using ARMCLANG compiler for TFA code.
Hi kbhuvanacbe,
armclang provides the `-fstack-usage` flag (e.g. `make CC=armclang CFLAGS=-fstack-usage`) which can report the stack usage for individual functions, but I’m afraid that call graph analysis is not currently possible as TF-A does not support linking with armlink outside of some specific niche situations.
Regards, Chris
From: kbhuvanacbe--- via TF-A tf-a@lists.trustedfirmware.org Date: Tuesday, 7 November 2023 at 09:40 To: tf-a@lists.trustedfirmware.org tf-a@lists.trustedfirmware.org Subject: [TF-A] Stack usage We have executed below command on terminal to get stack size using ARMCLANG compiler. but we are getting "undefined symbol".
armclang --target=arm-arm-none-eabi -march=armv8-a -c -g file.c -o file.o armlink file.o --info=stack armlink file.o --callgraph -o FileImage.axf
Could anyone answer me that how to get stack size using ARMCLANG compiler for TFA code. -- TF-A mailing list -- tf-a@lists.trustedfirmware.org To unsubscribe send an email to tf-a-leave@lists.trustedfirmware.org
Hello Chris Kay,
Thank you for your reply. I had tried 'fstack-usage` and got error armclang: error: unknown argument: 'fstack-usage' Then I found above commands and tried but got truck there.
Hello Chris, Good morning,
In our makefile we have added like this TF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \ -ffunction-sections -fdata-sections \ -ffreestanding -fno-builtin -fno-common \ -O0 -std=gnu99 -fstack-usage -fdump-ipa-cgraph Here anything do I need to change?
If your aim is generate per-function stack usage for all functions in the TF-A bootloader images then that should be sufficient, yes. To my knowledge, however, the `-fdump-ipa-cgraph` is a GCC-specific developer option, and is not supported by armclang.
Chris
From: Bhuvaneswari K via TF-A tf-a@lists.trustedfirmware.org Date: Wednesday, 8 November 2023 at 05:05 To: tf-a@lists.trustedfirmware.org tf-a@lists.trustedfirmware.org Subject: [TF-A] Re: Stack usage Hello Chris, Good morning,
In our makefile we have added like this TF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \ -ffunction-sections -fdata-sections \ -ffreestanding -fno-builtin -fno-common \ -O0 -std=gnu99 -fstack-usage -fdump-ipa-cgraph Here anything do I need to change? -- TF-A mailing list -- tf-a@lists.trustedfirmware.org To unsubscribe send an email to tf-a-leave@lists.trustedfirmware.org
Hello Chris, Good Day,
For `-fstack-usage` flag i am getting unknown error. please find the attachment.
sorry not able to include image so here is my error
armclang: error: unknown argument: `-fstack-usage` armclang: error: unknown argument: `-fdump-ipa-cgraph`
Make sure that your Arm Compiler version is up to date – I think support for this flag is relatively recent (6.18ish). I’m unable to reproduce this error with 6.20:
$ make CC=armclang CFLAGS=-fstack-usage $ find build -name '*.su' build/fvp/release/libfdt/fdt_wip.su build/fvp/release/libfdt/fdt.su build/fvp/release/libfdt/fdt_rw.su ...
The stack usage is dumped as expected, e.g. build/fvp/release/bl31/psci_on.su:
lib/psci/psci_on.c:59:psci_cpu_on_start 48 static lib/psci/psci_on.c:163:psci_cpu_on_finish 48 static
Chris
From: Bhuvaneswari K via TF-A tf-a@lists.trustedfirmware.org Date: Friday, 10 November 2023 at 07:30 To: tf-a@lists.trustedfirmware.org tf-a@lists.trustedfirmware.org Subject: [TF-A] Re: Stack usage sorry not able to include image so here is my error
armclang: error: unknown argument: `-fstack-usage` armclang: error: unknown argument: `-fdump-ipa-cgraph` -- TF-A mailing list -- tf-a@lists.trustedfirmware.org To unsubscribe send an email to tf-a-leave@lists.trustedfirmware.org
Currently we are using 6.6.2 version and executed -fstack-usage as you suggested but still getting "unknown argument" error. My question is 1. Do we need to go for version upgrade? if so which version we should use, any suggestion ? 2. If we have .su files but without having .cgraph do we get a exact stack info for functions? As you told .cgraph is not possible for armclang. any other possibilities to get stack usage without having .cgraph.
Also wants to know how to get the stack size for assembly files(.S) using gcc and armclang.
tf-a@lists.trustedfirmware.org