acassis commented on code in PR #16323: URL: https://github.com/apache/nuttx/pull/16323#discussion_r2076029293
########## arch/avr/src/avr/Kconfig: ########## @@ -57,6 +57,26 @@ config AVR_BUILDROOT_TOOLCHAIN endchoice # Toolchain +config AVR_LINUXGCC_TOOLCHAIN_IS_GCC + bool "Mark the toolchain as a GCC toolchain" + default n + depends on AVR_LINUXGCC_TOOLCHAIN + select ARCH_TOOLCHAIN_GCC Review Comment: Hi @xiaoxiang781216 actually he explained why he decided to do this way: ``` [ Enable eliminating unused sections with GCC ] More precisely, this patch allows marking the GCC toolchain as a GCC toolchain (ie. GCC toolchain option in AVR-specific Kconfig will select ARCH_TOOLCHAIN_GCC.) The direct consequence is that DEBUG_OPT_UNUSED_SECTIONS is enabled (it is marked default Y) and unused code is removed from the resulting binary. Other architectures have this enabled, program code savings can be quite relavant for these flash-constrained chips and as far as I understand it, the downsides are negligible. However, linker scripts need to account for this and, for existing chips, they do not. Most notably, .vectors sections need to be flagged as KEEP, otherwise the linker removes them too. Since I can only test the DA chips properly, I enabled this indirectly. Instead of selecting ARCH_TOOLCHAIN_GCC unconditionally, the GCC toolchain only enables additional option marked as default N. This additional option then selects ARCH_TOOLCHAIN_GCC, if set by user; its description provides warning about the linker script. ``` According to him: "doing it like that would likely break existing AVR boards, some code sections are not-referenced from the linker's point of view and therefore removed - this affects for example .vectors section." This goal it to fix it later for all boards, but now it is a fail-safe solution -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org